Bump tree-sitter-ccomment to v0.17

This commit is contained in:
Luni-4 2021-03-10 10:36:26 +01:00
Родитель 364681323c
Коммит 9a373ab1cf
11 изменённых файлов: 112 добавлений и 76 удалений

2
Cargo.lock сгенерированный
Просмотреть файл

@ -2204,7 +2204,7 @@ dependencies = [
[[package]]
name = "tree-sitter-ccomment"
version = "0.16.0"
version = "0.17.0"
dependencies = [
"cc",
"tree-sitter 0.17.1",

Просмотреть файл

@ -33,7 +33,7 @@ termcolor = "^1.1"
tree-sitter = "^0.17"
tree-sitter-java = "^0.16"
tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "^0.16" }
tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "^0.16" }
tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "^0.17" }
tree-sitter-mozcpp = { path = "./tree-sitter-mozcpp", version = "^0.16" }
tree-sitter-mozjs = { path = "./tree-sitter-mozjs", version = "^0.16" }

4
enums/Cargo.lock сгенерированный
Просмотреть файл

@ -498,7 +498,7 @@ dependencies = [
[[package]]
name = "tree-sitter-ccomment"
version = "0.16.0"
version = "0.17.0"
dependencies = [
"cc",
"tree-sitter 0.17.1",
@ -538,7 +538,7 @@ name = "tree-sitter-mozjs"
version = "0.16.0"
dependencies = [
"cc",
"tree-sitter",
"tree-sitter 0.17.1",
]
[[package]]

Просмотреть файл

@ -19,6 +19,6 @@ libc = "^0.2"
tree-sitter = "^0.17"
tree-sitter-java = "^0.16"
tree-sitter-preproc = { path = "../tree-sitter-preproc" }
tree-sitter-ccomment = { path = "../tree-sitter-ccomment" }
tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "^0.17" }
tree-sitter-mozcpp = { path = "../tree-sitter-mozcpp" }
tree-sitter-mozjs = { path = "../tree-sitter-mozjs" }

Просмотреть файл

@ -1,7 +1,7 @@
[package]
name = "tree-sitter-ccomment"
description = "Ccomment grammar for the tree-sitter parsing library"
version = "0.16.0"
version = "0.17.0"
authors = ["Calixte Denizet <cdenizet@mozilla.com>"]
license = "MIT"
readme = "bindings/rust/README.md"

Просмотреть файл

@ -9,7 +9,7 @@ way.)
``` toml
[dependencies]
tree-sitter = "0.17"
tree-sitter-ccomment = "0.16"
tree-sitter-ccomment = "0.17"
```
Typically, you will use the [language][language func] function to add this

Просмотреть файл

@ -1,24 +1,25 @@
{
"name": "tree-sitter-c",
"version": "0.15.2",
"description": "C grammar for node-tree-sitter",
"name": "tree-sitter-ccomment",
"version": "0.17.0",
"description": "Ccomment grammar for node-tree-sitter",
"main": "index.js",
"keywords": [
"parser",
"lexer"
],
"author": "Max Brunsfeld",
"author": "Calixte Denizet",
"license": "MIT",
"dependencies": {
"nan": "^2.10.0"
"nan": "^2.14.2"
},
"devDependencies": {
"tree-sitter-cli": "^0.15.5"
"tree-sitter-cli": "^0.17.3"
},
"scripts": {
"build": "tree-sitter generate && node-gyp build",
"test": "tree-sitter test && tree-sitter parse examples/* --quiet --time",
"test-windows": "tree-sitter test"
"test-windows": "tree-sitter test",
"install": "node-gyp rebuild"
},
"tree-sitter": [
{
@ -27,5 +28,9 @@
"c"
]
}
]
],
"gypfile": true,
"directories": {
"example": "examples"
}
}

2
tree-sitter-ccomment/src/grammar.json поставляемый
Просмотреть файл

@ -136,7 +136,7 @@
},
{
"type": "PATTERN",
"value": "[^*]*\\*+([^\\/*][^*]*\\*+)*"
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
},
{
"type": "STRING",

4
tree-sitter-ccomment/src/node-types.json поставляемый
Просмотреть файл

@ -78,5 +78,9 @@
{
"type": "preproc_line",
"named": true
},
{
"type": "raw_string_literal",
"named": true
}
]

94
tree-sitter-ccomment/src/parser.c поставляемый
Просмотреть файл

