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