feat: upgrade to tree-sitter@0.19.3 (#19)
This commit is contained in:
parent
ab0ce67ce9
commit
32689b654d
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,5 @@
|
||||||
/build
|
/build
|
||||||
/node_modules
|
/node_modules
|
||||||
|
|
||||||
|
/bindings/rust
|
||||||
|
/Cargo.toml
|
||||||
|
|
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,7 +1,7 @@
|
||||||
[submodule "tree-sitter"]
|
[submodule "tree-sitter"]
|
||||||
path = tree-sitter
|
path = tree-sitter
|
||||||
url = https://github.com/ikatyang/tree-sitter
|
url = https://github.com/ikatyang/tree-sitter
|
||||||
branch = 0.16.7-custom
|
branch = 0.19.3-custom
|
||||||
[submodule "yaml-test-suite"]
|
[submodule "yaml-test-suite"]
|
||||||
path = yaml-test-suite
|
path = yaml-test-suite
|
||||||
url = https://github.com/yaml/yaml-test-suite
|
url = https://github.com/yaml/yaml-test-suite
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"src"
|
"src"
|
||||||
],
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
"src/binding.cc",
|
"bindings/node/binding.cc",
|
||||||
"src/parser.c",
|
"src/parser.c",
|
||||||
"src/scanner.cc",
|
"src/scanner.cc",
|
||||||
],
|
],
|
||||||
|
|
19
bindings/node/index.js
Normal file
19
bindings/node/index.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
try {
|
||||||
|
module.exports = require("../../build/Release/tree_sitter_yaml_binding");
|
||||||
|
} catch (error1) {
|
||||||
|
if (error1.code !== 'MODULE_NOT_FOUND') {
|
||||||
|
throw error1;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
module.exports = require("../../build/Debug/tree_sitter_yaml_binding");
|
||||||
|
} catch (error2) {
|
||||||
|
if (error2.code !== 'MODULE_NOT_FOUND') {
|
||||||
|
throw error2;
|
||||||
|
}
|
||||||
|
throw error1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
module.exports.nodeTypeInfo = require("../../src/node-types.json");
|
||||||
|
} catch (_) {}
|
13
index.js
generated
13
index.js
generated
|
@ -1,13 +0,0 @@
|
||||||
try {
|
|
||||||
module.exports = require("./build/Release/tree_sitter_yaml_binding");
|
|
||||||
} catch (error) {
|
|
||||||
try {
|
|
||||||
module.exports = require("./build/Debug/tree_sitter_yaml_binding");
|
|
||||||
} catch (_) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
module.exports.nodeTypeInfo = require("./src/node-types.json");
|
|
||||||
} catch (_) {}
|
|
|
@ -6,7 +6,7 @@
|
||||||
"parser",
|
"parser",
|
||||||
"lexer"
|
"lexer"
|
||||||
],
|
],
|
||||||
"main": "index.js",
|
"main": "bindings/node",
|
||||||
"repository": "https://github.com/ikatyang/tree-sitter-yaml",
|
"repository": "https://github.com/ikatyang/tree-sitter-yaml",
|
||||||
"homepage": "https://github.com/ikatyang/tree-sitter-yaml#readme",
|
"homepage": "https://github.com/ikatyang/tree-sitter-yaml#readme",
|
||||||
"author": {
|
"author": {
|
||||||
|
@ -37,8 +37,7 @@
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"/src/",
|
"/src/",
|
||||||
"/binding.gyp",
|
"/bindings/node/",
|
||||||
"/grammar.js",
|
"/grammar.js"
|
||||||
"/index.js"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
1
src/grammar.json
generated
1
src/grammar.json
generated
|
@ -6365,6 +6365,7 @@
|
||||||
"_br_prp"
|
"_br_prp"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"precedences": [],
|
||||||
"externals": [
|
"externals": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
|
|
4
src/node-types.json
generated
4
src/node-types.json
generated
|
@ -441,6 +441,10 @@
|
||||||
"type": "boolean_scalar",
|
"type": "boolean_scalar",
|
||||||
"named": true
|
"named": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "comment",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "directive_name",
|
"type": "directive_name",
|
||||||
"named": true
|
"named": true
|
||||||
|
|
44303
src/parser.c
generated
44303
src/parser.c
generated
File diff suppressed because it is too large
Load diff
114
src/tree_sitter/parser.h
generated
114
src/tree_sitter/parser.h
generated
|
@ -13,6 +13,8 @@ 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
|
||||||
|
|
||||||
|
typedef uint16_t TSStateId;
|
||||||
|
|
||||||
#ifndef TREE_SITTER_API_H_
|
#ifndef TREE_SITTER_API_H_
|
||||||
typedef uint16_t TSSymbol;
|
typedef uint16_t TSSymbol;
|
||||||
typedef uint16_t TSFieldId;
|
typedef uint16_t TSFieldId;
|
||||||
|
@ -30,11 +32,10 @@ typedef struct {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
} TSFieldMapSlice;
|
} TSFieldMapSlice;
|
||||||
|
|
||||||
typedef uint16_t TSStateId;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool visible : 1;
|
bool visible;
|
||||||
bool named : 1;
|
bool named;
|
||||||
|
bool supertype;
|
||||||
} TSSymbolMetadata;
|
} TSSymbolMetadata;
|
||||||
|
|
||||||
typedef struct TSLexer TSLexer;
|
typedef struct TSLexer TSLexer;
|
||||||
|
@ -56,21 +57,21 @@ typedef enum {
|
||||||
TSParseActionTypeRecover,
|
TSParseActionTypeRecover,
|
||||||
} TSParseActionType;
|
} TSParseActionType;
|
||||||
|
|
||||||
typedef struct {
|
typedef union {
|
||||||
union {
|
|
||||||
struct {
|
struct {
|
||||||
|
uint8_t type;
|
||||||
TSStateId state;
|
TSStateId state;
|
||||||
bool extra : 1;
|
bool extra;
|
||||||
bool repetition : 1;
|
bool repetition;
|
||||||
} shift;
|
} shift;
|
||||||
struct {
|
struct {
|
||||||
|
uint8_t type;
|
||||||
|
uint8_t child_count;
|
||||||
TSSymbol symbol;
|
TSSymbol symbol;
|
||||||
int16_t dynamic_precedence;
|
int16_t dynamic_precedence;
|
||||||
uint8_t child_count;
|
uint16_t production_id;
|
||||||
uint8_t production_id;
|
|
||||||
} reduce;
|
} reduce;
|
||||||
} params;
|
uint8_t type;
|
||||||
TSParseActionType type : 4;
|
|
||||||
} TSParseAction;
|
} TSParseAction;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -82,7 +83,7 @@ typedef union {
|
||||||
TSParseAction action;
|
TSParseAction action;
|
||||||
struct {
|
struct {
|
||||||
uint8_t count;
|
uint8_t count;
|
||||||
bool reusable : 1;
|
bool reusable;
|
||||||
} entry;
|
} entry;
|
||||||
} TSParseActionEntry;
|
} TSParseActionEntry;
|
||||||
|
|
||||||
|
@ -92,13 +93,24 @@ struct TSLanguage {
|
||||||
uint32_t alias_count;
|
uint32_t alias_count;
|
||||||
uint32_t token_count;
|
uint32_t token_count;
|
||||||
uint32_t external_token_count;
|
uint32_t external_token_count;
|
||||||
const char **symbol_names;
|
uint32_t state_count;
|
||||||
const TSSymbolMetadata *symbol_metadata;
|
uint32_t large_state_count;
|
||||||
const uint16_t *parse_table;
|
uint32_t production_id_count;
|
||||||
const TSParseActionEntry *parse_actions;
|
uint32_t field_count;
|
||||||
const TSLexMode *lex_modes;
|
|
||||||
const TSSymbol *alias_sequences;
|
|
||||||
uint16_t max_alias_sequence_length;
|
uint16_t max_alias_sequence_length;
|
||||||
|
const uint16_t *parse_table;
|
||||||
|
const uint16_t *small_parse_table;
|
||||||
|
const uint32_t *small_parse_table_map;
|
||||||
|
const TSParseActionEntry *parse_actions;
|
||||||
|
const char **symbol_names;
|
||||||
|
const char **field_names;
|
||||||
|
const TSFieldMapSlice *field_map_slices;
|
||||||
|
const TSFieldMapEntry *field_map_entries;
|
||||||
|
const TSSymbolMetadata *symbol_metadata;
|
||||||
|
const TSSymbol *public_symbol_map;
|
||||||
|
const uint16_t *alias_map;
|
||||||
|
const TSSymbol *alias_sequences;
|
||||||
|
const TSLexMode *lex_modes;
|
||||||
bool (*lex_fn)(TSLexer *, TSStateId);
|
bool (*lex_fn)(TSLexer *, TSStateId);
|
||||||
bool (*keyword_lex_fn)(TSLexer *, TSStateId);
|
bool (*keyword_lex_fn)(TSLexer *, TSStateId);
|
||||||
TSSymbol keyword_capture_token;
|
TSSymbol keyword_capture_token;
|
||||||
|
@ -111,14 +123,6 @@ struct TSLanguage {
|
||||||
unsigned (*serialize)(void *, char *);
|
unsigned (*serialize)(void *, char *);
|
||||||
void (*deserialize)(void *, const char *, unsigned);
|
void (*deserialize)(void *, const char *, unsigned);
|
||||||
} external_scanner;
|
} external_scanner;
|
||||||
uint32_t field_count;
|
|
||||||
const TSFieldMapSlice *field_map_slices;
|
|
||||||
const TSFieldMapEntry *field_map_entries;
|
|
||||||
const char **field_names;
|
|
||||||
uint32_t large_state_count;
|
|
||||||
const uint16_t *small_parse_table;
|
|
||||||
const uint32_t *small_parse_table_map;
|
|
||||||
const TSSymbol *public_symbol_map;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -168,65 +172,49 @@ struct TSLanguage {
|
||||||
#define ACTIONS(id) id
|
#define ACTIONS(id) id
|
||||||
|
|
||||||
#define SHIFT(state_value) \
|
#define SHIFT(state_value) \
|
||||||
{ \
|
{{ \
|
||||||
{ \
|
|
||||||
.params = { \
|
|
||||||
.shift = { \
|
.shift = { \
|
||||||
|
.type = TSParseActionTypeShift, \
|
||||||
.state = state_value \
|
.state = state_value \
|
||||||
} \
|
} \
|
||||||
}, \
|
}}
|
||||||
.type = TSParseActionTypeShift \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SHIFT_REPEAT(state_value) \
|
#define SHIFT_REPEAT(state_value) \
|
||||||
{ \
|
{{ \
|
||||||
{ \
|
|
||||||
.params = { \
|
|
||||||
.shift = { \
|
.shift = { \
|
||||||
|
.type = TSParseActionTypeShift, \
|
||||||
.state = state_value, \
|
.state = state_value, \
|
||||||
.repetition = true \
|
.repetition = true \
|
||||||
} \
|
} \
|
||||||
}, \
|
}}
|
||||||
.type = TSParseActionTypeShift \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define RECOVER() \
|
|
||||||
{ \
|
|
||||||
{ .type = TSParseActionTypeRecover } \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SHIFT_EXTRA() \
|
#define SHIFT_EXTRA() \
|
||||||
{ \
|
{{ \
|
||||||
{ \
|
|
||||||
.params = { \
|
|
||||||
.shift = { \
|
.shift = { \
|
||||||
|
.type = TSParseActionTypeShift, \
|
||||||
.extra = true \
|
.extra = true \
|
||||||
} \
|
} \
|
||||||
}, \
|
}}
|
||||||
.type = TSParseActionTypeShift \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define REDUCE(symbol_val, child_count_val, ...) \
|
#define REDUCE(symbol_val, child_count_val, ...) \
|
||||||
{ \
|
{{ \
|
||||||
{ \
|
|
||||||
.params = { \
|
|
||||||
.reduce = { \
|
.reduce = { \
|
||||||
|
.type = TSParseActionTypeReduce, \
|
||||||
.symbol = symbol_val, \
|
.symbol = symbol_val, \
|
||||||
.child_count = child_count_val, \
|
.child_count = child_count_val, \
|
||||||
__VA_ARGS__ \
|
__VA_ARGS__ \
|
||||||
}, \
|
}, \
|
||||||
}, \
|
}}
|
||||||
.type = TSParseActionTypeReduce \
|
|
||||||
} \
|
#define RECOVER() \
|
||||||
}
|
{{ \
|
||||||
|
.type = TSParseActionTypeRecover \
|
||||||
|
}}
|
||||||
|
|
||||||
#define ACCEPT_INPUT() \
|
#define ACCEPT_INPUT() \
|
||||||
{ \
|
{{ \
|
||||||
{ .type = TSParseActionTypeAccept } \
|
.type = TSParseActionTypeAccept \
|
||||||
}
|
}}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1ccb0ac0e840c58f23012dd495bd0180884077e1
|
Subproject commit fc5a692b7d5f144cc531f5823b1c5a3b2f06cf01
|
Loading…
Reference in a new issue