Merge remote-tracking branch 'origin/create-parser' into typedAST
This commit is contained in:
commit
45114caffb
@ -139,16 +139,16 @@ testExpressionOr = TestCase $
|
|||||||
assertEqual "expect or expression" (BinaryOperation Or (Reference "bar") (Reference "baz")) $
|
assertEqual "expect or expression" (BinaryOperation Or (Reference "bar") (Reference "baz")) $
|
||||||
parseExpression [IDENTIFIER "bar",OR,IDENTIFIER "baz"]
|
parseExpression [IDENTIFIER "bar",OR,IDENTIFIER "baz"]
|
||||||
testExpressionPostIncrement = TestCase $
|
testExpressionPostIncrement = TestCase $
|
||||||
assertEqual "expect PostIncrement" (UnaryOperation PostIncrement (Reference "a")) $
|
assertEqual "expect PostIncrement" (StatementExpressionExpression $ PostIncrement (Reference "a")) $
|
||||||
parseExpression [IDENTIFIER "a",INCREMENT]
|
parseExpression [IDENTIFIER "a",INCREMENT]
|
||||||
testExpressionPostDecrement = TestCase $
|
testExpressionPostDecrement = TestCase $
|
||||||
assertEqual "expect PostDecrement" (UnaryOperation PostDecrement (Reference "a")) $
|
assertEqual "expect PostDecrement" (StatementExpressionExpression $ PostDecrement (Reference "a")) $
|
||||||
parseExpression [IDENTIFIER "a",DECREMENT]
|
parseExpression [IDENTIFIER "a",DECREMENT]
|
||||||
testExpressionPreIncrement = TestCase $
|
testExpressionPreIncrement = TestCase $
|
||||||
assertEqual "expect PreIncrement" (UnaryOperation PreIncrement (Reference "a")) $
|
assertEqual "expect PreIncrement" (StatementExpressionExpression $ PreIncrement (Reference "a")) $
|
||||||
parseExpression [INCREMENT,IDENTIFIER "a"]
|
parseExpression [INCREMENT,IDENTIFIER "a"]
|
||||||
testExpressionPreDecrement = TestCase $
|
testExpressionPreDecrement = TestCase $
|
||||||
assertEqual "expect PreIncrement" (UnaryOperation PreDecrement (Reference "a")) $
|
assertEqual "expect PreIncrement" (StatementExpressionExpression $ PreDecrement (Reference "a")) $
|
||||||
parseExpression [DECREMENT,IDENTIFIER "a"]
|
parseExpression [DECREMENT,IDENTIFIER "a"]
|
||||||
testExpressionAssign = TestCase $
|
testExpressionAssign = TestCase $
|
||||||
assertEqual "expect assign 5 to a" (StatementExpressionExpression (Assignment (Reference "a") (IntegerLiteral 5))) $
|
assertEqual "expect assign 5 to a" (StatementExpressionExpression (Assignment (Reference "a") (IntegerLiteral 5))) $
|
||||||
|
@ -279,13 +279,13 @@ assignmentoperator : ASSIGN { Nothing }
|
|||||||
| XOREQUAL { Just BitwiseXor }
|
| XOREQUAL { Just BitwiseXor }
|
||||||
| OREQUAL{ Just BitwiseOr }
|
| OREQUAL{ Just BitwiseOr }
|
||||||
|
|
||||||
preincrementexpression : INCREMENT unaryexpression { UnaryOperation PreIncrement $2 }
|
preincrementexpression : INCREMENT unaryexpression { PreIncrement $2 }
|
||||||
|
|
||||||
predecrementexpression : DECREMENT unaryexpression { UnaryOperation PreDecrement $2 }
|
predecrementexpression : DECREMENT unaryexpression { PreDecrement $2 }
|
||||||
|
|
||||||
postincrementexpression : postfixexpression INCREMENT { UnaryOperation PostIncrement $1 }
|
postincrementexpression : postfixexpression INCREMENT { PostIncrement $1 }
|
||||||
|
|
||||||
postdecrementexpression : postfixexpression DECREMENT { UnaryOperation PostDecrement $1 }
|
postdecrementexpression : postfixexpression DECREMENT { PostDecrement $1 }
|
||||||
|
|
||||||
methodinvocation : simplename LBRACE RBRACE { MethodCall (Reference "this") $1 [] }
|
methodinvocation : simplename LBRACE RBRACE { MethodCall (Reference "this") $1 [] }
|
||||||
| simplename LBRACE argumentlist RBRACE { MethodCall (Reference "this") $1 $3 }
|
| simplename LBRACE argumentlist RBRACE { MethodCall (Reference "this") $1 $3 }
|
||||||
@ -300,15 +300,15 @@ conditionalandexpression : inclusiveorexpression { $1 }
|
|||||||
fieldaccess : primary DOT IDENTIFIER { }
|
fieldaccess : primary DOT IDENTIFIER { }
|
||||||
|
|
||||||
unaryexpression : unaryexpressionnotplusminus { $1 }
|
unaryexpression : unaryexpressionnotplusminus { $1 }
|
||||||
| predecrementexpression { $1 }
|
| predecrementexpression { StatementExpressionExpression $1 }
|
||||||
| PLUS unaryexpression { $2 }
|
| PLUS unaryexpression { $2 }
|
||||||
| MINUS unaryexpression { UnaryOperation Minus $2 }
|
| MINUS unaryexpression { UnaryOperation Minus $2 }
|
||||||
| preincrementexpression { $1 }
|
| preincrementexpression { StatementExpressionExpression $1 }
|
||||||
|
|
||||||
postfixexpression : primary { $1 }
|
postfixexpression : primary { $1 }
|
||||||
| name { $1 }
|
| name { $1 }
|
||||||
| postincrementexpression { $1 }
|
| postincrementexpression { StatementExpressionExpression $1 }
|
||||||
| postdecrementexpression{ $1 }
|
| postdecrementexpression { StatementExpressionExpression $1 }
|
||||||
|
|
||||||
primary : primarynonewarray { $1 }
|
primary : primarynonewarray { $1 }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user