Search in sources :

Example 1 with MulExprToken

use of org.develnext.jphp.core.tokenizer.token.expr.operator.MulExprToken in project jphp by jphp-compiler.

the class ASMExpressionTest method testCallExpr.

@Test
public void testCallExpr() {
    ExprStmtToken expression = getASMExpression("func(1 + 2, 3) * 3").getResult();
    Assert.assertEquals(3, expression.getTokens().size());
    Assert.assertTrue(expression.getTokens().get(0) instanceof CallExprToken);
    CallExprToken call = (CallExprToken) expression.getTokens().get(0);
    Assert.assertEquals(2, call.getParameters().size());
    Assert.assertEquals("1+2", call.getParameters().get(0).getWord());
    Assert.assertEquals("3", call.getParameters().get(1).getWord());
    Assert.assertTrue(expression.getTokens().get(1) instanceof IntegerExprToken);
    Assert.assertTrue(expression.getTokens().get(2) instanceof MulExprToken);
}
Also used : CallExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.CallExprToken) ExprStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ExprStmtToken) MulExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MulExprToken) IntegerExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.IntegerExprToken) Test(org.junit.Test)

Aggregations

MulExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.MulExprToken)1 CallExprToken (org.develnext.jphp.core.tokenizer.token.expr.value.CallExprToken)1 IntegerExprToken (org.develnext.jphp.core.tokenizer.token.expr.value.IntegerExprToken)1 ExprStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.ExprStmtToken)1 Test (org.junit.Test)1