@ -5,7 +5,7 @@
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
#define LANGUAGE_VERSION 11
#define LANGUAGE_VERSION 12
#define STATE_COUNT 12
#define LARGE_STATE_COUNT 4
#define SYMBOL_COUNT 16
@ -142,6 +142,10 @@ static TSSymbol ts_alias_sequences[1][MAX_ALIAS_SEQUENCE_LENGTH] = {
[0] = {0},
};
static uint16_t ts_non_terminal_alias_map[] = {
0,
};
static bool ts_lex(TSLexer *lexer, TSStateId state) {
START_LEXER();
eof = lexer->eof(lexer);
@ -484,40 +488,43 @@ static uint32_t ts_small_parse_table_map[] = {
};
static TSParseActionEntry ts_parse_actions[] = {
[0] = {.count = 0, .reusable = false},
[1] = {.count = 1, .reusable = false}, RECOVER(),
[3] = {.count = 1, .reusable = true}, REDUCE(sym_translation_unit, 0),
[5] = {.count = 1, .reusable = false}, SHIFT(2),
[7] = {.count = 1, .reusable = false}, SHIFT(8),
[9] = {.count = 1, .reusable = false}, SHIFT(4),
[11] = {.count = 1, .reusable = false}, SHIFT(5),
[13] = {.count = 1, .reusable = true}, SHIFT(2),
[15] = {.count = 1, .reusable = true}, REDUCE(sym_translation_unit, 1),
[17] = {.count = 1, .reusable = false}, SHIFT(3),
[19] = {.count = 1, .reusable = true}, SHIFT(3),
[21] = {.count = 1, .reusable = true}, REDUCE(aux_sym_translation_unit_repeat1, 2),
[23] = {.count = 2, .reusable = false}, REDUCE(aux_sym_translation_unit_repeat1, 2), SHIFT_REPEAT(3),
[26] = {.count = 2, .reusable = false}, REDUCE(aux_sym_translation_unit_repeat1, 2), SHIFT_REPEAT(8),
[29] = {.count = 2, .reusable = false}, REDUCE(aux_sym_translation_unit_repeat1, 2), SHIFT_REPEAT(4),
[32] = {.count = 2, .reusable = false}, REDUCE(aux_sym_translation_unit_repeat1, 2), SHIFT_REPEAT(5),
[35] = {.count = 2, .reusable = true}, REDUCE(aux_sym_translation_unit_repeat1, 2), SHIFT_REPEAT(3),
[38] = {.count = 1, .reusable = true}, REDUCE(sym_string_literal, 1),
[40] = {.count = 1, .reusable = false}, REDUCE(sym_string_literal, 1),
[42] = {.count = 1, .reusable = true}, REDUCE(sym_char_literal, 1),
[44] = {.count = 1, .reusable = false}, REDUCE(sym_char_literal, 1),
[46] = {.count = 1, .reusable = true}, REDUCE(sym_define, 2),
[48] = {.count = 1, .reusable = false}, REDUCE(sym_define, 2),
[50] = {.count = 1, .reusable = true}, REDUCE(sym_define, 3),
[52] = {.count = 1, .reusable = false}, REDUCE(sym_define, 3),
[54] = {.count = 1, .reusable = false}, SHIFT(9),
[56] = {.count = 1, .reusable = false}, SHIFT(6),
[58] = {.count = 1, .reusable = false}, SHIFT(10),
[60] = {.count = 1, .reusable = false}, SHIFT(7),
[62] = {.count = 2, .reusable = false}, REDUCE(aux_sym_define_repeat1, 2), SHIFT_REPEAT(10),
[65] = {.count = 1, .reusable = false}, REDUCE(aux_sym_define_repeat1, 2),
[67] = {.count = 1, .reusable = true}, ACCEPT_INPUT(),
[0] = {.entry = {.count = 0, .reusable = false}},
[1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(),
[3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_translation_unit, 0),
[5] = {.entry = {.count = 1, .reusable = false}}, SHIFT(2),
[7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(8),
[9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(4),
[11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(5),
[13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2),
[15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_translation_unit, 1),
[17] = {.entry = {.count = 1, .reusable = false}}, SHIFT(3),
[19] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3),
[21] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_translation_unit_repeat1, 2),
[23] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_translation_unit_repeat1, 2), SHIFT_REPEAT(3),
[26] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_translation_unit_repeat1, 2), SHIFT_REPEAT(8),
[29] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_translation_unit_repeat1, 2), SHIFT_REPEAT(4),
[32] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_translation_unit_repeat1, 2), SHIFT_REPEAT(5),
[35] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_translation_unit_repeat1, 2), SHIFT_REPEAT(3),
[38] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string_literal, 1),
[40] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string_literal, 1),
[42] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_char_literal, 1),
[44] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_char_literal, 1),
[46] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_define, 2),
[48] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_define, 2),
[50] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_define, 3),
[52] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_define, 3),
[54] = {.entry = {.count = 1, .reusable = false}}, SHIFT(9),
[56] = {.entry = {.count = 1, .reusable = false}}, SHIFT(6),
[58] = {.entry = {.count = 1, .reusable = false}}, SHIFT(10),
[60] = {.entry = {.count = 1, .reusable = false}}, SHIFT(7),
[62] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_define_repeat1, 2), SHIFT_REPEAT(10),
[65] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_define_repeat1, 2),
[67] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
};
#ifdef __cplusplus
extern "C" {
#endif
void *tree_sitter_ccomment_external_scanner_create(void);
void tree_sitter_ccomment_external_scanner_destroy(void *);
bool tree_sitter_ccomment_external_scanner_scan(void *, TSLexer *, const bool *);
@ -534,20 +541,15 @@ extern const TSLanguage *tree_sitter_ccomment(void) {
.symbol_count = SYMBOL_COUNT,
.alias_count = ALIAS_COUNT,
.token_count = TOKEN_COUNT,
.large_state_count = LARGE_STATE_COUNT,
.external_token_count = EXTERNAL_TOKEN_COUNT,
.symbol_names = ts_symbol_names,
.symbol_metadata = ts_symbol_metadata,
.parse_table = (const unsigned short *)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 = (const uint16_t *)ts_parse_table,
.parse_actions = ts_parse_actions,
.lex_modes = ts_lex_modes,
.symbol_names = ts_symbol_names,
.public_symbol_map = ts_symbol_map,
.alias_sequences = (const TSSymbol *)ts_alias_sequences,
.field_count = FIELD_COUNT,
.max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH,
.lex_fn = ts_lex,
.external_token_count = EXTERNAL_TOKEN_COUNT,
.external_scanner = {
(const bool *)ts_external_scanner_states,
ts_external_scanner_symbol_map,
@ -557,6 +559,16 @@ extern const TSLanguage *tree_sitter_ccomment(void) {
tree_sitter_ccomment_external_scanner_serialize,
tree_sitter_ccomment_external_scanner_deserialize,
},
.field_count = FIELD_COUNT,
.large_state_count = LARGE_STATE_COUNT,
.small_parse_table = (const uint16_t *)ts_small_parse_table,
.small_parse_table_map = (const uint32_t *)ts_small_parse_table_map,
.public_symbol_map = ts_symbol_map,
.alias_map = ts_non_terminal_alias_map,
.state_count = STATE_COUNT,
};
return &language;
}
#ifdef __cplusplus
}
#endif

