Package Dependencies.PR1

Examples of Dependencies.PR1.FileReader


        throw new ArithmeticException("Esperaba '*' o '/'.");
    }

    double F() {
        if (esParentesisAbierto()) {
            Match(new VT("TK_PAR_ABR"));
            double valor = E();
            Match(new VT("TK_PAR_CER"));
            return valor;
        }
        else if (esID()) {
            double valor = devolverTabla((String) tokenActual.getContenido());
            Match(new VT("TK_ID"));
            return valor;
        }
        else if (esNumero()) {
            double valor = 0;
            try {
                if (tokenActual.getContenido() instanceof Integer) {
                    valor = (double) (int) tokenActual.getContenido();
                }
                else //Suponemos que es double entonces
                    valor = (double) tokenActual.getContenido();
                }
            }
            catch (Exception e) {
                throw new InterpreterException("No es número entero o double");
            }
            Match(new VT("TK_CTE_NUM"));
            return valor;
        }
        else if (esNumeroD()) {
            double valor = Double.parseDouble((String) tokenActual.getContenido());
            Match(new VT("TK_NOTCNTF"));
            return valor;
        }
        else if (esMasMenos()) {
            int simbolo = MAS_MENOS(1);
            double valor = F();
View Full Code Here


        throw new SyntaxException("Esperaba paréntesis abierto, identificador o número.");
    }

    int MAS_MENOS(int n) {
        if (esMas()) {
            Match(new VT("TK_MAS"));
            return +n;
        }
        else if (esMenos()) {
            Match(new VT("TK_MENOS"));
            return -n;
        }
        throw new ArithmeticException("Espera '+' o '-'.");
    }
View Full Code Here

                VN transf = (VN) cons;
                VN copia = transf.clone();
                toReturn.add(copia);
            }
            else {
                VT transf = (VT) cons;
                VT copia = transf.clone();
                toReturn.add(copia);
            }
        }
        return toReturn;
    }
View Full Code Here

        //Consecuente = lambda
    }

    void PASO() {
        if (esCasa()) {
            Match(new VT("TK_CASA"));
            return;
        }
        if (esGiro()) {
            Match(new VT("TK_GIRO"));
            E();
            return;
        }
        if (esAvanza()) {
            Match(new VT("TK_AVANZA"));
            E();
            return;
        }
        if (esPinta()) {
            Match(new VT("TK_PINTA"));
            E();
            return;
        }
        if (esID()) {
            Match(new VT("TK_ID"));
            Match(new VT("TK_ASIGN"));
            E();
            return;
        }
        if (esColor()) {
            Match(new VT("TK_COLOR"));
            Match(new VT("TK_ASIGN"));
            COLOR();
            return;
        }
        if (esCondicional()) {
            Match(new VT("TK_SI"));
            CONDICIONAL();
            Match(new VT("TK_ENTONCES"));
            PASO();
            return;
        }
        if (esSalto()) {
            Match(new VT("TK_IR_A"));
            E();
            return;
        }
        throw new SyntaxException("Esperaba pinta, casa, avanza, giro, identificador, color, condicional (SI) o salto (ir_a).");
    }
View Full Code Here

        }
    }
   
    void COND_PAR () {
        if (esParentesisAbierto()) {
            Match(new VT("TK_PAR_ABR"));
            CONDICIONAL();
            Match(new VT("TK_PAR_CER"));
            if (esAndOr()){
                AndOr();
            }
        }
    }
View Full Code Here

        }
    }
   
    void NOT () {
        if (esNot()) {
            Match (new VT("TK_NOT"));
            NOT();
        }
    }
View Full Code Here

        }
    }
   
    void AndOr() {
        if (esAnd()) {
            Match(new VT("TK_AND"));
            CONDICIONAL();
            return;
        }
        else if (esOr()) {
            Match(new VT("TK_OR"));
            CONDICIONAL();
            return;
        }
        throw new OperatorException("Esperaba AND o OR");
    }
View Full Code Here

   
    void COMP () {
        E();
        if (esComparador()) {
            if (esMayor()) {
                Match(new VT("TK_MAYOR"));
            }
            else if (esMenor()) {
                Match(new VT("TK_MENOR"));
            }
            else if (esDistinto()) {
                Match(new VT("TK_DISTINTO"));
            }
            else if (esComparacion()) {
                Match(new VT("TK_IGUALDAD"));
            }
            else if (esMayorIgual()) {
                Match(new VT("TK_MAYOR_IGUAL"));
            }
            else if (esMenorIgual()) {
                Match(new VT("TK_MENOR_IGUAL"));
            }
            E();
            return;
        }
        throw new OperatorException("Esperaba comparador");
View Full Code Here

        throw new OperatorException("Esperaba comparador");
    }
   
    void COLOR () {
        if (esNegro()) {
            Match(new VT("TK_NEGRO"));
            return;
        }
        if (esVerde()) {
            Match(new VT("TK_VERDE"));
            return;
        }
        if (esNaranja()) {
            Match(new VT("TK_NARANJA"));
            return;
        }
        if (esRosa()) {
            Match(new VT("TK_ROSA"));
            return;
        }
        if (esRojo()) {
            Match(new VT("TK_ROJO"));
            return;
        }
        if (esBlanco()) {
            Match(new VT("TK_BLANCO"));
            return;
        }
        if (esAmarillo()) {
            Match(new VT("TK_AMARILLO"));
            return;
        }
        if (esMagenta()) {
            Match(new VT("TK_MAGENTA"));
            return;
        }
        throw new ColorException("Esperaba color");
    }
View Full Code Here

        }
    }
   
    void E_PRIMA() {
        if (esSuma()) {
            Match(new VT("TK_MAS"));
            T();
            if (esSumaResta()) {
                E_PRIMA();
            }
            return;
        }
        else if (esResta()) {
            Match(new VT("TK_MENOS"));
            T();
            if (esSumaResta()) {
                E_PRIMA();
            }
            return;
View Full Code Here

TOP

Related Classes of Dependencies.PR1.FileReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.