Declarations are not parsed as expressions any more (JET-1)

This commit is contained in:
Andrey Breslav
2011-04-25 20:32:12 +04:00
parent 9059dae673
commit d4551a61bf
7 changed files with 104 additions and 33 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ initializer
;
block
: "{" expressions "}"
: "{" statements "}"
;
function
+11 -6
View File
@@ -89,7 +89,7 @@ atomicExpression
: "typeof" "(" expression ")"
: "new" constructorInvocation
: objectLiteral
: declaration
// : declaration
: jump
: loop
: SimpleName
@@ -126,6 +126,11 @@ declaration
: typedef
;
statement
: declaration
: expression
;
multiplicativeOperation
: "*" : "/" : "%"
;
@@ -215,13 +220,13 @@ tupleLiteral // Ambiguity when after a SimpleName (infix call). In this case (e)
;
functionLiteral // one can use "it" as a parameter name
: "{" expressions "}"
: "{" (type ".")? modifiers SimpleName "=>" expressions "}"
: "{" (type ".")? "(" (modifiers SimpleName (":" type)?){","} ")" (":" type)? "=>" expressions "}"
: "{" statements "}"
: "{" (type ".")? modifiers SimpleName "=>" statements "}"
: "{" (type ".")? "(" (modifiers SimpleName (":" type)?){","} ")" (":" type)? "=>" statements "}"
;
expressions
: SEMI* expression{SEMI+} SEMI*
statements
: SEMI* statement{SEMI+} SEMI*
;
constructorInvocation