Skip to content

Commit 52ed09e

Browse files
committed
And allow them as macro identifiers
1 parent d6550d9 commit 52ed09e

File tree

3 files changed

+63680
-62395
lines changed

3 files changed

+63680
-62395
lines changed

grammar.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ module.exports = grammar({
129129

130130
return seq(
131131
'macro_rules!',
132-
field('name', $.identifier),
132+
field('name', choice(
133+
$.identifier,
134+
$._reserved_identifier,
135+
)),
133136
choice(
134137
seq('(', rules, ')', ';'),
135138
seq('{', rules, '}')
@@ -877,7 +880,8 @@ module.exports = grammar({
877880
macro_invocation: $ => seq(
878881
field('macro', choice(
879882
$.scoped_identifier,
880-
$.identifier
883+
$.identifier,
884+
$._reserved_identifier,
881885
)),
882886
'!',
883887
$.token_tree

src/grammar.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,17 @@
152152
"type": "FIELD",
153153
"name": "name",
154154
"content": {
155-
"type": "SYMBOL",
156-
"name": "identifier"
155+
"type": "CHOICE",
156+
"members": [
157+
{
158+
"type": "SYMBOL",
159+
"name": "identifier"
160+
},
161+
{
162+
"type": "SYMBOL",
163+
"name": "_reserved_identifier"
164+
}
165+
]
157166
}
158167
},
159168
{
@@ -4852,6 +4861,10 @@
48524861
{
48534862
"type": "SYMBOL",
48544863
"name": "identifier"
4864+
},
4865+
{
4866+
"type": "SYMBOL",
4867+
"name": "_reserved_identifier"
48554868
}
48564869
]
48574870
}

0 commit comments

Comments
 (0)