Package Dependencies.PR1

Examples of Dependencies.PR1.FileReader


        if (aux.length() <= 0) {
            ponerAnalizarFallido("El conjunto de instrucciones está vacío");
        }
        else {
            FileReader fr = new FileReader("src" + File.separator + "Palabras reservadas.txt");

            String[] palabrasReservadas = null;
            try {
                palabrasReservadas = fr.palabrasReservadas();
            }
            catch (Exception e) {
                ponerAnalizarFallido("No se encuentra directorio con palabras reservadas.");
            }
            LexicalAnalyzer al = new LexicalAnalyzer(palabrasReservadas);
View Full Code Here


        pack();
    }// </editor-fold>

    private void b1ActionPerformed(ActionEvent evt) throws IOException {
        Grammar g = new Grammar("src" + File.separator + "Gramatica_Logo.txt");
        String cadenaString = textArea.getText();
        StringTokenizer st = new StringTokenizer(cadenaString, "\n");
        String aux = "";
        while (st.hasMoreTokens()) {
            aux += st.nextToken() + "$";
View Full Code Here

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

            //Tratamos 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.

            while ((aux = br.readLine()).compareTo("}") != 0) {
                if (!aux.startsWith("//") && aux.length() != 0) {
                    split = aux.split(" -> ");
                    VN antecedente = new VN(split[0]);
                    List<V> consecuentes = analizarConsecuentes(split[1], listaVN, listaVT);
                    producciones.add(new Production(antecedente, consecuentes));
                }
            }
View Full Code Here

            if (esTerminal(c, listaVN, listaVT)) {
                VT consecuente = new VT(c + "");
                toReturn.add(consecuente);
            }
            else {
                toReturn.add(new VN(c + ""));
            }
        }
        return toReturn;
    }
View Full Code Here

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

            //Tratamos 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.

            while ((aux = br.readLine()).compareTo("}") != 0) {
                if (!aux.startsWith("//") && aux.length() != 0) {
                    split = aux.split(" ::= ");
                    VN antecedente = new VN(split[0]);
                    List<V> consecuentes = analizarConsecuentes(split[1], listaVN, listaVT);
                    producciones.add(new Production(antecedente, consecuentes));
                }
            }
View Full Code Here

        this.antecedente = antecedente;
        this.consecuente = consecuente;
    }

    public Production() {
        this.antecedente = new VN("");
        this.consecuente = new ArrayList<V>();
    }
View Full Code Here

    public List<V> clonarConsecuentes(List<V> consecuente) {
        List<V> toReturn = new ArrayList<V>();
        for (V cons : consecuente) {
            if (cons instanceof VN) {
                VN transf = (VN) cons;
                VN copia = transf.clone();
                toReturn.add(copia);
            }
            else {
                VT transf = (VT) cons;
                VT copia = transf.clone();
View Full Code Here

        //Inicialización de variables.

        listaVN = new ArrayList<VN>();
        listaVT = new ArrayList<VT>();
        producciones = new ArrayList<Production>();
        simbInicial = new VN();

        //Lectura de fichero.

        FileReader lF = new FileReader(path);
        lF.analizarFichero(listaVN, listaVT, producciones, simbInicial);
View Full Code Here

            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

        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

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.