[orx-kotlin-parser] Update kotlin antlr grammars
This commit is contained in:
@@ -2,12 +2,8 @@
|
|||||||
* Kotlin lexical grammar in ANTLR4 notation
|
* Kotlin lexical grammar in ANTLR4 notation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lexer grammar KotlinLexer;
|
lexer grammar KotlinLexer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import UnicodeClasses;
|
import UnicodeClasses;
|
||||||
|
|
||||||
// SECTION: lexicalGeneral
|
// SECTION: lexicalGeneral
|
||||||
@@ -160,6 +156,7 @@ SEALED: 'sealed';
|
|||||||
ANNOTATION: 'annotation';
|
ANNOTATION: 'annotation';
|
||||||
DATA: 'data';
|
DATA: 'data';
|
||||||
INNER: 'inner';
|
INNER: 'inner';
|
||||||
|
VALUE: 'value';
|
||||||
TAILREC: 'tailrec';
|
TAILREC: 'tailrec';
|
||||||
OPERATOR: 'operator';
|
OPERATOR: 'operator';
|
||||||
INLINE: 'inline';
|
INLINE: 'inline';
|
||||||
@@ -229,11 +226,11 @@ BinLiteral
|
|||||||
;
|
;
|
||||||
|
|
||||||
UnsignedLiteral
|
UnsignedLiteral
|
||||||
: (IntegerLiteral | HexLiteral | BinLiteral) [uU] 'L'?
|
: (IntegerLiteral | HexLiteral | BinLiteral) [uU] [lL]?
|
||||||
;
|
;
|
||||||
|
|
||||||
LongLiteral
|
LongLiteral
|
||||||
: (IntegerLiteral | HexLiteral | BinLiteral) 'L'
|
: (IntegerLiteral | HexLiteral | BinLiteral) [lL]
|
||||||
;
|
;
|
||||||
|
|
||||||
BooleanLiteral: 'true'| 'false';
|
BooleanLiteral: 'true'| 'false';
|
||||||
@@ -300,6 +297,7 @@ IdentifierOrSoftKey
|
|||||||
| FILE
|
| FILE
|
||||||
| EXPECT
|
| EXPECT
|
||||||
| ACTUAL
|
| ACTUAL
|
||||||
|
| VALUE
|
||||||
/* Strong keywords */
|
/* Strong keywords */
|
||||||
| CONST
|
| CONST
|
||||||
| SUSPEND
|
| SUSPEND
|
||||||
@@ -488,6 +486,7 @@ Inside_SEALED: SEALED -> type(SEALED);
|
|||||||
Inside_ANNOTATION: ANNOTATION -> type(ANNOTATION);
|
Inside_ANNOTATION: ANNOTATION -> type(ANNOTATION);
|
||||||
Inside_DATA: DATA -> type(DATA);
|
Inside_DATA: DATA -> type(DATA);
|
||||||
Inside_INNER: INNER -> type(INNER);
|
Inside_INNER: INNER -> type(INNER);
|
||||||
|
Inside_VALUE: VALUE -> type(VALUE);
|
||||||
Inside_TAILREC: TAILREC -> type(TAILREC);
|
Inside_TAILREC: TAILREC -> type(TAILREC);
|
||||||
Inside_OPERATOR: OPERATOR -> type(OPERATOR);
|
Inside_OPERATOR: OPERATOR -> type(OPERATOR);
|
||||||
Inside_INLINE: INLINE -> type(INLINE);
|
Inside_INLINE: INLINE -> type(INLINE);
|
||||||
|
|||||||
@@ -113,61 +113,62 @@ SEALED=112
|
|||||||
ANNOTATION=113
|
ANNOTATION=113
|
||||||
DATA=114
|
DATA=114
|
||||||
INNER=115
|
INNER=115
|
||||||
TAILREC=116
|
VALUE=116
|
||||||
OPERATOR=117
|
TAILREC=117
|
||||||
INLINE=118
|
OPERATOR=118
|
||||||
INFIX=119
|
INLINE=119
|
||||||
EXTERNAL=120
|
INFIX=120
|
||||||
SUSPEND=121
|
EXTERNAL=121
|
||||||
OVERRIDE=122
|
SUSPEND=122
|
||||||
ABSTRACT=123
|
OVERRIDE=123
|
||||||
FINAL=124
|
ABSTRACT=124
|
||||||
OPEN=125
|
FINAL=125
|
||||||
CONST=126
|
OPEN=126
|
||||||
LATEINIT=127
|
CONST=127
|
||||||
VARARG=128
|
LATEINIT=128
|
||||||
NOINLINE=129
|
VARARG=129
|
||||||
CROSSINLINE=130
|
NOINLINE=130
|
||||||
REIFIED=131
|
CROSSINLINE=131
|
||||||
EXPECT=132
|
REIFIED=132
|
||||||
ACTUAL=133
|
EXPECT=133
|
||||||
RealLiteral=134
|
ACTUAL=134
|
||||||
FloatLiteral=135
|
RealLiteral=135
|
||||||
DoubleLiteral=136
|
FloatLiteral=136
|
||||||
IntegerLiteral=137
|
DoubleLiteral=137
|
||||||
HexLiteral=138
|
IntegerLiteral=138
|
||||||
BinLiteral=139
|
HexLiteral=139
|
||||||
UnsignedLiteral=140
|
BinLiteral=140
|
||||||
LongLiteral=141
|
UnsignedLiteral=141
|
||||||
BooleanLiteral=142
|
LongLiteral=142
|
||||||
NullLiteral=143
|
BooleanLiteral=143
|
||||||
CharacterLiteral=144
|
NullLiteral=144
|
||||||
Identifier=145
|
CharacterLiteral=145
|
||||||
IdentifierOrSoftKey=146
|
Identifier=146
|
||||||
FieldIdentifier=147
|
IdentifierOrSoftKey=147
|
||||||
QUOTE_OPEN=148
|
FieldIdentifier=148
|
||||||
TRIPLE_QUOTE_OPEN=149
|
QUOTE_OPEN=149
|
||||||
UNICODE_CLASS_LL=150
|
TRIPLE_QUOTE_OPEN=150
|
||||||
UNICODE_CLASS_LM=151
|
UNICODE_CLASS_LL=151
|
||||||
UNICODE_CLASS_LO=152
|
UNICODE_CLASS_LM=152
|
||||||
UNICODE_CLASS_LT=153
|
UNICODE_CLASS_LO=153
|
||||||
UNICODE_CLASS_LU=154
|
UNICODE_CLASS_LT=154
|
||||||
UNICODE_CLASS_ND=155
|
UNICODE_CLASS_LU=155
|
||||||
UNICODE_CLASS_NL=156
|
UNICODE_CLASS_ND=156
|
||||||
QUOTE_CLOSE=157
|
UNICODE_CLASS_NL=157
|
||||||
LineStrRef=158
|
QUOTE_CLOSE=158
|
||||||
LineStrText=159
|
LineStrRef=159
|
||||||
LineStrEscapedChar=160
|
LineStrText=160
|
||||||
LineStrExprStart=161
|
LineStrEscapedChar=161
|
||||||
TRIPLE_QUOTE_CLOSE=162
|
LineStrExprStart=162
|
||||||
MultiLineStringQuote=163
|
TRIPLE_QUOTE_CLOSE=163
|
||||||
MultiLineStrRef=164
|
MultiLineStringQuote=164
|
||||||
MultiLineStrText=165
|
MultiLineStrRef=165
|
||||||
MultiLineStrExprStart=166
|
MultiLineStrText=166
|
||||||
Inside_Comment=167
|
MultiLineStrExprStart=167
|
||||||
Inside_WS=168
|
Inside_Comment=168
|
||||||
Inside_NL=169
|
Inside_WS=169
|
||||||
ErrorCharacter=170
|
Inside_NL=170
|
||||||
|
ErrorCharacter=171
|
||||||
'...'=6
|
'...'=6
|
||||||
'.'=7
|
'.'=7
|
||||||
','=8
|
','=8
|
||||||
@@ -266,23 +267,24 @@ ErrorCharacter=170
|
|||||||
'annotation'=113
|
'annotation'=113
|
||||||
'data'=114
|
'data'=114
|
||||||
'inner'=115
|
'inner'=115
|
||||||
'tailrec'=116
|
'value'=116
|
||||||
'operator'=117
|
'tailrec'=117
|
||||||
'inline'=118
|
'operator'=118
|
||||||
'infix'=119
|
'inline'=119
|
||||||
'external'=120
|
'infix'=120
|
||||||
'suspend'=121
|
'external'=121
|
||||||
'override'=122
|
'suspend'=122
|
||||||
'abstract'=123
|
'override'=123
|
||||||
'final'=124
|
'abstract'=124
|
||||||
'open'=125
|
'final'=125
|
||||||
'const'=126
|
'open'=126
|
||||||
'lateinit'=127
|
'const'=127
|
||||||
'vararg'=128
|
'lateinit'=128
|
||||||
'noinline'=129
|
'vararg'=129
|
||||||
'crossinline'=130
|
'noinline'=130
|
||||||
'reified'=131
|
'crossinline'=131
|
||||||
'expect'=132
|
'reified'=132
|
||||||
'actual'=133
|
'expect'=133
|
||||||
'null'=143
|
'actual'=134
|
||||||
'"""'=149
|
'null'=144
|
||||||
|
'"""'=150
|
||||||
|
|||||||
@@ -65,10 +65,10 @@ declaration
|
|||||||
|
|
||||||
classDeclaration
|
classDeclaration
|
||||||
: modifiers? (CLASS | (FUN NL*)? INTERFACE) NL* simpleIdentifier
|
: modifiers? (CLASS | (FUN NL*)? INTERFACE) NL* simpleIdentifier
|
||||||
(NL* typeParameters)? (NL* primaryConstructor)?
|
(NL* typeParameters)? (NL* primaryConstructor)?
|
||||||
(NL* COLON NL* delegationSpecifiers)?
|
(NL* COLON NL* delegationSpecifiers)?
|
||||||
(NL* typeConstraints)?
|
(NL* typeConstraints)?
|
||||||
(NL* classBody | NL* enumClassBody)?
|
(NL* classBody | NL* enumClassBody)?
|
||||||
;
|
;
|
||||||
|
|
||||||
primaryConstructor
|
primaryConstructor
|
||||||
@@ -145,9 +145,9 @@ anonymousInitializer
|
|||||||
|
|
||||||
companionObject
|
companionObject
|
||||||
: modifiers? COMPANION NL* OBJECT
|
: modifiers? COMPANION NL* OBJECT
|
||||||
(NL* simpleIdentifier)?
|
(NL* simpleIdentifier)?
|
||||||
(NL* COLON NL* delegationSpecifiers)?
|
(NL* COLON NL* delegationSpecifiers)?
|
||||||
(NL* classBody)?
|
(NL* classBody)?
|
||||||
;
|
;
|
||||||
|
|
||||||
functionValueParameters
|
functionValueParameters
|
||||||
@@ -160,11 +160,11 @@ functionValueParameter
|
|||||||
|
|
||||||
functionDeclaration
|
functionDeclaration
|
||||||
: modifiers?
|
: modifiers?
|
||||||
FUN (NL* typeParameters)? (NL* receiverType NL* DOT)? NL* simpleIdentifier
|
FUN (NL* typeParameters)? (NL* receiverType NL* DOT)? NL* simpleIdentifier
|
||||||
NL* functionValueParameters
|
NL* functionValueParameters
|
||||||
(NL* COLON NL* type)?
|
(NL* COLON NL* type)?
|
||||||
(NL* typeConstraints)?
|
(NL* typeConstraints)?
|
||||||
(NL* functionBody)?
|
(NL* functionBody)?
|
||||||
;
|
;
|
||||||
|
|
||||||
functionBody
|
functionBody
|
||||||
@@ -182,12 +182,12 @@ multiVariableDeclaration
|
|||||||
|
|
||||||
propertyDeclaration
|
propertyDeclaration
|
||||||
: modifiers? (VAL | VAR)
|
: modifiers? (VAL | VAR)
|
||||||
(NL* typeParameters)?
|
(NL* typeParameters)?
|
||||||
(NL* receiverType NL* DOT)?
|
(NL* receiverType NL* DOT)?
|
||||||
(NL* (multiVariableDeclaration | variableDeclaration))
|
(NL* (multiVariableDeclaration | variableDeclaration))
|
||||||
(NL* typeConstraints)?
|
(NL* typeConstraints)?
|
||||||
(NL* (ASSIGNMENT NL* expression | propertyDelegate))?
|
(NL* (ASSIGNMENT NL* expression | propertyDelegate))?
|
||||||
(NL+ SEMICOLON)? NL* (getter? (NL* semi? setter)? | setter? (NL* semi? getter)?)
|
(NL+ SEMICOLON)? NL* (getter? (NL* semi? setter)? | setter? (NL* semi? getter)?)
|
||||||
;
|
;
|
||||||
|
|
||||||
propertyDelegate
|
propertyDelegate
|
||||||
@@ -196,20 +196,24 @@ propertyDelegate
|
|||||||
|
|
||||||
getter
|
getter
|
||||||
: modifiers? GET
|
: modifiers? GET
|
||||||
| modifiers? GET NL* LPAREN NL* RPAREN (NL* COLON NL* type)? NL* functionBody
|
(NL* LPAREN NL* RPAREN (NL* COLON NL* type)? NL* functionBody)?
|
||||||
;
|
;
|
||||||
|
|
||||||
setter
|
setter
|
||||||
: modifiers? SET
|
: modifiers? SET
|
||||||
| modifiers? SET NL* LPAREN NL* parameterWithOptionalType (NL* COMMA)? NL* RPAREN (NL* COLON NL* type)? NL* functionBody
|
(NL* LPAREN NL* functionValueParameterWithOptionalType (NL* COMMA)? NL* RPAREN (NL* COLON NL* type)? NL* functionBody)?
|
||||||
;
|
;
|
||||||
|
|
||||||
parametersWithOptionalType
|
parametersWithOptionalType
|
||||||
: LPAREN NL* (parameterWithOptionalType (NL* COMMA NL* parameterWithOptionalType)* (NL* COMMA)?)? NL* RPAREN
|
: LPAREN NL* (functionValueParameterWithOptionalType (NL* COMMA NL* functionValueParameterWithOptionalType)* (NL* COMMA)?)? NL* RPAREN
|
||||||
|
;
|
||||||
|
|
||||||
|
functionValueParameterWithOptionalType
|
||||||
|
: parameterModifiers? parameterWithOptionalType (NL* ASSIGNMENT NL* expression)?
|
||||||
;
|
;
|
||||||
|
|
||||||
parameterWithOptionalType
|
parameterWithOptionalType
|
||||||
: parameterModifiers? simpleIdentifier NL* (COLON NL* type)?
|
: simpleIdentifier NL* (COLON NL* type)?
|
||||||
;
|
;
|
||||||
|
|
||||||
parameter
|
parameter
|
||||||
@@ -218,9 +222,9 @@ parameter
|
|||||||
|
|
||||||
objectDeclaration
|
objectDeclaration
|
||||||
: modifiers? OBJECT
|
: modifiers? OBJECT
|
||||||
NL* simpleIdentifier
|
NL* simpleIdentifier
|
||||||
(NL* COLON NL* delegationSpecifiers)?
|
(NL* COLON NL* delegationSpecifiers)?
|
||||||
(NL* classBody)?
|
(NL* classBody)?
|
||||||
;
|
;
|
||||||
|
|
||||||
secondaryConstructor
|
secondaryConstructor
|
||||||
@@ -228,8 +232,7 @@ secondaryConstructor
|
|||||||
;
|
;
|
||||||
|
|
||||||
constructorDelegationCall
|
constructorDelegationCall
|
||||||
: THIS NL* valueArguments
|
: (THIS | SUPER) NL* valueArguments
|
||||||
| SUPER NL* valueArguments
|
|
||||||
;
|
;
|
||||||
|
|
||||||
// SECTION: enumClasses
|
// SECTION: enumClasses
|
||||||
@@ -249,11 +252,7 @@ enumEntry
|
|||||||
// SECTION: types
|
// SECTION: types
|
||||||
|
|
||||||
type
|
type
|
||||||
: typeModifiers?
|
: typeModifiers? (parenthesizedType | nullableType | typeReference | functionType)
|
||||||
( parenthesizedType
|
|
||||||
| nullableType
|
|
||||||
| typeReference
|
|
||||||
| functionType)
|
|
||||||
;
|
;
|
||||||
|
|
||||||
typeReference
|
typeReference
|
||||||
@@ -279,7 +278,8 @@ simpleUserType
|
|||||||
;
|
;
|
||||||
|
|
||||||
typeProjection
|
typeProjection
|
||||||
: typeProjectionModifiers? type | MULT
|
: typeProjectionModifiers? type
|
||||||
|
| MULT
|
||||||
;
|
;
|
||||||
|
|
||||||
typeProjectionModifiers
|
typeProjectionModifiers
|
||||||
@@ -304,15 +304,11 @@ parenthesizedType
|
|||||||
;
|
;
|
||||||
|
|
||||||
receiverType
|
receiverType
|
||||||
: typeModifiers?
|
: typeModifiers? (parenthesizedType | nullableType | typeReference)
|
||||||
( parenthesizedType
|
|
||||||
| nullableType
|
|
||||||
| typeReference)
|
|
||||||
;
|
;
|
||||||
|
|
||||||
parenthesizedUserType
|
parenthesizedUserType
|
||||||
: LPAREN NL* userType NL* RPAREN
|
: LPAREN NL* (userType | parenthesizedUserType) NL* RPAREN
|
||||||
| LPAREN NL* parenthesizedUserType NL* RPAREN
|
|
||||||
;
|
;
|
||||||
|
|
||||||
// SECTION: statements
|
// SECTION: statements
|
||||||
@@ -322,11 +318,7 @@ statements
|
|||||||
;
|
;
|
||||||
|
|
||||||
statement
|
statement
|
||||||
: (label | annotation)*
|
: (label | annotation)* ( declaration | assignment | loopStatement | expression)
|
||||||
( declaration
|
|
||||||
| assignment
|
|
||||||
| loopStatement
|
|
||||||
| expression)
|
|
||||||
;
|
;
|
||||||
|
|
||||||
label
|
label
|
||||||
@@ -349,12 +341,12 @@ loopStatement
|
|||||||
;
|
;
|
||||||
|
|
||||||
forStatement
|
forStatement
|
||||||
: FOR NL* LPAREN annotation* (variableDeclaration | multiVariableDeclaration) IN expression RPAREN NL* controlStructureBody?
|
: FOR NL* LPAREN annotation* (variableDeclaration | multiVariableDeclaration)
|
||||||
|
IN expression RPAREN NL* controlStructureBody?
|
||||||
;
|
;
|
||||||
|
|
||||||
whileStatement
|
whileStatement
|
||||||
: WHILE NL* LPAREN expression RPAREN NL* controlStructureBody
|
: WHILE NL* LPAREN expression RPAREN NL* (controlStructureBody | SEMICOLON)
|
||||||
| WHILE NL* LPAREN expression RPAREN NL* SEMICOLON
|
|
||||||
;
|
;
|
||||||
|
|
||||||
doWhileStatement
|
doWhileStatement
|
||||||
@@ -362,13 +354,13 @@ doWhileStatement
|
|||||||
;
|
;
|
||||||
|
|
||||||
assignment
|
assignment
|
||||||
: directlyAssignableExpression ASSIGNMENT NL* expression
|
: (directlyAssignableExpression ASSIGNMENT | assignableExpression assignmentAndOperator) NL* expression
|
||||||
| assignableExpression assignmentAndOperator NL* expression
|
|
||||||
;
|
;
|
||||||
|
|
||||||
semi
|
semi
|
||||||
: (SEMICOLON | NL) NL*
|
: (SEMICOLON | NL) NL*
|
||||||
| EOF;
|
| EOF
|
||||||
|
;
|
||||||
|
|
||||||
semis
|
semis
|
||||||
: (SEMICOLON | NL)+
|
: (SEMICOLON | NL)+
|
||||||
@@ -394,7 +386,11 @@ equality
|
|||||||
;
|
;
|
||||||
|
|
||||||
comparison
|
comparison
|
||||||
: infixOperation (comparisonOperator NL* infixOperation)?
|
: genericCallLikeComparison (comparisonOperator NL* genericCallLikeComparison)*
|
||||||
|
;
|
||||||
|
|
||||||
|
genericCallLikeComparison
|
||||||
|
: infixOperation callSuffix*
|
||||||
;
|
;
|
||||||
|
|
||||||
infixOperation
|
infixOperation
|
||||||
@@ -426,11 +422,7 @@ multiplicativeExpression
|
|||||||
;
|
;
|
||||||
|
|
||||||
asExpression
|
asExpression
|
||||||
: comparisonWithLiteralRightSide (NL* asOperator NL* type)?
|
: prefixUnaryExpression (NL* asOperator NL* type)*
|
||||||
;
|
|
||||||
|
|
||||||
comparisonWithLiteralRightSide
|
|
||||||
: prefixUnaryExpression (NL* LANGLE NL* literalConstant NL* RANGLE NL* (expression | parenthesizedExpression))*
|
|
||||||
;
|
;
|
||||||
|
|
||||||
prefixUnaryExpression
|
prefixUnaryExpression
|
||||||
@@ -444,8 +436,7 @@ unaryPrefix
|
|||||||
;
|
;
|
||||||
|
|
||||||
postfixUnaryExpression
|
postfixUnaryExpression
|
||||||
: primaryExpression
|
: primaryExpression postfixUnarySuffix*
|
||||||
| primaryExpression postfixUnarySuffix+
|
|
||||||
;
|
;
|
||||||
|
|
||||||
postfixUnarySuffix
|
postfixUnarySuffix
|
||||||
@@ -467,7 +458,8 @@ parenthesizedDirectlyAssignableExpression
|
|||||||
;
|
;
|
||||||
|
|
||||||
assignableExpression
|
assignableExpression
|
||||||
: prefixUnaryExpression | parenthesizedAssignableExpression
|
: prefixUnaryExpression
|
||||||
|
| parenthesizedAssignableExpression
|
||||||
;
|
;
|
||||||
|
|
||||||
parenthesizedAssignableExpression
|
parenthesizedAssignableExpression
|
||||||
@@ -485,12 +477,11 @@ indexingSuffix
|
|||||||
;
|
;
|
||||||
|
|
||||||
navigationSuffix
|
navigationSuffix
|
||||||
: NL* memberAccessOperator NL* (simpleIdentifier | parenthesizedExpression | CLASS)
|
: memberAccessOperator NL* (simpleIdentifier | parenthesizedExpression | CLASS)
|
||||||
;
|
;
|
||||||
|
|
||||||
callSuffix
|
callSuffix
|
||||||
: typeArguments? valueArguments? annotatedLambda
|
: typeArguments? (valueArguments? annotatedLambda | valueArguments)
|
||||||
| typeArguments? valueArguments
|
|
||||||
;
|
;
|
||||||
|
|
||||||
annotatedLambda
|
annotatedLambda
|
||||||
@@ -502,8 +493,7 @@ typeArguments
|
|||||||
;
|
;
|
||||||
|
|
||||||
valueArguments
|
valueArguments
|
||||||
: LPAREN NL* RPAREN
|
: LPAREN NL* (valueArgument (NL* COMMA NL* valueArgument)* (NL* COMMA)? NL*)? RPAREN
|
||||||
| LPAREN NL* valueArgument (NL* COMMA NL* valueArgument)* (NL* COMMA)? NL* RPAREN
|
|
||||||
;
|
;
|
||||||
|
|
||||||
valueArgument
|
valueArgument
|
||||||
@@ -532,8 +522,7 @@ parenthesizedExpression
|
|||||||
;
|
;
|
||||||
|
|
||||||
collectionLiteral
|
collectionLiteral
|
||||||
: LSQUARE NL* expression (NL* COMMA NL* expression)* (NL* COMMA)? NL* RSQUARE
|
: LSQUARE NL* (expression (NL* COMMA NL* expression)* (NL* COMMA)? NL*)? RSQUARE
|
||||||
| LSQUARE NL* RSQUARE
|
|
||||||
;
|
;
|
||||||
|
|
||||||
literalConstant
|
literalConstant
|
||||||
@@ -568,7 +557,7 @@ lineStringContent
|
|||||||
;
|
;
|
||||||
|
|
||||||
lineStringExpression
|
lineStringExpression
|
||||||
: LineStrExprStart expression RCURL
|
: LineStrExprStart NL* expression NL* RCURL
|
||||||
;
|
;
|
||||||
|
|
||||||
multiLineStringContent
|
multiLineStringContent
|
||||||
@@ -582,8 +571,7 @@ multiLineStringExpression
|
|||||||
;
|
;
|
||||||
|
|
||||||
lambdaLiteral
|
lambdaLiteral
|
||||||
: LCURL NL* statements NL* RCURL
|
: LCURL NL* (lambdaParameters? NL* ARROW NL*)? statements NL* RCURL
|
||||||
| LCURL NL* lambdaParameters? NL* ARROW NL* statements NL* RCURL
|
|
||||||
;
|
;
|
||||||
|
|
||||||
lambdaParameters
|
lambdaParameters
|
||||||
@@ -597,11 +585,11 @@ lambdaParameter
|
|||||||
|
|
||||||
anonymousFunction
|
anonymousFunction
|
||||||
: FUN
|
: FUN
|
||||||
(NL* type NL* DOT)?
|
(NL* type NL* DOT)?
|
||||||
NL* parametersWithOptionalType
|
NL* parametersWithOptionalType
|
||||||
(NL* COLON NL* type)?
|
(NL* COLON NL* type)?
|
||||||
(NL* typeConstraints)?
|
(NL* typeConstraints)?
|
||||||
(NL* functionBody)?
|
(NL* functionBody)?
|
||||||
;
|
;
|
||||||
|
|
||||||
functionLiteral
|
functionLiteral
|
||||||
@@ -610,8 +598,7 @@ functionLiteral
|
|||||||
;
|
;
|
||||||
|
|
||||||
objectLiteral
|
objectLiteral
|
||||||
: OBJECT NL* COLON NL* delegationSpecifiers NL* classBody
|
: OBJECT (NL* COLON NL* delegationSpecifiers NL*)? (NL* classBody)?
|
||||||
| OBJECT NL* classBody
|
|
||||||
;
|
;
|
||||||
|
|
||||||
thisExpression
|
thisExpression
|
||||||
@@ -625,8 +612,10 @@ superExpression
|
|||||||
;
|
;
|
||||||
|
|
||||||
ifExpression
|
ifExpression
|
||||||
: IF NL* LPAREN NL* expression NL* RPAREN NL* (controlStructureBody | SEMICOLON)
|
: IF NL* LPAREN NL* expression NL* RPAREN NL*
|
||||||
| IF NL* LPAREN NL* expression NL* RPAREN NL* controlStructureBody? NL* SEMICOLON? NL* ELSE NL* (controlStructureBody | SEMICOLON)
|
( controlStructureBody
|
||||||
|
| controlStructureBody? NL* SEMICOLON? NL* ELSE NL* (controlStructureBody | SEMICOLON)
|
||||||
|
| SEMICOLON)
|
||||||
;
|
;
|
||||||
|
|
||||||
whenSubject
|
whenSubject
|
||||||
@@ -671,12 +660,14 @@ finallyBlock
|
|||||||
jumpExpression
|
jumpExpression
|
||||||
: THROW NL* expression
|
: THROW NL* expression
|
||||||
| (RETURN | RETURN_AT) expression?
|
| (RETURN | RETURN_AT) expression?
|
||||||
| CONTINUE | CONTINUE_AT
|
| CONTINUE
|
||||||
| BREAK | BREAK_AT
|
| CONTINUE_AT
|
||||||
|
| BREAK
|
||||||
|
| BREAK_AT
|
||||||
;
|
;
|
||||||
|
|
||||||
callableReference
|
callableReference
|
||||||
: (receiverType? NL* COLONCOLON NL* (simpleIdentifier | CLASS))
|
: receiverType? COLONCOLON NL* (simpleIdentifier | CLASS)
|
||||||
;
|
;
|
||||||
|
|
||||||
assignmentAndOperator
|
assignmentAndOperator
|
||||||
@@ -702,15 +693,18 @@ comparisonOperator
|
|||||||
;
|
;
|
||||||
|
|
||||||
inOperator
|
inOperator
|
||||||
: IN | NOT_IN
|
: IN
|
||||||
|
| NOT_IN
|
||||||
;
|
;
|
||||||
|
|
||||||
isOperator
|
isOperator
|
||||||
: IS | NOT_IS
|
: IS
|
||||||
|
| NOT_IS
|
||||||
;
|
;
|
||||||
|
|
||||||
additiveOperator
|
additiveOperator
|
||||||
: ADD | SUB
|
: ADD
|
||||||
|
| SUB
|
||||||
;
|
;
|
||||||
|
|
||||||
multiplicativeOperator
|
multiplicativeOperator
|
||||||
@@ -744,7 +738,9 @@ excl
|
|||||||
;
|
;
|
||||||
|
|
||||||
memberAccessOperator
|
memberAccessOperator
|
||||||
: DOT | safeNav | COLONCOLON
|
: NL* DOT
|
||||||
|
| NL* safeNav
|
||||||
|
| COLONCOLON
|
||||||
;
|
;
|
||||||
|
|
||||||
safeNav
|
safeNav
|
||||||
@@ -777,7 +773,8 @@ typeModifiers
|
|||||||
;
|
;
|
||||||
|
|
||||||
typeModifier
|
typeModifier
|
||||||
: annotation | SUSPEND NL*
|
: annotation
|
||||||
|
| SUSPEND NL*
|
||||||
;
|
;
|
||||||
|
|
||||||
classModifier
|
classModifier
|
||||||
@@ -786,6 +783,7 @@ classModifier
|
|||||||
| ANNOTATION
|
| ANNOTATION
|
||||||
| DATA
|
| DATA
|
||||||
| INNER
|
| INNER
|
||||||
|
| VALUE
|
||||||
;
|
;
|
||||||
|
|
||||||
memberModifier
|
memberModifier
|
||||||
@@ -856,13 +854,11 @@ annotation
|
|||||||
;
|
;
|
||||||
|
|
||||||
singleAnnotation
|
singleAnnotation
|
||||||
: annotationUseSiteTarget NL* unescapedAnnotation
|
: (annotationUseSiteTarget NL* | AT_NO_WS | AT_PRE_WS) unescapedAnnotation
|
||||||
| (AT_NO_WS | AT_PRE_WS) unescapedAnnotation
|
|
||||||
;
|
;
|
||||||
|
|
||||||
multiAnnotation
|
multiAnnotation
|
||||||
: annotationUseSiteTarget NL* LSQUARE unescapedAnnotation+ RSQUARE
|
: (annotationUseSiteTarget NL* | AT_NO_WS | AT_PRE_WS) LSQUARE unescapedAnnotation+ RSQUARE
|
||||||
| (AT_NO_WS | AT_PRE_WS) LSQUARE unescapedAnnotation+ RSQUARE
|
|
||||||
;
|
;
|
||||||
|
|
||||||
annotationUseSiteTarget
|
annotationUseSiteTarget
|
||||||
@@ -876,7 +872,8 @@ unescapedAnnotation
|
|||||||
|
|
||||||
// SECTION: identifiers
|
// SECTION: identifiers
|
||||||
|
|
||||||
simpleIdentifier: Identifier
|
simpleIdentifier
|
||||||
|
: Identifier
|
||||||
| ABSTRACT
|
| ABSTRACT
|
||||||
| ANNOTATION
|
| ANNOTATION
|
||||||
| BY
|
| BY
|
||||||
@@ -923,6 +920,7 @@ simpleIdentifier: Identifier
|
|||||||
| ACTUAL
|
| ACTUAL
|
||||||
| CONST
|
| CONST
|
||||||
| SUSPEND
|
| SUSPEND
|
||||||
|
| VALUE
|
||||||
;
|
;
|
||||||
|
|
||||||
identifier
|
identifier
|
||||||
|
|||||||
1
orx-jvm/orx-kotlin-parser/src/main/antlr/README.md
Normal file
1
orx-jvm/orx-kotlin-parser/src/main/antlr/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Synced from https://github.com/Kotlin/kotlin-spec/ @ 648afef3b9a7fccec7fdaa4aabde6d114bcf9d69
|
||||||
Reference in New Issue
Block a user