Esempio n. 1
0
 public Token(TOKENK tokenk, string lexeme, object literal, int line)
 {
     m_tokenk  = tokenk;
     m_lexeme  = lexeme;
     m_literal = literal;
     m_line    = line;
 }
Esempio n. 2
0
 public AstBinaryExpr(AstExpr leftExpr, TOKENK tokenkOp, AstExpr rightExpr)
     : base(EXPRK.Binary, leftExpr.m_startLine)
 {
     m_leftExpr  = leftExpr;
     m_rightExpr = rightExpr;
     m_tokenkOp  = tokenkOp;
 }
Esempio n. 3
0
    protected Token TryMatch(params TOKENK[] aryTokenkMatch)
    {
        if (IsAtEnd())
        {
            return(null);
        }

        Token token = m_tokens[m_currentIndex];

        for (int i = 0; i < aryTokenkMatch.Length; i++)
        {
            TOKENK tokenkMatch = aryTokenkMatch[i];

            if (token.m_tokenk == tokenkMatch)
            {
                m_currentIndex++;   // Consume
                return(token);
            }
        }

        return(null);
    }
Esempio n. 4
0
 protected void AddToken(TOKENK tokenk, object literal)
 {
     m_tokens.Add(new Token(tokenk, CurrentLexeme(), literal, m_currentLine));
 }
Esempio n. 5
0
    // NOTE (andrews) technically the start line should be the line of the operator.
    //  That info *is* stored on Token's but we only really need the tokenk here
    //  So we just use the expression.

    public AstUnaryExpr(TOKENK tokenkOp, AstExpr expr)
        : base(EXPRK.Unary, expr.m_startLine)
    {
        m_tokenkOp = tokenkOp;
        m_expr     = expr;
    }