use of org.develnext.jphp.core.tokenizer.token.expr.value.IntegerExprToken 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);
}
use of org.develnext.jphp.core.tokenizer.token.expr.value.IntegerExprToken in project jphp by jphp-compiler.
the class ConstTest method testSimple.
@Test
public void testSimple() {
List<Token> tree = getSyntaxTree("const my_CONST = 1;");
Assert.assertTrue(tree.size() == 1);
Assert.assertTrue(tree.get(0) instanceof ConstStmtToken);
ConstStmtToken constant = (ConstStmtToken) tree.get(0);
Assert.assertEquals("my_CONST", constant.items.get(0).getFulledName());
Assert.assertNull(constant.getClazz());
Assert.assertNotNull(constant.items.get(0).value);
Assert.assertTrue(constant.items.get(0).value.getTokens().size() == 1);
Assert.assertTrue(constant.items.get(0).value.getTokens().get(0) instanceof IntegerExprToken);
}
Aggregations