本文整理汇总了C#中Antlr3.ST.StringTemplateGroup.IsDefined方法的典型用法代码示例。如果您正苦于以下问题:C# StringTemplateGroup.IsDefined方法的具体用法?C# StringTemplateGroup.IsDefined怎么用?C# StringTemplateGroup.IsDefined使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Antlr3.ST.StringTemplateGroup
的用法示例。
在下文中一共展示了StringTemplateGroup.IsDefined方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMissingTemplates
/** <summary>
* Return a list of all template names missing from group that are defined
* in this interface. Return null if all is well.
* </summary>
*/
public virtual IList<string> GetMissingTemplates( StringTemplateGroup group )
{
string[] missing =
_templates.Values
.Where( template => !template.optional && !group.IsDefined( template.name ) )
.Select( template => template.name )
.ToArray();
return ( missing.Length == 0 ) ? null : missing;
}
示例2: GetMismatchedTemplates
/** <summary>
* Return a list of all template sigs that are present in the group, but
* that have wrong formal argument lists. Return null if all is well.
* </summary>
*/
public virtual IList<string> GetMismatchedTemplates( StringTemplateGroup group )
{
List<string> mismatched = new List<string>();
foreach ( TemplateDefinition d in _templates.Values )
{
if ( group.IsDefined( d.name ) )
{
StringTemplate defST = group.GetTemplateDefinition( d.name );
var formalArgs = defST.FormalArguments;
bool ack = false;
if ( ( d.formalArgs != null && formalArgs == null ) ||
( d.formalArgs == null && formalArgs != null ) ||
d.formalArgs.Count != formalArgs.Count )
{
ack = true;
}
if ( !ack )
{
foreach ( var arg in formalArgs )
{
FormalArgument arg2;
if ( !d.formalArgs.TryGetValue( arg.name, out arg2 ) || arg2 == null )
{
ack = true;
break;
}
}
}
if ( ack )
{
//System.out.println(d.formalArgs+"!="+formalArgs);
mismatched.Add( GetTemplateSignature( d ) );
}
}
}
if ( mismatched.Count == 0 )
{
mismatched = null;
}
return mismatched;
}