⬆️ tree-sitter-cli

This commit is contained in:
Max Brunsfeld 2020-05-14 15:24:16 -07:00
parent e213464b50
commit 60f2783804
4 changed files with 3276 additions and 3245 deletions

View File

@ -15,7 +15,7 @@
}, },
"devDependencies": { "devDependencies": {
"prebuild": "^10.0.0", "prebuild": "^10.0.0",
"tree-sitter-cli": "^0.16.1" "tree-sitter-cli": "^0.16.7"
}, },
"scripts": { "scripts": {
"install": "prebuild-install || node-gyp rebuild", "install": "prebuild-install || node-gyp rebuild",

21
src/node-types.json vendored
View File

@ -2964,6 +2964,11 @@
} }
} }
}, },
{
"type": "word",
"named": true,
"fields": {}
},
{ {
"type": "\n", "type": "\n",
"named": false "named": false
@ -3200,6 +3205,10 @@
"type": "fi", "type": "fi",
"named": false "named": false
}, },
{
"type": "file_descriptor",
"named": true
},
{ {
"type": "for", "type": "for",
"named": false "named": false
@ -3208,6 +3217,10 @@
"type": "function", "type": "function",
"named": false "named": false
}, },
{
"type": "heredoc_start",
"named": true
},
{ {
"type": "if", "type": "if",
"named": false "named": false
@ -3228,6 +3241,10 @@
"type": "readonly", "type": "readonly",
"named": false "named": false
}, },
{
"type": "regex",
"named": true
},
{ {
"type": "special_variable_name", "type": "special_variable_name",
"named": true "named": true
@ -3260,10 +3277,6 @@
"type": "while", "type": "while",
"named": false "named": false
}, },
{
"type": "word",
"named": true
},
{ {
"type": "{", "type": "{",
"named": false "named": false

6448
src/parser.c vendored

File diff suppressed because it is too large Load Diff

View File

@ -62,13 +62,13 @@ typedef struct {
TSStateId state; TSStateId state;
bool extra : 1; bool extra : 1;
bool repetition : 1; bool repetition : 1;
}; } shift;
struct { struct {
TSSymbol symbol; TSSymbol symbol;
int16_t dynamic_precedence; int16_t dynamic_precedence;
uint8_t child_count; uint8_t child_count;
uint8_t production_id; uint8_t production_id;
}; } reduce;
} params; } params;
TSParseActionType type : 4; TSParseActionType type : 4;
} TSParseAction; } TSParseAction;
@ -83,7 +83,7 @@ typedef union {
struct { struct {
uint8_t count; uint8_t count;
bool reusable : 1; bool reusable : 1;
}; } entry;
} TSParseActionEntry; } TSParseActionEntry;
struct TSLanguage { struct TSLanguage {
@ -170,19 +170,25 @@ struct TSLanguage {
#define SHIFT(state_value) \ #define SHIFT(state_value) \
{ \ { \
{ \ { \
.type = TSParseActionTypeShift, \ .params = { \
.params = {.state = state_value}, \ .shift = { \
.state = state_value \
} \
}, \
.type = TSParseActionTypeShift \
} \ } \
} }
#define SHIFT_REPEAT(state_value) \ #define SHIFT_REPEAT(state_value) \
{ \ { \
{ \ { \
.type = TSParseActionTypeShift, \
.params = { \ .params = { \
.shift = { \
.state = state_value, \ .state = state_value, \
.repetition = true \ .repetition = true \
} \
}, \ }, \
.type = TSParseActionTypeShift \
} \ } \
} }
@ -194,20 +200,26 @@ struct TSLanguage {
#define SHIFT_EXTRA() \ #define SHIFT_EXTRA() \
{ \ { \
{ \ { \
.type = TSParseActionTypeShift, \ .params = { \
.params = {.extra = true} \ .shift = { \
.extra = true \
} \
}, \
.type = TSParseActionTypeShift \
} \ } \
} }
#define REDUCE(symbol_val, child_count_val, ...) \ #define REDUCE(symbol_val, child_count_val, ...) \
{ \ { \
{ \ { \
.type = TSParseActionTypeReduce, \
.params = { \ .params = { \
.reduce = { \
.symbol = symbol_val, \ .symbol = symbol_val, \
.child_count = child_count_val, \ .child_count = child_count_val, \
__VA_ARGS__ \ __VA_ARGS__ \
} \ }, \
}, \
.type = TSParseActionTypeReduce \
} \ } \
} }