Package org.antlr.v4.runtime.atn

Examples of org.antlr.v4.runtime.atn.ATN


      "0->1 EPSILON 0,0,0\n" +
      "1->3 EPSILON 0,0,0\n" +
      "3->4 NOT_SET 0,0,0\n" +
      "4->2 EPSILON 0,0,0\n" +
      "0:0\n";
    ATN atn = createATN(lg, true);
    String result = ATNSerializer.getDecoded(atn, Arrays.asList(lg.getTokenNames()));
    assertEquals(expecting, result);
  }
View Full Code Here


      "0->1 EPSILON 0,0,0\n" +
      "1->3 EPSILON 0,0,0\n" +
      "3->4 SET 0,0,0\n" +
      "4->2 EPSILON 0,0,0\n" +
      "0:0\n";
    ATN atn = createATN(lg, true);
    String result = ATNSerializer.getDecoded(atn, Arrays.asList(lg.getTokenNames()));
    assertEquals(expecting, result);
  }
View Full Code Here

      "0->1 EPSILON 0,0,0\n" +
      "1->3 EPSILON 0,0,0\n" +
      "3->4 NOT_SET 0,0,0\n" +
      "4->2 EPSILON 0,0,0\n" +
      "0:0\n";
    ATN atn = createATN(lg, true);
    String result = ATNSerializer.getDecoded(atn, Arrays.asList(lg.getTokenNames()));
    assertEquals(expecting, result);
  }
View Full Code Here

        "19->20 ACTION 2,1,0\n" +
        "20->7 EPSILON 0,0,0\n" +
        "0:0\n" +
        "1:1\n" +
        "2:11\n";
    ATN atn = createATN(lg, true);
    String result = ATNSerializer.getDecoded(atn, Arrays.asList(lg.getTokenNames()));
    assertEquals(expecting, result);
  }
View Full Code Here

        "1->3 EPSILON 0,0,0\n" +
        "3->4 NOT_SET 0,0,0\n" +
        "4->5 NOT_SET 1,0,0\n" +
        "5->2 EPSILON 0,0,0\n" +
        "0:0\n";
    ATN atn = createATN(lg, true);
    String result = ATNSerializer.getDecoded(atn, Arrays.asList(lg.getTokenNames()));
    assertEquals(expecting, result);
  }
View Full Code Here

      "15->7 EPSILON 0,0,0\n" +
      "16->17 ATOM 100,0,0\n" +
      "17->9 EPSILON 0,0,0\n" +
      "0:0\n" +
      "1:1\n";
    ATN atn = createATN(lg, true);
    String result = ATNSerializer.getDecoded(atn, Arrays.asList(lg.getTokenNames()));
    assertEquals(expecting, result);
  }
View Full Code Here

      "13->14 ATOM 99,0,0\n" +
      "14->8 EPSILON 0,0,0\n" +
      "0:0\n" +
      "1:1\n" +
      "2:2\n";
    ATN atn = createATN(lg, true);
    String result = ATNSerializer.getDecoded(atn, Arrays.asList(lg.getTokenNames()));
    assertEquals(expecting, result);
  }
View Full Code Here

    String expecting = "A, DONE, EOF";
    checkLexerMatches(lg, "a", expecting);
  }

  protected void checkLexerMatches(LexerGrammar lg, String inputString, String expecting) {
    ATN atn = createATN(lg, true);
    CharStream input = new ANTLRInputStream(inputString);
    ATNState startState = atn.modeNameToStartState.get("DEFAULT_MODE");
    DOTGenerator dot = new DOTGenerator(lg);
    System.out.println(dot.getDOT(startState, true));
View Full Code Here

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

    ATN atn = g.atn;
    if (useSerializer) {
      char[] serialized = ATNSerializer.getSerializedAsChars(atn);
      return new ATNDeserializer().deserialize(serialized);
    }
View Full Code Here

  List<ANTLRMessage> checkRuleDFA(String gtext, String ruleName, String expecting)
    throws Exception
  {
    ErrorQueue equeue = new ErrorQueue();
    Grammar g = new Grammar(gtext, equeue);
    ATN atn = createATN(g, false);
    ATNState s = atn.ruleToStartState[g.getRule(ruleName).index];
    if ( s==null ) {
      System.err.println("no such rule: "+ruleName);
      return null;
    }
View Full Code Here

TOP

Related Classes of org.antlr.v4.runtime.atn.ATN

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.