当前位置: 首页>>代码示例>>C#>>正文


C# Grammar.GetDirectDelegates方法代码示例

本文整理汇总了C#中Antlr3.Tool.Grammar.GetDirectDelegates方法的典型用法代码示例。如果您正苦于以下问题:C# Grammar.GetDirectDelegates方法的具体用法?C# Grammar.GetDirectDelegates怎么用?C# Grammar.GetDirectDelegates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Antlr3.Tool.Grammar的用法示例。


在下文中一共展示了Grammar.GetDirectDelegates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateRecognizer

        /** Create NFA, DFA and generate code for grammar.
         *  Create NFA for any delegates first.  Once all NFA are created,
         *  it's ok to create DFA, which must check for left-recursion.  That check
         *  is done by walking the full NFA, which therefore must be complete.
         *  After all NFA, comes DFA conversion for root grammar then code gen for
         *  root grammar.  DFA and code gen for delegates comes next.
         */
        protected virtual void GenerateRecognizer( Grammar grammar )
        {
            string language = (string)grammar.GetOption( "language" );
            if ( language != null )
            {
                CodeGenerator generator = new CodeGenerator( this, grammar, language );
                grammar.CodeGenerator = generator;
                generator.Debug = Debug;
                generator.Profile = Profile;
                generator.Trace = Trace;

                // generate NFA early in case of crash later (for debugging)
                if ( Generate_NFA_dot )
                {
                    GenerateNFAs( grammar );
                }

                // GENERATE CODE
                generator.GenRecognizer();

                if ( Generate_DFA_dot )
                {
                    GenerateDFAs( grammar );
                }

                IList<Grammar> delegates = grammar.GetDirectDelegates();
                for ( int i = 0; delegates != null && i < delegates.Count; i++ )
                {
                    Grammar @delegate = (Grammar)delegates[i];
                    if ( @delegate != grammar )
                    {
                        // already processing this one
                        GenerateRecognizer( @delegate );
                    }
                }
            }
        }
开发者ID:antlr,项目名称:antlrcs,代码行数:44,代码来源:AntlrTool.cs


注:本文中的Antlr3.Tool.Grammar.GetDirectDelegates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。