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


C# GrammarAST.getNextSibling方法代码示例

本文整理汇总了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;
 }
开发者ID:bszafko,项目名称:antlrcs,代码行数:13,代码来源:GrammarSanity.cs

示例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 );
 }
开发者ID:bszafko,项目名称:antlrcs,代码行数:50,代码来源:GrammarSanity.cs


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