a bunch of fixes to the grammar
This commit is contained in:
@@ -15,7 +15,7 @@ internal class Example<X, T : Comparable<X>>(protected val x : Foo<X, T>, y : So
|
||||
*/
|
||||
|
||||
class
|
||||
: modifiers ("class" | "trait") SimpleName
|
||||
: modifiers ("class" | "interface") SimpleName
|
||||
typeParameters?
|
||||
primaryConstructor?
|
||||
(":" annotations delegationSpecifier{","})?
|
||||
@@ -63,7 +63,6 @@ typeConstraints
|
||||
|
||||
typeConstraint
|
||||
: annotations SimpleName ":" type
|
||||
: annotations "class" "object" SimpleName ":" type
|
||||
;
|
||||
/**
|
||||
See [Generic constraints](generics.html#generic-constraints)
|
||||
|
||||
@@ -39,11 +39,10 @@ memberDeclaration
|
||||
|
||||
anonymousInitializer
|
||||
: "init" block
|
||||
: block
|
||||
;
|
||||
|
||||
companionObject
|
||||
: modifiers "class" object
|
||||
: modifiers "companion" "object"
|
||||
;
|
||||
|
||||
valueParameters
|
||||
|
||||
@@ -27,7 +27,7 @@ loop
|
||||
;
|
||||
|
||||
for
|
||||
: "for" "(" annotations ("val" | "var")? (multipleVariableDeclarations | variableDeclarationEntry) "in" expression ")" expression
|
||||
: "for" "(" annotations (multipleVariableDeclarations | variableDeclarationEntry) "in" expression ")" expression
|
||||
;
|
||||
|
||||
while
|
||||
|
||||
@@ -5,7 +5,7 @@ See [Enum classes](enum-classes.html)
|
||||
*/
|
||||
|
||||
enumClassBody
|
||||
: "{" enumEntries members "}"
|
||||
: "{" enumEntries (";" members)? "}"
|
||||
;
|
||||
|
||||
enumEntries
|
||||
|
||||
@@ -167,7 +167,7 @@ declaration
|
||||
: function
|
||||
: property
|
||||
: class
|
||||
: typeAlias
|
||||
// : typeAlias
|
||||
: object
|
||||
;
|
||||
|
||||
@@ -289,3 +289,4 @@ objectLiteralMember
|
||||
factoryMethod
|
||||
: accessModifier? SimpleName typeParameters? functionParameters functionBody
|
||||
;
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@ modifierKeyword
|
||||
: accessModifier
|
||||
: varianceAnnotation
|
||||
: memberModifier
|
||||
: parameterKind
|
||||
: annotations
|
||||
;
|
||||
|
||||
@@ -24,7 +23,7 @@ classModifier
|
||||
: "final"
|
||||
: "enum"
|
||||
: "open"
|
||||
: "attribute"
|
||||
: "annotation"
|
||||
;
|
||||
|
||||
memberModifier
|
||||
@@ -45,9 +44,3 @@ varianceAnnotation
|
||||
: "in"
|
||||
: "out"
|
||||
;
|
||||
|
||||
parameterKind
|
||||
: "lazy"
|
||||
: "out"
|
||||
: "ref"
|
||||
;
|
||||
@@ -45,7 +45,7 @@ toplevelObject
|
||||
: object
|
||||
: function
|
||||
: property
|
||||
: typeAlias
|
||||
// : typeAlias
|
||||
;
|
||||
|
||||
package
|
||||
@@ -59,6 +59,8 @@ package
|
||||
See [Packages](packages.html)
|
||||
*/
|
||||
|
||||
/*
|
||||
typeAlias
|
||||
: modifiers "typealias" SimpleName (typeParameters typeConstraints)? "=" type
|
||||
;
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,7 @@ type
|
||||
// IF YOU CHANGE THIS, please, update TYPE_FIRST in JetParsing
|
||||
typeDescriptor
|
||||
: "(" typeDescriptor ")"
|
||||
: selfType
|
||||
// : selfType
|
||||
: functionType
|
||||
: userType
|
||||
: nullableType
|
||||
@@ -29,9 +29,11 @@ typeDescriptor
|
||||
nullableType
|
||||
: typeDescriptor "?"
|
||||
|
||||
/*
|
||||
selfType
|
||||
: "This"
|
||||
;
|
||||
*/
|
||||
|
||||
userType
|
||||
: ("package" ".")? simpleUserType{"."}
|
||||
|
||||
@@ -5,7 +5,7 @@ See [When-expression](control-flow.html#when-expression)
|
||||
*/
|
||||
|
||||
when
|
||||
: "when" ("(" (modifiers "val" SimpleName "=")? expression ")")? "{"
|
||||
: "when" ("(" expression ")")? "{"
|
||||
whenEntry*
|
||||
"}"
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user