Skip to content

Commit 2dcd1a0

Browse files
committed
feat: use the new reserved rules api
1 parent e8841a6 commit 2dcd1a0

File tree

7 files changed

+56948
-57152
lines changed

7 files changed

+56948
-57152
lines changed

grammar.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ module.exports = grammar({
7979
$._abstract_declarator,
8080
],
8181

82+
reserved: {
83+
global: $ => [
84+
'alignas', 'alignof', 'auto', 'break', 'case', 'const',
85+
'constexpr', 'continue', 'default', 'do', 'else', 'enum',
86+
'extern', $.false, 'for', 'goto', 'if', 'inline', 'long',
87+
'nullptr', $.primitive_type, 'register', 'restrict', 'return',
88+
'short', 'signed', 'sizeof', 'static', 'struct', 'switch',
89+
'thread_local', $.true, 'typedef', 'union', 'unsigned',
90+
'volatile', 'while', '_Alignas', '_Alignof', '_Atomic',
91+
'_Generic', '_Noreturn',
92+
],
93+
attributes: _ => [],
94+
},
95+
8296
word: $ => $.identifier,
8397

8498
rules: {
@@ -310,7 +324,7 @@ module.exports = grammar({
310324

311325
attribute: $ => seq(
312326
optional(seq(field('prefix', $.identifier), '::')),
313-
field('name', $.identifier),
327+
reserved('attributes', field('name', $.identifier)),
314328
optional($.argument_list),
315329
),
316330

package-lock.json

Lines changed: 46 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)