Matches reorganized
This commit is contained in:
@@ -13,7 +13,8 @@ internal class Example<X, T : Comparable<X>>(protected val x : Foo<X, T>, y : So
|
|||||||
class
|
class
|
||||||
: classModifier* "class" SimpleName
|
: classModifier* "class" SimpleName
|
||||||
("<" typeParameter{","} ">")?
|
("<" typeParameter{","} ">")?
|
||||||
("(" defaultConstructorParameter{","} ")")?
|
"wraps"?
|
||||||
|
("(" primaryConstructorParameter{","} ")")?
|
||||||
(":" delegationSpecifier{","})?
|
(":" delegationSpecifier{","})?
|
||||||
("where" typeConstraint{","})? // Syntax is questionable
|
("where" typeConstraint{","})? // Syntax is questionable
|
||||||
classBody?
|
classBody?
|
||||||
@@ -48,7 +49,7 @@ typeConstraint
|
|||||||
// TODO: other constraints, maybe
|
// TODO: other constraints, maybe
|
||||||
;
|
;
|
||||||
|
|
||||||
defaultConstructorParameter
|
primaryConstructorParameter
|
||||||
: accessModifier? ("val" | "var")? parameter
|
: accessModifier? ("val" | "var")? parameter
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ functionParameters
|
|||||||
;
|
;
|
||||||
|
|
||||||
block
|
block
|
||||||
: "{" statements "}"
|
: "{" expression* "}"
|
||||||
;
|
;
|
||||||
|
|
||||||
functionBody
|
functionBody
|
||||||
|
|||||||
+13
-2
@@ -2,5 +2,16 @@ SimpleName : /*java identifier*/;
|
|||||||
FieldName : "$" SimpleName;
|
FieldName : "$" SimpleName;
|
||||||
[helper] Digit : ["0".."9"];
|
[helper] Digit : ["0".."9"];
|
||||||
IntegerLiteral : Digit+ "L"?
|
IntegerLiteral : Digit+ "L"?
|
||||||
[helper] HaxDigit : Digit | ["A"-"F", "a"-"f"];
|
[helper] HexDigit : Digit | ["A"-"F", "a"-"f"];
|
||||||
HexadecimaLiteral : "0x" HexDigit+;
|
HexadecimalLiteral : "0x" HexDigit+;
|
||||||
|
|
||||||
|
StringWithPatterns : /*single-quoted string, $ can be escaped*/;
|
||||||
|
NoEscapeString : /* @-prefixed string, maybe allow putting a bar for indentation correction */;
|
||||||
|
|
||||||
|
/*
|
||||||
|
val foo = @"
|
||||||
|
|Blah-blah-blah
|
||||||
|
foobar
|
||||||
|
barfoo
|
||||||
|
"
|
||||||
|
*/
|
||||||
@@ -3,14 +3,14 @@ match
|
|||||||
;
|
;
|
||||||
|
|
||||||
matchEntry
|
matchEntry
|
||||||
: "case" pattern "=>" expression // TODO: Consider other options than "=>"
|
: "case" pattern ("if" "(" expression ")")? "=>" expression // TODO: Consider other options than "=>"
|
||||||
;
|
;
|
||||||
|
|
||||||
pattern
|
pattern
|
||||||
: constantPattern // literal
|
: constantPattern // literal
|
||||||
: variablePattern // variable from the context
|
: variablePattern // variable from the context
|
||||||
: tuplePattern
|
: tuplePattern
|
||||||
: bindingPattern
|
: bindingPattern // we allow non-linear patterns
|
||||||
: decomposerPattern // labeled components are allowed
|
: decomposerPattern // labeled components are allowed
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ jetlFile
|
|||||||
;
|
;
|
||||||
|
|
||||||
preamble
|
preamble
|
||||||
: empty
|
: // TODO: Imports?!
|
||||||
;
|
;
|
||||||
|
|
||||||
toplevelObject
|
toplevelObject
|
||||||
|
|||||||
Reference in New Issue
Block a user