@willbooster/tree-sitter-c 7.0.2 → 8.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/grammar.js CHANGED
@@ -114,6 +114,16 @@ module.exports = Object.assign(
114
114
  [$.type_specifier, $._top_level_expression_statement],
115
115
  [$.type_qualifier, $.extension_expression],
116
116
  [$.storage_class_specifier, $.type_specifier],
117
+ [$.storage_class_specifier, $.type_specifier, $.expression],
118
+ [$.storage_class_specifier, $.expression],
119
+ [$.attributed_declarator],
120
+ [$.attributed_declarator, $._declarator],
121
+ [$.attributed_declarator, $._declarator, $.type_specifier],
122
+ [$.attributed_field_declarator],
123
+ [$.attributed_field_declarator, $._field_declarator],
124
+ [$.attributed_type_declarator],
125
+ [$.attributed_type_declarator, $._type_declarator],
126
+ [$._declaration_specifiers],
117
127
  [$._compound_literal_storage_class_specifier, $.type_specifier],
118
128
  [$._compound_literal_constexpr_specifier, $.type_qualifier],
119
129
  ],
@@ -131,6 +141,9 @@ module.exports = Object.assign(
131
141
 
132
142
  inline: ($) => [
133
143
  $._non_identifier_type_specifier,
144
+ $._unattributed_declarator,
145
+ $._unattributed_field_declarator,
146
+ $._unattributed_type_declarator,
134
147
  $._type_identifier,
135
148
  $._field_identifier,
136
149
  $._statement_identifier,
@@ -434,9 +447,7 @@ module.exports = Object.assign(
434
447
  ),
435
448
 
436
449
  _declaration_specifiers: ($) =>
437
- prec.right(
438
- seq(repeat($._declaration_modifiers), field('type', $.type_specifier), repeat($._declaration_modifiers))
439
- ),
450
+ seq(repeat($._declaration_modifiers), field('type', $.type_specifier), repeat($._declaration_modifiers)),
440
451
 
441
452
  linkage_specification: ($) =>
442
453
  seq(
@@ -450,7 +461,7 @@ module.exports = Object.assign(
450
461
  attribute: ($) =>
451
462
  seq(optional(seq(field('prefix', $.identifier), '::')), field('name', $.identifier), optional($.argument_list)),
452
463
 
453
- attribute_declaration: ($) => seq('[[', commaSep1($.attribute), ']]'),
464
+ attribute_declaration: ($) => seq('[', '[', commaSep1($.attribute), ']', ']'),
454
465
 
455
466
  ms_declspec_modifier: ($) => seq('__declspec', '(', repeat(seq($.identifier, optional($.argument_list))), ')'),
456
467
 
@@ -479,9 +490,10 @@ module.exports = Object.assign(
479
490
 
480
491
  declaration_list: ($) => seq('{', repeat($._block_item), '}'),
481
492
 
482
- _declarator: ($) =>
493
+ _declarator: ($) => choice($.attributed_declarator, $._unattributed_declarator),
494
+
495
+ _unattributed_declarator: ($) =>
483
496
  choice(
484
- $.attributed_declarator,
485
497
  $.pointer_declarator,
486
498
  $.function_declarator,
487
499
  $.array_declarator,
@@ -502,8 +514,10 @@ module.exports = Object.assign(
502
514
  ),
503
515
 
504
516
  _field_declarator: ($) =>
517
+ choice(alias($.attributed_field_declarator, $.attributed_declarator), $._unattributed_field_declarator),
518
+
519
+ _unattributed_field_declarator: ($) =>
505
520
  choice(
506
- alias($.attributed_field_declarator, $.attributed_declarator),
507
521
  alias($.pointer_field_declarator, $.pointer_declarator),
508
522
  alias($.function_field_declarator, $.function_declarator),
509
523
  alias($.array_field_declarator, $.array_declarator),
@@ -512,8 +526,10 @@ module.exports = Object.assign(
512
526
  ),
513
527
 
514
528
  _type_declarator: ($) =>
529
+ choice(alias($.attributed_type_declarator, $.attributed_declarator), $._unattributed_type_declarator),
530
+
531
+ _unattributed_type_declarator: ($) =>
515
532
  choice(
516
- alias($.attributed_type_declarator, $.attributed_declarator),
517
533
  alias($.pointer_type_declarator, $.pointer_declarator),
518
534
  alias($.function_type_declarator, $.function_declarator),
519
535
  alias($.array_type_declarator, $.array_declarator),
@@ -540,9 +556,9 @@ module.exports = Object.assign(
540
556
  abstract_parenthesized_declarator: ($) =>
541
557
  prec(1, seq('(', optional($.ms_call_modifier), $._abstract_declarator, ')')),
542
558
 
543
- attributed_declarator: ($) => prec.right(seq($._declarator, repeat1($.attribute_declaration))),
544
- attributed_field_declarator: ($) => prec.right(seq($._field_declarator, repeat1($.attribute_declaration))),
545
- attributed_type_declarator: ($) => prec.right(seq($._type_declarator, repeat1($.attribute_declaration))),
559
+ attributed_declarator: ($) => seq($._unattributed_declarator, repeat1($.attribute_declaration)),
560
+ attributed_field_declarator: ($) => seq($._unattributed_field_declarator, repeat1($.attribute_declaration)),
561
+ attributed_type_declarator: ($) => seq($._unattributed_type_declarator, repeat1($.attribute_declaration)),
546
562
 
547
563
  pointer_declarator: ($) =>
548
564
  prec.dynamic(
@@ -1537,8 +1553,8 @@ module.exports = Object.assign(
1537
1553
 
1538
1554
  system_lib_string: () => token(seq('<', repeat(choice(/[^>\n]/, String.raw`\>`)), '>')),
1539
1555
 
1540
- true: () => token(choice('TRUE', 'true')),
1541
- false: () => token(choice('FALSE', 'false')),
1556
+ true: () => 'true',
1557
+ false: () => 'false',
1542
1558
  null: () => choice('NULL', 'nullptr'),
1543
1559
 
1544
1560
  identifier: () =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-c",
3
- "version": "7.0.2",
3
+ "version": "8.0.0",
4
4
  "description": "C grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -781,19 +781,39 @@
781
781
  "required": true,
782
782
  "types": [
783
783
  {
784
- "type": "_declarator",
784
+ "type": "array_declarator",
785
785
  "named": true
786
786
  },
787
787
  {
788
- "type": "_field_declarator",
788
+ "type": "attribute_declaration",
789
789
  "named": true
790
790
  },
791
791
  {
792
- "type": "_type_declarator",
792
+ "type": "field_identifier",
793
793
  "named": true
794
794
  },
795
795
  {
796
- "type": "attribute_declaration",
796
+ "type": "function_declarator",
797
+ "named": true
798
+ },
799
+ {
800
+ "type": "identifier",
801
+ "named": true
802
+ },
803
+ {
804
+ "type": "parenthesized_declarator",
805
+ "named": true
806
+ },
807
+ {
808
+ "type": "pointer_declarator",
809
+ "named": true
810
+ },
811
+ {
812
+ "type": "primitive_type",
813
+ "named": true
814
+ },
815
+ {
816
+ "type": "type_identifier",
797
817
  "named": true
798
818
  }
799
819
  ]
@@ -4639,18 +4659,10 @@
4639
4659
  "type": "[",
4640
4660
  "named": false
4641
4661
  },
4642
- {
4643
- "type": "[[",
4644
- "named": false
4645
- },
4646
4662
  {
4647
4663
  "type": "]",
4648
4664
  "named": false
4649
4665
  },
4650
- {
4651
- "type": "]]",
4652
- "named": false
4653
- },
4654
4666
  {
4655
4667
  "type": "^",
4656
4668
  "named": false
Binary file
package/tree-sitter.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  ],
18
18
  "metadata": {
19
- "version": "7.0.2",
19
+ "version": "8.0.0",
20
20
  "license": "MIT",
21
21
  "description": "C grammar for tree-sitter",
22
22
  "authors": [