Skip to content

Commit

Permalink
feat: use the new reserved rules api
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Nov 23, 2024
1 parent e8841a6 commit 2dcd1a0
Show file tree
Hide file tree
Showing 7 changed files with 56,948 additions and 57,152 deletions.
16 changes: 15 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ module.exports = grammar({
$._abstract_declarator,
],

reserved: {
global: $ => [
'alignas', 'alignof', 'auto', 'break', 'case', 'const',
'constexpr', 'continue', 'default', 'do', 'else', 'enum',
'extern', $.false, 'for', 'goto', 'if', 'inline', 'long',
'nullptr', $.primitive_type, 'register', 'restrict', 'return',
'short', 'signed', 'sizeof', 'static', 'struct', 'switch',
'thread_local', $.true, 'typedef', 'union', 'unsigned',
'volatile', 'while', '_Alignas', '_Alignof', '_Atomic',
'_Generic', '_Noreturn',
],
attributes: _ => [],
},

word: $ => $.identifier,

rules: {
Expand Down Expand Up @@ -310,7 +324,7 @@ module.exports = grammar({

attribute: $ => seq(
optional(seq(field('prefix', $.identifier), '::')),
field('name', $.identifier),
reserved('attributes', field('name', $.identifier)),
optional($.argument_list),
),

Expand Down
112 changes: 46 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2dcd1a0

Please sign in to comment.