Search in sources :

Example 1 with DollarExprToken

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

the class TokenizerTest method testVarVar.

@Test
public void testVarVar() throws IOException {
    Tokenizer tokenizer = new Tokenizer(new Context("$$foo $ $bar $$$foobar"));
    assertTrue(tokenizer.nextToken() instanceof DollarExprToken);
    assertTrue(tokenizer.nextToken() instanceof VariableExprToken);
    assertTrue(tokenizer.nextToken() instanceof DollarExprToken);
    assertTrue(tokenizer.nextToken() instanceof VariableExprToken);
    assertTrue(tokenizer.nextToken() instanceof DollarExprToken);
    assertTrue(tokenizer.nextToken() instanceof DollarExprToken);
    assertTrue(tokenizer.nextToken() instanceof VariableExprToken);
    tokenizer = new Tokenizer(new Context("${'foo;6bar'}"));
    assertTrue(tokenizer.nextToken() instanceof DollarExprToken);
    assertTrue(tokenizer.nextToken() instanceof BraceExprToken);
    assertTrue(tokenizer.nextToken() instanceof StringExprToken);
    assertTrue(tokenizer.nextToken() instanceof BraceExprToken);
}
Also used : Context(php.runtime.env.Context) DollarExprToken(org.develnext.jphp.core.tokenizer.token.expr.DollarExprToken) BraceExprToken(org.develnext.jphp.core.tokenizer.token.expr.BraceExprToken) VariableExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.VariableExprToken) Tokenizer(org.develnext.jphp.core.tokenizer.Tokenizer) StringExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StringExprToken) Test(org.junit.Test)

Aggregations

Tokenizer (org.develnext.jphp.core.tokenizer.Tokenizer)1 BraceExprToken (org.develnext.jphp.core.tokenizer.token.expr.BraceExprToken)1 DollarExprToken (org.develnext.jphp.core.tokenizer.token.expr.DollarExprToken)1 StringExprToken (org.develnext.jphp.core.tokenizer.token.expr.value.StringExprToken)1 VariableExprToken (org.develnext.jphp.core.tokenizer.token.expr.value.VariableExprToken)1 Test (org.junit.Test)1 Context (php.runtime.env.Context)1