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