feat(yaml): capture "boolean strings" (#7512)

See for example: https://www.bram.us/2022/01/11/yaml-the-norway-problem/
values based on: https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.truthy

Parser targets YAML 1.2, which has stricter promotions.
This commit is contained in:
Chris Grieser 2025-02-19 18:37:18 +01:00 committed by GitHub
parent c32b59a8fd
commit 36bbf51842
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,3 +80,20 @@
"---"
"..."
] @punctuation.special
; help deal with for yaml's norway problem https://www.bram.us/2022/01/11/yaml-the-norway-problem/
; only using `true` and `false`, since Treesitter parser targets YAML spec 1.2 https://github.com/nvim-treesitter/nvim-treesitter/pull/7512#issuecomment-2565397302
(block_mapping_pair
value: (block_node
(block_sequence
(block_sequence_item
(flow_node
(plain_scalar
(string_scalar) @boolean
(#any-of? @boolean "TRUE" "FALSE" "True" "False")))))))
(block_mapping_pair
value: (flow_node
(plain_scalar
(string_scalar) @boolean
(#any-of? @boolean "TRUE" "FALSE" "True" "False"))))