Package org.antlr.misc

Examples of org.antlr.misc.Graph.sort()


            catch (FileNotFoundException fnfe) {
                ErrorManager.error(ErrorManager.MSG_CANNOT_OPEN_FILE, gfile);
                missingFiles.add(gfile);
            }
        }
        List<Object> sorted = g.sort();
        //System.out.println("sorted="+sorted);
        grammarFileNames.clear(); // wipe so we can give new ordered list
        for (int i = 0; i < sorted.size(); i++) {
            String f = (String)sorted.get(i);
            if ( missingFiles.contains(f) ) continue;
View Full Code Here


        g.addEdge("D", "F");
        g.addEdge("F", "H");
        g.addEdge("E", "F");

        String expecting = "[H, F, E, D, G, A, B, C]";
        List nodes = g.sort();
        String result = nodes.toString();
        assertEquals(expecting, result);
    }

    @Test
View Full Code Here

        g.addEdge("B", "C");
        g.addEdge("C", "A");
        g.addEdge("C", "D");

        String expecting = "[D, C, B, A]";
        List nodes = g.sort();
        String result = nodes.toString();
        assertEquals(expecting, result);
    }

    @Test
View Full Code Here

        g.addEdge("B", "C");
        g.addEdge("A", "B"); // dup
        g.addEdge("C", "D");

        String expecting = "[D, C, B, A]";
        List nodes = g.sort();
        String result = nodes.toString();
        assertEquals(expecting, result);
    }

    @Test
View Full Code Here

        g.addEdge("Java.tokens", "Java.g");       
        g.addEdge("Def.g", "Java.tokens");    // walkers feed off generated tokens
        g.addEdge("Ref.g", "Java.tokens");

        String expecting = "[MyJava.tokens, Java.g, Java.tokens, Ref.g, Def.g]";
        List nodes = g.sort();
        String result = nodes.toString();
        assertEquals(expecting, result);
    }

    @Test
View Full Code Here

        g.addEdge("JavaParser.g", "JavaLexer.tokens");
        g.addEdge("Def.g", "JavaLexer.tokens");
        g.addEdge("Ref.g", "JavaLexer.tokens");

        String expecting = "[JavaLexer.g, JavaLexer.tokens, JavaParser.g, Ref.g, Def.g]";
        List nodes = g.sort();
        String result = nodes.toString();
        assertEquals(expecting, result);
    }
}
View Full Code Here

            catch (FileNotFoundException fnfe) {
                ErrorManager.error(ErrorManager.MSG_CANNOT_OPEN_FILE, gfile);
                missingFiles.add(gfile);
            }
        }
        List<Object> sorted = g.sort();
        //System.out.println("sorted="+sorted);
        grammarFileNames.clear(); // wipe so we can give new ordered list
        for (int i = 0; i < sorted.size(); i++) {
            String f = (String)sorted.get(i);
            if ( missingFiles.contains(f) ) continue;
View Full Code Here

        g.addEdge("D", "F");
        g.addEdge("F", "H");
        g.addEdge("E", "F");

        String expecting = "[H, F, E, D, A, G, B, C]";
        List nodes = g.sort();
        String result = nodes.toString();
        assertEquals(expecting, result);
    }

    @Test
View Full Code Here

        g.addEdge("B", "C");
        g.addEdge("C", "A");
        g.addEdge("C", "D");

        String expecting = "[D, C, B, A]";
        List nodes = g.sort();
        String result = nodes.toString();
        assertEquals(expecting, result);
    }

    @Test
View Full Code Here

        g.addEdge("B", "C");
        g.addEdge("A", "B"); // dup
        g.addEdge("C", "D");

        String expecting = "[D, C, B, A]";
        List nodes = g.sort();
        String result = nodes.toString();
        assertEquals(expecting, result);
    }

    @Test
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.