getTokenType() public method

public getTokenType ( ) : TokenType
return TokenType
Beispiel #1
0
        public override bool Equals(object obj)
        {
            if (obj is Token)
            {
                Token other = obj as Token;

                if (this.getTokenString() == "")
                {
                    return(m_tokenType == other.getTokenType());
                }
                else
                {
                    return(m_tokenString == other.getTokenString());
                }
            }

            return(false);
        }
Beispiel #2
0
        private AST operand()
        {
#if WRITE_DEBUG_INFO
            Console.WriteLine("operand");
#endif

            AST operandTree = null;

            if (lookAheadType(1) == Token.TokenType.NAME &&
                lookAheadType(2) == Token.TokenType.PARANTHESIS_LEFT)
            {
                operandTree = functionCall();
            }
            else if (lookAheadType(1) == Token.TokenType.NAME &&
                     lookAheadType(2) == Token.TokenType.BRACKET_LEFT)
            {
                operandTree = arrayLookup();
            }
            else if (lookAheadType(1) == Token.TokenType.FROM)
            {
                operandTree = fromMinToMaxArrayCreation();
            }
            else if (lookAheadType(1) == Token.TokenType.NAME)
            {
                Token operandToken = match(Token.TokenType.NAME);
                operandTree = new AST(operandToken);
            }
            else if (lookAheadType(1) == Token.TokenType.NUMBER)
            {
                Token operandToken = match(Token.TokenType.NUMBER);


                float number = (float)Convert.ToDouble(operandToken.getTokenString(),
                                                       CultureInfo.InvariantCulture
                                                       );

                operandTree = new AST(new TokenWithValue(operandToken.getTokenType(),
                                                         operandToken.getTokenString(),
                                                         new ReturnValue(number)));
            }
            else if (lookAheadType(1) == Token.TokenType.QUOTED_STRING)
            {
                Token operandToken = match(Token.TokenType.QUOTED_STRING);
                operandTree = new AST(new TokenWithValue(operandToken.getTokenType(),
                                                         operandToken.getTokenString(),
                                                         new ReturnValue(operandToken.getTokenString())));
            }
            else if (lookAheadType(1) == Token.TokenType.BOOLEAN_VALUE)
            {
                Token operandToken = match(Token.TokenType.BOOLEAN_VALUE);
                bool  boolean      = operandToken.getTokenString() == "true" ? true : false;
                operandTree = new AST(new TokenWithValue(operandToken.getTokenType(),
                                                         operandToken.getTokenString(),
                                                         new ReturnValue(boolean)));
            }
            else if (lookAheadType(1) == Token.TokenType.OPERATOR &&
                     lookAhead(1).getTokenString() == "-")
            {
                operandTree = negativeExpression();
            }
            else if (lookAheadType(1) == Token.TokenType.BRACKET_LEFT)
            {
                operandTree = arrayCreation();
            }

            return(operandTree);
        }