@willbooster/tree-sitter-c 45.0.3 → 47.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -85,7 +85,7 @@ and starter characters before `scan_c_token_slow` or token-specific lookahead ru
85
85
  external token the derived grammar adds (including unspaced tokens, error-recovery slots, and spaced punctuation or identifier starters), or
86
86
  those filters will reject the derived tokens before their scanner runs. When the scanner is ready and only extras, conditional markers,
87
87
  `_trailing_object_declaration_start`, or external directive tokens are valid, dispatch to `scan_extras` first. Otherwise check null-directive consumption before directive-body tokens,
88
- then reject external scans at `empty_directives_at_line_end` before the other token dispatch. Pass `empty_directives_skip` and its state through `ConditionalMacroSymbols.skip_empty` and
88
+ then reject external scans at `empty_directives_at_line_end` unless `PREPROC_NEWLINE` is valid. Pass `empty_directives_skip` and its state through `ConditionalMacroSymbols.skip_empty` and
89
89
  `empty_context` so declaration lookahead ignores null directives without moving the opening token's range.
90
90
  Keep preprocessor argument/newline handling ahead of annotation lookahead.
91
91
  Port `preproc_argument_mode` selection together with `scan_preproc_arg` so tokenized pragmas retain raw bodies.
package/grammar.js CHANGED
@@ -1386,7 +1386,7 @@ module.exports = Object.assign(
1386
1386
  $._type_identifier,
1387
1387
  alias('thread_local', sym('type_identifier')),
1388
1388
  alias(choice('signed', 'unsigned', 'long', 'short'), $.primitive_type),
1389
- $.primitive_type
1389
+ alias($.primitive_type, sym('type_identifier'))
1390
1390
  ),
1391
1391
 
1392
1392
  _abstract_declarator: ($) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-c",
3
- "version": "45.0.3",
3
+ "version": "47.0.0",
4
4
  "description": "C grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "c",
@@ -1,4 +1,12 @@
1
1
  // @ts-check
2
2
 
3
3
  // oxlint-disable-next-line unicorn/prefer-module -- Tree-sitter loads grammar dependencies as CommonJS.
