Пример #1
0
        public actParsAST parseActPars()
        {
            listExprAST temp   = null;
            listExprAST temp2  = null;
            listExprAST result = null;
            exprAST     expr   = null;

            if (currentToken.sym == sym.RES || currentToken.sym == sym.ID || currentToken.sym == sym.NUM || currentToken.sym == sym.CHARCONS || currentToken.sym == sym.TRUE || currentToken.sym == sym.FALSE || currentToken.sym == sym.NEW || currentToken.sym == sym.P_ABI)
            {
                expr = parseExpr();
                temp = new unExprAST(expr);
                Boolean ind = false;
                while (currentToken.sym == sym.COMA)
                {
                    if (ind == false)
                    {
                        acceptIt();
                        expr   = parseExpr();
                        temp2  = new unExprAST(expr);
                        result = new varExprAST(temp2, temp);
                        ind    = true;
                    }
                    else
                    {
                        acceptIt();
                        expr   = parseExpr();
                        temp2  = new unExprAST(expr);
                        result = new varExprAST(result, temp2);
                    }
                }
                if (temp2 == null && result == null)
                {
                    return(new  actParsAST(temp));
                }

                return(new actParsAST(result));
            }
            else
            {
                error(currentToken, " '-' o 'ID'");
                return(null);
            }
        }
Пример #2
0
 public actParsAST(listExprAST l)
 {
     this.listExpr = l;
 }
Пример #3
0
 public varExprAST(listExprAST hh1, listExprAST hh2)
 {
     h1 = hh1;
     h2 = hh2;
 }