Search in sources :

Example 56 with Token

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

the class FunctionGenerator method processArguments.

protected void processArguments(FunctionStmtToken result, ListIterator<Token> iterator) {
    checkUnexpectedEnd(iterator);
    List<ArgumentStmtToken> arguments = new ArrayList<ArgumentStmtToken>();
    while (iterator.hasNext()) {
        ArgumentStmtToken argument = processArgument(iterator);
        if (argument == null)
            break;
        arguments.add(argument);
    }
    result.setArguments(arguments);
    Token token = nextTokenAndPrev(iterator);
    if (token instanceof ColonToken) {
        nextToken(iterator);
        Token next = nextToken(iterator);
        if (next instanceof ValueIfElseToken) {
            result.setReturnOptional(true);
            next = nextToken(iterator);
        }
        HintType hintType;
        NameToken hintTypeClass = null;
        if (next instanceof SelfExprToken) {
            if (analyzer.getClazz() == null) {
                result.setReturnHintType(HintType.SELF);
            } else {
                if (analyzer.getClazz().isTrait()) {
                    result.setReturnHintType(HintType.SELF);
                } else {
                    result.setReturnHintTypeClass(new FulledNameToken(next.getMeta(), new ArrayList<Token>() {

                        {
                            if (analyzer.getClazz().getNamespace().getName() != null) {
                                addAll(analyzer.getClazz().getNamespace().getName().getNames());
                            }
                            add(analyzer.getClazz().getName());
                        }
                    }));
                }
            }
        } else if (next instanceof NameToken) {
            String word = ((NameToken) next).getName().toLowerCase();
            if (scalarTypeHints.contains(word)) {
                hintType = HintType.of(word);
            } else {
                hintType = jphp_scalarTypeHints.contains(word) ? null : HintType.of(word);
                if (hintType == null) {
                    hintTypeClass = analyzer.getRealName((NameToken) next);
                }
            }
            result.setReturnHintType(hintType);
            result.setReturnHintTypeClass(hintTypeClass);
        } else {
            unexpectedToken(next, "name");
        }
    }
}
Also used : ValueIfElseToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ValueIfElseToken) HintType(php.runtime.common.HintType) Token(org.develnext.jphp.core.tokenizer.token.Token) ValueIfElseToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ValueIfElseToken) AssignExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.AssignExprToken) ArgumentUnpackExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ArgumentUnpackExprToken) CommentToken(org.develnext.jphp.core.tokenizer.token.CommentToken) AmpersandRefToken(org.develnext.jphp.core.tokenizer.token.expr.operator.AmpersandRefToken) ColonToken(org.develnext.jphp.core.tokenizer.token.ColonToken) BraceExprToken(org.develnext.jphp.core.tokenizer.token.expr.BraceExprToken) CommaToken(org.develnext.jphp.core.tokenizer.token.expr.CommaToken) SemicolonToken(org.develnext.jphp.core.tokenizer.token.SemicolonToken) ColonToken(org.develnext.jphp.core.tokenizer.token.ColonToken)

Example 57 with Token

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

the class TokenizerTest method testMagicString.

