Search in sources :

Example 1 with MinusExprToken

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

the class SimpleExprTest method testVarCall.

@Test
public void testVarCall() {
    List<Token> tokens = getSyntaxTree("$x - $func(1, 3, 4);");
    Assert.assertEquals(1, tokens.size());
    Assert.assertTrue(tokens.get(0) instanceof ExprStmtToken);
    ExprStmtToken expr = (ExprStmtToken) tokens.get(0);
    tokens = expr.getTokens();
    Assert.assertTrue(tokens.size() == 3);
    Assert.assertTrue(tokens.get(0) instanceof VariableExprToken);
    Assert.assertTrue(tokens.get(1) instanceof MinusExprToken);
    Assert.assertTrue(tokens.get(2) instanceof CallExprToken);
}
Also used : ExprStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ExprStmtToken) MinusExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MinusExprToken) Token(org.develnext.jphp.core.tokenizer.token.Token) ValueIfElseToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ValueIfElseToken) ExprStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ExprStmtToken) MinusExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MinusExprToken) Test(org.junit.Test)

Aggregations

Token (org.develnext.jphp.core.tokenizer.token.Token)1 MinusExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.MinusExprToken)1 ValueIfElseToken (org.develnext.jphp.core.tokenizer.token.expr.operator.ValueIfElseToken)1 ExprStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.ExprStmtToken)1 Test (org.junit.Test)1