Matches reorganized
This commit is contained in:
@@ -33,11 +33,16 @@ class Example(a : Foo, i : Int) : Bar(i), Some {
|
||||
memberDeclaration
|
||||
: classObject
|
||||
: constructor
|
||||
: decomposer
|
||||
: method
|
||||
: property
|
||||
: class
|
||||
;
|
||||
|
||||
decomposer // TODO: consider other names
|
||||
: "decomposer" SimpleName "(" SimpleName{","} ")" // Public properties only
|
||||
;
|
||||
|
||||
classObject
|
||||
: "class" objectLiteral
|
||||
;
|
||||
|
||||
@@ -12,6 +12,7 @@ expression
|
||||
: expressionWithPrecedences
|
||||
: match
|
||||
: if
|
||||
: "typeof"
|
||||
: "new" constructorInvocation // TODO: Do we need "new"?, see factory methods
|
||||
: objectLiteral
|
||||
: jump
|
||||
@@ -87,7 +88,7 @@ typeArguments
|
||||
;
|
||||
|
||||
valueArguments
|
||||
: "(" (SimpleName ":")? expression{","} ")"
|
||||
: "(" (SimpleName "=")? expression{","} ")"
|
||||
;
|
||||
|
||||
infixFunctionCall
|
||||
|
||||
@@ -2,6 +2,7 @@ extension
|
||||
: completeExtension
|
||||
: extensionMethod
|
||||
: extensionProperty
|
||||
: extensionDecomposer
|
||||
;
|
||||
|
||||
completeExtension
|
||||
@@ -15,3 +16,7 @@ extensionMethod
|
||||
extensionProperty
|
||||
: accessModifier? propertyModifier? ("val" | "var") type "." propertyRest
|
||||
;
|
||||
|
||||
extensionDecomposer
|
||||
: "decomposer" (type ".")? SimpleName "(" SimpleName{","} ")" // Public properties only
|
||||
;
|
||||
+17
-4
@@ -4,11 +4,24 @@ match
|
||||
|
||||
matchEntry
|
||||
: "case" pattern "=>" expression // TODO: Consider other options than "=>"
|
||||
: "else" "=>" expression // TODO: keyword
|
||||
;
|
||||
|
||||
pattern
|
||||
: SimpleName
|
||||
: expression
|
||||
: // TODO: how to write the typeswitch?
|
||||
: constantPattern // literal
|
||||
: variablePattern // variable from the context
|
||||
: tuplePattern
|
||||
: bindingPattern
|
||||
: decomposerPattern // labeled components are allowed
|
||||
;
|
||||
|
||||
tuplePattern
|
||||
: "(" ((SimpleName "=")? pattern{","})? ")"
|
||||
;
|
||||
|
||||
bindingPattern
|
||||
: "?" SimpleName? (":" pattern)?
|
||||
;
|
||||
|
||||
decomposerPattern
|
||||
: userType tuplePattern?
|
||||
;
|
||||
Reference in New Issue
Block a user