示例#1
0
        public override IEnumerable <OutputRecord> Execute(ParseEngine context)
        {
            context.Log(ToString());
            context.Log("{");
//            if (!context.Grammar.IsTokenGrammar)
//                Console.WriteLine("Executing " + Name);
            IEnumerable <OutputRecord> nonterminal = context.ApplyNonterminal(this, context.Position);

//            if (!context.Grammar.IsTokenGrammar)
//                Console.WriteLine("Executed " + Name);
//            if (!context.IsFailure(nonterminal) && !context.Grammar.IsTokenGrammar)
//                Logger.WriteLine("Accepted " + Name + " (" + nonterminal.Concatenate(" ", o => o.OutputType == OutputType.None ? o.ToString() : "") + ")");

            if (context.IsFailure(nonterminal))
            {
                context.Log(ParseEngine.Indent + "Failed");
            }
            else
            {
                context.Log(ParseEngine.Indent + "Succeeded");
            }

            context.Log("}");

            return(nonterminal);
        }