private Expression ParseExpr(int precedence)
        {
            Expression ret = ParseFactor();

            while (true)
            {
                TokenInfo t = Tokenizer.PeekToken();

                if (!Helpers.IsBinaryOperator(t)) return ret;

                Operator op = GetBinaryOperator(t);
                int prec = GetOperatorPrecedence(op);

                if (prec >= precedence)
                {
                    GetNextToken();

                    t = Tokenizer.PeekToken();

                    if (EatOptional(Token.EOL))
                    {
                        statementSymbols.Add(t);
                    }

                    Expression right = ParseExpr(prec + 1);

                    //SourceLocation start = ret.Location.Start;
                    var sourceData =
                        new SourceData(
                            new SourceSpan(ret.SourceData.SourceSpan.Start, right.SourceData.SourceSpan.End), SourceFile,
                            statementSymbols);
                    ret = new BinaryExpression(statement, op, ret, right, sourceData);
                    //ret.SetLoc(start, this.Tokenizer.GetSourceLocation());
                }
                else
                {
                    return ret;
                }
            }
        }
 private Expression ParsePower()
 {
     Expression ret = ParsePrimary();
     //ret = AddTrailers(ret);
     if (EatOptional(Token.Caret))
     {
         Expression right = ParseFactor();
         var sourceData =
             new SourceData(new SourceSpan(ret.SourceData.SourceSpan.Start, right.SourceData.SourceSpan.End),
                            SourceFile, statementSymbols);
         ret = new BinaryExpression(statement, Operator.Power, ret, right, sourceData);
     }
     return ret;
 }
        private Expression ParseCompExpr()
        {
            isComparisonExpression = true;

            Expression ret = ParseExpression();

            TokenInfo token;

            while (true)
            {
                Operator op;

                token = Tokenizer.PeekToken();

                switch (token.Token)
                {
                    case Token.Equality:
                        GetNextToken();
                        op = Operator.Equal;
                        break;

                    case Token.Inequality:
                        GetNextToken();
                        op = Operator.NotEquals;
                        break;

                    case Token.Is:
                        GetNextToken();
                        op = Operator.Is;
                        break;

                    case Token.IsNot:
                        GetNextToken();
                        op = Operator.IsNot;
                        break;

                    default:
                        isComparisonExpression = false;
                        return ret;
                }
                Expression rhs = ParseCompExpr();

                var sourceData =
                    new SourceData(new SourceSpan(ret.SourceData.SourceSpan.Start, rhs.SourceData.SourceSpan.End),
                                   SourceFile, statementSymbols);
                var be = new BinaryExpression(statement, op, ret, rhs, sourceData);
                //be.SetLoc(ret.Start, GetEnd());
                ret = be;
            }
        }