diff --git a/Cargo.toml b/Cargo.toml index 26d538a7b..9276e1360 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ tree-sitter-javascript = "=0.20.0" tree-sitter-python = "=0.20.2" tree-sitter-rust = "=0.20.3" tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "=0.20.1" } -tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "=0.20.0" } +tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "=0.20.1" } tree-sitter-mozcpp = { path = "./tree-sitter-mozcpp", version = "=0.20.2" } tree-sitter-mozjs = { path = "./tree-sitter-mozjs", version = "=0.20.1" } diff --git a/enums/Cargo.toml b/enums/Cargo.toml index d408b4313..40133a3f0 100644 --- a/enums/Cargo.toml +++ b/enums/Cargo.toml @@ -15,7 +15,7 @@ tree-sitter-javascript = "=0.20.0" tree-sitter-python = "=0.20.2" tree-sitter-rust = "=0.20.3" tree-sitter-preproc = { path = "../tree-sitter-preproc", version = "=0.20.1" } -tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "=0.20.0" } +tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "=0.20.1" } tree-sitter-mozcpp = { path = "../tree-sitter-mozcpp", version = "=0.20.2" } tree-sitter-mozjs = { path = "../tree-sitter-mozjs", version = "=0.20.1" } diff --git a/tree-sitter-ccomment/Cargo.toml b/tree-sitter-ccomment/Cargo.toml index f491c100c..5dc07e694 100644 --- a/tree-sitter-ccomment/Cargo.toml +++ b/tree-sitter-ccomment/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tree-sitter-ccomment" description = "Ccomment grammar for the tree-sitter parsing library" -version = "0.20.0" +version = "0.20.1" authors = ["Calixte Denizet "] license = "MIT" readme = "bindings/rust/README.md" @@ -21,7 +21,7 @@ include = [ path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "0.20.0" +tree-sitter = "0.20.9" [build-dependencies] cc = "^1.0" diff --git a/tree-sitter-ccomment/package.json b/tree-sitter-ccomment/package.json index 35afdd702..ed1cc1ea2 100644 --- a/tree-sitter-ccomment/package.json +++ b/tree-sitter-ccomment/package.json @@ -1,6 +1,6 @@ { "name": "tree-sitter-ccomment", - "version": "0.19.0", + "version": "0.20.0", "description": "Ccomment grammar for node-tree-sitter", "main": "bindings/node", "keywords": [ @@ -13,7 +13,7 @@ "nan": "^2.14.2" }, "devDependencies": { - "tree-sitter-cli": "^0.19.3" + "tree-sitter-cli": "^0.20.7" }, "scripts": { "build": "tree-sitter generate && node-gyp build", diff --git a/tree-sitter-ccomment/src/parser.c b/tree-sitter-ccomment/src/parser.c index ab94e2ac9..89cc60dec 100644 --- a/tree-sitter-ccomment/src/parser.c +++ b/tree-sitter-ccomment/src/parser.c @@ -5,7 +5,7 @@ #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif -#define LANGUAGE_VERSION 13 +#define LANGUAGE_VERSION 14 #define STATE_COUNT 12 #define LARGE_STATE_COUNT 4 #define SYMBOL_COUNT 16 @@ -34,7 +34,7 @@ enum { aux_sym_define_repeat1 = 15, }; -static const char *ts_symbol_names[] = { +static const char * const ts_symbol_names[] = { [ts_builtin_sym_end] = "end", [sym_nothing] = "nothing", [sym_preproc_continuation_line] = "preproc_continuation_line", @@ -53,7 +53,7 @@ static const char *ts_symbol_names[] = { [aux_sym_define_repeat1] = "define_repeat1", }; -static TSSymbol ts_symbol_map[] = { +static const TSSymbol ts_symbol_map[] = { [ts_builtin_sym_end] = ts_builtin_sym_end, [sym_nothing] = sym_nothing, [sym_preproc_continuation_line] = sym_preproc_continuation_line, @@ -139,14 +139,29 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { }, }; -static TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { +static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = { [0] = {0}, }; -static uint16_t ts_non_terminal_alias_map[] = { +static const uint16_t ts_non_terminal_alias_map[] = { 0, }; +static const TSStateId ts_primary_state_ids[STATE_COUNT] = { + [0] = 0, + [1] = 1, + [2] = 2, + [3] = 3, + [4] = 4, + [5] = 5, + [6] = 6, + [7] = 7, + [8] = 8, + [9] = 9, + [10] = 10, + [11] = 11, +}; + static bool ts_lex(TSLexer *lexer, TSStateId state) { START_LEXER(); eof = lexer->eof(lexer); @@ -326,7 +341,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { } } -static TSLexMode ts_lex_modes[STATE_COUNT] = { +static const TSLexMode ts_lex_modes[STATE_COUNT] = { [0] = {.lex_state = 0, .external_lex_state = 1}, [1] = {.lex_state = 0, .external_lex_state = 1}, [2] = {.lex_state = 0, .external_lex_state = 1}, @@ -345,17 +360,17 @@ enum { ts_external_token_raw_string_literal = 0, }; -static TSSymbol ts_external_scanner_symbol_map[EXTERNAL_TOKEN_COUNT] = { +static const TSSymbol ts_external_scanner_symbol_map[EXTERNAL_TOKEN_COUNT] = { [ts_external_token_raw_string_literal] = sym_raw_string_literal, }; -static bool ts_external_scanner_states[2][EXTERNAL_TOKEN_COUNT] = { +static const bool ts_external_scanner_states[2][EXTERNAL_TOKEN_COUNT] = { [1] = { [ts_external_token_raw_string_literal] = true, }, }; -static uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { +static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [0] = { [ts_builtin_sym_end] = ACTIONS(1), [sym_nothing] = ACTIONS(1), @@ -410,7 +425,7 @@ static uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { }, }; -static uint16_t ts_small_parse_table[] = { +static const uint16_t ts_small_parse_table[] = { [0] = 2, ACTIONS(38), 2, sym_raw_string_literal, @@ -477,7 +492,7 @@ static uint16_t ts_small_parse_table[] = { ts_builtin_sym_end, }; -static uint32_t ts_small_parse_table_map[] = { +static const uint32_t ts_small_parse_table_map[] = { [SMALL_STATE(4)] = 0, [SMALL_STATE(5)] = 12, [SMALL_STATE(6)] = 24, @@ -488,7 +503,7 @@ static uint32_t ts_small_parse_table_map[] = { [SMALL_STATE(11)] = 78, }; -static TSParseActionEntry ts_parse_actions[] = { +static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_translation_unit, 0), @@ -537,7 +552,7 @@ void tree_sitter_ccomment_external_scanner_deserialize(void *, const char *, uns #endif extern const TSLanguage *tree_sitter_ccomment(void) { - static TSLanguage language = { + static const TSLanguage language = { .version = LANGUAGE_VERSION, .symbol_count = SYMBOL_COUNT, .alias_count = ALIAS_COUNT, @@ -548,19 +563,19 @@ extern const TSLanguage *tree_sitter_ccomment(void) { .production_id_count = PRODUCTION_ID_COUNT, .field_count = FIELD_COUNT, .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH, - .parse_table = (const uint16_t *)ts_parse_table, - .small_parse_table = (const uint16_t *)ts_small_parse_table, - .small_parse_table_map = (const uint32_t *)ts_small_parse_table_map, + .parse_table = &ts_parse_table[0][0], + .small_parse_table = ts_small_parse_table, + .small_parse_table_map = ts_small_parse_table_map, .parse_actions = ts_parse_actions, .symbol_names = ts_symbol_names, .symbol_metadata = ts_symbol_metadata, .public_symbol_map = ts_symbol_map, .alias_map = ts_non_terminal_alias_map, - .alias_sequences = (const TSSymbol *)ts_alias_sequences, + .alias_sequences = &ts_alias_sequences[0][0], .lex_modes = ts_lex_modes, .lex_fn = ts_lex, .external_scanner = { - (const bool *)ts_external_scanner_states, + &ts_external_scanner_states[0][0], ts_external_scanner_symbol_map, tree_sitter_ccomment_external_scanner_create, tree_sitter_ccomment_external_scanner_destroy, @@ -568,6 +583,7 @@ extern const TSLanguage *tree_sitter_ccomment(void) { tree_sitter_ccomment_external_scanner_serialize, tree_sitter_ccomment_external_scanner_deserialize, }, + .primary_state_ids = ts_primary_state_ids, }; return &language; } diff --git a/tree-sitter-ccomment/src/tree_sitter/parser.h b/tree-sitter-ccomment/src/tree_sitter/parser.h index a3a87bd1d..2b14ac104 100644 --- a/tree-sitter-ccomment/src/tree_sitter/parser.h +++ b/tree-sitter-ccomment/src/tree_sitter/parser.h @@ -102,8 +102,8 @@ struct TSLanguage { 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 char * const *symbol_names; + const char * const *field_names; const TSFieldMapSlice *field_map_slices; const TSFieldMapEntry *field_map_entries; const TSSymbolMetadata *symbol_metadata; @@ -123,6 +123,7 @@ struct TSLanguage { unsigned (*serialize)(void *, char *); void (*deserialize)(void *, const char *, unsigned); } external_scanner; + const TSStateId *primary_state_ids; }; /*