build: regenerate parser
This commit is contained in:
parent
49db816e6a
commit
49b7f874e6
28
schema/core/src/parser.c
generated
28
schema/core/src/parser.c
generated
|
@ -89,17 +89,19 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case 0:
|
case 0:
|
||||||
if (eof) ADVANCE(34);
|
if (eof) ADVANCE(34);
|
||||||
if (lookahead == '+' ||
|
ADVANCE_MAP(
|
||||||
lookahead == '-') ADVANCE(1);
|
'.', 6,
|
||||||
if (lookahead == '.') ADVANCE(6);
|
'0', 37,
|
||||||
if (lookahead == '0') ADVANCE(37);
|
'F', 2,
|
||||||
if (lookahead == 'F') ADVANCE(2);
|
'N', 16,
|
||||||
if (lookahead == 'N') ADVANCE(16);
|
'T', 13,
|
||||||
if (lookahead == 'T') ADVANCE(13);
|
'f', 17,
|
||||||
if (lookahead == 'f') ADVANCE(17);
|
'n', 29,
|
||||||
if (lookahead == 'n') ADVANCE(29);
|
't', 26,
|
||||||
if (lookahead == 't') ADVANCE(26);
|
'~', 35,
|
||||||
if (lookahead == '~') ADVANCE(35);
|
'+', 1,
|
||||||
|
'-', 1,
|
||||||
|
);
|
||||||
if (('1' <= lookahead && lookahead <= '9')) ADVANCE(38);
|
if (('1' <= lookahead && lookahead <= '9')) ADVANCE(38);
|
||||||
END_STATE();
|
END_STATE();
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -313,7 +315,7 @@ static const TSParseActionEntry ts_parse_actions[] = {
|
||||||
[1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(),
|
[1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(),
|
||||||
[3] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2),
|
[3] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2),
|
||||||
[5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(2),
|
[5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(2),
|
||||||
[7] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_scalar, 1),
|
[7] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_scalar, 1, 0, 0),
|
||||||
[9] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
|
[9] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -328,7 +330,7 @@ extern "C" {
|
||||||
#define TS_PUBLIC __attribute__((visibility("default")))
|
#define TS_PUBLIC __attribute__((visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TS_PUBLIC const TSLanguage *tree_sitter_core_schema() {
|
TS_PUBLIC const TSLanguage *tree_sitter_core_schema(void) {
|
||||||
static const TSLanguage language = {
|
static const TSLanguage language = {
|
||||||
.version = LANGUAGE_VERSION,
|
.version = LANGUAGE_VERSION,
|
||||||
.symbol_count = SYMBOL_COUNT,
|
.symbol_count = SYMBOL_COUNT,
|
||||||
|
|
51
schema/core/src/tree_sitter/parser.h
generated
51
schema/core/src/tree_sitter/parser.h
generated
|
@ -86,6 +86,11 @@ typedef union {
|
||||||
} entry;
|
} entry;
|
||||||
} TSParseActionEntry;
|
} TSParseActionEntry;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t start;
|
||||||
|
int32_t end;
|
||||||
|
} TSCharacterRange;
|
||||||
|
|
||||||
struct TSLanguage {
|
struct TSLanguage {
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
uint32_t symbol_count;
|
uint32_t symbol_count;
|
||||||
|
@ -125,6 +130,24 @@ struct TSLanguage {
|
||||||
const TSStateId *primary_state_ids;
|
const TSStateId *primary_state_ids;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t lookahead) {
|
||||||
|
uint32_t index = 0;
|
||||||
|
uint32_t size = len - index;
|
||||||
|
while (size > 1) {
|
||||||
|
uint32_t half_size = size / 2;
|
||||||
|
uint32_t mid_index = index + half_size;
|
||||||
|
TSCharacterRange *range = &ranges[mid_index];
|
||||||
|
if (lookahead >= range->start && lookahead <= range->end) {
|
||||||
|
return true;
|
||||||
|
} else if (lookahead > range->end) {
|
||||||
|
index = mid_index;
|
||||||
|
}
|
||||||
|
size -= half_size;
|
||||||
|
}
|
||||||
|
TSCharacterRange *range = &ranges[index];
|
||||||
|
return (lookahead >= range->start && lookahead <= range->end);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lexer Macros
|
* Lexer Macros
|
||||||
*/
|
*/
|
||||||
|
@ -154,6 +177,17 @@ struct TSLanguage {
|
||||||
goto next_state; \
|
goto next_state; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ADVANCE_MAP(...) \
|
||||||
|
{ \
|
||||||
|
static const uint16_t map[] = { __VA_ARGS__ }; \
|
||||||
|
for (uint32_t i = 0; i < sizeof(map) / sizeof(map[0]); i += 2) { \
|
||||||
|
if (map[i] == lookahead) { \
|
||||||
|
state = map[i + 1]; \
|
||||||
|
goto next_state; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#define SKIP(state_value) \
|
#define SKIP(state_value) \
|
||||||
{ \
|
{ \
|
||||||
skip = true; \
|
skip = true; \
|
||||||
|
@ -203,14 +237,15 @@ struct TSLanguage {
|
||||||
} \
|
} \
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#define REDUCE(symbol_val, child_count_val, ...) \
|
#define REDUCE(symbol_name, children, precedence, prod_id) \
|
||||||
{{ \
|
{{ \
|
||||||
.reduce = { \
|
.reduce = { \
|
||||||
.type = TSParseActionTypeReduce, \
|
.type = TSParseActionTypeReduce, \
|
||||||
.symbol = symbol_val, \
|
.symbol = symbol_name, \
|
||||||
.child_count = child_count_val, \
|
.child_count = children, \
|
||||||
__VA_ARGS__ \
|
.dynamic_precedence = precedence, \
|
||||||
}, \
|
.production_id = prod_id \
|
||||||
|
}, \
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#define RECOVER() \
|
#define RECOVER() \
|
||||||
|
|
4
schema/json/src/parser.c
generated
4
schema/json/src/parser.c
generated
|
@ -215,7 +215,7 @@ static const TSParseActionEntry ts_parse_actions[] = {
|
||||||
[1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(),
|
[1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(),
|
||||||
[3] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2),
|
[3] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2),
|
||||||
[5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(2),
|
[5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(2),
|
||||||
[7] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_scalar, 1),
|
[7] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_scalar, 1, 0, 0),
|
||||||
[9] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
|
[9] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ extern "C" {
|
||||||
#define TS_PUBLIC __attribute__((visibility("default")))
|
#define TS_PUBLIC __attribute__((visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TS_PUBLIC const TSLanguage *tree_sitter_json_schema() {
|
TS_PUBLIC const TSLanguage *tree_sitter_json_schema(void) {
|
||||||
static const TSLanguage language = {
|
static const TSLanguage language = {
|
||||||
.version = LANGUAGE_VERSION,
|
.version = LANGUAGE_VERSION,
|
||||||
.symbol_count = SYMBOL_COUNT,
|
.symbol_count = SYMBOL_COUNT,
|
||||||
|
|
51
schema/json/src/tree_sitter/parser.h
generated
51
schema/json/src/tree_sitter/parser.h
generated
|
@ -86,6 +86,11 @@ typedef union {
|
||||||
} entry;
|
} entry;
|
||||||
} TSParseActionEntry;
|
} TSParseActionEntry;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t start;
|
||||||
|
int32_t end;
|
||||||
|
} TSCharacterRange;
|
||||||
|
|
||||||
struct TSLanguage {
|
struct TSLanguage {
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
uint32_t symbol_count;
|
uint32_t symbol_count;
|
||||||
|
@ -125,6 +130,24 @@ struct TSLanguage {
|
||||||
const TSStateId *primary_state_ids;
|
const TSStateId *primary_state_ids;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t lookahead) {
|
||||||
|
uint32_t index = 0;
|
||||||
|
uint32_t size = len - index;
|
||||||
|
while (size > 1) {
|
||||||
|
uint32_t half_size = size / 2;
|
||||||
|
uint32_t mid_index = index + half_size;
|
||||||
|
TSCharacterRange *range = &ranges[mid_index];
|
||||||
|
if (lookahead >= range->start && lookahead <= range->end) {
|
||||||
|
return true;
|
||||||
|
} else if (lookahead > range->end) {
|
||||||
|
index = mid_index;
|
||||||
|
}
|
||||||
|
size -= half_size;
|
||||||
|
}
|
||||||
|
TSCharacterRange *range = &ranges[index];
|
||||||
|
return (lookahead >= range->start && lookahead <= range->end);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lexer Macros
|
* Lexer Macros
|
||||||
*/
|
*/
|
||||||
|
@ -154,6 +177,17 @@ struct TSLanguage {
|
||||||
goto next_state; \
|
goto next_state; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ADVANCE_MAP(...) \
|
||||||
|
{ \
|
||||||
|
static const uint16_t map[] = { __VA_ARGS__ }; \
|
||||||
|
for (uint32_t i = 0; i < sizeof(map) / sizeof(map[0]); i += 2) { \
|
||||||
|
if (map[i] == lookahead) { \
|
||||||
|
state = map[i + 1]; \
|
||||||
|
goto next_state; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#define SKIP(state_value) \
|
#define SKIP(state_value) \
|
||||||
{ \
|
{ \
|
||||||
skip = true; \
|
skip = true; \
|
||||||
|
@ -203,14 +237,15 @@ struct TSLanguage {
|
||||||
} \
|
} \
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#define REDUCE(symbol_val, child_count_val, ...) \
|
#define REDUCE(symbol_name, children, precedence, prod_id) \
|
||||||
{{ \
|
{{ \
|
||||||
.reduce = { \
|
.reduce = { \
|
||||||
.type = TSParseActionTypeReduce, \
|
.type = TSParseActionTypeReduce, \
|
||||||
.symbol = symbol_val, \
|
.symbol = symbol_name, \
|
||||||
.child_count = child_count_val, \
|
.child_count = children, \
|
||||||
__VA_ARGS__ \
|
.dynamic_precedence = precedence, \
|
||||||
}, \
|
.production_id = prod_id \
|
||||||
|
}, \
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#define RECOVER() \
|
#define RECOVER() \
|
||||||
|
|
|
@ -16,6 +16,9 @@ readFile(join(__dirname, schema, "src", "parser.c"), "utf8").then(input => {
|
||||||
cases
|
cases
|
||||||
.map(([key, { content }]) => `${(key === "default" ? "default:" : `case ${key}:`)}\n${indent(content)}`)
|
.map(([key, { content }]) => `${(key === "default" ? "default:" : `case ${key}:`)}\n${indent(content)}`)
|
||||||
.join("\n END_STATE();\n")
|
.join("\n END_STATE();\n")
|
||||||
|
.replace(/\s+ADVANCE_MAP\(([^]+?)\);\n/, (_, map) => {
|
||||||
|
return map.replace(/'(.)', (\d+),/g, "if (lookahead == '$1') ADVANCE($2);");
|
||||||
|
})
|
||||||
.replace(/ADVANCE\((\d+)\);/g, (_, state) => {
|
.replace(/ADVANCE\((\d+)\);/g, (_, state) => {
|
||||||
const stateCase = cases.find(([key]) => key === state);
|
const stateCase = cases.find(([key]) => key === state);
|
||||||
if (stateCase) {
|
if (stateCase) {
|
||||||
|
|
2
src/parser.c
generated
2
src/parser.c
generated
|
@ -40504,7 +40504,7 @@ void tree_sitter_yaml_external_scanner_deserialize(void *, const char *, unsigne
|
||||||
#define TS_PUBLIC __attribute__((visibility("default")))
|
#define TS_PUBLIC __attribute__((visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TS_PUBLIC const TSLanguage *tree_sitter_yaml() {
|
TS_PUBLIC const TSLanguage *tree_sitter_yaml(void) {
|
||||||
static const TSLanguage language = {
|
static const TSLanguage language = {
|
||||||
.version = LANGUAGE_VERSION,
|
.version = LANGUAGE_VERSION,
|
||||||
.symbol_count = SYMBOL_COUNT,
|
.symbol_count = SYMBOL_COUNT,
|
||||||
|
|
26
src/schema.core.c
generated
26
src/schema.core.c
generated
|
@ -15,18 +15,18 @@ static int8_t adv_sch_stt(int8_t sch_stt, int32_t cur_chr, ResultSchema *rlt_sch
|
||||||
case SCH_STT_FRZ:
|
case SCH_STT_FRZ:
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
if (cur_chr == '+' ||
|
if (cur_chr == '.') {*rlt_sch = RS_STR; return 6;}
|
||||||
cur_chr == '-') {*rlt_sch = RS_STR; return 1;}
|
if (cur_chr == '0') {*rlt_sch = RS_INT; return 37;}
|
||||||
if (cur_chr == '.') {*rlt_sch = RS_STR; return 6;}
|
if (cur_chr == 'F') {*rlt_sch = RS_STR; return 2;}
|
||||||
if (cur_chr == '0') {*rlt_sch = RS_INT; return 37;}
|
if (cur_chr == 'N') {*rlt_sch = RS_STR; return 16;}
|
||||||
if (cur_chr == 'F') {*rlt_sch = RS_STR; return 2;}
|
if (cur_chr == 'T') {*rlt_sch = RS_STR; return 13;}
|
||||||
if (cur_chr == 'N') {*rlt_sch = RS_STR; return 16;}
|
if (cur_chr == 'f') {*rlt_sch = RS_STR; return 17;}
|
||||||
if (cur_chr == 'T') {*rlt_sch = RS_STR; return 13;}
|
if (cur_chr == 'n') {*rlt_sch = RS_STR; return 29;}
|
||||||
if (cur_chr == 'f') {*rlt_sch = RS_STR; return 17;}
|
if (cur_chr == 't') {*rlt_sch = RS_STR; return 26;}
|
||||||
if (cur_chr == 'n') {*rlt_sch = RS_STR; return 29;}
|
if (cur_chr == '~') {*rlt_sch = RS_NULL; return 35;}
|
||||||
if (cur_chr == 't') {*rlt_sch = RS_STR; return 26;}
|
if (cur_chr == '+') {*rlt_sch = RS_STR; return 1;}
|
||||||
if (cur_chr == '~') {*rlt_sch = RS_NULL; return 35;}
|
if (cur_chr == '-') {*rlt_sch = RS_STR; return 1;}
|
||||||
if (('1' <= cur_chr && cur_chr <= '9')) {*rlt_sch = RS_INT; return 38;}
|
if (('1' <= cur_chr && cur_chr <= '9')) {*rlt_sch = RS_INT; return 38;}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (cur_chr == '.') {*rlt_sch = RS_STR; return 7;}
|
if (cur_chr == '.') {*rlt_sch = RS_STR; return 7;}
|
||||||
|
@ -195,6 +195,6 @@ static int8_t adv_sch_stt(int8_t sch_stt, int32_t cur_chr, ResultSchema *rlt_sch
|
||||||
*rlt_sch = RS_STR;
|
*rlt_sch = RS_STR;
|
||||||
return SCH_STT_FRZ;
|
return SCH_STT_FRZ;
|
||||||
}
|
}
|
||||||
if (cur_chr != '\r' && cur_chr != '\n' && cur_chr != ' ' && cur_chr != 0) {*rlt_sch = RS_STR;}
|
if (cur_chr != '\r' && cur_chr != '\n' && cur_chr != ' ' && cur_chr != 0) *rlt_sch = RS_STR;
|
||||||
return SCH_STT_FRZ;
|
return SCH_STT_FRZ;
|
||||||
}
|
}
|
||||||
|
|
2
src/schema.json.c
generated
2
src/schema.json.c
generated
|
@ -97,6 +97,6 @@ static int8_t adv_sch_stt(int8_t sch_stt, int32_t cur_chr, ResultSchema *rlt_sch
|
||||||
*rlt_sch = RS_STR;
|
*rlt_sch = RS_STR;
|
||||||
return SCH_STT_FRZ;
|
return SCH_STT_FRZ;
|
||||||
}
|
}
|
||||||
if (cur_chr != '\r' && cur_chr != '\n' && cur_chr != ' ' && cur_chr != 0) {*rlt_sch = RS_STR;}
|
if (cur_chr != '\r' && cur_chr != '\n' && cur_chr != ' ' && cur_chr != 0) *rlt_sch = RS_STR;
|
||||||
return SCH_STT_FRZ;
|
return SCH_STT_FRZ;
|
||||||
}
|
}
|
||||||
|
|
7
src/tree_sitter/parser.h
generated
7
src/tree_sitter/parser.h
generated
|
@ -161,8 +161,9 @@ static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t
|
||||||
#define START_LEXER() \
|
#define START_LEXER() \
|
||||||
bool result = false; \
|
bool result = false; \
|
||||||
bool skip = false; \
|
bool skip = false; \
|
||||||
UNUSED bool eof = false; \
|
UNUSED \
|
||||||
UNUSED int32_t lookahead; \
|
bool eof = false; \
|
||||||
|
int32_t lookahead; \
|
||||||
goto start; \
|
goto start; \
|
||||||
next_state: \
|
next_state: \
|
||||||
lexer->advance(lexer, skip); \
|
lexer->advance(lexer, skip); \
|
||||||
|
@ -244,7 +245,7 @@ static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t
|
||||||
.child_count = children, \
|
.child_count = children, \
|
||||||
.dynamic_precedence = precedence, \
|
.dynamic_precedence = precedence, \
|
||||||
.production_id = prod_id \
|
.production_id = prod_id \
|
||||||
} \
|
}, \
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#define RECOVER() \
|
#define RECOVER() \
|
||||||
|
|
Loading…
Reference in a new issue