コード例 #1
0
ファイル: Parser.cs プロジェクト: dotted/csly
        public virtual BuildResult <ParserConfiguration <IN, OUT> > BuildExpressionParser(BuildResult <Parser <IN, OUT> > result, string startingRule = null)
        {
            var exprResult = new BuildResult <ParserConfiguration <IN, OUT> >(Configuration);

            exprResult    = ExpressionRulesGenerator.BuildExpressionRules <IN, OUT>(Configuration, Instance.GetType(), exprResult);
            Configuration = exprResult.Result;
            SyntaxParser.Init(exprResult.Result, startingRule);
            if (startingRule != null)
            {
                Configuration.StartingRule       = startingRule;
                SyntaxParser.StartingNonTerminal = startingRule;
            }
            if (exprResult.IsError)
            {
                result.AddErrors(exprResult.Errors);
            }
            else
            {
                result.Result.Configuration = Configuration;
            }
            return(exprResult);
        }