本文整理汇总了C#中Antlr3.Tool.GrammarAST.getNextSibling方法的典型用法代码示例。如果您正苦于以下问题:C# GrammarAST.getNextSibling方法的具体用法?C# GrammarAST.getNextSibling怎么用?C# GrammarAST.getNextSibling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Antlr3.Tool.GrammarAST
的用法示例。
在下文中一共展示了GrammarAST.getNextSibling方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsNextNonActionElementEOA
protected virtual bool IsNextNonActionElementEOA( GrammarAST t )
{
while ( t.Type == ANTLRParser.ACTION ||
t.Type == ANTLRParser.SEMPRED )
{
t = (GrammarAST)t.getNextSibling();
}
if ( t.Type == ANTLRParser.EOA )
{
return true;
}
return false;
}
示例2: EnsureAltIsSimpleNodeOrTree
/** Rules in tree grammar that use -> rewrites and are spitting out
* templates via output=template and then use rewrite=true must only
* use -> on alts that are simple nodes or trees or single rule refs
* that match either nodes or trees. The altAST is the ALT node
* for an ALT. Verify that its first child is simple. Must be either
* ( ALT ^( A B ) <end-of-alt> ) or ( ALT A <end-of-alt> ) or
* other element.
*
* Ignore predicates in front and labels.
*/
public virtual void EnsureAltIsSimpleNodeOrTree( GrammarAST altAST,
GrammarAST elementAST,
int outerAltNum )
{
if ( IsValidSimpleElementNode( elementAST ) )
{
GrammarAST next = (GrammarAST)elementAST.getNextSibling();
if ( !IsNextNonActionElementEOA( next ) )
{
ErrorManager.GrammarWarning( ErrorManager.MSG_REWRITE_FOR_MULTI_ELEMENT_ALT,
grammar,
next.Token,
outerAltNum );
}
return;
}
switch ( elementAST.Type )
{
case ANTLRParser.ASSIGN: // labels ok on non-rule refs
case ANTLRParser.PLUS_ASSIGN:
if ( IsValidSimpleElementNode( (GrammarAST)elementAST.GetChild( 1 ) ) )
{
return;
}
break;
case ANTLRParser.ACTION: // skip past actions
case ANTLRParser.SEMPRED:
case ANTLRParser.SYN_SEMPRED:
case ANTLRParser.BACKTRACK_SEMPRED:
case ANTLRParser.GATED_SEMPRED:
EnsureAltIsSimpleNodeOrTree( altAST,
(GrammarAST)elementAST.getNextSibling(),
outerAltNum );
return;
}
ErrorManager.GrammarWarning( ErrorManager.MSG_REWRITE_FOR_MULTI_ELEMENT_ALT,
grammar,
elementAST.Token,
outerAltNum );
}