Package org.antlr.v4

Examples of org.antlr.v4.Tool.addListener()


    final String[] optionsA = new String[options.size()];
    options.toArray(optionsA);
    Tool antlr = newTool(optionsA);
    ErrorQueue equeue = new ErrorQueue(antlr);
    antlr.addListener(equeue);
    if (defaultListener) {
      antlr.addListener(new DefaultToolListener(antlr));
    }
    antlr.processGrammarsOnCommandLine();
View Full Code Here


    options.toArray(optionsA);
    Tool antlr = newTool(optionsA);
    ErrorQueue equeue = new ErrorQueue(antlr);
    antlr.addListener(equeue);
    if (defaultListener) {
      antlr.addListener(new DefaultToolListener(antlr));
    }
    antlr.processGrammarsOnCommandLine();

    if ( !defaultListener && !equeue.errors.isEmpty() ) {
      System.err.println("antlr reports errors from "+options);
View Full Code Here

        "a : A;\n"+
        "A : a;\n";

      Tool tool = new Tool();
      tool.removeListeners();
      tool.addListener(errorQueue);
      assertEquals(0, errorQueue.size());
      GrammarRootAST grammarRootAST = tool.parseGrammarFromString(gstr);
      assertEquals(0, errorQueue.size());
      Grammar g = tool.createGrammar(grammarRootAST);
      assertEquals(0, errorQueue.size());
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.