@Test
public void testMagicString() throws IOException {
    Token token;
    Tokenizer tokenizer = new Tokenizer(new Context("\"\\.{$foo}\""));
    token = tokenizer.nextToken();
    assertTrue(token instanceof StringExprToken);
    assertEquals("\\.{$foo}", ((StringExprToken) token).getValue());
    assertEquals(1, ((StringExprToken) token).getSegments().size());
    StringExprToken.Segment segment = ((StringExprToken) token).getSegments().get(0);
    assertEquals(2, segment.from);
    assertEquals(8, segment.to);
}
Also used : Context(php.runtime.env.Context) StaticAccessExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StaticAccessExprToken) GlobalStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.GlobalStmtToken) DefaultStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.DefaultStmtToken) CommentToken(org.develnext.jphp.core.tokenizer.token.CommentToken) DirMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.DirMacroToken) NamespaceStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.NamespaceStmtToken) PowExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.PowExprToken) IdenticalExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.IdenticalExprToken) ModExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ModExprToken) MulExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MulExprToken) DoStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.DoStmtToken) FunctionMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.FunctionMacroToken) EqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.EqualExprToken) EndswitchStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndswitchStmtToken) ReturnStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ReturnStmtToken) PlusExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.PlusExprToken) ForStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ForStmtToken) BraceExprToken(org.develnext.jphp.core.tokenizer.token.expr.BraceExprToken) ProtectedStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ProtectedStmtToken) EndwhileStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndwhileStmtToken) StaticExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StaticExprToken) DollarExprToken(org.develnext.jphp.core.tokenizer.token.expr.DollarExprToken) ForeachStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ForeachStmtToken) VariableExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.VariableExprToken) TraitMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.TraitMacroToken) AbstractStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.AbstractStmtToken) FinallyStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.FinallyStmtToken) CommaToken(org.develnext.jphp.core.tokenizer.token.expr.CommaToken) SemicolonToken(org.develnext.jphp.core.tokenizer.token.SemicolonToken) CatchStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.CatchStmtToken) EndifStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndifStmtToken) ClassMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.ClassMacroToken) ConcatExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ConcatExprToken) BooleanExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.BooleanExprToken) TryStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.TryStmtToken) DynamicAccessExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.DynamicAccessExprToken) BooleanAndExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAndExprToken) FunctionStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.FunctionStmtToken) BooleanNotExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotExprToken) NotIdenticalExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.NotIdenticalExprToken) FinalStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.FinalStmtToken) DoubleExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.DoubleExprToken) ElseIfStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ElseIfStmtToken) MinusExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MinusExprToken) BooleanXorExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanXorExprToken) ImplementsStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ImplementsStmtToken) Token(org.develnext.jphp.core.tokenizer.token.Token) IfStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.IfStmtToken) NamespaceMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.NamespaceMacroToken) AssignExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.AssignExprToken) PublicStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.PublicStmtToken) BooleanNotEqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotEqualExprToken) EndforStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndforStmtToken) SmallerOrEqualToken(org.develnext.jphp.core.tokenizer.token.expr.operator.SmallerOrEqualToken) SwitchStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.SwitchStmtToken) BooleanAnd2ExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAnd2ExprToken) MethodMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.MethodMacroToken) ElseStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ElseStmtToken) BooleanOrExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOrExprToken) IntegerExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.IntegerExprToken) DeclareStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.DeclareStmtToken) LineMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.LineMacroToken) ClassStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ClassStmtToken) FileMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.FileMacroToken) BooleanOr2ExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOr2ExprToken) WhileStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.WhileStmtToken) ExtendsStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ExtendsStmtToken) GreaterOrEqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.GreaterOrEqualExprToken) PrivateStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.PrivateStmtToken) EndforeachStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndforeachStmtToken) NamespaceUseStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.NamespaceUseStmtToken) StringExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StringExprToken) DivExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.DivExprToken) NameToken(org.develnext.jphp.core.tokenizer.token.expr.value.NameToken) NewExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.NewExprToken) CaseStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.CaseStmtToken) Tokenizer(org.develnext.jphp.core.tokenizer.Tokenizer) StringExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StringExprToken) Test(org.junit.Test)

Example 58 with Token

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

the class TokenizerTest method testEscapeBug307.

