/// <summary>Get num hidden tokens between i..j inclusive</summary> public int GetNumberOfHiddenTokens(int i, int j) { int n = 0; ITokenStream input = parser.TokenStream; for (int ti = i; ti < input.Size() && ti <= j; ti++) { IToken t = input.Get(ti); if (t.Channel != Token.DEFAULT_CHANNEL) { n++; } } return(n); }
// R E P O R T I N G public virtual string ToNotifyString() { ITokenStream input = parser.TokenStream; for (int i = 0; (i < input.Size()) && (lastTokenConsumed != null) && (i <= lastTokenConsumed.TokenIndex); i++) { IToken t = input.Get(i); if (t.Channel != Token.DEFAULT_CHANNEL) { numHiddenTokens++; numHiddenCharsMatched += t.Text.Length; } } numCharsMatched = lastTokenConsumed.StopIndex + 1; decisionMaxFixedLookaheads = Trim(decisionMaxFixedLookaheads, numFixedDecisions); decisionMaxCyclicLookaheads = Trim(decisionMaxCyclicLookaheads, numCyclicDecisions); StringBuilder buf = new StringBuilder(); buf.Append(Version); buf.Append('\t'); buf.Append(parser.GetType().FullName); buf.Append('\t'); buf.Append(numRuleInvocations); buf.Append('\t'); buf.Append(maxRuleInvocationDepth); buf.Append('\t'); buf.Append(numFixedDecisions); buf.Append('\t'); buf.Append(Stats.Min(decisionMaxFixedLookaheads)); buf.Append('\t'); buf.Append(Stats.Max(decisionMaxFixedLookaheads)); buf.Append('\t'); buf.Append(Stats.Avg(decisionMaxFixedLookaheads)); buf.Append('\t'); buf.Append(Stats.Stddev(decisionMaxFixedLookaheads)); buf.Append('\t'); buf.Append(numCyclicDecisions); buf.Append('\t'); buf.Append(Stats.Min(decisionMaxCyclicLookaheads)); buf.Append('\t'); buf.Append(Stats.Max(decisionMaxCyclicLookaheads)); buf.Append('\t'); buf.Append(Stats.Avg(decisionMaxCyclicLookaheads)); buf.Append('\t'); buf.Append(Stats.Stddev(decisionMaxCyclicLookaheads)); buf.Append('\t'); buf.Append(numBacktrackDecisions); buf.Append('\t'); buf.Append(Stats.Min(ToArray(decisionMaxSynPredLookaheads))); buf.Append('\t'); buf.Append(Stats.Max(ToArray(decisionMaxSynPredLookaheads))); buf.Append('\t'); buf.Append(Stats.Avg(ToArray(decisionMaxSynPredLookaheads))); buf.Append('\t'); buf.Append(Stats.Stddev(ToArray(decisionMaxSynPredLookaheads))); buf.Append('\t'); buf.Append(numSemanticPredicates); buf.Append('\t'); buf.Append(parser.TokenStream.Size()); buf.Append('\t'); buf.Append(numHiddenTokens); buf.Append('\t'); buf.Append(numCharsMatched); buf.Append('\t'); buf.Append(numHiddenCharsMatched); buf.Append('\t'); buf.Append(numberReportedErrors); buf.Append('\t'); buf.Append(numMemoizationCacheHits); buf.Append('\t'); buf.Append(numMemoizationCacheMisses); buf.Append('\t'); buf.Append(numGuessingRuleInvocations); buf.Append('\t'); buf.Append(numMemoizationCacheEntries); return(buf.ToString()); }