feat(queries): add highlight queries
This commit is contained in:
parent
17f636215d
commit
af011e6e1a
8
bindings/rust/lib.rs
generated
8
bindings/rust/lib.rs
generated
|
@ -39,12 +39,8 @@ pub fn language() -> Language {
|
|||
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
|
||||
pub const NODE_TYPES: &str = include_str!("../../src/node-types.json");
|
||||
|
||||
// Uncomment these to include any queries that this grammar contains
|
||||
|
||||
// pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm");
|
||||
// pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm");
|
||||
// pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm");
|
||||
// pub const TAGS_QUERY: &str = include_str!("../../queries/tags.scm");
|
||||
/// The highlight queries for this grammar.
|
||||
pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm");
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
"yaml"
|
||||
],
|
||||
"injection-regex": "^ya?ml$",
|
||||
"highlights": "queries/highlights.scm",
|
||||
"external-files": [
|
||||
"src/schema.generated.c"
|
||||
]
|
||||
|
|
79
queries/highlights.scm
Normal file
79
queries/highlights.scm
Normal file
|
@ -0,0 +1,79 @@
|
|||
(boolean_scalar) @boolean
|
||||
|
||||
(null_scalar) @constant.builtin
|
||||
|
||||
[
|
||||
(double_quote_scalar)
|
||||
(single_quote_scalar)
|
||||
(block_scalar)
|
||||
(string_scalar)
|
||||
] @string
|
||||
|
||||
[
|
||||
(integer_scalar)
|
||||
(float_scalar)
|
||||
] @number
|
||||
|
||||
(comment) @comment
|
||||
|
||||
[
|
||||
(anchor_name)
|
||||
(alias_name)
|
||||
] @label
|
||||
|
||||
(tag) @type
|
||||
|
||||
[
|
||||
(yaml_directive)
|
||||
(tag_directive)
|
||||
(reserved_directive)
|
||||
] @attribute
|
||||
|
||||
(block_mapping_pair
|
||||
key: (flow_node
|
||||
[
|
||||
(double_quote_scalar)
|
||||
(single_quote_scalar)
|
||||
] @property))
|
||||
|
||||
(block_mapping_pair
|
||||
key: (flow_node
|
||||
(plain_scalar
|
||||
(string_scalar) @property)))
|
||||
|
||||
(flow_mapping
|
||||
(_
|
||||
key: (flow_node
|
||||
[
|
||||
(double_quote_scalar)
|
||||
(single_quote_scalar)
|
||||
] @property)))
|
||||
|
||||
(flow_mapping
|
||||
(_
|
||||
key: (flow_node
|
||||
(plain_scalar
|
||||
(string_scalar) @property))))
|
||||
|
||||
[
|
||||
","
|
||||
"-"
|
||||
":"
|
||||
">"
|
||||
"?"
|
||||
"|"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"*"
|
||||
"&"
|
||||
"---"
|
||||
"..."
|
||||
] @punctuation.special
|
32
test/highlight/core.yaml
Normal file
32
test/highlight/core.yaml
Normal file
|
@ -0,0 +1,32 @@
|
|||
A null: null
|
||||
# <- @property
|
||||
# ^ @punctuation.delimiter
|
||||
# ^^^^ @constant.builtin
|
||||
Also a null: # Empty
|
||||
# ^^^^^^^ @comment
|
||||
Not a null: ""
|
||||
# ^^ @string
|
||||
Booleans: [ true, True, false, FALSE ]
|
||||
# ^ @punctuation.bracket
|
||||
# ^ @punctuation.bracket
|
||||
# ^ @punctuation.delimiter
|
||||
# ^^^^ @boolean
|
||||
# ^^^^ @boolean
|
||||
# ^^^^^ @boolean
|
||||
# ^^^^^ @boolean
|
||||
Integers: [ 0, 0o7, 0x3A, -19 ]
|
||||
# ^ @number
|
||||
# ^^^ @number
|
||||
# ^^^^ @number
|
||||
# ^^^ @number
|
||||
Floats: [ 0., -0.0, .5, +12e03, -2E+05 ]
|
||||
# ^^ @number
|
||||
# ^^^^ @number
|
||||
# ^^ @number
|
||||
# ^^^^^^ @number
|
||||
# ^^^^^^ @number
|
||||
Also floats: [ .inf, -.Inf, +.INF, .NAN ]
|
||||
# ^^^^ @number
|
||||
# ^^^^^ @number
|
||||
# ^^^^^ @number
|
||||
# ^^^^ @number
|
Loading…
Reference in a new issue