Ejemplo n.º 1
0
 public varIdentExpreAST(listIdentExprAST hh1, listIdentExprAST hh2)
 {
     h1 = hh1;
     h2 = hh2;
 }
Ejemplo n.º 2
0
 public designatorConIdentExprAST(Symbol s, listIdentExprAST l)
 {
     this.listIdentExpr = l;
     simbol             = s;
 }
 public designatorConIdentExprAST(Symbol s,listIdentExprAST l)
 {
     this.listIdentExpr = l;
     simbol=s;
 }
Ejemplo n.º 4
0
        public designatorAST parseDesignator()
        {//Designator
            //Designator = ident { "." ident | "[" Expr "]" }
            listIdentExprAST temp        = null;
            listIdentExprAST result      = null;
            Symbol           tempsimbol2 = null;
            exprAST          expr        = null;
            Symbol           tempsimbol  = currentToken;

            accept(sym.ID, "ident");
            Boolean ind  = false;
            Boolean ind2 = false;

            while (currentToken.sym == sym.PUNTO || currentToken.sym == sym.C_ABI)
            {
                if (currentToken.sym == sym.PUNTO)
                {
                    if (ind == false)
                    {
                        acceptIt();
                        tempsimbol2 = currentToken;
                        accept(sym.ID, "ident");
                        result = new unIdentExpreConIdentAST(tempsimbol2);
                        ind    = true;
                    }
                    else
                    {
                        acceptIt();
                        tempsimbol2 = currentToken;
                        accept(sym.ID, "ident");
                        temp   = new unIdentExpreConIdentAST(tempsimbol2);
                        result = new varIdentExpreAST(result, temp);
                    }
                }
                else
                {
                    if (ind2 == false)
                    {
                        acceptIt();
                        expr = parseExpr();
                        accept(sym.C_CER, "]");
                        result = new unIdentExpreConExprAST(expr);
                        ind2   = true;
                    }
                    else
                    {
                        acceptIt();
                        expr = parseExpr();
                        accept(sym.C_CER, "]");
                        temp   = new unIdentExpreConExprAST(expr);
                        result = new varIdentExpreAST(result, temp);
                    }
                }
            }

            if (tempsimbol2 == null && result == null)
            {
                return(new designatorSinIdentExprAST(tempsimbol));
            }
            else
            {
                return(new designatorConIdentExprAST(tempsimbol, result));
            }
        }