public Expression(Statement statement, SourceData sourceData)
        {
            Statement = statement;
            SourceData = sourceData;

            resolveContext = new ExpressionResolveContext();
        }
 public MethodCallOrArrayDereference(Statement statement, FullNamedExpression member, Expression[] args,
                                     SourceData sourceData)
     : base(statement, sourceData)
 {
     // TODO: Complete member initialization
     Member = member;
     Arguments = args;
 }
        public BinaryExpression(Statement statement, Operator op, Expression ret, Expression rhs, SourceData sourceData)
            : base(statement, sourceData)
        {
            // TODO: Complete member initialization
            Operator = op;
            Left = ret;
            Right = rhs;

            Left.SetParent(this);
            Right.SetParent(this);
        }
 public GenericNameExpression(Statement statement, SimpleName left, GenericArguments arguments,
                              SourceData sourceData)
     : base(statement, left, sourceData)
 {
     Arguments = arguments;
 }
        private Expression ParseMemberOrMethodAccess()
        {
            TokenInfo token = Tokenizer.PeekToken();

            TokenInfo token2;

            FullNamedExpression name = ParseFullName();

            if (EatOptional(Token.LeftParenthesis))
            {
                Expression[] args = ParseArguments();

                token2 = GetNextToken();

                SourceSpan span = token.GetSpan(token2);

                var sourceData = new SourceData(span, SourceFile, statementSymbols);

                return new MethodCallOrArrayDereference(statement, name, args, sourceData);
            }

            token2 = Tokenizer.PeekToken();

            return new VariableAccess(statement, name,
                                      new SourceData(token.GetSpan(token2), SourceFile, statementSymbols));
        }
 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 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 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;
            }
        }
 public CharStringLiteral(Statement statement, List<TokenInfo> tokens, SourceData sourceData)
     : base(statement, sourceData)
 {
     // TODO: Complete member initialization
     this.tokens = tokens;
 }
 public IntegerConstant(Statement statement, int nr, SourceData sourceData)
     : base(statement, sourceData)
 {
     // TODO: Complete member initialization
     this.nr = nr;
 }