@Test
public void testEscapeBug307() throws IOException {
    Token token;
    Tokenizer tokenizer = new Tokenizer(new Context("\"Ymd\\THis\\Z\""));
    token = tokenizer.nextToken();
    assertTrue(token instanceof StringExprToken);
    assertEquals("Ymd\\THis\\Z", ((StringExprToken) token).getValue());
}
Also used : Context(php.runtime.env.Context) StaticAccessExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StaticAccessExprToken) GlobalStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.GlobalStmtToken) DefaultStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.DefaultStmtToken) CommentToken(org.develnext.jphp.core.tokenizer.token.CommentToken) DirMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.DirMacroToken) NamespaceStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.NamespaceStmtToken) PowExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.PowExprToken) IdenticalExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.IdenticalExprToken) ModExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ModExprToken) MulExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MulExprToken) DoStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.DoStmtToken) FunctionMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.FunctionMacroToken) EqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.EqualExprToken) EndswitchStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndswitchStmtToken) ReturnStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ReturnStmtToken) PlusExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.PlusExprToken) ForStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ForStmtToken) BraceExprToken(org.develnext.jphp.core.tokenizer.token.expr.BraceExprToken) ProtectedStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ProtectedStmtToken) EndwhileStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndwhileStmtToken) StaticExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StaticExprToken) DollarExprToken(org.develnext.jphp.core.tokenizer.token.expr.DollarExprToken) ForeachStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ForeachStmtToken) VariableExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.VariableExprToken) TraitMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.TraitMacroToken) AbstractStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.AbstractStmtToken) FinallyStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.FinallyStmtToken) CommaToken(org.develnext.jphp.core.tokenizer.token.expr.CommaToken) SemicolonToken(org.develnext.jphp.core.tokenizer.token.SemicolonToken) CatchStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.CatchStmtToken) EndifStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndifStmtToken) ClassMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.ClassMacroToken) ConcatExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ConcatExprToken) BooleanExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.BooleanExprToken) TryStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.TryStmtToken) DynamicAccessExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.DynamicAccessExprToken) BooleanAndExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAndExprToken) FunctionStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.FunctionStmtToken) BooleanNotExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotExprToken) NotIdenticalExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.NotIdenticalExprToken) FinalStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.FinalStmtToken) DoubleExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.DoubleExprToken) ElseIfStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ElseIfStmtToken) MinusExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MinusExprToken) BooleanXorExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanXorExprToken) ImplementsStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ImplementsStmtToken) Token(org.develnext.jphp.core.tokenizer.token.Token) IfStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.IfStmtToken) NamespaceMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.NamespaceMacroToken) AssignExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.AssignExprToken) PublicStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.PublicStmtToken) BooleanNotEqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotEqualExprToken) EndforStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndforStmtToken) SmallerOrEqualToken(org.develnext.jphp.core.tokenizer.token.expr.operator.SmallerOrEqualToken) SwitchStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.SwitchStmtToken) BooleanAnd2ExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAnd2ExprToken) MethodMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.MethodMacroToken) ElseStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ElseStmtToken) BooleanOrExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOrExprToken) IntegerExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.IntegerExprToken) DeclareStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.DeclareStmtToken) LineMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.LineMacroToken) ClassStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ClassStmtToken) FileMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.FileMacroToken) BooleanOr2ExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOr2ExprToken) WhileStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.WhileStmtToken) ExtendsStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ExtendsStmtToken) GreaterOrEqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.GreaterOrEqualExprToken) PrivateStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.PrivateStmtToken) EndforeachStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndforeachStmtToken) NamespaceUseStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.NamespaceUseStmtToken) StringExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StringExprToken) DivExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.DivExprToken) NameToken(org.develnext.jphp.core.tokenizer.token.expr.value.NameToken) NewExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.NewExprToken) CaseStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.CaseStmtToken) Tokenizer(org.develnext.jphp.core.tokenizer.Tokenizer) StringExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StringExprToken) Test(org.junit.Test)

Example 59 with Token

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

the class TokenizerTest method testStringSlashes.

