@willbooster/tree-sitter-c 1.4.0 → 1.4.2
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/grammar.js +37 -11
- package/package.json +1 -1
- package/src/node-types.json +72 -0
- package/tree-sitter-c.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -44,6 +44,10 @@ module.exports = Object.assign(
|
|
|
44
44
|
name: 'c',
|
|
45
45
|
|
|
46
46
|
conflicts: ($) => [
|
|
47
|
+
[$.type_definition, $._declaration_modifiers],
|
|
48
|
+
[$.type_definition, $.type_specifier],
|
|
49
|
+
[$.type_definition, $.type_qualifier, $.extension_expression],
|
|
50
|
+
[$.type_definition, $.type_qualifier],
|
|
47
51
|
[$._declaration_modifiers, $._empty_declaration],
|
|
48
52
|
[$.declaration, $.storage_class_specifier],
|
|
49
53
|
[$.sized_type_specifier, $.enum_specifier],
|
|
@@ -57,6 +61,11 @@ module.exports = Object.assign(
|
|
|
57
61
|
[$.sized_type_specifier],
|
|
58
62
|
[$._sized_bit_int_specifier],
|
|
59
63
|
[$.sized_type_specifier, $._sized_bit_int_specifier],
|
|
64
|
+
[$._type_declarator, $.sized_type_specifier, $._sized_bit_int_specifier],
|
|
65
|
+
[$.type_qualifier, $.atomic_type_specifier],
|
|
66
|
+
[$.type_definition, $._type_declarator],
|
|
67
|
+
[$.type_definition, $.sized_type_specifier],
|
|
68
|
+
[$.type_definition, $._sized_bit_int_specifier],
|
|
60
69
|
[$.attributed_statement],
|
|
61
70
|
[$._declaration_modifiers, $.attributed_statement],
|
|
62
71
|
[$.enum_specifier],
|
|
@@ -77,6 +86,7 @@ module.exports = Object.assign(
|
|
|
77
86
|
extras: ($) => [$.pragma_operator, /\s|\\\r?\n/, $.comment],
|
|
78
87
|
|
|
79
88
|
inline: ($) => [
|
|
89
|
+
$._non_identifier_type_specifier,
|
|
80
90
|
$._type_identifier,
|
|
81
91
|
$._field_identifier,
|
|
82
92
|
$._statement_identifier,
|
|
@@ -323,9 +333,17 @@ module.exports = Object.assign(
|
|
|
323
333
|
|
|
324
334
|
type_definition: ($) =>
|
|
325
335
|
seq(
|
|
326
|
-
optional('__extension__'),
|
|
327
|
-
|
|
328
|
-
|
|
336
|
+
optional(prec.dynamic(1, '__extension__')),
|
|
337
|
+
choice(
|
|
338
|
+
seq(repeat($.type_qualifier), 'typedef', $._type_definition_type),
|
|
339
|
+
seq(
|
|
340
|
+
repeat($._declaration_modifiers),
|
|
341
|
+
field('type', $._non_identifier_type_specifier),
|
|
342
|
+
repeat($.type_qualifier),
|
|
343
|
+
'typedef',
|
|
344
|
+
repeat(choice($.type_qualifier, $._non_identifier_type_specifier))
|
|
345
|
+
)
|
|
346
|
+
),
|
|
329
347
|
$._type_definition_declarators,
|
|
330
348
|
repeat($.attribute_specifier),
|
|
331
349
|
';'
|
|
@@ -461,7 +479,7 @@ module.exports = Object.assign(
|
|
|
461
479
|
'*',
|
|
462
480
|
repeat($.attribute_declaration),
|
|
463
481
|
repeat($.ms_pointer_modifier),
|
|
464
|
-
repeat($.type_qualifier),
|
|
482
|
+
repeat(choice($.type_qualifier, $.attribute_specifier)),
|
|
465
483
|
field('declarator', $._declarator)
|
|
466
484
|
)
|
|
467
485
|
)
|
|
@@ -475,7 +493,7 @@ module.exports = Object.assign(
|
|
|
475
493
|
'*',
|
|
476
494
|
repeat($.attribute_declaration),
|
|
477
495
|
repeat($.ms_pointer_modifier),
|
|
478
|
-
repeat($.type_qualifier),
|
|
496
|
+
repeat(choice($.type_qualifier, $.attribute_specifier)),
|
|
479
497
|
field('declarator', $._field_declarator)
|
|
480
498
|
)
|
|
481
499
|
)
|
|
@@ -489,7 +507,7 @@ module.exports = Object.assign(
|
|
|
489
507
|
'*',
|
|
490
508
|
repeat($.attribute_declaration),
|
|
491
509
|
repeat($.ms_pointer_modifier),
|
|
492
|
-
repeat($.type_qualifier),
|
|
510
|
+
repeat(choice($.type_qualifier, $.attribute_specifier)),
|
|
493
511
|
field('declarator', $._type_declarator)
|
|
494
512
|
)
|
|
495
513
|
)
|
|
@@ -502,7 +520,7 @@ module.exports = Object.assign(
|
|
|
502
520
|
'*',
|
|
503
521
|
repeat($.attribute_declaration),
|
|
504
522
|
repeat($.ms_pointer_modifier),
|
|
505
|
-
repeat($.type_qualifier),
|
|
523
|
+
repeat(choice($.type_qualifier, $.attribute_specifier)),
|
|
506
524
|
field('declarator', optional($._abstract_declarator))
|
|
507
525
|
)
|
|
508
526
|
)
|
|
@@ -626,18 +644,24 @@ module.exports = Object.assign(
|
|
|
626
644
|
alignas_qualifier: ($) => seq(choice('alignas', '_Alignas'), '(', choice($.expression, $.type_descriptor), ')'),
|
|
627
645
|
|
|
628
646
|
type_specifier: ($) =>
|
|
647
|
+
choice(
|
|
648
|
+
$._non_identifier_type_specifier,
|
|
649
|
+
$.macro_type_specifier,
|
|
650
|
+
$._type_identifier,
|
|
651
|
+
prec.dynamic(-1, alias('thread_local', sym('type_identifier')))
|
|
652
|
+
),
|
|
653
|
+
|
|
654
|
+
_non_identifier_type_specifier: ($) =>
|
|
629
655
|
choice(
|
|
630
656
|
$.struct_specifier,
|
|
631
657
|
$.union_specifier,
|
|
632
658
|
$.enum_specifier,
|
|
633
659
|
$.typeof_specifier,
|
|
634
660
|
$.bit_int_specifier,
|
|
635
|
-
$.
|
|
661
|
+
$.atomic_type_specifier,
|
|
636
662
|
$.sized_type_specifier,
|
|
637
663
|
alias($._sized_bit_int_specifier, $.sized_type_specifier),
|
|
638
|
-
$.primitive_type
|
|
639
|
-
$._type_identifier,
|
|
640
|
-
prec.dynamic(-1, alias('thread_local', sym('type_identifier')))
|
|
664
|
+
$.primitive_type
|
|
641
665
|
),
|
|
642
666
|
|
|
643
667
|
typeof_specifier: ($) =>
|
|
@@ -647,6 +671,8 @@ module.exports = Object.assign(
|
|
|
647
671
|
choice($.type_descriptor, $.expression, $.comma_expression),
|
|
648
672
|
')'
|
|
649
673
|
),
|
|
674
|
+
atomic_type_specifier: ($) => seq('_Atomic', '(', field('type', $.type_descriptor), ')'),
|
|
675
|
+
|
|
650
676
|
bit_int_specifier: ($) => seq('_BitInt', '(', $.expression, ')'),
|
|
651
677
|
|
|
652
678
|
sized_type_specifier: ($) =>
|
package/package.json
CHANGED
package/src/node-types.json
CHANGED
|
@@ -303,6 +303,10 @@
|
|
|
303
303
|
"type": "type_specifier",
|
|
304
304
|
"named": true,
|
|
305
305
|
"subtypes": [
|
|
306
|
+
{
|
|
307
|
+
"type": "atomic_type_specifier",
|
|
308
|
+
"named": true
|
|
309
|
+
},
|
|
306
310
|
{
|
|
307
311
|
"type": "bit_int_specifier",
|
|
308
312
|
"named": true
|
|
@@ -449,6 +453,10 @@
|
|
|
449
453
|
"type": "attribute_declaration",
|
|
450
454
|
"named": true
|
|
451
455
|
},
|
|
456
|
+
{
|
|
457
|
+
"type": "attribute_specifier",
|
|
458
|
+
"named": true
|
|
459
|
+
},
|
|
452
460
|
{
|
|
453
461
|
"type": "ms_pointer_modifier",
|
|
454
462
|
"named": true
|
|
@@ -666,6 +674,22 @@
|
|
|
666
674
|
}
|
|
667
675
|
}
|
|
668
676
|
},
|
|
677
|
+
{
|
|
678
|
+
"type": "atomic_type_specifier",
|
|
679
|
+
"named": true,
|
|
680
|
+
"fields": {
|
|
681
|
+
"type": {
|
|
682
|
+
"multiple": false,
|
|
683
|
+
"required": true,
|
|
684
|
+
"types": [
|
|
685
|
+
{
|
|
686
|
+
"type": "type_descriptor",
|
|
687
|
+
"named": true
|
|
688
|
+
}
|
|
689
|
+
]
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
},
|
|
669
693
|
{
|
|
670
694
|
"type": "attribute",
|
|
671
695
|
"named": true,
|
|
@@ -2775,6 +2799,10 @@
|
|
|
2775
2799
|
"type": "attribute_declaration",
|
|
2776
2800
|
"named": true
|
|
2777
2801
|
},
|
|
2802
|
+
{
|
|
2803
|
+
"type": "attribute_specifier",
|
|
2804
|
+
"named": true
|
|
2805
|
+
},
|
|
2778
2806
|
{
|
|
2779
2807
|
"type": "ms_based_modifier",
|
|
2780
2808
|
"named": true
|
|
@@ -4011,13 +4039,57 @@
|
|
|
4011
4039
|
"multiple": true,
|
|
4012
4040
|
"required": false,
|
|
4013
4041
|
"types": [
|
|
4042
|
+
{
|
|
4043
|
+
"type": "atomic_type_specifier",
|
|
4044
|
+
"named": true
|
|
4045
|
+
},
|
|
4046
|
+
{
|
|
4047
|
+
"type": "attribute_declaration",
|
|
4048
|
+
"named": true
|
|
4049
|
+
},
|
|
4014
4050
|
{
|
|
4015
4051
|
"type": "attribute_specifier",
|
|
4016
4052
|
"named": true
|
|
4017
4053
|
},
|
|
4054
|
+
{
|
|
4055
|
+
"type": "bit_int_specifier",
|
|
4056
|
+
"named": true
|
|
4057
|
+
},
|
|
4058
|
+
{
|
|
4059
|
+
"type": "enum_specifier",
|
|
4060
|
+
"named": true
|
|
4061
|
+
},
|
|
4062
|
+
{
|
|
4063
|
+
"type": "ms_declspec_modifier",
|
|
4064
|
+
"named": true
|
|
4065
|
+
},
|
|
4066
|
+
{
|
|
4067
|
+
"type": "primitive_type",
|
|
4068
|
+
"named": true
|
|
4069
|
+
},
|
|
4070
|
+
{
|
|
4071
|
+
"type": "sized_type_specifier",
|
|
4072
|
+
"named": true
|
|
4073
|
+
},
|
|
4074
|
+
{
|
|
4075
|
+
"type": "storage_class_specifier",
|
|
4076
|
+
"named": true
|
|
4077
|
+
},
|
|
4078
|
+
{
|
|
4079
|
+
"type": "struct_specifier",
|
|
4080
|
+
"named": true
|
|
4081
|
+
},
|
|
4018
4082
|
{
|
|
4019
4083
|
"type": "type_qualifier",
|
|
4020
4084
|
"named": true
|
|
4085
|
+
},
|
|
4086
|
+
{
|
|
4087
|
+
"type": "typeof_specifier",
|
|
4088
|
+
"named": true
|
|
4089
|
+
},
|
|
4090
|
+
{
|
|
4091
|
+
"type": "union_specifier",
|
|
4092
|
+
"named": true
|
|
4021
4093
|
}
|
|
4022
4094
|
]
|
|
4023
4095
|
}
|
package/tree-sitter-c.wasm
CHANGED
|
Binary file
|