예제 #1
0
        public String ToString(IRecognizer recog, bool showAlt)
        {
            StringBuilder buf = new StringBuilder();

            //		if ( state.ruleIndex>=0 ) {
            //			if ( recog!=null ) buf.append(recog.getRuleNames()[state.ruleIndex]+":");
            //			else buf.append(state.ruleIndex+":");
            //		}
            buf.Append('(');
            buf.Append(state);
            if (showAlt)
            {
                buf.Append(",");
                buf.Append(alt);
            }
            if (context != null)
            {
                buf.Append(",[");
                buf.Append(context.ToString());
                buf.Append("]");
            }
            if (semanticContext != null && semanticContext != SemanticContext.NONE)
            {
                buf.Append(",");
                buf.Append(semanticContext);
            }
            if (OuterContextDepth > 0)
            {
                buf.Append(",up=").Append(OuterContextDepth);
            }
            buf.Append(')');
            return(buf.ToString());
        }
예제 #2
0
        public override string ToString()
        {
            string up = parent != null?parent.ToString() : "";

            if (up.Length == 0)
            {
                if (returnState == EMPTY_RETURN_STATE)
                {
                    return("$");
                }
                return(returnState.ToString());
            }
            return(returnState.ToString() + " " + up);
        }