4
- module.exports = { primitiveTypeKeywords: ['_Bool', 'bool', 'char', 'int', 'float', 'double', 'void'] };
4
+ module.exports = {
5
+ primitiveTypeKeywords: [
6
+ '_Bool', 'bool', 'char', 'int', 'float', 'double', 'void',
7
+ '_Float16', '_Float32', '_Float64', '_Float128',
8
+ '_Float32x', '_Float64x', '_Float128x',
9
+ '_Decimal32', '_Decimal64', '_Decimal96', '_Decimal128', '_Decimal64x', '_Decimal128x',
10
+ '__fp16', '__float80', '__float128', '__ibm128',
11
+ ],
12
+ };
package/src/keywords.h CHANGED
@@ -12,7 +12,20 @@ static const char *const function_macro_keywords[] = {
12
12
  "_Bool",
13
13
  "_Complex",
14
14
  "_Countof",
15
+ "_Decimal128",
16
+ "_Decimal128x",
17
+ "_Decimal32",
18
+ "_Decimal64",
19
+ "_Decimal64x",
20
+ "_Decimal96",
15
21
  "_Defer",
22
+ "_Float128",
23
+ "_Float128x",
24
+ "_Float16",
25
+ "_Float32",
26
+ "_Float32x",
27
+ "_Float64",
28
+ "_Float64x",
16
29
  "_Generic",
17
30
  "_Imaginary",
18
31
  "_Nonnull",
@@ -35,7 +48,11 @@ static const char *const function_macro_keywords[] = {
35
48
  "__extension__",
36
49
  "__fastcall",
37
50
  "__finally",
51
+ "__float128",
52
+ "__float80",
38
53
  "__forceinline",
54
+ "__fp16",
55
+ "__ibm128",
39
56
  "__inline",
40
57
  "__inline__",
41
58
  "__leave",
@@ -151,8 +168,25 @@ static const char *const function_macro_type_keywords[] = {
151
168
  "_BitInt",
152
169
  "_Bool",
153
170
  "_Complex",
171
+ "_Decimal128",
172
+ "_Decimal128x",
173
+ "_Decimal32",
174
+ "_Decimal64",
175
+ "_Decimal64x",
176
+ "_Decimal96",
177
+ "_Float128",
178
+ "_Float128x",
179
+ "_Float16",
180
+ "_Float32",
181
+ "_Float32x",
182
+ "_Float64",
183
+ "_Float64x",
154
184
  "_Imaginary",
155
185
  "__complex__",
186
+ "__float128",
187
+ "__float80",
188
+ "__fp16",
189
+ "__ibm128",
156
190
  "__typeof",
157
191
  "__typeof__",
158
192
  "__typeof_unqual",
@@ -195,6 +229,23 @@ static const char *const function_macro_type_keywords[] = {
195
229
  };
196
230
  static const char *const function_macro_scalar_type_keywords[] = {
197
231
  "_Bool",
232
+ "_Decimal128",
233
+ "_Decimal128x",
234
+ "_Decimal32",
235
+ "_Decimal64",
236
+ "_Decimal64x",
237
+ "_Decimal96",
238
+ "_Float128",
239
+ "_Float128x",
240
+ "_Float16",
241
+ "_Float32",
242
+ "_Float32x",
243
+ "_Float64",
244
+ "_Float64x",
245
+ "__float128",
246
+ "__float80",
247
+ "__fp16",
248
+ "__ibm128",
198
249
  "bool",
199
250
  "char",
200
251
  "char16_t",
@@ -227,6 +278,19 @@ static const char *const function_macro_object_prefix_keywords[] = {
227
278
  "_Atomic",
228
279
  "_Bool",
229
280
  "_Complex",
281
+ "_Decimal128",
282
+ "_Decimal128x",
283
+ "_Decimal32",
284
+ "_Decimal64",
285
+ "_Decimal64x",
286
+ "_Decimal96",
287
+ "_Float128",
288
+ "_Float128x",
289
+ "_Float16",
290
+ "_Float32",
291
+ "_Float32x",
292
+ "_Float64",
293
+ "_Float64x",
230
294
  "_Imaginary",
231
295
  "_Nonnull",
232
296
  "_Noreturn",
@@ -241,7 +305,11 @@ static const char *const function_macro_object_prefix_keywords[] = {
241
305
  "__declspec",
242
306
  "__extension__",
243
307
  "__fastcall",
308
+ "__float128",
309
+ "__float80",
244
310
  "__forceinline",
311
+ "__fp16",
312
+ "__ibm128",
245
313
  "__inline",
246
314
  "__inline__",
247
315
  "__restrict__",
package/src/scanner.c CHANGED
@@ -164,7 +164,7 @@ static bool scan_error_recovery_tokens(EmptyDirectives *state, TSLexer *lexer, c
164
164
 
165
165
  static bool scan_active_tokens(CScanner *scanner, TSLexer *lexer, const bool *valid_symbols) {
166
166
  EmptyDirectives *state = scanner_directives(scanner);
167
- if (empty_directives_at_line_end(state, lexer)) return false;
167
+ if (!valid_symbols[PREPROC_NEWLINE] && empty_directives_at_line_end(state, lexer)) return false;
168
168
  if (any_preproc_body_valid(valid_symbols)) return scan_non_declaration_tokens(state, lexer, valid_symbols);
169
169
  int32_t peeked = peek_after_ascii_spaces(lexer);
170
170
  if (peeked >= 0) {
Binary file
package/tree-sitter.json CHANGED
@@ -28,7 +28,7 @@
28
28
  }
29
29
  ],
30
30
  "metadata": {
31
- "version": "45.0.3",
31
+ "version": "47.0.0",
32
32
  "license": "MIT",
33
33
  "description": "C grammar for tree-sitter",
34
34
  "authors": [