Skip to content

Commit

Permalink
Use standard capture names
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Oct 25, 2023
1 parent 2339ffe commit f58a4a4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ Cargo.lock
build/
target/
*.wasm
*.o
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tree-sitter-gitattributes",
"version": "0.1.3",
"version": "0.1.4",
"license": "MIT",
"description": "gitattributes grammar for tree-sitter",
"repository": "ObserverOfTime/tree-sitter-gitattributes",
Expand All @@ -22,7 +22,7 @@
},
"main": "bindings/node",
"dependencies": {
"nan": "^2.17.0"
"nan": "^2.18.0"
},
"devDependencies": {
"tree-sitter-cli": "^0.20.8"
Expand Down
15 changes: 6 additions & 9 deletions queries/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
(dir_sep) @punctuation.delimiter

(quoted_pattern
("\"" @punctuation.special))
"\"" @punctuation.special)

(range_notation) @string.special

(range_notation
[ "[" "]" ] @punctuation.bracket)

(wildcard) @character.special
(wildcard) @string.regexp

(range_negation) @operator

(character_class) @constant

(class_range ("-" @operator))
(class_range "-" @operator)

[
(ansi_c_escape)
(escaped_char)
] @string.escape
] @escape

(attribute
(attr_name) @parameter)
(attr_name) @variable.parameter)

(attribute
(builtin_attr) @variable.builtin)
Expand All @@ -37,7 +37,7 @@

(string_value) @string

(macro_tag) @preproc
(macro_tag) @keyword

(macro_def
macro_name: (_) @property)
Expand All @@ -48,7 +48,4 @@
(trailing_slash)
] @error

(ERROR) @error

(comment) @comment
(comment) @spell
14 changes: 7 additions & 7 deletions test/highlight/test.gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[attr]nodiff -diff -merge
# <- preproc
# <- keyword
# ^^^^^^ property
# ^ operator
# ^^^^ variable.builtin
Expand All @@ -8,8 +8,8 @@

vendor/** linguist-vendored=true
# ^ punctuation.delimiter
# ^^ character.special
# ^^^^^^^^^^^^^^^^^ parameter
# ^^ string.regexp
# ^^^^^^^^^^^^^^^^^ variable.parameter
# ^ operator
# ^^^^ boolean

Expand All @@ -22,13 +22,13 @@ vendor/** linguist-vendored=true
# ^^^^^^^^^ constant
# ^ punctuation.bracket
# ^ operator
# ^^^^^^^^^^ parameter
# ^^^^^^^^^^ variable.parameter

"_\u4E00\t\56txt" encoding=UTF-16
# <- punctuation.special
# ^^^^^^ string.escape
# ^^ string.escape
# ^^^ string.escape
# ^^^^^^ escape
# ^^ escape
# ^^^ escape
# ^ punctuation.special
# ^^^^^^^^ variable.builtin
# ^ operator
Expand Down

0 comments on commit f58a4a4

Please sign in to comment.