⬆️ 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
test_script:
- npm test
- npm run test-windows
build: off

View File

@ -13,9 +13,18 @@
"nan": "^2.11.1"
},
"devDependencies": {
"tree-sitter-cli": "^0.13.10"
"tree-sitter-cli": "^0.14.5"
},
"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';
}
sibling_selector > "~",
child_selector > ">",
adjacent_sibling_selector > "+" {
sibling_selector > [token="~"],
child_selector > [token=">"],
adjacent_sibling_selector > [token="+"] {
scope: 'operator';
}
attribute_selector > {
& > "=",
& > "^=",
& > "|=",
& > "~=",
& > "$=",
& > "*=" {
& > [token="="],
& > [token="^="],
& > [token="|="],
& > [token="~="],
& > [token="$="],
& > [token="*="] {
scope: 'operator';
}
}
@ -54,7 +54,7 @@ function_name {
property_name,
plain_value {
&:text('^--') {
&[text='^--'] {
scope: 'variable';
}
}
@ -67,12 +67,12 @@ attribute_name {
scope: 'attribute';
}
"@media",
"@import",
"@charset",
"@namespace",
"@supports",
"@keyframes",
[token="@media"],
[token="@import"],
[token="@charset"],
[token="@namespace"],
[token="@supports"],
[token="@keyframes"],
at_keyword,
to,
from,
@ -121,20 +121,20 @@ feature_name {
scope: 'property';
}
color_value > "#",
id_selector > "#",
selectors > "," {
color_value > [token="#"],
id_selector > [token="#"],
selectors > [token=","] {
scope: 'punctuation.delimiter';
}
"and",
"or",
"not",
"only",
[token="and"],
[token="or"],
[token="not"],
[token="only"],
keyword_query,
binary_expression > "+",
binary_expression > "-",
binary_expression > "/",
binary_expression > "*" {
binary_expression > [token="+"],
binary_expression > [token="-"],
binary_expression > [token="/"],
binary_expression > [token="*"] {
scope: 'operator';
}

1
src/grammar.json vendored
View File

@ -1740,3 +1740,4 @@
"_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 TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
#ifndef TREE_SITTER_RUNTIME_H_
#ifndef TREE_SITTER_API_H_
typedef uint16_t TSSymbol;
typedef struct TSLanguage TSLanguage;
#endif