53
tree-sitter-ccomment/src/tree_sitter/parser.h поставляемый
Просмотреть файл

@ -35,6 +35,7 @@ typedef uint16_t TSStateId;
typedef struct {
bool visible : 1;
bool named : 1;
bool supertype: 1;
} TSSymbolMetadata;
typedef struct TSLexer TSLexer;
@ -62,13 +63,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 +84,7 @@ typedef union {
struct {
uint8_t count;
bool reusable : 1;
};
} entry;
} TSParseActionEntry;
struct TSLanguage {
@ -119,6 +120,8 @@ struct TSLanguage {
const uint16_t *small_parse_table;
const uint32_t *small_parse_table_map;
const TSSymbol *public_symbol_map;
const uint16_t *alias_map;
uint32_t state_count;
};
/*
@ -167,22 +170,28 @@ struct TSLanguage {
#define ACTIONS(id) id
#define SHIFT(state_value) \
{ \
{ \
.type = TSParseActionTypeShift, \
.params = {.state = state_value}, \
} \
#define SHIFT(state_value) \
{ \
{ \
.params = { \
.shift = { \
.state = state_value \
} \
}, \
.type = TSParseActionTypeShift \
} \
}
#define SHIFT_REPEAT(state_value) \
{ \
{ \
.type = TSParseActionTypeShift, \
.params = { \
.state = state_value, \
.repetition = true \
.shift = { \
.state = state_value, \
.repetition = true \
} \
}, \
.type = TSParseActionTypeShift \
} \
}
@ -194,20 +203,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 = { \
.symbol = symbol_val, \
.child_count = child_count_val, \
__VA_ARGS__ \
} \
.reduce = { \
.symbol = symbol_val, \
.child_count = child_count_val, \
__VA_ARGS__ \
}, \
}, \
.type = TSParseActionTypeReduce \
} \
}