Ejemplo n.º 1
0
 public override string ToString()
 {
     if (IntegerVariable != null)
     {
         return(IntegerVariable.ToString());
     }
     return(NumericVariable.ToString());
 }
Ejemplo n.º 2
0
 public NumericVariableOperand(IntegerVariable variable)
     : base(ExpressionNodeType.NumericVariable)
 {
     IntegerVariable = variable;
 }
        internal SubscriptExpression[] CreateSubscriptExpressions(CodeElementsParser.SubscriptContext[] contextArray)
        {
            SubscriptExpression[] subscriptExpressions = new SubscriptExpression[contextArray.Length];
            for(int i = 0; i < contextArray.Length; i++)
            {
                CodeElementsParser.SubscriptContext context = contextArray[i];
                if(context.ALL() != null)
                {
                    subscriptExpressions[i] = new SubscriptExpression(
                        ParseTreeUtils.GetFirstToken(context.ALL()));
                }
                else
                {
                    IntegerVariable integerVariable = CreateIntegerVariableOrIndex(context.integerVariableOrIndex2());
                    ArithmeticExpression arithmeticExpression = new NumericVariableOperand(integerVariable);
                    if(context.withRelativeSubscripting() != null)
                    {
                        SyntaxProperty<ArithmeticOperator> arithmeticOperator = null;
                        if(context.withRelativeSubscripting().PlusOperator() != null)
                        {
                            arithmeticOperator = new SyntaxProperty<ArithmeticOperator>(
                                ArithmeticOperator.Plus,
                                ParseTreeUtils.GetFirstToken(context.withRelativeSubscripting().PlusOperator()));
                        }
                        else
                        {
                            arithmeticOperator = new SyntaxProperty<ArithmeticOperator>(
                                ArithmeticOperator.Minus,
                                ParseTreeUtils.GetFirstToken(context.withRelativeSubscripting().MinusOperator()));
                        }

                        IntegerVariable integerVariable2 = new IntegerVariable(
                            CobolWordsBuilder.CreateIntegerValue(context.withRelativeSubscripting().integerValue()));
                        ArithmeticExpression numericOperand2 = new NumericVariableOperand(integerVariable2);

                        arithmeticExpression = new ArithmeticOperation(
                            arithmeticExpression,
                            arithmeticOperator,
                            numericOperand2);
                    }
                    subscriptExpressions[i] = new SubscriptExpression(arithmeticExpression);
                }
            }
            return subscriptExpressions;
        }
Ejemplo n.º 4
0
 public NumericVariableOperand(IntegerVariable variable) : base(ExpressionNodeType.NumericVariable)
 {
     IntegerVariable = variable;
 }
Ejemplo n.º 5
0
        internal IntegerVariable CreateIntegerVariableOrIndex(CodeElementsParser.IntegerVariableOrIndex2Context context)
        {
            IntegerVariable variable = null;
            if (context.qualifiedDataNameOrIndexName() != null)
            {
                variable = new IntegerVariable(
                    new DataOrConditionStorageArea(
                        CobolWordsBuilder.CreateQualifiedDataNameOrIndexName(context.qualifiedDataNameOrIndexName())));
            }
            else
            {
                variable = new IntegerVariable(
                    CobolWordsBuilder.CreateIntegerValue(context.integerValue()));
            }

            // Collect storage area read/writes at the code element level
            if (variable.StorageArea != null)
            {
                this.storageAreaReads.Add(variable.StorageArea);
            }

            return variable;
        }
Ejemplo n.º 6
0
        internal IntegerVariable CreateIntegerVariable([CanBeNull] CodeElementsParser.IntegerVariable1Context context)
        {
            if(context == null) return null;
            IntegerVariable variable = null;
            if(context.identifier() != null)
            {
                variable = new IntegerVariable(
                    CreateIdentifier(context.identifier()));
            }
            else
            {
                variable = new IntegerVariable(
                    CobolWordsBuilder.CreateIntegerValue(context.integerValue()));
            }

            // Collect storage area read/writes at the code element level
            if (variable.StorageArea != null)
            {
                this.storageAreaReads.Add(variable.StorageArea);
            }

            return variable;
        }
Ejemplo n.º 7
0
 public virtual bool Visit(IntegerVariable integerVariable)
 {
     return(true);
 }