Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
ANTLR Runtime Source Code
ANTLR is a powerful parser generator for multiple programming languages including Java.
ANTLR contains 2 major modules:
ANTLR Runtime Source Code files are provided in the distribution packge (antlr4-4.10.1.zip). You can download them at ANTLR Website.
You can also browse the source code below:
✍: FYIcenter
⏎ org/antlr/v4/runtime/atn/ParseInfo.java
/* * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. * Use of this file is governed by the BSD 3-clause license that * can be found in the LICENSE.txt file in the project root. */ package org.antlr.v4.runtime.atn; import org.antlr.v4.runtime.dfa.DFA; import java.util.ArrayList; import java.util.List; /** * This class provides access to specific and aggregate statistics gathered * during profiling of a parser. * * @since 4.3 */ public class ParseInfo { protected final ProfilingATNSimulator atnSimulator; public ParseInfo(ProfilingATNSimulator atnSimulator) { this.atnSimulator = atnSimulator; } /** * Gets an array of {@link DecisionInfo} instances containing the profiling * information gathered for each decision in the ATN. * * @return An array of {@link DecisionInfo} instances, indexed by decision * number. */ public DecisionInfo[] getDecisionInfo() { return atnSimulator.getDecisionInfo(); } /** * Gets the decision numbers for decisions that required one or more * full-context predictions during parsing. These are decisions for which * {@link DecisionInfo#LL_Fallback} is non-zero. * * @return A list of decision numbers which required one or more * full-context predictions during parsing. */ public List<Integer> getLLDecisions() { DecisionInfo[] decisions = atnSimulator.getDecisionInfo(); List<Integer> LL = new ArrayList<Integer>(); for (int i=0; i<decisions.length; i++) { long fallBack = decisions[i].LL_Fallback; if ( fallBack>0 ) LL.add(i); } return LL; } /** * Gets the total time spent during prediction across all decisions made * during parsing. This value is the sum of * {@link DecisionInfo#timeInPrediction} for all decisions. */ public long getTotalTimeInPrediction() { DecisionInfo[] decisions = atnSimulator.getDecisionInfo(); long t = 0; for (int i=0; i<decisions.length; i++) { t += decisions[i].timeInPrediction; } return t; } /** * Gets the total number of SLL lookahead operations across all decisions * made during parsing. This value is the sum of * {@link DecisionInfo#SLL_TotalLook} for all decisions. */ public long getTotalSLLLookaheadOps() { DecisionInfo[] decisions = atnSimulator.getDecisionInfo(); long k = 0; for (int i = 0; i < decisions.length; i++) { k += decisions[i].SLL_TotalLook; } return k; } /** * Gets the total number of LL lookahead operations across all decisions * made during parsing. This value is the sum of * {@link DecisionInfo#LL_TotalLook} for all decisions. */ public long getTotalLLLookaheadOps() { DecisionInfo[] decisions = atnSimulator.getDecisionInfo(); long k = 0; for (int i = 0; i < decisions.length; i++) { k += decisions[i].LL_TotalLook; } return k; } /** * Gets the total number of ATN lookahead operations for SLL prediction * across all decisions made during parsing. */ public long getTotalSLLATNLookaheadOps() { DecisionInfo[] decisions = atnSimulator.getDecisionInfo(); long k = 0; for (int i = 0; i < decisions.length; i++) { k += decisions[i].SLL_ATNTransitions; } return k; } /** * Gets the total number of ATN lookahead operations for LL prediction * across all decisions made during parsing. */ public long getTotalLLATNLookaheadOps() { DecisionInfo[] decisions = atnSimulator.getDecisionInfo(); long k = 0; for (int i = 0; i < decisions.length; i++) { k += decisions[i].LL_ATNTransitions; } return k; } /** * Gets the total number of ATN lookahead operations for SLL and LL * prediction across all decisions made during parsing. * * <p> * This value is the sum of {@link #getTotalSLLATNLookaheadOps} and * {@link #getTotalLLATNLookaheadOps}.</p> */ public long getTotalATNLookaheadOps() { DecisionInfo[] decisions = atnSimulator.getDecisionInfo(); long k = 0; for (int i = 0; i < decisions.length; i++) { k += decisions[i].SLL_ATNTransitions; k += decisions[i].LL_ATNTransitions; } return k; } /** * Gets the total number of DFA states stored in the DFA cache for all * decisions in the ATN. */ public int getDFASize() { int n = 0; DFA[] decisionToDFA = atnSimulator.decisionToDFA; for (int i = 0; i < decisionToDFA.length; i++) { n += getDFASize(i); } return n; } /** * Gets the total number of DFA states stored in the DFA cache for a * particular decision. */ public int getDFASize(int decision) { DFA decisionToDFA = atnSimulator.decisionToDFA[decision]; return decisionToDFA.states.size(); } }
⏎ org/antlr/v4/runtime/atn/ParseInfo.java
Or download all of them as a single archive file:
File name: antlr-runtime-4.10.1-sources.jar File size: 308953 bytes Release date: 2022-04-15 Download
⇐ What Is ANTLR Parser Generator
2018-10-21, 31705👍, 0💬
Popular Posts:
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...
How to show the XML parsing flow with sax\DocumentTracer.java provided in the Apache Xerces package?...
What is the dom\GetElementsByTagName .javaprovided in the Apache Xerces package? I have Apache Xerce...
How to download and install mysql-connector-j-8.0.31 .zip?Connector/J Java library is a JDBC Driver ...
How to download and install mysql-connector-j-8.0.31 .zip?Connector/J Java library is a JDBC Driver ...