⬆️ tree-sitter-cli

This commit is contained in:
Max Brunsfeld 2019-03-12 12:16:19 -07:00
parent 521103931f
commit 10dafb5f94
7 changed files with 8495 additions and 8517 deletions

View File

@ -13,7 +13,7 @@ install:
- npm install - npm install
test_script: test_script:
- npm test - npm run test-windows
build: off build: off

View File

@ -13,9 +13,18 @@
"nan": "^2.11.1" "nan": "^2.11.1"
}, },
"devDependencies": { "devDependencies": {
"tree-sitter-cli": "^0.13.10" "tree-sitter-cli": "^0.14.5"
}, },
"scripts": { "scripts": {
"test": "tree-sitter test && tree-sitter parse examples --quiet --time" "test": "tree-sitter test && tree-sitter parse examples/*.css --quiet --time",
} "test-windows": "tree-sitter test"
},
"tree-sitter": [
{
"scope": "source.css",
"file-types": ["css"],
"injection-regex": "^css$",
"highlights": "src/highlights.json"
}
]
} }

View File

@ -10,19 +10,19 @@ universal_selector {
scope: 'tag'; scope: 'tag';
} }
sibling_selector > "~", sibling_selector > [token="~"],
child_selector > ">", child_selector > [token=">"],
adjacent_sibling_selector > "+" { adjacent_sibling_selector > [token="+"] {
scope: 'operator'; scope: 'operator';
} }
attribute_selector > { attribute_selector > {
& > "=", & > [token="="],
& > "^=", & > [token="^="],
& > "|=", & > [token="|="],
& > "~=", & > [token="~="],
& > "$=", & > [token="$="],
& > "*=" { & > [token="*="] {
scope: 'operator'; scope: 'operator';
} }
} }
@ -54,7 +54,7 @@ function_name {
property_name, property_name,
plain_value { plain_value {
&:text('^--') { &[text='^--'] {
scope: 'variable'; scope: 'variable';
} }
} }
@ -67,12 +67,12 @@ attribute_name {
scope: 'attribute'; scope: 'attribute';
} }
"@media", [token="@media"],
"@import", [token="@import"],
"@charset", [token="@charset"],
"@namespace", [token="@namespace"],
"@supports", [token="@supports"],
"@keyframes", [token="@keyframes"],
at_keyword, at_keyword,
to, to,
from, from,
@ -121,20 +121,20 @@ feature_name {
scope: 'property'; scope: 'property';
} }
color_value > "#", color_value > [token="#"],
id_selector > "#", id_selector > [token="#"],
selectors > "," { selectors > [token=","] {
scope: 'punctuation.delimiter'; scope: 'punctuation.delimiter';
} }
"and", [token="and"],
"or", [token="or"],
"not", [token="not"],
"only", [token="only"],
keyword_query, keyword_query,
binary_expression > "+", binary_expression > [token="+"],
binary_expression > "-", binary_expression > [token="-"],
binary_expression > "/", binary_expression > [token="/"],
binary_expression > "*" { binary_expression > [token="*"] {
scope: 'operator'; scope: 'operator';
} }

3
src/grammar.json vendored
View File

@ -1739,4 +1739,5 @@
"_top_level_item", "_top_level_item",
"_block_item" "_block_item"
] ]
} }

4386
src/highlights.json vendored

File diff suppressed because it is too large Load Diff

12550
src/parser.c vendored

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ extern "C" {
#define ts_builtin_sym_end 0 #define ts_builtin_sym_end 0
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 #define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
#ifndef TREE_SITTER_RUNTIME_H_ #ifndef TREE_SITTER_API_H_
typedef uint16_t TSSymbol; typedef uint16_t TSSymbol;
typedef struct TSLanguage TSLanguage; typedef struct TSLanguage TSLanguage;
#endif #endif