Search in sources :

Example 1 with BooleanOrExprToken

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

the class TokenizerTest method testSimpleOperators.

@Test
public void testSimpleOperators() throws IOException {
    Tokenizer tokenizer = new Tokenizer(new Context("= + - / * % . and or new && || ! xor **"));
    assertTrue(tokenizer.nextToken() instanceof AssignExprToken);
    assertTrue(tokenizer.nextToken() instanceof PlusExprToken);
    assertTrue(tokenizer.nextToken() instanceof MinusExprToken);
    assertTrue(tokenizer.nextToken() instanceof DivExprToken);
    assertTrue(tokenizer.nextToken() instanceof MulExprToken);
    assertTrue(tokenizer.nextToken() instanceof ModExprToken);
    assertTrue(tokenizer.nextToken() instanceof ConcatExprToken);
    assertTrue(tokenizer.nextToken() instanceof BooleanAnd2ExprToken);
    assertTrue(tokenizer.nextToken() instanceof BooleanOr2ExprToken);
    assertTrue(tokenizer.nextToken() instanceof NewExprToken);
    assertTrue(tokenizer.nextToken() instanceof BooleanAndExprToken);
    assertTrue(tokenizer.nextToken() instanceof BooleanOrExprToken);
    assertTrue(tokenizer.nextToken() instanceof BooleanNotExprToken);
    assertTrue(tokenizer.nextToken() instanceof BooleanXorExprToken);
    assertTrue(tokenizer.nextToken() instanceof PowExprToken);
}
Also used : Context(php.runtime.env.Context) BooleanOr2ExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOr2ExprToken) AssignExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.AssignExprToken) MulExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MulExprToken) PowExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.PowExprToken) ConcatExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ConcatExprToken) BooleanOrExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOrExprToken) MinusExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MinusExprToken) BooleanNotExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotExprToken) PlusExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.PlusExprToken) NewExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.NewExprToken) BooleanXorExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanXorExprToken) BooleanAnd2ExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAnd2ExprToken) Tokenizer(org.develnext.jphp.core.tokenizer.Tokenizer) BooleanAndExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAndExprToken) DivExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.DivExprToken) ModExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ModExprToken) Test(org.junit.Test)

Example 2 with BooleanOrExprToken

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

the class TokenizerTest method testComplexOperators.

@Test
public void testComplexOperators() throws IOException {
    Tokenizer tokenizer = new Tokenizer(new Context("== >= <= === !== != && ||"));
    assertTrue(tokenizer.nextToken() instanceof EqualExprToken);
    assertTrue(tokenizer.nextToken() instanceof GreaterOrEqualExprToken);
    assertTrue(tokenizer.nextToken() instanceof SmallerOrEqualToken);
    assertTrue(tokenizer.nextToken() instanceof IdenticalExprToken);
    assertTrue(tokenizer.nextToken() instanceof NotIdenticalExprToken);
    assertTrue(tokenizer.nextToken() instanceof BooleanNotEqualExprToken);
    assertTrue(tokenizer.nextToken() instanceof BooleanAndExprToken);
    assertTrue(tokenizer.nextToken() instanceof BooleanOrExprToken);
}
Also used : Context(php.runtime.env.Context) BooleanOrExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOrExprToken) EqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.EqualExprToken) BooleanNotEqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotEqualExprToken) GreaterOrEqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.GreaterOrEqualExprToken) SmallerOrEqualToken(org.develnext.jphp.core.tokenizer.token.expr.operator.SmallerOrEqualToken) NotIdenticalExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.NotIdenticalExprToken) Tokenizer(org.develnext.jphp.core.tokenizer.Tokenizer) GreaterOrEqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.GreaterOrEqualExprToken) BooleanNotEqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotEqualExprToken) BooleanAndExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAndExprToken) IdenticalExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.IdenticalExprToken) NotIdenticalExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.NotIdenticalExprToken) Test(org.junit.Test)

Aggregations

Tokenizer (org.develnext.jphp.core.tokenizer.Tokenizer)2 BooleanAndExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAndExprToken)2 BooleanOrExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOrExprToken)2 Test (org.junit.Test)2 Context (php.runtime.env.Context)2 AssignExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.AssignExprToken)1 BooleanAnd2ExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAnd2ExprToken)1 BooleanNotEqualExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotEqualExprToken)1 BooleanNotExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotExprToken)1 BooleanOr2ExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOr2ExprToken)1 BooleanXorExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanXorExprToken)1 ConcatExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.ConcatExprToken)1 DivExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.DivExprToken)1 EqualExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.EqualExprToken)1 GreaterOrEqualExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.GreaterOrEqualExprToken)1 IdenticalExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.IdenticalExprToken)1 MinusExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.MinusExprToken)1 ModExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.ModExprToken)1 MulExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.MulExprToken)1 NotIdenticalExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.NotIdenticalExprToken)1