⬆️ 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": {
"prebuild": "^10.0.0",
"tree-sitter-cli": "^0.16.1"
"tree-sitter-cli": "^0.16.7"
},
"scripts": {
"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",
"named": false
@ -3200,6 +3205,10 @@
"type": "fi",
"named": false
},
{
"type": "file_descriptor",
"named": true
},
{
"type": "for",
"named": false
@ -3208,6 +3217,10 @@
"type": "function",
"named": false
},
{
"type": "heredoc_start",
"named": true
},
{
"type": "if",
"named": false
@ -3228,6 +3241,10 @@
"type": "readonly",
"named": false
},
{
"type": "regex",
"named": true
},
{
"type": "special_variable_name",
"named": true
@ -3260,10 +3277,6 @@
"type": "while",
"named": false
},
{
"type": "word",
"named": true
},
{
"type": "{",
"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;
bool extra : 1;
bool repetition : 1;
};
} shift;
struct {
TSSymbol symbol;
int16_t dynamic_precedence;
uint8_t child_count;
uint8_t production_id;
};
} reduce;
} params;
TSParseActionType type : 4;
} TSParseAction;
@ -83,7 +83,7 @@ typedef union {
struct {
uint8_t count;
bool reusable : 1;
};
} entry;
} TSParseActionEntry;
struct TSLanguage {
@ -170,19 +170,25 @@ struct TSLanguage {
#define SHIFT(state_value) \
{ \
{ \
.type = TSParseActionTypeShift, \
.params = {.state = state_value}, \
.params = { \
.shift = { \
.state = state_value \
} \
}, \
.type = TSParseActionTypeShift \
} \
}
#define SHIFT_REPEAT(state_value) \
{ \
{ \
.type = TSParseActionTypeShift, \
.params = { \
.shift = { \
.state = state_value, \
.repetition = true \
} \
}, \
.type = TSParseActionTypeShift \
} \
}
@ -194,20 +200,26 @@ struct TSLanguage {
#define SHIFT_EXTRA() \
{ \
{ \
.type = TSParseActionTypeShift, \
.params = {.extra = true} \
.params = { \
.shift = { \
.extra = true \
} \
}, \
.type = TSParseActionTypeShift \
} \
}
#define REDUCE(symbol_val, child_count_val, ...) \
{ \
{ \
.type = TSParseActionTypeReduce, \
.params = { \
.reduce = { \
.symbol = symbol_val, \
.child_count = child_count_val, \
__VA_ARGS__ \
} \
}, \
}, \
.type = TSParseActionTypeReduce \
} \
}