Examples of ParserATNFactory


Examples of org.antlr.v4.automata.ParserATNFactory

    List<String> evals = new ArrayList<String>();
    if ( g.ast!=null && !g.ast.hasErrors ) {
      SemanticPipeline sem = new SemanticPipeline(g);
      sem.process();

      ATNFactory factory = new ParserATNFactory(g);
      if (g.isLexer()) factory = new LexerATNFactory((LexerGrammar) g);
      g.atn = factory.createATN();

      CodeGenerator gen = new CodeGenerator(g);
      ST outputFileST = gen.generateParser();

//      STViz viz = outputFileST.inspect();
View Full Code Here

Examples of org.antlr.v4.automata.ParserATNFactory

    semanticProcess(lg);
    g.importVocab(lg);
    semanticProcess(g);

    ParserATNFactory f = new ParserATNFactory(g);
    ATN atn = f.createATN();

    DOTGenerator dot = new DOTGenerator(g);

    Rule r = g.getRule("a");
    if ( r!=null) System.out.println(dot.getDOT(atn.ruleToStartState[r.index]));
View Full Code Here

Examples of org.antlr.v4.automata.ParserATNFactory

  protected ATN createATN(Grammar g, boolean useSerializer) {
    if ( g.atn==null ) {
      semanticProcess(g);
      assertEquals(0, g.tool.getNumErrors());

      ParserATNFactory f;
      if ( g.isLexer() ) {
        f = new LexerATNFactory((LexerGrammar)g);
      }
      else {
        f = new ParserATNFactory(g);
      }

      g.atn = f.createATN();
      assertEquals(0, g.tool.getNumErrors());
    }

    ATN atn = g.atn;
    if (useSerializer) {
View Full Code Here

Examples of org.antlr.v4.automata.ParserATNFactory

    Grammar g = new Grammar(grammar, equeue);
    if ( g.ast!=null && !g.ast.hasErrors ) {
      SemanticPipeline sem = new SemanticPipeline(g);
      sem.process();

      ATNFactory factory = new ParserATNFactory(g);
      if ( g.isLexer() ) factory = new LexerATNFactory((LexerGrammar)g);
      g.atn = factory.createATN();

      CodeGenerator gen = new CodeGenerator(g);
      ST outputFileST = gen.generateParser();
      String output = outputFileST.render();
      //System.out.println(output);
View Full Code Here

Examples of org.antlr.v4.automata.ParserATNFactory

    if ( errMgr.getNumErrors()>prevErrors ) return;

    // BUILD ATN FROM AST
    ATNFactory factory;
    if ( g.isLexer() ) factory = new LexerATNFactory((LexerGrammar)g);
    else factory = new ParserATNFactory(g);
    g.atn = factory.createATN();

    if ( generate_ATN_dot ) generateATNs(g);

    // PERFORM GRAMMAR ANALYSIS ON ATN: BUILD DECISION DFAs
View Full Code Here

Examples of org.antlr.v4.automata.ParserATNFactory

    if ( modeName==null ) modeName = "DEFAULT_MODE";
    if ( g.modes.get(modeName)==null ) {
      System.err.println("no such mode "+modeName);
      return;
    }
    ParserATNFactory f = new LexerATNFactory(g);
    ATN nfa = f.createATN();
    ATNState startState = nfa.modeNameToStartState.get(modeName);
    ATNPrinter serializer = new ATNPrinter(g, startState);
    String result = serializer.asString();
    //System.out.print(result);
    assertEquals(expecting, result);
View Full Code Here

Examples of org.antlr.v4.automata.ParserATNFactory

    IntegerList types = getTokenTypesViaATN(inputString, lexInterp);
    System.out.println(types);

    g.importVocab(lg);

    ParserATNFactory f = new ParserATNFactory(g);
    ATN atn = f.createATN();

    IntTokenStream input = new IntTokenStream(types);
    System.out.println("input="+input.types);
    ParserInterpreterForTesting interp = new ParserInterpreterForTesting(g, input);
    ATNState startState = atn.ruleToStartState[g.getRule("a").index];
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.