本文整理汇总了C#中Antlr3.Codegen.CodeGenerator.TranslateAction方法的典型用法代码示例。如果您正苦于以下问题:C# Antlr3.Codegen.CodeGenerator.TranslateAction方法的具体用法?C# Antlr3.Codegen.CodeGenerator.TranslateAction怎么用?C# Antlr3.Codegen.CodeGenerator.TranslateAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Antlr3.Codegen.CodeGenerator
的用法示例。
在下文中一共展示了Antlr3.Codegen.CodeGenerator.TranslateAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenExpr
public override StringTemplate GenExpr( CodeGenerator generator,
StringTemplateGroup templates,
DFA dfa )
{
StringTemplate eST = null;
if ( templates != null )
{
if ( _synpred )
{
eST = templates.GetInstanceOf( "evalSynPredicate" );
}
else
{
eST = templates.GetInstanceOf( "evalPredicate" );
generator.grammar.decisionsWhoseDFAsUsesSemPreds.Add( dfa );
}
string predEnclosingRuleName = predicateAST.enclosingRuleName;
/*
String decisionEnclosingRuleName =
dfa.getNFADecisionStartState().getEnclosingRule();
// if these rulenames are diff, then pred was hoisted out of rule
// Currently I don't warn you about this as it could be annoying.
// I do the translation anyway.
*/
//eST.setAttribute("pred", this.toString());
if ( generator != null )
{
eST.SetAttribute( "pred",
generator.TranslateAction( predEnclosingRuleName, predicateAST ) );
}
}
else
{
eST = new StringTemplate( "$pred$" );
eST.SetAttribute( "pred", this.ToString() );
return eST;
}
if ( generator != null )
{
string description =
generator.target.GetTargetStringLiteralFromString( this.ToString() );
eST.SetAttribute( "description", description );
}
return eST;
}