Examples of VT


Examples of Dependencies.PR1.Symbols.VT

            aux = br.readLine(); //Línea de VT.
            String linea_VT = aux.substring(6, aux.length() - 1);
            split = linea_VT.split(", ");
            for (String s : split) {
                listaVT.add(new VT(s));
            }

            //Tratamos P.

            aux = br.readLine(); //Línea de P.
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        List<V> toReturn = new ArrayList<V>();
        String[] sp = consecuentes.split(" ");
        for (int i = 0; i < sp.length; i++) {
            String c = sp[i];//consecuentes.charAt(i);
            if (esTerminal(c, listaVN, listaVT)) {
                VT consecuente = new VT(c + "");
                toReturn.add(consecuente);
            }
            else {
                toReturn.add(new VN(c + ""));
            }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        }
        return toReturn;
    }

    private boolean esTerminal(String simb, Collection<VN> listaVN, Collection<VT> listaVT) {
        VT v = new VT(simb);
        return listaVT.contains(v);//!(Character.isUpperCase(simb));
    }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

            aux = br.readLine(); //Línea de VT.
            String linea_VT = aux.substring(6, aux.length() - 1);
            split = linea_VT.split(", ");
            for (String s : split) {
                listaVT.add(new VT(s));
            }

            //Tratamos P.

            aux = br.readLine(); //Línea de P.
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        //Consecuente = lambda
    }

    void PASO() {
        if (esCasa()) {
            Match(new VT("TK_CASA"));
            t.home();
            return;
        }
        if (esGiro()) {
            Match(new VT("TK_GIRO"));
            double d = E();
            t.turn(d);
            return;
        }
        if (esAvanza()) {
            Match(new VT("TK_AVANZA"));
            double d = E();
            t.penUp();
            t.move(d);
            t.penDown();
            return;
        }
        if (esPinta()) {
            Match(new VT("TK_PINTA"));
            double d = E();
            t.forward(d);
            return;
        }
        if (esID()) {
            String nombreID = (String) tokenActual.getContenido();
            Match(new VT("TK_ID"));
            Match(new VT("TK_ASIGN"));
            double d = E();
            tablaIdentificadores.put(nombreID, d);
            return;
        }
        if (esColor()) {
            Match(new VT("TK_COLOR"));
            Match(new VT("TK_ASIGN"));
            Color c = COLOR();
            t.setColor(c);
            return;
        }
        if (esCondicional()) {
            Match(new VT("TK_SI"));
            boolean resultado = CONDICIONAL();
            if (resultado) {
                Match(new VT("TK_ENTONCES"));
                PASO();
                nLlamadasRecursivas--;
            }
            else {
                irSiguienteLinea();
            }
            return;
        }
        if (esSalto()) {
            Match(new VT("TK_IR_A"));
            int valor = (int) E();
            saltar(valor);
            return;
        }
        throw new SyntaxException("Esperaba pinta, casa, avanza, giro, identificador, color, condicional (SI) o salto (ir_a).");
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

    }

    boolean COND_PAR() {
        boolean salida = true;
        if (esParentesisAbierto()) {
            Match(new VT("TK_PAR_ABR"));
            salida = CONDICIONAL();
            Match(new VT("TK_PAR_CER"));
            if (esAndOr()) {
                salida = AndOr(salida);
            }
        }
        return salida;
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        return salida;
    }

    boolean NOT(boolean not) {
        if (esNot()) {
            Match(new VT("TK_NOT"));
            not = !NOT(not);
        }
        return not;
    }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        return not;
    }

    boolean AndOr(boolean r) {
        if (esAnd()) {
            Match(new VT("TK_AND"));
            boolean r2 = CONDICIONAL();
            return r && r2;
        }
        if (esOr()) {
            Match(new VT("TK_OR"));
            boolean r2 = CONDICIONAL();
            return r || r2;
        }
        throw new OperatorException("Esperaba AND o OR.");
    }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

    boolean COMP() {
        double valor1 = E();
        if (esComparador()) {
            if (esMayor()) {
                Match(new VT("TK_MAYOR"));
                double valor2 = E();
                return valor1 > valor2;
            }
            else if (esMenor()) {
                Match(new VT("TK_MENOR"));
                double valor2 = E();
                return valor1 < valor2;
            }
            else if (esDistinto()) {
                Match(new VT("TK_DISTINTO"));
                double valor2 = E();
                return valor1 != valor2;
            }
            else if (esComparacion()) {
                Match(new VT("TK_IGUALDAD"));
                double valor2 = E();
                return valor1 == valor2;
            }
            else if (esMayorIgual()) {
                Match(new VT("TK_MAYOR_IGUAL"));
                double valor2 = E();
                return valor1 >= valor2;
            }
            else if (esMenorIgual()) {
                Match(new VT("TK_MENOR_IGUAL"));
                double valor2 = E();
                return valor1 <= valor2;
            }
        }
        throw new OperatorException("Esperaba comparador.");
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        throw new OperatorException("Esperaba comparador.");
    }

    Color COLOR() {
        if (esNegro()) {
            Match(new VT("TK_NEGRO"));
            return Color.black;
        }
        if (esVerde()) {
            Match(new VT("TK_VERDE"));
            return Color.green;
        }
        if (esNaranja()) {
            Match(new VT("TK_NARANJA"));
            return Color.orange;
        }
        if (esRosa()) {
            Match(new VT("TK_ROSA"));
            return Color.pink;
        }
        if (esRojo()) {
            Match(new VT("TK_ROJO"));
            return Color.red;
        }
        if (esBlanco()) {
            Match(new VT("TK_BLANCO"));
            return Color.white;
        }
        if (esAmarillo()) {
            Match(new VT("TK_AMARILLO"));
            return Color.yellow;
        }
        if (esMagenta()) {
            Match(new VT("TK_MAGENTA"));
            return Color.magenta;
        }
        throw new ColorException("Esperaba color.");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.