Skip to content

Commit 1f1191e

Browse files
committed
Add internal soft keyword as simple identifier
1 parent 97ec5f5 commit 1f1191e

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

grammar.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ module.exports = grammar({
7272
[$.platform_modifier, $.simple_identifier],
7373
// "data", "inner" as class modifier or id
7474
[$.class_modifier, $.simple_identifier],
75+
// "internal" as visibility modifier conflicts with internal as an identifier
76+
[$.visibility_modifier, $.simple_identifier],
7577

7678
// "<x>.<y> = z assignment conflicts with <x>.<y>() function call"
7779
[$._postfix_unary_expression, $._expression],
@@ -1110,6 +1112,7 @@ module.exports = grammar({
11101112
"get",
11111113
"enum",
11121114
"annotation",
1115+
"internal",
11131116
// TODO: More soft keywords
11141117
),
11151118

test/corpus/classes.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Classes
44

55
class Empty
66
class Empty2 {}
7+
internal class Empty3 {}
78

89
--------------------------------------------------------------------------------
910

@@ -12,6 +13,11 @@ class Empty2 {}
1213
(type_identifier))
1314
(class_declaration
1415
(type_identifier)
16+
(class_body))
17+
(class_declaration
18+
(modifiers
19+
(visibility_modifier))
20+
(type_identifier)
1521
(class_body)))
1622

1723
================================================================================
@@ -401,11 +407,23 @@ interface Foo {
401407
fun bar()
402408
}
403409

410+
internal interface Bar {
411+
fun foo()
412+
}
413+
404414
--------------------------------------------------------------------------------
405415

406416
(source_file
407417
(class_declaration
408418
(type_identifier)
419+
(class_body
420+
(function_declaration
421+
(simple_identifier)
422+
(function_value_parameters))))
423+
(class_declaration
424+
(modifiers
425+
(visibility_modifier))
426+
(type_identifier)
409427
(class_body
410428
(function_declaration
411429
(simple_identifier)

test/corpus/expressions.txt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ when {
158158

159159
annotations.filter { annotation -> true }
160160

161+
availability.associate { internal -> false }.toMap()
162+
161163
--------------------------------------------------------------------------------
162164

163165
(source_file
@@ -188,7 +190,26 @@ annotations.filter { annotation -> true }
188190
(variable_declaration
189191
(simple_identifier)))
190192
(statements
191-
(boolean_literal)))))))
193+
(boolean_literal))))))
194+
(call_expression
195+
(navigation_expression
196+
(call_expression
197+
(navigation_expression
198+
(simple_identifier)
199+
(navigation_suffix
200+
(simple_identifier)))
201+
(call_suffix
202+
(annotated_lambda
203+
(lambda_literal
204+
(lambda_parameters
205+
(variable_declaration
206+
(simple_identifier)))
207+
(statements
208+
(boolean_literal))))))
209+
(navigation_suffix
210+
(simple_identifier)))
211+
(call_suffix
212+
(value_arguments))))
192213

193214
================================================================================
194215
Value declaration with receiver type

0 commit comments

Comments
 (0)