@Test
public void testStringSlashes() throws IOException {
    Token token;
    Tokenizer tokenizer = new Tokenizer(new Context(" 'foo\\'bar' \"foo\\\"bar\""));
    token = tokenizer.nextToken();
    assertTrue(token instanceof StringExprToken);
    assertEquals("foo'bar", ((StringExprToken) token).getValue());
    token = tokenizer.nextToken();
    assertTrue(token instanceof StringExprToken);
    assertEquals("foo\"bar", ((StringExprToken) token).getValue());
}
Also used : Context(php.runtime.env.Context) StaticAccessExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StaticAccessExprToken) GlobalStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.GlobalStmtToken) DefaultStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.DefaultStmtToken) CommentToken(org.develnext.jphp.core.tokenizer.token.CommentToken) DirMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.DirMacroToken) NamespaceStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.NamespaceStmtToken) PowExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.PowExprToken) IdenticalExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.IdenticalExprToken) ModExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ModExprToken) MulExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MulExprToken) DoStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.DoStmtToken) FunctionMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.FunctionMacroToken) EqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.EqualExprToken) EndswitchStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndswitchStmtToken) ReturnStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ReturnStmtToken) PlusExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.PlusExprToken) ForStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ForStmtToken) BraceExprToken(org.develnext.jphp.core.tokenizer.token.expr.BraceExprToken) ProtectedStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ProtectedStmtToken) EndwhileStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndwhileStmtToken) StaticExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StaticExprToken) DollarExprToken(org.develnext.jphp.core.tokenizer.token.expr.DollarExprToken) ForeachStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ForeachStmtToken) VariableExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.VariableExprToken) TraitMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.TraitMacroToken) AbstractStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.AbstractStmtToken) FinallyStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.FinallyStmtToken) CommaToken(org.develnext.jphp.core.tokenizer.token.expr.CommaToken) SemicolonToken(org.develnext.jphp.core.tokenizer.token.SemicolonToken) CatchStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.CatchStmtToken) EndifStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndifStmtToken) ClassMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.ClassMacroToken) ConcatExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.ConcatExprToken) BooleanExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.BooleanExprToken) TryStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.TryStmtToken) DynamicAccessExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.DynamicAccessExprToken) BooleanAndExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAndExprToken) FunctionStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.FunctionStmtToken) BooleanNotExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotExprToken) NotIdenticalExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.NotIdenticalExprToken) FinalStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.FinalStmtToken) DoubleExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.DoubleExprToken) ElseIfStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ElseIfStmtToken) MinusExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.MinusExprToken) BooleanXorExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanXorExprToken) ImplementsStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ImplementsStmtToken) Token(org.develnext.jphp.core.tokenizer.token.Token) IfStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.IfStmtToken) NamespaceMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.NamespaceMacroToken) AssignExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.AssignExprToken) PublicStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.PublicStmtToken) BooleanNotEqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanNotEqualExprToken) EndforStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndforStmtToken) SmallerOrEqualToken(org.develnext.jphp.core.tokenizer.token.expr.operator.SmallerOrEqualToken) SwitchStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.SwitchStmtToken) BooleanAnd2ExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanAnd2ExprToken) MethodMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.MethodMacroToken) ElseStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ElseStmtToken) BooleanOrExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOrExprToken) IntegerExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.IntegerExprToken) DeclareStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.DeclareStmtToken) LineMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.LineMacroToken) ClassStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ClassStmtToken) FileMacroToken(org.develnext.jphp.core.tokenizer.token.expr.value.macro.FileMacroToken) BooleanOr2ExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.BooleanOr2ExprToken) WhileStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.WhileStmtToken) ExtendsStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ExtendsStmtToken) GreaterOrEqualExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.GreaterOrEqualExprToken) PrivateStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.PrivateStmtToken) EndforeachStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.EndforeachStmtToken) NamespaceUseStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.NamespaceUseStmtToken) StringExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StringExprToken) DivExprToken(org.develnext.jphp.core.tokenizer.token.expr.operator.DivExprToken) NameToken(org.develnext.jphp.core.tokenizer.token.expr.value.NameToken) NewExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.NewExprToken) CaseStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.CaseStmtToken) Tokenizer(org.develnext.jphp.core.tokenizer.Tokenizer) StringExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StringExprToken) Test(org.junit.Test)

Example 60 with Token

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

the class TokenizerAssert method nextIsStringToken.

public TokenizerAssert nextIsStringToken(String expectedValue) {
    Token actual = this.actual.nextToken();
    isStringTokenWithValue(expectedValue, actual);
    return this;
}
Also used : Token(org.develnext.jphp.core.tokenizer.token.Token) StringExprToken(org.develnext.jphp.core.tokenizer.token.expr.value.StringExprToken)

Aggregations

Token (org.develnext.jphp.core.tokenizer.token.Token)93 SemicolonToken (org.develnext.jphp.core.tokenizer.token.SemicolonToken)47 BraceExprToken (org.develnext.jphp.core.tokenizer.token.expr.BraceExprToken)39 CommentToken (org.develnext.jphp.core.tokenizer.token.CommentToken)37 ValueExprToken (org.develnext.jphp.core.tokenizer.token.expr.ValueExprToken)27 CommaToken (org.develnext.jphp.core.tokenizer.token.expr.CommaToken)26 BreakToken (org.develnext.jphp.core.tokenizer.token.BreakToken)25 AssignExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.AssignExprToken)25 Test (org.junit.Test)24 ColonToken (org.develnext.jphp.core.tokenizer.token.ColonToken)22 NameToken (org.develnext.jphp.core.tokenizer.token.expr.value.NameToken)21 ValueIfElseToken (org.develnext.jphp.core.tokenizer.token.expr.operator.ValueIfElseToken)19 CastExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.cast.CastExprToken)16 UnsetCastExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.cast.UnsetCastExprToken)16 MacroToken (org.develnext.jphp.core.tokenizer.token.expr.value.macro.MacroToken)16 StringExprToken (org.develnext.jphp.core.tokenizer.token.expr.value.StringExprToken)14 VariableExprToken (org.develnext.jphp.core.tokenizer.token.expr.value.VariableExprToken)14 Tokenizer (org.develnext.jphp.core.tokenizer.Tokenizer)13 MinusExprToken (org.develnext.jphp.core.tokenizer.token.expr.operator.MinusExprToken)12 ExprStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.ExprStmtToken)12