@willbooster/tree-sitter-c 18.3.0 → 20.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.
@@ -207,6 +207,10 @@
207
207
  "type": "pointer_expression",
208
208
  "named": true
209
209
  },
210
+ {
211
+ "type": "raw_string_literal",
212
+ "named": true
213
+ },
210
214
  {
211
215
  "type": "sizeof_expression",
212
216
  "named": true
@@ -550,6 +554,14 @@
550
554
  "type": "initializer_pair",
551
555
  "named": true
552
556
  },
557
+ {
558
+ "type": "parameter_declaration",
559
+ "named": true
560
+ },
561
+ {
562
+ "type": "preproc_arg",
563
+ "named": true
564
+ },
553
565
  {
554
566
  "type": "preproc_defined",
555
567
  "named": true
@@ -1320,6 +1332,10 @@
1320
1332
  "type": "identifier",
1321
1333
  "named": true
1322
1334
  },
1335
+ {
1336
+ "type": "raw_string_literal",
1337
+ "named": true
1338
+ },
1323
1339
  {
1324
1340
  "type": "string_literal",
1325
1341
  "named": true
@@ -1407,25 +1423,13 @@
1407
1423
  "required": false,
1408
1424
  "types": [
1409
1425
  {
1410
- "type": "array_declarator",
1411
- "named": true
1412
- },
1413
- {
1414
- "type": "attributed_declarator",
1415
- "named": true
1416
- },
1417
- {
1418
- "type": "function_declarator",
1426
+ "type": "_declarator",
1419
1427
  "named": true
1420
1428
  },
1421
1429
  {
1422
1430
  "type": "gnu_asm_expression",
1423
1431
  "named": true
1424
1432
  },
1425
- {
1426
- "type": "identifier",
1427
- "named": true
1428
- },
1429
1433
  {
1430
1434
  "type": "init_declarator",
1431
1435
  "named": true
@@ -1433,14 +1437,6 @@
1433
1437
  {
1434
1438
  "type": "ms_call_modifier",
1435
1439
  "named": true
1436
- },
1437
- {
1438
- "type": "parenthesized_declarator",
1439
- "named": true
1440
- },
1441
- {
1442
- "type": "pointer_declarator",
1443
- "named": true
1444
1440
  }
1445
1441
  ]
1446
1442
  },
@@ -2216,6 +2212,10 @@
2216
2212
  "type": "concatenated_string",
2217
2213
  "named": true
2218
2214
  },
2215
+ {
2216
+ "type": "raw_string_literal",
2217
+ "named": true
2218
+ },
2219
2219
  {
2220
2220
  "type": "string_literal",
2221
2221
  "named": true
@@ -2236,6 +2236,10 @@
2236
2236
  "type": "concatenated_string",
2237
2237
  "named": true
2238
2238
  },
