Use new alias API
This commit is contained in:
parent
4340002e38
commit
ccc07eab4b
|
@ -299,7 +299,7 @@ module.exports = grammar({
|
|||
),
|
||||
|
||||
_variable_name: $ => choice(
|
||||
rename($.simple_variable_name, 'variable_name'),
|
||||
alias($.simple_variable_name, $.variable_name),
|
||||
$.special_variable_name
|
||||
),
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"nan": "^2.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tree-sitter-cli": "^0.6.0"
|
||||
"tree-sitter-cli": "^0.6.6-0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tree-sitter generate && node-gyp build",
|
||||
|
|
|
@ -1067,11 +1067,12 @@
|
|||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "RENAME",
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "simple_variable_name"
|
||||
},
|
||||
"named": true,
|
||||
"value": "variable_name"
|
||||
},
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,10 +11,10 @@ extern "C" {
|
|||
|
||||
typedef uint16_t TSSymbol;
|
||||
typedef uint16_t TSStateId;
|
||||
typedef uint8_t TSExternalTokenState[16];
|
||||
|
||||
#define ts_builtin_sym_error ((TSSymbol)-1)
|
||||
#define ts_builtin_sym_end 0
|
||||
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
||||
|
||||
typedef struct {
|
||||
bool visible : 1;
|
||||
|
@ -40,17 +40,17 @@ typedef enum {
|
|||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
TSStateId to_state;
|
||||
TSStateId state;
|
||||
bool extra : 1;
|
||||
};
|
||||
struct {
|
||||
TSSymbol symbol;
|
||||
int16_t dynamic_precedence;
|
||||
uint8_t child_count;
|
||||
uint8_t rename_sequence_id : 7;
|
||||
uint8_t alias_sequence_id : 7;
|
||||
bool fragile : 1;
|
||||
};
|
||||
};
|
||||
} params;
|
||||
TSParseActionType type : 4;
|
||||
} TSParseAction;
|
||||
|
||||
|
@ -71,6 +71,7 @@ typedef union {
|
|||
typedef struct TSLanguage {
|
||||
uint32_t version;
|
||||
uint32_t symbol_count;
|
||||
uint32_t alias_count;
|
||||
uint32_t token_count;
|
||||
uint32_t external_token_count;
|
||||
const char **symbol_names;
|
||||
|
@ -78,18 +79,17 @@ typedef struct TSLanguage {
|
|||
const uint16_t *parse_table;
|
||||
const TSParseActionEntry *parse_actions;
|
||||
const TSLexMode *lex_modes;
|
||||
const TSSymbol *rename_sequences;
|
||||
uint16_t max_rename_sequence_length;
|
||||
const TSSymbol *alias_sequences;
|
||||
uint16_t max_alias_sequence_length;
|
||||
bool (*lex_fn)(TSLexer *, TSStateId);
|
||||
struct {
|
||||
const bool *states;
|
||||
const TSSymbol *symbol_map;
|
||||
void *(*create)();
|
||||
void (*destroy)(void *);
|
||||
void (*reset)(void *);
|
||||
bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist);
|
||||
bool (*serialize)(void *, TSExternalTokenState);
|
||||
void (*deserialize)(void *, const TSExternalTokenState);
|
||||
unsigned (*serialize)(void *, char *);
|
||||
void (*deserialize)(void *, const char *, unsigned);
|
||||
} external_scanner;
|
||||
} TSLanguage;
|
||||
|
||||
|
@ -131,19 +131,19 @@ typedef struct TSLanguage {
|
|||
#define STATE(id) id
|
||||
#define ACTIONS(id) id
|
||||
|
||||
#define SHIFT(to_state_value) \
|
||||
#define SHIFT(state_value) \
|
||||
{ \
|
||||
{ \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.to_state = to_state_value, \
|
||||
.params = {.state = state_value}, \
|
||||
} \
|
||||
}
|
||||
|
||||
#define RECOVER(to_state_value) \
|
||||
#define RECOVER(state_value) \
|
||||
{ \
|
||||
{ \
|
||||
.type = TSParseActionTypeRecover, \
|
||||
.to_state = to_state_value \
|
||||
.params = {.state = state_value} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ typedef struct TSLanguage {
|
|||
{ \
|
||||
{ \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.extra = true \
|
||||
.params = {.extra = true} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -159,10 +159,12 @@ typedef struct TSLanguage {
|
|||
{ \
|
||||
{ \
|
||||
.type = TSParseActionTypeReduce, \
|
||||
.params = { \
|
||||
.symbol = symbol_val, \
|
||||
.child_count = child_count_val, \
|
||||
__VA_ARGS__ \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ACCEPT_INPUT() \
|
||||
|
@ -174,14 +176,15 @@ typedef struct TSLanguage {
|
|||
static TSLanguage language = { \
|
||||
.version = LANGUAGE_VERSION, \
|
||||
.symbol_count = SYMBOL_COUNT, \
|
||||
.alias_count = ALIAS_COUNT, \
|
||||
.token_count = TOKEN_COUNT, \
|
||||
.symbol_metadata = ts_symbol_metadata, \
|
||||
.parse_table = (const unsigned short *)ts_parse_table, \
|
||||
.parse_actions = ts_parse_actions, \
|
||||
.lex_modes = ts_lex_modes, \
|
||||
.symbol_names = ts_symbol_names, \
|
||||
.rename_sequences = (const TSSymbol *)ts_rename_sequences, \
|
||||
.max_rename_sequence_length = MAX_RENAME_SEQUENCE_LENGTH, \
|
||||
.alias_sequences = (const TSSymbol *)ts_alias_sequences, \
|
||||
.max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH, \
|
||||
.lex_fn = ts_lex, \
|
||||
.external_token_count = EXTERNAL_TOKEN_COUNT, \
|
||||
.external_scanner = {__VA_ARGS__} \
|
||||
|
|
Loading…
Reference in New Issue