Skip to content

Commit 55dfb91

Browse files
committed
Add enum soft keyword as simple identifier
1 parent 57fb456 commit 55dfb91

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

grammar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,8 @@ module.exports = grammar({
11071107
"value",
11081108
"actual",
11091109
"set",
1110-
"get"
1110+
"get",
1111+
"enum"
11111112
// TODO: More soft keywords
11121113
),
11131114

test/corpus/expressions.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,33 @@ when (this) {
148148
(jump_expression
149149
(null_literal))))))
150150

151+
================================================================================
152+
Expressions with Soft Keywords
153+
================================================================================
154+
155+
when {
156+
hasEnum() -> enum.loc.filename
157+
}
158+
159+
--------------------------------------------------------------------------------
160+
161+
(source_file
162+
(when_expression
163+
(when_entry
164+
(when_condition
165+
(call_expression
166+
(simple_identifier)
167+
(call_suffix
168+
(value_arguments))))
169+
(control_structure_body
170+
(navigation_expression
171+
(navigation_expression
172+
(simple_identifier)
173+
(navigation_suffix
174+
(simple_identifier)))
175+
(navigation_suffix
176+
(simple_identifier)))))))
177+
151178
================================================================================
152179
Value declaration with receiver type
153180
================================================================================
@@ -375,6 +402,7 @@ fun main() { val temp = b.y; b.y = b.z; b.z = temp }
375402
when (dir) {
376403
1 -> { val temp = b.y; b.y = b.z; b.z = temp }
377404
}
405+
378406
--------------------------------------------------------------------------------
379407

380408
(source_file

0 commit comments

Comments
 (0)