コード例 #1
0
        /** <summary>Get num hidden tokens between i..j inclusive</summary> */
        public virtual 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 != TokenConstants.DEFAULT_CHANNEL)
                {
                    n++;
                }
            }
            return(n);
        }
コード例 #2
0
        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 != TokenConstants.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().Name);
            buf.Append('\t');
            buf.Append(numRuleInvocations);
            buf.Append('\t');
            buf.Append(maxRuleInvocationDepth);
            buf.Append('\t');
            buf.Append(numFixedDecisions);
            buf.Append('\t');
            buf.Append(decisionMaxFixedLookaheads.DefaultIfEmpty(int.MaxValue).Min());
            buf.Append('\t');
            buf.Append(decisionMaxFixedLookaheads.DefaultIfEmpty(int.MinValue).Max());
            buf.Append('\t');
            buf.Append(decisionMaxFixedLookaheads.DefaultIfEmpty(0).Average());
            buf.Append('\t');
            buf.Append(Stats.Stddev(decisionMaxFixedLookaheads));
            buf.Append('\t');
            buf.Append(numCyclicDecisions);
            buf.Append('\t');
            buf.Append(decisionMaxCyclicLookaheads.DefaultIfEmpty(int.MaxValue).Min());
            buf.Append('\t');
            buf.Append(decisionMaxCyclicLookaheads.DefaultIfEmpty(int.MinValue).Max());
            buf.Append('\t');
            buf.Append(decisionMaxCyclicLookaheads.DefaultIfEmpty(0).Average());
            buf.Append('\t');
            buf.Append(Stats.Stddev(decisionMaxCyclicLookaheads));
            buf.Append('\t');
            buf.Append(numBacktrackDecisions);
            buf.Append('\t');
            buf.Append(decisionMaxSynPredLookaheads.DefaultIfEmpty(int.MaxValue).Min());
            buf.Append('\t');
            buf.Append(decisionMaxSynPredLookaheads.DefaultIfEmpty(int.MinValue).Max());
            buf.Append('\t');
            buf.Append(decisionMaxSynPredLookaheads.DefaultIfEmpty(0).Average());
            buf.Append('\t');
            buf.Append(Stats.Stddev(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());
        }
コード例 #3
0
 public virtual int Size()
 {
     return(input.Size());
 }