Search in sources :

Example 6 with CharToken

use of com.googlecode.aviator.lexer.token.CharToken in project aviatorscript by killme2008.

the class ExpressionParser method isOPVariable.

public boolean isOPVariable(final Token<?> token) {
    if (token.getType() != TokenType.Char) {
        return false;
    }
    CharToken charToken = (CharToken) token;
    move(true);
    if (expectChar(',') || expectChar(')')) {
        back();
        String lexeme = String.valueOf(charToken.getCh());
        if (lexeme.equals("-")) {
            lexeme = "-sub";
        }
        return this.instance.containsFunction(lexeme);
    } else {
        back();
        return false;
    }
}
Also used : CharToken(com.googlecode.aviator.lexer.token.CharToken)

Aggregations

CharToken (com.googlecode.aviator.lexer.token.CharToken)6 CompileExpressionErrorException (com.googlecode.aviator.exception.CompileExpressionErrorException)2 NumberToken (com.googlecode.aviator.lexer.token.NumberToken)2 PatternToken (com.googlecode.aviator.lexer.token.PatternToken)2 StringToken (com.googlecode.aviator.lexer.token.StringToken)2 Variable (com.googlecode.aviator.lexer.token.Variable)2 ExpressionSyntaxErrorException (com.googlecode.aviator.exception.ExpressionSyntaxErrorException)1 ExpressionLexer (com.googlecode.aviator.lexer.ExpressionLexer)1 DelegateToken (com.googlecode.aviator.lexer.token.DelegateToken)1 Token (com.googlecode.aviator.lexer.token.Token)1 ExpressionParser (com.googlecode.aviator.parser.ExpressionParser)1 ExpressionSegment (com.googlecode.aviator.runtime.type.string.ExpressionSegment)1 LiteralSegment (com.googlecode.aviator.runtime.type.string.LiteralSegment)1 StringSegment (com.googlecode.aviator.runtime.type.string.StringSegment)1 VarSegment (com.googlecode.aviator.runtime.type.string.VarSegment)1 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 StringCharacterIterator (java.text.StringCharacterIterator)1 ArrayList (java.util.ArrayList)1