Skip to content

Commit 5c5dadb

Browse files
committed
Bump tree-sitter-preproc to v0.17
1 parent 9a373ab commit 5c5dadb

10 files changed

Lines changed: 267 additions & 231 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ termcolor = "^1.1"
3232

3333
tree-sitter = "^0.17"
3434
tree-sitter-java = "^0.16"
35-
tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "^0.16" }
35+
tree-sitter-preproc = { path = "./tree-sitter-preproc", version = "^0.17" }
3636
tree-sitter-ccomment = { path = "./tree-sitter-ccomment", version = "^0.17" }
3737
tree-sitter-mozcpp = { path = "./tree-sitter-mozcpp", version = "^0.16" }
3838
tree-sitter-mozjs = { path = "./tree-sitter-mozjs", version = "^0.16" }

‎enums/Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎enums/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ libc = "^0.2"
1818

1919
tree-sitter = "^0.17"
2020
tree-sitter-java = "^0.16"
21-
tree-sitter-preproc = { path = "../tree-sitter-preproc" }
21+
tree-sitter-preproc = { path = "../tree-sitter-preproc", version = "^0.17" }
2222
tree-sitter-ccomment = { path = "../tree-sitter-ccomment", version = "^0.17" }
2323
tree-sitter-mozcpp = { path = "../tree-sitter-mozcpp" }
2424
tree-sitter-mozjs = { path = "../tree-sitter-mozjs" }

‎tree-sitter-preproc/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "tree-sitter-preproc"
33
description = "Preproc grammar for the tree-sitter parsing library"
4-
version = "0.16.0"
4+
version = "0.17.0"
55
authors = ["Calixte Denizet <[email protected]>"]
66
license = "MIT"
77
readme = "bindings/rust/README.md"

‎tree-sitter-preproc/package.json‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
{
2-
"name": "tree-sitter-c",
3-
"version": "0.15.2",
4-
"description": "C grammar for node-tree-sitter",
2+
"name": "tree-sitter-preproc",
3+
"version": "0.17.0",
4+
"description": "Preproc grammar for node-tree-sitter",
55
"main": "index.js",
66
"keywords": [
77
"parser",
88
"lexer"
99
],
10-
"author": "Max Brunsfeld",
10+
"author": "Calixte Denizet",
1111
"license": "MIT",
1212
"dependencies": {
13-
"nan": "^2.10.0"
13+
"nan": "^2.14.2"
1414
},
1515
"devDependencies": {
16-
"tree-sitter-cli": "^0.15.5"
16+
"tree-sitter-cli": "^0.17.3"
1717
},
1818
"scripts": {
1919
"build": "tree-sitter generate && node-gyp build",
2020
"test": "tree-sitter test && tree-sitter parse examples/* --quiet --time",
21-
"test-windows": "tree-sitter test"
21+
"test-windows": "tree-sitter test",
22+
"install": "node-gyp rebuild"
2223
},
2324
"tree-sitter": [
2425
{
@@ -27,5 +28,9 @@
2728
"c"
2829
]
2930
}
30-
]
31+
],
32+
"gypfile": true,
33+
"directories": {
34+
"example": "examples"
35+
}
3136
}

‎tree-sitter-preproc/src/grammar.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@
351351
},
352352
{
353353
"type": "PATTERN",
354-
"value": "[^*]*\\*+([^\\/*][^*]*\\*+)*"
354+
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
355355
},
356356
{
357357
"type": "STRING",

‎tree-sitter-preproc/src/node-types.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,5 +364,9 @@
364364
{
365365
"type": "preproc_line",
366366
"named": true
367+
},
368+
{
369+
"type": "raw_string_literal",
370+
"named": true
367371
}
368372
]

‎tree-sitter-preproc/src/parser.c‎

Lines changed: 210 additions & 198 deletions
Large diffs are not rendered by default.

‎tree-sitter-preproc/src/tree_sitter/parser.h‎

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ typedef uint16_t TSStateId;
3535
typedef struct {
3636
bool visible : 1;
3737
bool named : 1;
38+
bool supertype: 1;
3839
} TSSymbolMetadata;
3940

4041
typedef struct TSLexer TSLexer;
@@ -62,13 +63,13 @@ typedef struct {
6263
TSStateId state;
6364
bool extra : 1;
6465
bool repetition : 1;
65-
};
66+
} shift;
6667
struct {
6768
TSSymbol symbol;
6869
int16_t dynamic_precedence;
6970
uint8_t child_count;
7071
uint8_t production_id;
71-
};
72+
} reduce;
7273
} params;
7374
TSParseActionType type : 4;
7475
} TSParseAction;
@@ -83,7 +84,7 @@ typedef union {
8384
struct {
8485
uint8_t count;
8586
bool reusable : 1;
86-
};
87+
} entry;
8788
} TSParseActionEntry;
8889

8990
struct TSLanguage {
@@ -119,6 +120,8 @@ struct TSLanguage {
119120
const uint16_t *small_parse_table;
120121
const uint32_t *small_parse_table_map;
121122
const TSSymbol *public_symbol_map;
123+
const uint16_t *alias_map;
124+
uint32_t state_count;
122125
};
123126

124127
/*
@@ -167,22 +170,28 @@ struct TSLanguage {
167170

168171
#define ACTIONS(id) id
169172

170-
#define SHIFT(state_value) \
171-
{ \
172-
{ \
173-
.type = TSParseActionTypeShift, \
174-
.params = {.state = state_value}, \
175-
} \
173+
#define SHIFT(state_value) \
174+
{ \
175+
{ \
176+
.params = { \
177+
.shift = { \
178+
.state = state_value \
179+
} \
180+
}, \
181+
.type = TSParseActionTypeShift \
182+
} \
176183
}
177184

178185
#define SHIFT_REPEAT(state_value) \
179186
{ \
180187
{ \
181-
.type = TSParseActionTypeShift, \
182188
.params = { \
183-
.state = state_value, \
184-
.repetition = true \
189+
.shift = { \
190+
.state = state_value, \
191+
.repetition = true \
192+
} \
185193
}, \
194+
.type = TSParseActionTypeShift \
186195
} \
187196
}
188197

@@ -194,20 +203,26 @@ struct TSLanguage {
194203
#define SHIFT_EXTRA() \
195204
{ \
196205
{ \
197-
.type = TSParseActionTypeShift, \
198-
.params = {.extra = true} \
206+
.params = { \
207+
.shift = { \
208+
.extra = true \
209+
} \
210+
}, \
211+
.type = TSParseActionTypeShift \
199212
} \
200213
}
201214

202215
#define REDUCE(symbol_val, child_count_val, ...) \
203216
{ \
204217
{ \
205-
.type = TSParseActionTypeReduce, \
206218
.params = { \
207-
.symbol = symbol_val, \
208-
.child_count = child_count_val, \
209-
__VA_ARGS__ \
210-
} \
219+
.reduce = { \
220+
.symbol = symbol_val, \
221+
.child_count = child_count_val, \
222+
__VA_ARGS__ \
223+
}, \
224+
}, \
225+
.type = TSParseActionTypeReduce \
211226
} \
212227
}
213228

0 commit comments

Comments
 (0)