Enum entry syntax fixed
This commit is contained in:
@@ -14,11 +14,15 @@ class
|
||||
: modifiers "class" SimpleName
|
||||
typeParameters?
|
||||
"wraps"?
|
||||
("(" primaryConstructorParameter{","} ")")?
|
||||
primaryConstructorParameters?
|
||||
(":" attributes delegationSpecifier{","})?
|
||||
(classBody? | enumClassBody)
|
||||
;
|
||||
|
||||
primaryConstructorParameters
|
||||
: "(" primaryConstructorParameter{","} ")"
|
||||
;
|
||||
|
||||
typeParameters
|
||||
: "<" typeParameter{","} ">"
|
||||
("where" typeConstraint{","})? // TODO: Syntax is questionable
|
||||
|
||||
@@ -3,5 +3,5 @@ enumClassBody
|
||||
;
|
||||
|
||||
enumEntry
|
||||
: modifiers SimpleName typeParameters? valueParameters? (":" initializer{","})? classBody?
|
||||
: modifiers SimpleName typeParameters? primaryConstructorParameters? (":" initializer{","})? classBody?
|
||||
;
|
||||
|
||||
@@ -494,7 +494,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
|
||||
/*
|
||||
* enumEntry
|
||||
* : modifiers SimpleName typeParameters? valueParameters? (":" initializer{","})? classBody?
|
||||
* : modifiers SimpleName typeParameters? primaryConstructorParameters? (":" initializer{","})? classBody?
|
||||
* ;
|
||||
*/
|
||||
private void parseEnumEntry() {
|
||||
@@ -505,7 +505,8 @@ public class JetParsing extends AbstractJetParsing {
|
||||
parseTypeParameterList(TokenSet.create(COLON, LPAR, SEMICOLON, LBRACE));
|
||||
|
||||
if (at(LPAR)) {
|
||||
parseValueParameterList(false, TokenSet.create(COLON, SEMICOLON, LBRACE));
|
||||
parsePrimaryConstructorParameterList();
|
||||
// parseValueParameterList(false, TokenSet.create(COLON, SEMICOLON, LBRACE));
|
||||
}
|
||||
|
||||
if (at(COLON)) {
|
||||
|
||||
@@ -7,7 +7,7 @@ enum class Color(val rgb : Int) {
|
||||
enum class List<out T>(val size : Int) {
|
||||
Nil : List<Nothing>(0)
|
||||
|
||||
Cons<T>(value : T, tail : List<T>) : List<T>(/*tail.size + 1*/a)
|
||||
Cons<T>(val value : T, val tail : List<T>) : List<T>(/*tail.size + 1*/a)
|
||||
|
||||
val isEmpty : Bool
|
||||
get() = size //> 0
|
||||
|
||||
@@ -149,9 +149,11 @@ JetFile: Enums.jet
|
||||
TYPE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(GT)('>')
|
||||
VALUE_PARAMETER_LIST
|
||||
PRIMARY_CONSTRUCTOR_PARAMETERS_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
PRIMARY_CONSTRUCTOR_PARAMETER
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('value')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
@@ -161,7 +163,9 @@ JetFile: Enums.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER
|
||||
PRIMARY_CONSTRUCTOR_PARAMETER
|
||||
PsiElement(val)('val')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(IDENTIFIER)('tail')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
|
||||
Reference in New Issue
Block a user