Merge remote-tracking branch 'origin/create-parser' into typedAST
This commit is contained in:
commit
060321f323
@ -191,6 +191,15 @@ testExpressionThisMethodCall = TestCase $
|
|||||||
testExpressionThisMethodCallParam = TestCase $
|
testExpressionThisMethodCallParam = TestCase $
|
||||||
assertEqual "expect this methocall" (StatementExpressionExpression (MethodCall (Reference "this") "foo" [Reference "x"])) $
|
assertEqual "expect this methocall" (StatementExpressionExpression (MethodCall (Reference "this") "foo" [Reference "x"])) $
|
||||||
parseExpression [THIS,DOT,IDENTIFIER "foo",LBRACE,IDENTIFIER "x",RBRACE]
|
parseExpression [THIS,DOT,IDENTIFIER "foo",LBRACE,IDENTIFIER "x",RBRACE]
|
||||||
|
testExpressionFieldAccess = TestCase $
|
||||||
|
assertEqual "expect NameResolution" (BinaryOperation NameResolution (Reference "this") (Reference "b")) $
|
||||||
|
parseExpression [THIS,DOT,IDENTIFIER "b"]
|
||||||
|
testExpressionSimpleFieldAccess = TestCase $
|
||||||
|
assertEqual "expect Reference" (Reference "a") $
|
||||||
|
parseExpression [IDENTIFIER "a"]
|
||||||
|
testExpressionFieldSubAccess = TestCase $
|
||||||
|
assertEqual "expect NameResolution without this" (BinaryOperation NameResolution (Reference "a") (Reference "b")) $
|
||||||
|
parseExpression [IDENTIFIER "a",DOT,IDENTIFIER "b"]
|
||||||
|
|
||||||
testStatementIfThen = TestCase $
|
testStatementIfThen = TestCase $
|
||||||
assertEqual "expect empty ifthen" [If (Reference "a") (Block [Block []]) Nothing] $
|
assertEqual "expect empty ifthen" [If (Reference "a") (Block [Block []]) Nothing] $
|
||||||
@ -267,6 +276,9 @@ tests = TestList [
|
|||||||
testExpressionMethodCallTwoParams,
|
testExpressionMethodCallTwoParams,
|
||||||
testExpressionThisMethodCall,
|
testExpressionThisMethodCall,
|
||||||
testExpressionThisMethodCallParam,
|
testExpressionThisMethodCallParam,
|
||||||
|
testExpressionFieldAccess,
|
||||||
|
testExpressionSimpleFieldAccess,
|
||||||
|
testExpressionFieldSubAccess,
|
||||||
testStatementIfThen,
|
testStatementIfThen,
|
||||||
testStatementIfThenElse,
|
testStatementIfThenElse,
|
||||||
testStatementWhile,
|
testStatementWhile,
|
||||||
|
@ -83,11 +83,11 @@ typedeclarations : typedeclaration { [$1] }
|
|||||||
| typedeclarations typedeclaration { $1 ++ [$2] }
|
| typedeclarations typedeclaration { $1 ++ [$2] }
|
||||||
|
|
||||||
name : simplename { Reference $1 }
|
name : simplename { Reference $1 }
|
||||||
-- | qualifiedname { }
|
| qualifiedname { $1 }
|
||||||
|
|
||||||
typedeclaration : classdeclaration { $1 }
|
typedeclaration : classdeclaration { $1 }
|
||||||
|
|
||||||
qualifiedname : name DOT IDENTIFIER { }
|
qualifiedname : name DOT IDENTIFIER { BinaryOperation NameResolution $1 (Reference $3) }
|
||||||
|
|
||||||
simplename : IDENTIFIER { $1 }
|
simplename : IDENTIFIER { $1 }
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ classinstancecreationexpression : NEW classtype LBRACE RBRACE { }
|
|||||||
|
|
||||||
conditionalandexpression : inclusiveorexpression { $1 }
|
conditionalandexpression : inclusiveorexpression { $1 }
|
||||||
|
|
||||||
fieldaccess : primary DOT IDENTIFIER { }
|
fieldaccess : primary DOT IDENTIFIER { BinaryOperation NameResolution $1 (Reference $3) }
|
||||||
|
|
||||||
unaryexpression : unaryexpressionnotplusminus { $1 }
|
unaryexpression : unaryexpressionnotplusminus { $1 }
|
||||||
| predecrementexpression { StatementExpressionExpression $1 }
|
| predecrementexpression { StatementExpressionExpression $1 }
|
||||||
@ -319,7 +319,7 @@ primarynonewarray : literal { $1 }
|
|||||||
| THIS { Reference "this" }
|
| THIS { Reference "this" }
|
||||||
| LBRACE expression RBRACE { $2 }
|
| LBRACE expression RBRACE { $2 }
|
||||||
-- | classinstancecreationexpression { }
|
-- | classinstancecreationexpression { }
|
||||||
-- | fieldaccess { }
|
| fieldaccess { $1 }
|
||||||
| methodinvocation { StatementExpressionExpression $1 }
|
| methodinvocation { StatementExpressionExpression $1 }
|
||||||
|
|
||||||
unaryexpressionnotplusminus : postfixexpression { $1 }
|
unaryexpressionnotplusminus : postfixexpression { $1 }
|
||||||
|
Loading…
Reference in New Issue
Block a user