Exemplo n.º 1
0
        public override void ExitSingle_varDeclaration(DecafParser.Single_varDeclarationContext context)
        {
            SymbolType theType = getNodeType(context.varType());
            Symbol theSymbolRepresentation;

            if (theType != SymbolType.TstructImpl)
                theSymbolRepresentation = new Symbol(theType);
            else
                theSymbolRepresentation = getNodeSymbol(context.varType());

            theScopeManager.AddSymbol(context.Id().GetText(), theSymbolRepresentation);
        }
Exemplo n.º 2
0
        public override void ExitArray_varDeclaration(DecafParser.Array_varDeclarationContext context)
        {
            SymbolType theType = getNodeType(context.varType());
            string num = context.Num().GetText();
            ArraySymbol theSymbolRepresentation;

            if (theType != SymbolType.TstructImpl)
                theSymbolRepresentation = new ArraySymbol(theType, Convert.ToInt32(num));
            else
            {
                StructImpl theSymbol = getNodeSymbol(context.varType()) as StructImpl;
                theSymbolRepresentation = new StructArraySymbol(theType, Convert.ToInt32(num), theSymbol.ParentStructName);
            }
            theScopeManager.AddSymbol(context.Id().GetText(), theSymbolRepresentation);
        }