Search in sources :

Example 6 with NamespaceStmtToken

use of org.develnext.jphp.core.tokenizer.token.stmt.NamespaceStmtToken in project jphp by jphp-compiler.

the class NamespaceSyntaxTest method testMultiple.

@Test
public void testMultiple() {
    List<Token> tree = getSyntaxTree("namespace A { 123; } namespace B { 321; }");
    Assert.assertTrue(tree.size() == 4);
    NamespaceStmtToken token = (NamespaceStmtToken) tree.get(0);
    Assert.assertNotNull(token.getName());
    Assert.assertEquals("A", token.getName().toName());
    Assert.assertNull(token.getTree());
    token = (NamespaceStmtToken) tree.get(2);
    Assert.assertNotNull(token.getName());
    Assert.assertEquals("B", token.getName().toName());
    Assert.assertNull(token.getTree());
}
Also used : NamespaceStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.NamespaceStmtToken) ExprStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ExprStmtToken) Token(org.develnext.jphp.core.tokenizer.token.Token) NamespaceStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.NamespaceStmtToken) Test(org.junit.Test)

Aggregations

NamespaceStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.NamespaceStmtToken)6 Token (org.develnext.jphp.core.tokenizer.token.Token)4 ExprStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.ExprStmtToken)3 Test (org.junit.Test)3 FulledNameToken (org.develnext.jphp.core.tokenizer.token.expr.value.FulledNameToken)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 SemicolonToken (org.develnext.jphp.core.tokenizer.token.SemicolonToken)1 BraceExprToken (org.develnext.jphp.core.tokenizer.token.expr.BraceExprToken)1 NameToken (org.develnext.jphp.core.tokenizer.token.expr.value.NameToken)1 ClassStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.ClassStmtToken)1 MethodStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.MethodStmtToken)1