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
|
||||
: classModifier* "class" SimpleName
|
||||
("<" typeParameter{","} ">")?
|
||||
("(" defaultConstructorParameter{","} ")")?
|
||||
"wraps"?
|
||||
("(" primaryConstructorParameter{","} ")")?
|
||||
(":" delegationSpecifier{","})?
|
||||
("where" typeConstraint{","})? // Syntax is questionable
|
||||
classBody?
|
||||
@@ -48,7 +49,7 @@ typeConstraint
|
||||
// TODO: other constraints, maybe
|
||||
;
|
||||
|
||||
defaultConstructorParameter
|
||||
primaryConstructorParameter
|
||||
: accessModifier? ("val" | "var")? parameter
|
||||
;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ functionParameters
|
||||
;
|
||||
|
||||
block
|
||||
: "{" statements "}"
|
||||
: "{" expression* "}"
|
||||
;
|
||||
|
||||
functionBody
|
||||
|
||||
+13
-2
@@ -2,5 +2,16 @@ SimpleName : /*java identifier*/;
|
||||
FieldName : "$" SimpleName;
|
||||
[helper] Digit : ["0".."9"];
|
||||
IntegerLiteral : Digit+ "L"?
|
||||
[helper] HaxDigit : Digit | ["A"-"F", "a"-"f"];
|
||||
HexadecimaLiteral : "0x" HexDigit+;
|
||||
[helper] HexDigit : Digit | ["A"-"F", "a"-"f"];
|
||||
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
|
||||
: "case" pattern "=>" expression // TODO: Consider other options than "=>"
|
||||
: "case" pattern ("if" "(" expression ")")? "=>" expression // TODO: Consider other options than "=>"
|
||||
;
|
||||
|
||||
pattern
|
||||
: constantPattern // literal
|
||||
: variablePattern // variable from the context
|
||||
: tuplePattern
|
||||
: bindingPattern
|
||||
: bindingPattern // we allow non-linear patterns
|
||||
: decomposerPattern // labeled components are allowed
|
||||
;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ jetlFile
|
||||
;
|
||||
|
||||
preamble
|
||||
: empty
|
||||
: // TODO: Imports?!
|
||||
;
|
||||
|
||||
toplevelObject
|
||||
|
||||
Reference in New Issue
Block a user