Skip to content

Commit 123fab5

Browse files
committed
Inferred parameters needs to support reserved identifiers
1 parent aa8adb4 commit 123fab5

File tree

4 files changed

+29506
-29375
lines changed

4 files changed

+29506
-29375
lines changed

grammar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ module.exports = grammar({
6868
[$.expression, $.statement],
6969
// Only conflicts in switch expressions
7070
[$.lambda_expression, $.primary_expression],
71+
[$.inferred_parameters, $.primary_expression],
7172
],
7273

7374
word: $ => $.identifier,
@@ -241,7 +242,7 @@ module.exports = grammar({
241242

242243
inferred_parameters: $ => seq(
243244
'(',
244-
commaSep1($.identifier),
245+
commaSep1(choice($.identifier, $._reserved_identifier)),
245246
')'
246247
),
247248

src/grammar.json

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,8 +2104,17 @@
21042104
"type": "SEQ",
21052105
"members": [
21062106
{
2107-
"type": "SYMBOL",
2108-
"name": "identifier"
2107+
"type": "CHOICE",
2108+
"members": [
2109+
{
2110+
"type": "SYMBOL",
2111+
"name": "identifier"
2112+
},
2113+
{
2114+
"type": "SYMBOL",
2115+
"name": "_reserved_identifier"
2116+
}
2117+
]
21092118
},
21102119
{
21112120
"type": "REPEAT",
@@ -2117,8 +2126,17 @@
21172126
"value": ","
21182127
},
21192128
{
2120-
"type": "SYMBOL",
2121-
"name": "identifier"
2129+
"type": "CHOICE",
2130+
"members": [
2131+
{
2132+
"type": "SYMBOL",
2133+
"name": "identifier"
2134+
},
2135+
{
2136+
"type": "SYMBOL",
2137+
"name": "_reserved_identifier"
2138+
}
2139+
]
21222140
}
21232141
]
21242142
}
@@ -7077,6 +7095,10 @@
70777095
[
70787096
"lambda_expression",
70797097
"primary_expression"
7098+
],
7099+
[
7100+
"inferred_parameters",
7101+
"primary_expression"
70807102
]
70817103
],
70827104
"precedences": [],

0 commit comments

Comments
 (0)