|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.antlr.runtime.debug.BlankDebugEventListener
org.antlr.runtime.debug.Profiler
public class Profiler
Using the debug event interface, track what is happening in the parser and record statistics about the runtime.
| Field Summary | |
|---|---|
protected int |
decisionLevel
|
int[] |
decisionMaxCyclicLookaheads
|
int[] |
decisionMaxFixedLookaheads
|
java.util.List |
decisionMaxSynPredLookaheads
|
protected CommonToken |
lastTokenConsumed
|
protected java.util.List |
lookaheadStack
|
protected int |
maxLookaheadInCurrentDecision
|
int |
maxRuleInvocationDepth
|
static int |
NUM_RUNTIME_STATS
|
int |
numBacktrackDecisions
|
protected int |
numberReportedErrors
|
int |
numCharsMatched
|
int |
numCyclicDecisions
|
int |
numFixedDecisions
|
int |
numGuessingRuleInvocations
|
int |
numHiddenCharsMatched
|
int |
numHiddenTokens
|
int |
numMemoizationCacheEntries
|
int |
numMemoizationCacheHits
|
int |
numMemoizationCacheMisses
|
int |
numRuleInvocations
|
int |
numSemanticPredicates
|
int |
numSyntacticPredicates
|
DebugParser |
parser
|
protected int |
ruleLevel
|
static java.lang.String |
RUNTIME_STATS_FILENAME
|
static java.lang.String |
Version
Because I may change the stats, I need to track that for later computations to be consistent. |
| Fields inherited from interface org.antlr.runtime.debug.DebugEventListener |
|---|
FALSE, PROTOCOL_VERSION, TRUE |
| Constructor Summary | |
|---|---|
Profiler()
|
|
Profiler(DebugParser parser)
|
|
| Method Summary | |
|---|---|
void |
beginBacktrack(int level)
Track backtracking decisions. |
void |
consumeHiddenToken(Token token)
An off-channel input token was consumed. |
void |
consumeToken(Token token)
An input token was consumed; matched by any kind of element. |
protected static java.lang.String[] |
decodeReportData(java.lang.String data)
|
void |
endBacktrack(int level,
boolean successful)
Successful or not, track how much lookahead synpreds use |
void |
enterDecision(int decisionNumber)
Every decision, fixed k or arbitrary, has an enter/exit event so that a GUI can easily track what LT/consume events are associated with prediction. |
void |
enterRule(java.lang.String grammarFileName,
java.lang.String ruleName)
The parser has just entered a rule. |
void |
examineRuleMemoization(IntStream input,
int ruleIndex,
java.lang.String ruleName)
Track memoization; this is not part of standard debug interface but is triggered by profiling. |
void |
exitDecision(int decisionNumber)
|
void |
exitRule(java.lang.String grammarFileName,
java.lang.String ruleName)
This is the last thing executed before leaving a rule. |
int |
getNumberOfHiddenTokens(int i,
int j)
Get num hidden tokens between i..j inclusive |
boolean |
inDecision()
The parser is in a decision if the decision depth > 0. |
void |
LT(int i,
Token t)
Track refs to lookahead if in a fixed/nonfixed decision. |
void |
memoize(IntStream input,
int ruleIndex,
int ruleStartIndex,
java.lang.String ruleName)
|
void |
recognitionException(RecognitionException e)
A recognition exception occurred such as NoViableAltException. |
void |
semanticPredicate(boolean result,
java.lang.String predicate)
A semantic predicate was evaluate with this result and action text |
void |
setParser(DebugParser parser)
|
void |
terminate()
Parsing is over; successfully or not. |
protected int[] |
toArray(java.util.List a)
|
java.lang.String |
toNotifyString()
|
java.lang.String |
toString()
|
static java.lang.String |
toString(java.lang.String notifyDataLine)
|
protected int[] |
trim(int[] X,
int n)
|
| Methods inherited from class org.antlr.runtime.debug.BlankDebugEventListener |
|---|
addChild, becomeRoot, beginResync, commence, consumeNode, createNode, createNode, endResync, enterAlt, enterSubRule, errorNode, exitSubRule, location, LT, mark, nilNode, rewind, rewind, setTokenBoundaries |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String Version
public static final java.lang.String RUNTIME_STATS_FILENAME
public static final int NUM_RUNTIME_STATS
public DebugParser parser
protected int ruleLevel
protected int decisionLevel
protected int maxLookaheadInCurrentDecision
protected CommonToken lastTokenConsumed
protected java.util.List lookaheadStack
public int numRuleInvocations
public int numGuessingRuleInvocations
public int maxRuleInvocationDepth
public int numFixedDecisions
public int numCyclicDecisions
public int numBacktrackDecisions
public int[] decisionMaxFixedLookaheads
public int[] decisionMaxCyclicLookaheads
public java.util.List decisionMaxSynPredLookaheads
public int numHiddenTokens
public int numCharsMatched
public int numHiddenCharsMatched
public int numSemanticPredicates
public int numSyntacticPredicates
protected int numberReportedErrors
public int numMemoizationCacheMisses
public int numMemoizationCacheHits
public int numMemoizationCacheEntries
| Constructor Detail |
|---|
public Profiler()
public Profiler(DebugParser parser)
| Method Detail |
|---|
public void enterRule(java.lang.String grammarFileName,
java.lang.String ruleName)
DebugEventListener
enterRule in interface DebugEventListenerenterRule in class BlankDebugEventListener
public void examineRuleMemoization(IntStream input,
int ruleIndex,
java.lang.String ruleName)
public void memoize(IntStream input,
int ruleIndex,
int ruleStartIndex,
java.lang.String ruleName)
public void exitRule(java.lang.String grammarFileName,
java.lang.String ruleName)
DebugEventListener
exitRule in interface DebugEventListenerexitRule in class BlankDebugEventListenerpublic void enterDecision(int decisionNumber)
DebugEventListener
enterDecision in interface DebugEventListenerenterDecision in class BlankDebugEventListenerpublic void exitDecision(int decisionNumber)
exitDecision in interface DebugEventListenerexitDecision in class BlankDebugEventListenerpublic void consumeToken(Token token)
DebugEventListener
consumeToken in interface DebugEventListenerconsumeToken in class BlankDebugEventListenerpublic boolean inDecision()
public void consumeHiddenToken(Token token)
DebugEventListener
consumeHiddenToken in interface DebugEventListenerconsumeHiddenToken in class BlankDebugEventListener
public void LT(int i,
Token t)
LT in interface DebugEventListenerLT in class BlankDebugEventListenerpublic void beginBacktrack(int level)
beginBacktrack in interface DebugEventListenerbeginBacktrack in class BlankDebugEventListener
public void endBacktrack(int level,
boolean successful)
endBacktrack in interface DebugEventListenerendBacktrack in class BlankDebugEventListenerpublic void recognitionException(RecognitionException e)
DebugEventListener
recognitionException in interface DebugEventListenerrecognitionException in class BlankDebugEventListener
public void semanticPredicate(boolean result,
java.lang.String predicate)
DebugEventListener
semanticPredicate in interface DebugEventListenersemanticPredicate in class BlankDebugEventListenerpublic void terminate()
DebugEventListener
terminate in interface DebugEventListenerterminate in class BlankDebugEventListenerpublic void setParser(DebugParser parser)
public java.lang.String toNotifyString()
public java.lang.String toString()
toString in class java.lang.Objectprotected static java.lang.String[] decodeReportData(java.lang.String data)
public static java.lang.String toString(java.lang.String notifyDataLine)
protected int[] trim(int[] X,
int n)
protected int[] toArray(java.util.List a)
public int getNumberOfHiddenTokens(int i,
int j)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||