本文整理汇总了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 );
}
}
}
}