2239
+ {
2240
+ "type": "raw_string_literal",
2241
+ "named": true
2242
+ },
2239
2243
  {
2240
2244
  "type": "string_literal",
2241
2245
  "named": true
@@ -2318,6 +2322,10 @@
2318
2322
  "multiple": false,
2319
2323
  "required": true,
2320
2324
  "types": [
2325
+ {
2326
+ "type": "raw_string_literal",
2327
+ "named": true
2328
+ },
2321
2329
  {
2322
2330
  "type": "string_literal",
2323
2331
  "named": true
@@ -2370,6 +2378,10 @@
2370
2378
  "multiple": false,
2371
2379
  "required": true,
2372
2380
  "types": [
2381
+ {
2382
+ "type": "raw_string_literal",
2383
+ "named": true
2384
+ },
2373
2385
  {
2374
2386
  "type": "string_literal",
2375
2387
  "named": true
@@ -2654,6 +2666,10 @@
2654
2666
  "multiple": false,
2655
2667
  "required": true,
2656
2668
  "types": [
2669
+ {
2670
+ "type": "raw_string_literal",
2671
+ "named": true
2672
+ },
2657
2673
  {
2658
2674
  "type": "string_literal",
2659
2675
  "named": true
@@ -2682,6 +2698,16 @@
2682
2698
  "type": "macro_type_specifier",
2683
2699
  "named": true,
2684
2700
  "fields": {
2701
+ "arguments": {
2702
+ "multiple": false,
2703
+ "required": false,
2704
+ "types": [
2705
+ {
2706
+ "type": "argument_list",
2707
+ "named": true
2708
+ }
2709
+ ]
2710
+ },
2685
2711
  "name": {
2686
2712
  "multiple": false,
2687
2713
  "required": true,
@@ -2694,7 +2720,7 @@
2694
2720
  },
2695
2721
  "type": {
2696
2722
  "multiple": false,
2697
- "required": true,
2723
+ "required": false,
2698
2724
  "types": [
2699
2725
  {
2700
2726
  "type": "type_descriptor",
@@ -2702,6 +2728,32 @@
2702
2728
  }
2703
2729
  ]
2704
2730
  }
2731
+ },
2732
+ "children": {
2733
+ "multiple": true,
2734
+ "required": false,
2735
+ "types": [
2736
+ {
2737
+ "type": "compound_statement",
2738
+ "named": true
2739
+ },
2740
+ {
2741
+ "type": "expression",
2742
+ "named": true
2743
+ },
2744
+ {
2745
+ "type": "initializer_list",
2746
+ "named": true
2747
+ },
2748
+ {
2749
+ "type": "initializer_pair",
2750
+ "named": true
2751
+ },
2752
+ {
2753
+ "type": "type_descriptor",
2754
+ "named": true
2755
+ }
2756
+ ]
2705
2757
  }
2706
2758
  },
2707
2759
  {
@@ -2892,13 +2944,25 @@
2892
2944
  "named": true
2893
2945
  },
2894
2946
  {
2895
- "type": "identifier",
2947
+ "type": "expression",
2948
+ "named": true
2949
+ },
2950
+ {
2951
+ "type": "initializer_list",
2952
+ "named": true
2953
+ },
2954
+ {
2955
+ "type": "initializer_pair",
2896
2956
  "named": true
2897
2957
  },
2898
2958
  {
2899
2959
  "type": "parameter_declaration",
2900
2960
  "named": true
2901
2961
  },
2962
+ {
2963
+ "type": "type_descriptor",
2964
+ "named": true
2965
+ },
2902
2966
  {
2903
2967
  "type": "variadic_parameter",
2904
2968
  "named": true
@@ -2945,7 +3009,7 @@
2945
3009
  "named": true,
2946
3010
  "fields": {},
2947
3011
  "children": {
2948
- "multiple": false,
3012
+ "multiple": true,
2949
3013
  "required": true,
2950
3014
  "types": [
2951
3015
  {
@@ -2960,9 +3024,29 @@
2960
3024
  "type": "expression",
2961
3025
  "named": true
2962
3026
  },
3027
+ {
3028
+ "type": "initializer_list",
3029
+ "named": true
3030
+ },
3031
+ {
3032
+ "type": "initializer_pair",
3033
+ "named": true
3034
+ },
3035
+ {
3036
+ "type": "parameter_declaration",
3037
+ "named": true
3038
+ },
3039
+ {
3040
+ "type": "preproc_arg",
3041
+ "named": true
3042
+ },
2963
3043
  {
2964
3044
  "type": "preproc_defined",
2965
3045
  "named": true
3046
+ },
3047
+ {
3048
+ "type": "type_descriptor",
3049
+ "named": true
2966
3050
  }
2967
3051
  ]
2968
3052
  }
@@ -3977,6 +4061,11 @@
3977
4061
  ]
3978
4062
  }
3979
4063
  },
4064
+ {
4065
+ "type": "raw_string_literal",
4066
+ "named": true,
4067
+ "fields": {}
4068
+ },
3980
4069
  {
3981
4070
  "type": "return_statement",
3982
4071
  "named": true,
package/src/pragma.h CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  #include "tree_sitter/parser.h"
5
5
  #include "identifier.h"
6
+ #include "gnuRawString.h"
6
7
  #include <string.h>
7
8
 
8
9
  static const char pragma_word[] = "_Pragma";
@@ -13,8 +14,15 @@ typedef struct {
13
14
  unsigned length;
14
15
  bool ascii;
15
16
  bool lookahead_only;
17
+ bool preserve_end;
16
18
  } MacroName;
17
19
 
20
+ typedef enum {
21
+ PREPROC_ARGUMENT_TOKENS,
22
+ PREPROC_ARGUMENT_TEXT,
23
+ PREPROC_ARGUMENT_PRAGMA,
24
+ } PreprocArgumentMode;
25
+
18
26
  typedef enum {
19
27
  MACRO_NAME_END,
20
28
  MACRO_NAME_CHARACTER,
@@ -27,8 +35,10 @@ static void scan_macro_name_start(TSLexer *lexer, bool lookahead_only);
27
35
  static MacroNameCharacter scan_macro_name_character(TSLexer *lexer, bool continuation, MacroName *name);
28
36
  static bool scan_macro_name_ucn(TSLexer *lexer);
29
37
 
38
+ static bool scan_pragma_argument(TSLexer *lexer);
30
39
  static bool scan_pragma_spacing(TSLexer *lexer);
31
40
  static bool scan_pragma_suffix(TSLexer *lexer);
41
+ static bool scan_pragma_suffix_end(TSLexer *lexer, bool mark_end);
32
42
  static bool pragma_space(int32_t c);
33
43
  static bool scan_pragma_word(TSLexer *lexer);
34
44
  static bool scan_preproc_newline(TSLexer *lexer, bool skip);
@@ -36,6 +46,7 @@ static bool scan_preproc_splices(TSLexer *lexer);
36
46
  static bool scan_preproc_ucn(TSLexer *lexer, bool *in_number);
37
47
  static bool preproc_word(int32_t c, bool continuation);
38
48
  static bool scan_preproc_quote(TSLexer *lexer, int32_t quote, bool escaped, bool directive_text);
49
+ static bool scan_preproc_raw_quote(TSLexer *lexer);
39
50
 
40
51
  static bool scan_pragma(TSLexer *lexer) {
41
52
  while (pragma_space(lexer->lookahead)) {
@@ -46,16 +57,34 @@ static bool scan_pragma(TSLexer *lexer) {
46
57
  }
47
58
 
48
59
  static bool scan_pragma_suffix(TSLexer *lexer) {
60
+ return scan_pragma_suffix_end(lexer, true);
61
+ }
62
+
63
+ static bool scan_pragma_suffix_end(TSLexer *lexer, bool mark_end) {
49
64
  if (!scan_pragma_spacing(lexer) || lexer->lookahead != '(') return false;
50
65
  lexer->advance(lexer, false);
51
66
  if (!scan_pragma_spacing(lexer)) return false;
67
+ if (!scan_pragma_argument(lexer)) return false;
68
+ if (!scan_pragma_spacing(lexer) || lexer->lookahead != ')') return false;
69
+ lexer->advance(lexer, false);
70
+ if (mark_end) lexer->mark_end(lexer);
71
+ return true;
72
+ }
73
+
74
+ static bool scan_pragma_argument(TSLexer *lexer) {
52
75
  if (lexer->lookahead == 'L' || lexer->lookahead == 'u' || lexer->lookahead == 'U') {
53
76
  bool utf8 = lexer->lookahead == 'u';
54
77
  lexer->advance(lexer, false);
78
+ if (!scan_preproc_splices(lexer)) return false;
55
79
  if (utf8 && lexer->lookahead == '8') lexer->advance(lexer, false);
80
+ if (!scan_preproc_splices(lexer)) return false;
56
81
  }
82
+ bool raw = lexer->lookahead == 'R';
83
+ if (raw) lexer->advance(lexer, false);
84
+ if (!scan_preproc_splices(lexer)) return false;
57
85
  if (lexer->lookahead != '"') return false;
58
86
  lexer->advance(lexer, false);
87
+ if (raw) return scan_gnu_raw_string_end(lexer);
59
88
  while (lexer->lookahead != '"') {
60
89
  if (lexer->eof(lexer) || lexer->lookahead == '\n' || lexer->lookahead == '\r') return false;
61
90
  if (lexer->lookahead == '\\') {
@@ -66,9 +95,6 @@ static bool scan_pragma_suffix(TSLexer *lexer) {
66
95
  lexer->advance(lexer, false);
67
96
  }
68
97
  lexer->advance(lexer, false);
69
- if (!scan_pragma_spacing(lexer) || lexer->lookahead != ')') return false;
70
- lexer->advance(lexer, false);
71
- lexer->mark_end(lexer);
72
98
  return true;
73
99
  }
74
100
 
@@ -114,7 +140,14 @@ static bool scan_pragma_spacing(TSLexer *lexer) {
114
140
  }
115
141
  }
116
142
 
117
- static bool scan_preproc_arg(TSLexer *lexer, bool consumed_backslash, bool directive_text) {
143
+ static PreprocArgumentMode preproc_argument_mode(bool tokens, bool directive, bool lparen) {
144
+ if (tokens && directive && !lparen) return PREPROC_ARGUMENT_PRAGMA;
145
+ return !tokens && directive ? PREPROC_ARGUMENT_TEXT : PREPROC_ARGUMENT_TOKENS;
146
+ }
147
+
148
+ static bool scan_preproc_arg(TSLexer *lexer, bool consumed_backslash, PreprocArgumentMode mode) {
149
+ bool directive_text = mode != PREPROC_ARGUMENT_TOKENS;
150
+ bool raw_allowed = mode != PREPROC_ARGUMENT_TEXT;
118
151
  bool has_content = consumed_backslash;
119
152
  while (!has_content && pragma_space(lexer->lookahead) && lexer->lookahead != '\n' && lexer->lookahead != '\r') {
120
153
  lexer->advance(lexer, true);
@@ -122,6 +155,8 @@ static bool scan_preproc_arg(TSLexer *lexer, bool consumed_backslash, bool direc
122
155
  bool after_comment = false;
123
156
  bool in_number = false;
124
157
  bool in_identifier = consumed_backslash && scan_preproc_ucn(lexer, &in_number);
158
+ GnuRawStringPrefix raw_prefix = {0};
159
+ if (consumed_backslash) gnu_raw_string_prefix_invalidate(&raw_prefix);
125
160
  if (consumed_backslash) lexer->mark_end(lexer);
126
161
  int32_t number_last = 0;
127
162
  while (!lexer->eof(lexer) && lexer->lookahead != '\n' && lexer->lookahead != '\r') {
@@ -138,6 +173,11 @@ static bool scan_preproc_arg(TSLexer *lexer, bool consumed_backslash, bool direc
138
173
  if (digit && !in_identifier) in_number = true;
139
174
  if (word && !in_number) in_identifier = true;
140
175
  if (in_number && c != '\\') number_last = c;
176
+ if (c != '"' && c != '\\') {
177
+ if (in_number) gnu_raw_string_prefix_invalidate(&raw_prefix);
178
+ else if (word || digit || exponent_sign) gnu_raw_string_prefix_character(&raw_prefix, c);
179
+ else raw_prefix = (GnuRawStringPrefix){0};
180
+ }
141
181
  if (lexer->lookahead == '/') {
142
182
  lexer->advance(lexer, false);
143
183
  bool split_opener = lexer->lookahead == '\\';
@@ -187,6 +227,7 @@ static bool scan_preproc_arg(TSLexer *lexer, bool consumed_backslash, bool direc
187
227
  if (!after_comment && has_content) lexer->mark_end(lexer);
188
228
  continue;
189
229
  }
230
+ gnu_raw_string_prefix_invalidate(&raw_prefix);
190
231
  if (scan_preproc_ucn(lexer, &in_number)) {
191
232
  if (!in_number) in_identifier = true;
192
233
  number_last = 0;
@@ -196,8 +237,9 @@ static bool scan_preproc_arg(TSLexer *lexer, bool consumed_backslash, bool direc
196
237
  }
197
238
  has_content = true;
198
239
  after_comment = false;
199
- } else if (lexer->lookahead == '"' || (!directive_text && lexer->lookahead == '\'')) {
240
+ } else if (lexer->lookahead == '"' || (raw_allowed && lexer->lookahead == '\'')) {
200
241
  int32_t quote = lexer->lookahead;
242
+ bool raw = raw_allowed && quote == '"' && gnu_raw_string_prefix(&raw_prefix);
201
243
  lexer->advance(lexer, false);
202
244
  bool escaped = false;
203
245
  if (quote == '\'' && in_number) {
@@ -216,7 +258,9 @@ static bool scan_preproc_arg(TSLexer *lexer, bool consumed_backslash, bool direc
216
258
  }
217
259
  in_number = false;
218
260
  in_identifier = false;
219
- if (!scan_preproc_quote(lexer, quote, escaped, directive_text)) return true;
261
+ bool quoted = raw ? scan_preproc_raw_quote(lexer) : scan_preproc_quote(lexer, quote, escaped, directive_text);
262
+ if (!quoted) return true;
263
+ raw_prefix = (GnuRawStringPrefix){0};
220
264
  has_content = true;
221
265
  after_comment = false;
222
266
  } else {
@@ -231,6 +275,13 @@ static bool scan_preproc_arg(TSLexer *lexer, bool consumed_backslash, bool direc
231
275
  return has_content;
232
276
  }
233
277
 
278
+ static bool scan_preproc_raw_quote(TSLexer *lexer) {
279
+ if (scan_gnu_raw_string_end(lexer)) return true;
280
+ while (!lexer->eof(lexer) && lexer->lookahead != '\n' && lexer->lookahead != '\r') lexer->advance(lexer, false);
281
+ lexer->mark_end(lexer);
282
+ return false;
283
+ }
284
+
234
285
  static bool scan_preproc_quote(TSLexer *lexer, int32_t quote, bool escaped, bool directive_text) {
235
286
  lexer->mark_end(lexer);
236
287
  bool literal = true;
@@ -369,7 +420,7 @@ static bool scan_function_macro_name(TSLexer *lexer, bool allow_pragma, TSSymbol
369
420
  static bool scan_macro_name(TSLexer *lexer, MacroName *name) {
370
421
  bool has_name = false;
371
422
  for (;;) {
372
- if (!has_name) scan_macro_name_start(lexer, name->lookahead_only);
423
+ if (!has_name) scan_macro_name_start(lexer, name->lookahead_only && !name->preserve_end);
373
424
  MacroNameCharacter character = scan_macro_name_character(lexer, has_name, name);
374
425
  if (character == MACRO_NAME_INVALID) return false;
375
426
  if (character == MACRO_NAME_END) return has_name;
package/src/scanner.c CHANGED
@@ -1,6 +1,7 @@
1
1
  #include "conditionalMacro.h"
2
+ #include "gnuRawString.h"
2
3
 
3
- enum TokenType { PRAGMA_OPERATOR, PREPROC_ARG, PREPROC_NEWLINE, PREPROC_LPAREN, PREPROC_DIRECTIVE_ARG, PREPROC_FUNCTION_NAME, FUNCTION_ATTRIBUTE_START, POST_TYPE_FUNCTION_ATTRIBUTE_START, POST_TYPE_FUNCTION_ATTRIBUTE_SUFFIX, TRAILING_MACRO_ATTRIBUTE_NAME, TRAILING_OBJECT_DECLARATION_START, CONDITIONAL_MARKER_IFDEF, CONDITIONAL_MARKER_IFNDEF, LEADING_CONDITIONAL_MARKER_IFDEF, LEADING_CONDITIONAL_MARKER_IFNDEF };
4
+ enum TokenType { PRAGMA_OPERATOR, PREPROC_ARG, PREPROC_NEWLINE, PREPROC_LPAREN, PREPROC_DIRECTIVE_ARG, PREPROC_FUNCTION_NAME, FUNCTION_ATTRIBUTE_START, POST_TYPE_FUNCTION_ATTRIBUTE_START, POST_TYPE_FUNCTION_ATTRIBUTE_SUFFIX, TRAILING_MACRO_ATTRIBUTE_NAME, TRAILING_OBJECT_DECLARATION_START, CONDITIONAL_MARKER_IFDEF, CONDITIONAL_MARKER_IFNDEF, LEADING_CONDITIONAL_MARKER_IFDEF, LEADING_CONDITIONAL_MARKER_IFNDEF, GNU_RAW_STRING_BODY, RAW_MACRO_TYPE_TAIL, BRACED_FUNCTION_ATTRIBUTE_START, BRACED_MACRO_TYPE_START };
4
5
 
5
6
  static bool scan_preproc_tokens(TSLexer *lexer, const bool *valid_symbols);
6
7
 
@@ -26,6 +27,14 @@ void tree_sitter_c_external_scanner_deserialize(void *payload, const char *buffe
26
27
 
27
28
  bool tree_sitter_c_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols) {
28
29
  (void)payload;
30
+ if (valid_symbols[GNU_RAW_STRING_BODY] && !valid_symbols[PREPROC_LPAREN]) {
31
+ lexer->result_symbol = GNU_RAW_STRING_BODY;
32
+ return scan_gnu_raw_string_token(lexer);
33
+ }
34
+ if (valid_symbols[RAW_MACRO_TYPE_TAIL] && !valid_symbols[PREPROC_LPAREN]) {
35
+ lexer->result_symbol = RAW_MACRO_TYPE_TAIL;
36
+ return scan_raw_macro_type_tail(lexer);
37
+ }
29
38
  if (valid_symbols[PREPROC_FUNCTION_NAME] && !valid_symbols[PREPROC_LPAREN]) {
30
39
  lexer->result_symbol = PREPROC_FUNCTION_NAME;
31
40
  return scan_function_macro_name(lexer, valid_symbols[PRAGMA_OPERATOR], PRAGMA_OPERATOR);
@@ -45,15 +54,21 @@ bool tree_sitter_c_external_scanner_scan(void *payload, TSLexer *lexer, const bo
45
54
  if (lexer->lookahead == '#') return scan_conditional_macro(lexer, &symbols, valid_symbols);
46
55
  }
47
56
  static const TSSymbol attribute_tokens[] = {
48
- FUNCTION_ATTRIBUTE_START, POST_TYPE_FUNCTION_ATTRIBUTE_START, POST_TYPE_FUNCTION_ATTRIBUTE_SUFFIX,
49
- TRAILING_MACRO_ATTRIBUTE_NAME, TRAILING_OBJECT_DECLARATION_START,
57
+ FUNCTION_ATTRIBUTE_START, POST_TYPE_FUNCTION_ATTRIBUTE_SUFFIX, POST_TYPE_FUNCTION_ATTRIBUTE_START,
58
+ TRAILING_MACRO_ATTRIBUTE_NAME, TRAILING_OBJECT_DECLARATION_START, BRACED_FUNCTION_ATTRIBUTE_START,
50
59
  };
51
60
  const MacroAttributeSymbols symbols = {
52
61
  .pragma = PRAGMA_OPERATOR,
53
62
  .object_start = TRAILING_OBJECT_DECLARATION_START,
54
63
  .allow_pragma = valid_symbols[PRAGMA_OPERATOR],
55
64
  .allow_object_start = valid_symbols[TRAILING_OBJECT_DECLARATION_START],
65
+ .braced_start = BRACED_FUNCTION_ATTRIBUTE_START,
66
+ .allow_braced_start = valid_symbols[BRACED_FUNCTION_ATTRIBUTE_START],
56
67
  };
68
+ if (valid_symbols[BRACED_MACRO_TYPE_START]) {
69
+ lexer->result_symbol = BRACED_MACRO_TYPE_START;
70
+ return scan_braced_macro_type_start(lexer, &symbols, NULL, 0);
71
+ }
57
72
  for (unsigned i = 0; i < sizeof(attribute_tokens) / sizeof(attribute_tokens[0]); i++) {
58
73
  TSSymbol token = attribute_tokens[i];
59
74
  if (!valid_symbols[token]) continue;
@@ -67,6 +82,8 @@ bool tree_sitter_c_external_scanner_scan(void *payload, TSLexer *lexer, const bo
67
82
 
68
83
  static bool scan_preproc_tokens(TSLexer *lexer, const bool *valid_symbols) {
69
84
  bool directive_text = !valid_symbols[PREPROC_ARG] && valid_symbols[PREPROC_DIRECTIVE_ARG];
85
+ PreprocArgumentMode argument_mode = preproc_argument_mode(
86
+ valid_symbols[PREPROC_ARG], valid_symbols[PREPROC_DIRECTIVE_ARG], valid_symbols[PREPROC_LPAREN]);
70
87
  TSSymbol argument_symbol = directive_text ? PREPROC_DIRECTIVE_ARG : PREPROC_ARG;
71
88
  bool argument_valid = valid_symbols[PREPROC_ARG] || directive_text;
72
89
  while (valid_symbols[PREPROC_LPAREN] && lexer->lookahead == '\\') {
@@ -89,7 +106,7 @@ static bool scan_preproc_tokens(TSLexer *lexer, const bool *valid_symbols) {
89
106
  lexer->mark_end(lexer);
90
107
  if (!scan_preproc_newline(lexer, true)) {
91
108
  lexer->result_symbol = argument_symbol;
92
- return argument_valid && scan_preproc_arg(lexer, true, directive_text);
109
+ return argument_valid && scan_preproc_arg(lexer, true, argument_mode);
93
110
  }
94
111
  }
95
112
  if (lexer->eof(lexer) || scan_preproc_newline(lexer, false)) {
@@ -100,7 +117,7 @@ static bool scan_preproc_tokens(TSLexer *lexer, const bool *valid_symbols) {
100
117
  }
101
118
  if (argument_valid) {
102
119
  lexer->result_symbol = argument_symbol;
103
- return scan_preproc_arg(lexer, false, directive_text);
120
+ return scan_preproc_arg(lexer, false, argument_mode);
104
121
  }
105
122
  lexer->result_symbol = PRAGMA_OPERATOR;
106
123
  return valid_symbols[PRAGMA_OPERATOR] && scan_pragma(lexer);
Binary file
package/tree-sitter.json CHANGED
@@ -18,12 +18,13 @@
18
18
  "src/identifier.h",
19
19
  "src/keywords.h",
20
20
  "src/functionMacro.h",
21
- "src/conditionalMacro.h"
21
+ "src/conditionalMacro.h",
22
+ "src/gnuRawString.h"
22
23
  ]
23
24
  }
24
25
  ],
25
26
  "metadata": {
26
- "version": "18.3.0",
27
+ "version": "20.0.0",
27
28
  "license": "MIT",
28
29
  "description": "C grammar for tree-sitter",
29
30
  "authors": [