internal Variable CreateVariable(CodeElementsParser.Variable3Context context)
 {
     if (context.identifier() != null)
     {
         StorageArea storageArea = CreateIdentifier(context.identifier());
         return new Variable(storageArea);
     }
     else if(context.numericValue() != null)
     {
         return new Variable(
             CobolWordsBuilder.CreateNumericValue(context.numericValue()));
     }
     else
     {
         return new Variable(
             CobolWordsBuilder.CreateAlphanumericValue(context.alphanumericValue2()));
     }
 }
 internal VariableOrExpression CreateVariableOrExpression(CodeElementsParser.VariableOrExpression2Context context)
 {
     if (context.identifier() != null)
     {
         return new VariableOrExpression(
             CreateIdentifier(context.identifier()));
     }
     else if (context.numericValue() != null)
     {
         return new VariableOrExpression(
             CobolWordsBuilder.CreateNumericValue(context.numericValue()));
     }
     else if (context.alphanumericValue2() != null)
     {
         return new VariableOrExpression(
             CobolWordsBuilder.CreateAlphanumericValue(context.alphanumericValue2()));
     }
     else if (context.repeatedCharacterValue1() != null)
     {
         return new VariableOrExpression(
             CobolWordsBuilder.CreateRepeatedCharacterValue(context.repeatedCharacterValue1()));
     }
     else
     {
         return new VariableOrExpression(
             CreateArithmeticExpression(context.arithmeticExpression()));
     }
 }
 internal Variable CreateVariableOrIndex(CodeElementsParser.VariableOrIndexContext context)
 {
     if(context.identifierOrIndexName() != null)
     {
         return new Variable(
             CreateIdentifierOrIndexName(context.identifierOrIndexName()));
     }
     else if (context.numericValue() != null)
     {
         return new Variable(
             CobolWordsBuilder.CreateNumericValue(context.numericValue()));
     }
     else if (context.alphanumericValue2() != null)
     {
         return new Variable(
             CobolWordsBuilder.CreateAlphanumericValue(context.alphanumericValue2()));
     }
     else
     {
         return new Variable(
             CobolWordsBuilder.CreateRepeatedCharacterValue(context.repeatedCharacterValue2()));
     }
 }
Exemplo n.º 4
0
 internal Value CreateValue(CodeElementsParser.Value1Context context)
 {
     if (context.numericValue() != null)
         return new Value(CreateNumericValue(context.numericValue()));
     if (context.alphanumericValue2() != null)
         return new Value(CreateAlphanumericValue(context.alphanumericValue2()));
     if (context.repeatedCharacterValue2() != null)
         return new Value(CreateRepeatedCharacterValue(context.repeatedCharacterValue2()));
     throw new InvalidOperationException();
 }
Exemplo n.º 5
0
 internal Value CreateValue(CodeElementsParser.Value2Context context)
 {
     if (context.numericValue() != null)
     {
         NumericValue numericValue = CreateNumericValue(context.numericValue());
         return new Value(numericValue);
     }
     else if (context.alphanumericValue2() != null)
     {
         AlphanumericValue alphanumericValue = CreateAlphanumericValue(context.alphanumericValue2());
         return new Value(alphanumericValue);
     }
     else if (context.repeatedCharacterValue2() != null)
     {
         RepeatedCharacterValue repeatedCharacterValue = CreateRepeatedCharacterValue(context.repeatedCharacterValue2());
         return new Value(repeatedCharacterValue);
     }
     else if (context.nullPointerValue() != null)
     {
         NullPointerValue nullPointerValue = CreateNullPointerValue(context.nullPointerValue());
         return new Value(nullPointerValue);
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
Exemplo n.º 6
0
 internal SymbolReference CreateSymbolReference(CodeElementsParser.SymbolReference2Context context, SymbolType symbolType)
 {
     AlphanumericValue nameLiteral = CreateAlphanumericValue(context.alphanumericValue2());
     var symbolReference = new SymbolReference(nameLiteral, symbolType);
     symbolInformationForTokens[nameLiteral.Token] = symbolReference;
     return symbolReference;
 }
Exemplo n.º 7
0
 internal SymbolDefinition CreateSymbolDefinition(CodeElementsParser.SymbolDefinition2Context context, SymbolType symbolType)
 {
     AlphanumericValue nameLiteral = CreateAlphanumericValue(context.alphanumericValue2());
     var symbolDefinition = new SymbolDefinition(nameLiteral, symbolType);
     symbolInformationForTokens[nameLiteral.Token] = symbolDefinition;
     return symbolDefinition;
 }
Exemplo n.º 8
0
        internal Variable CreateVariableOrIndex(CodeElementsParser.VariableOrIndexContext context)
        {
            Variable variable = null;
            if(context.identifierOrIndexName() != null)
            {
                variable = new Variable(
                    CreateIdentifierOrIndexName(context.identifierOrIndexName()));
            }
            else if (context.numericValue() != null)
            {
                variable = new Variable(
                    CobolWordsBuilder.CreateNumericValue(context.numericValue()));
            }
            else if (context.alphanumericValue2() != null)
            {
                variable = new Variable(
                    CobolWordsBuilder.CreateAlphanumericValue(context.alphanumericValue2()));
            }
            else
            {
                variable = new Variable(
                    CobolWordsBuilder.CreateRepeatedCharacterValue(context.repeatedCharacterValue2()));
            }

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

            return variable;
        }
Exemplo n.º 9
0
        internal VariableOrExpression CreateVariableOrExpression(CodeElementsParser.VariableOrExpression2Context context)
        {
            VariableOrExpression variableOrExpression = null;
            if (context.identifier() != null)
            {
                variableOrExpression = new VariableOrExpression(
                    CreateIdentifier(context.identifier()));
            }
            else if (context.numericValue() != null)
            {
                variableOrExpression = new VariableOrExpression(
                    CobolWordsBuilder.CreateNumericValue(context.numericValue()));
            }
            else if (context.alphanumericValue2() != null)
            {
                variableOrExpression = new VariableOrExpression(
                    CobolWordsBuilder.CreateAlphanumericValue(context.alphanumericValue2()));
            }
            else if (context.repeatedCharacterValue1() != null)
            {
                variableOrExpression = new VariableOrExpression(
                    CobolWordsBuilder.CreateRepeatedCharacterValue(context.repeatedCharacterValue1()));
            }
            else
            {
                variableOrExpression = new VariableOrExpression(
                    CreateArithmeticExpression(context.arithmeticExpression()));
            }

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

            return variableOrExpression;
        }
Exemplo n.º 10
0
 // --- Storage areas shared with calling or called program ---
 internal Variable CreateSharedVariable(CodeElementsParser.SharedVariable3Context context)
 {
     Variable variable = null;
     if (context.identifier() != null) {
         StorageArea storageArea = CreateIdentifier(context.identifier());
         variable = new Variable(storageArea);
     } else
     if (context.numericValue() != null) {
         variable = new Variable(CobolWordsBuilder.CreateNumericValue(context.numericValue()));
     } else {
         variable = new Variable(CobolWordsBuilder.CreateAlphanumericValue(context.alphanumericValue2()));
     }
     // Collect storage area read/writes at the code element level
     if (variable.StorageArea != null) {
         this.storageAreaReads.Add(variable.StorageArea);
     }
     return variable;
 }