Package org.antlr.v4.runtime.atn

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


    isKeywords = false;
  }

  @Override
  public void enterPackage(@NotNull PackageContext ctx) {
    ParserRuleContext prc = ctx.getParent();
    if (!(prc instanceof DomainArrayContext)) {
      return;
    }
    DomainArrayContext dac = (DomainArrayContext) prc;
    DomainHeaderContext dhctx = (DomainHeaderContext) dac.getChild(0);
View Full Code Here


    this._decisionToDFA = new DFA[atn.getNumberOfDecisions()];
    for (int i = 0; i < _decisionToDFA.length; i++) {
      _decisionToDFA[i] = new DFA(atn.getDecisionState(i), i);
    }
    this._interp = new LexerATNSimulator(this,atn,_decisionToDFA,_sharedContextCache);
  }
View Full Code Here

      this.tokenCount = tokenCount;
      this.startTime = startTime;
      this.endTime = System.nanoTime();

      if (lexer != null) {
        LexerATNSimulator interpreter = lexer.getInterpreter();
        if (interpreter instanceof StatisticsLexerATNSimulator) {
          lexerTotalTransitions = ((StatisticsLexerATNSimulator)interpreter).totalTransitions;
          lexerComputedTransitions = ((StatisticsLexerATNSimulator)interpreter).computedTransitions;
        } else {
          lexerTotalTransitions = 0;
View Full Code Here

                          (double)(System.nanoTime() - startTime) / 1000000.0);

    if (sharedLexers.length > 0) {
      int index = FILE_GRANULARITY ? 0 : ((NumberedThread)Thread.currentThread()).getThreadNumber();
      Lexer lexer = sharedLexers[index];
      final LexerATNSimulator lexerInterpreter = lexer.getInterpreter();
      final DFA[] modeToDFA = lexerInterpreter.decisionToDFA;
      if (SHOW_DFA_STATE_STATS) {
        int states = 0;
        int configs = 0;
        Set<ATNConfig> uniqueConfigs = new HashSet<ATNConfig>();
View Full Code Here

              }

              if (COMPUTE_TRANSITION_STATS) {
                lexer.setInterpreter(new StatisticsLexerATNSimulator(lexer, lexer.getATN(), decisionToDFA, lexer.getInterpreter().getSharedContextCache()));
              } else if (!REUSE_LEXER_DFA) {
                lexer.setInterpreter(new LexerATNSimulator(lexer, lexer.getATN(), decisionToDFA, lexer.getInterpreter().getSharedContextCache()));
              }

              sharedLexers[thread] = lexer;
                        }
View Full Code Here

  public void checkPredictedAlt(LexerGrammar lg, Grammar g, int decision,
                  String inputString, int expectedAlt)
  {
    Tool.internalOption_ShowATNConfigsInDFA = true;
    ATN lexatn = createATN(lg, true);
    LexerATNSimulator lexInterp =
      new LexerATNSimulator(lexatn,new DFA[] { new DFA(lexatn.modeToStartState.get(Lexer.DEFAULT_MODE)) },new PredictionContextCache());
    IntegerList types = getTokenTypesViaATN(inputString, lexInterp);
    System.out.println(types);

    semanticProcess(lg);
    g.importVocab(lg);
View Full Code Here

  public void checkDFAConstruction(LexerGrammar lg, Grammar g, int decision,
                   String[] inputString, String[] dfaString)
  {
//    Tool.internalOption_ShowATNConfigsInDFA = true;
    ATN lexatn = createATN(lg, true);
    LexerATNSimulator lexInterp =
      new LexerATNSimulator(lexatn,new DFA[] { new DFA(lexatn.getDecisionState(Lexer.DEFAULT_MODE)) }, new PredictionContextCache());

    semanticProcess(lg);
    g.importVocab(lg);
    semanticProcess(g);
View Full Code Here

  public List<String> getTokenTypes(LexerGrammar lg,
                    ATN atn,
                    CharStream input)
  {
    LexerATNSimulator interp = new LexerATNSimulator(atn,new DFA[] { new DFA(atn.modeToStartState.get(Lexer.DEFAULT_MODE)) },null);
    List<String> tokenTypes = new ArrayList<String>();
    int ttype;
    boolean hitEOF = false;
    do {
      if ( hitEOF ) {
        tokenTypes.add("EOF");
        break;
      }
      int t = input.LA(1);
      ttype = interp.match(input, Lexer.DEFAULT_MODE);
      if ( ttype == Token.EOF ) {
        tokenTypes.add("EOF");
      }
      else {
        tokenTypes.add(lg.typeToTokenList.get(ttype));
View Full Code Here

  public void checkMatchedAlt(LexerGrammar lg, final Grammar g,
                String inputString,
                int expected)
  {
    ATN lexatn = createATN(lg, true);
    LexerATNSimulator lexInterp = new LexerATNSimulator(lexatn,new DFA[] { new DFA(lexatn.modeToStartState.get(Lexer.DEFAULT_MODE)) },null);
    IntegerList types = getTokenTypesViaATN(inputString, lexInterp);
    System.out.println(types);

    g.importVocab(lg);
View Full Code Here



    public MAG1Lexer(CharStream input) {
        super(input);
        _interp = new LexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache);
    }
View Full Code Here

TOP

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

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.