Skip to content

Commit 18753a1

Browse files
committed
a bunch of fixes to the grammar
1 parent 5f0171a commit 18753a1

File tree

9 files changed

+14
-18
lines changed

9 files changed

+14
-18
lines changed

grammar/src/class.grm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal class Example<X, T : Comparable<X>>(protected val x : Foo<X, T>, y : So
1515
*/
1616

1717
class
18-
: modifiers ("class" | "trait") SimpleName
18+
: modifiers ("class" | "interface") SimpleName
1919
typeParameters?
2020
primaryConstructor?
2121
(":" annotations delegationSpecifier{","})?
@@ -63,7 +63,6 @@ typeConstraints
6363

6464
typeConstraint
6565
: annotations SimpleName ":" type
66-
: annotations "class" "object" SimpleName ":" type
6766
;
6867
/**
6968
See [Generic constraints](generics.html#generic-constraints)

grammar/src/class_members.grm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ memberDeclaration
3939

4040
anonymousInitializer
4141
: "init" block
42-
: block
4342
;
4443

4544
companionObject
46-
: modifiers "class" object
45+
: modifiers "companion" "object"
4746
;
4847

4948
valueParameters

grammar/src/control.grm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ loop
2727
;
2828

2929
for
30-
: "for" "(" annotations ("val" | "var")? (multipleVariableDeclarations | variableDeclarationEntry) "in" expression ")" expression
30+
: "for" "(" annotations (multipleVariableDeclarations | variableDeclarationEntry) "in" expression ")" expression
3131
;
3232

3333
while

grammar/src/enum.grm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ See [Enum classes](enum-classes.html)
55
*/
66

77
enumClassBody
8-
: "{" enumEntries members "}"
8+
: "{" enumEntries (";" members)? "}"
99
;
1010

1111
enumEntries

grammar/src/expressions.grm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ declaration
167167
: function
168168
: property
169169
: class
170-
: typeAlias
170+
// : typeAlias
171171
: object
172172
;
173173

@@ -289,3 +289,4 @@ objectLiteralMember
289289
factoryMethod
290290
: accessModifier? SimpleName typeParameters? functionParameters functionBody
291291
;
292+
*/

grammar/src/modifiers.grm

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ modifierKeyword
1515
: accessModifier
1616
: varianceAnnotation
1717
: memberModifier
18-
: parameterKind
1918
: annotations
2019
;
2120

@@ -24,7 +23,7 @@ classModifier
2423
: "final"
2524
: "enum"
2625
: "open"
27-
: "attribute"
26+
: "annotation"
2827
;
2928

3029
memberModifier
@@ -45,9 +44,3 @@ varianceAnnotation
4544
: "in"
4645
: "out"
4746
;
48-
49-
parameterKind
50-
: "lazy"
51-
: "out"
52-
: "ref"
53-
;

grammar/src/toplevel.grm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ toplevelObject
4545
: object
4646
: function
4747
: property
48-
: typeAlias
48+
// : typeAlias
4949
;
5050

5151
package
@@ -59,6 +59,8 @@ package
5959
See [Packages](packages.html)
6060
*/
6161

62+
/*
6263
typeAlias
6364
: modifiers "typealias" SimpleName (typeParameters typeConstraints)? "=" type
6465
;
66+
*/

grammar/src/types.grm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type
1919
// IF YOU CHANGE THIS, please, update TYPE_FIRST in JetParsing
2020
typeDescriptor
2121
: "(" typeDescriptor ")"
22-
: selfType
22+
// : selfType
2323
: functionType
2424
: userType
2525
: nullableType
@@ -29,9 +29,11 @@ typeDescriptor
2929
nullableType
3030
: typeDescriptor "?"
3131

32+
/*
3233
selfType
3334
: "This"
3435
;
36+
*/
3537

3638
userType
3739
: ("package" ".")? simpleUserType{"."}

grammar/src/when.grm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ See [When-expression](control-flow.html#when-expression)
55
*/
66

77
when
8-
: "when" ("(" (modifiers "val" SimpleName "=")? expression ")")? "{"
8+
: "when" ("(" expression ")")? "{"
99
whenEntry*
1010
"}"
1111
;

0 commit comments

Comments
 (0)