本文整理汇总了C#中RewriteRuleSubtreeStream.HasNext方法的典型用法代码示例。如果您正苦于以下问题:C# RewriteRuleSubtreeStream.HasNext方法的具体用法?C# RewriteRuleSubtreeStream.HasNext怎么用?C# RewriteRuleSubtreeStream.HasNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RewriteRuleSubtreeStream
的用法示例。
在下文中一共展示了RewriteRuleSubtreeStream.HasNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: constantCollectionInitializer
//.........这里部分代码省略.........
{
int alt40 = 2;
int LA40_0 = input.LA(1);
if ( (LA40_0 == 147) )
{
alt40 = 1;
}
switch (alt40)
{
case 1 :
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:450:42: ',' constantData
{
char_literal162=(IToken)Match(input,147,FOLLOW_147_in_constantCollectionInitializer2292); if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_147.Add(char_literal162);
PushFollow(FOLLOW_constantData_in_constantCollectionInitializer2294);
constantData163 = constantData();
state.followingStackPointer--;
if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_constantData.Add(constantData163.Tree);
}
break;
default:
goto loop40;
}
} while (true);
loop40:
; // Stops C# compiler whining that label 'loop40' has no statements
char_literal164=(IToken)Match(input,145,FOLLOW_145_in_constantCollectionInitializer2299); if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_145.Add(char_literal164);
// AST REWRITE
// elements: constantData, collectionType, constantData
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if ( (state.backtracking==0) ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
root_0 = (CommonTree)adaptor.GetNilNode();
// 450:66: -> ^( COLLECTION_INITIALIZER collectionType constantData ( constantData )* )
{
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:450:69: ^( COLLECTION_INITIALIZER collectionType constantData ( constantData )* )
{
CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(COLLECTION_INITIALIZER, "COLLECTION_INITIALIZER"), root_1);
adaptor.AddChild(root_1, stream_collectionType.NextTree());
adaptor.AddChild(root_1, stream_constantData.NextTree());
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:450:123: ( constantData )*
while ( stream_constantData.HasNext() )
{
adaptor.AddChild(root_1, stream_constantData.NextTree());
}
stream_constantData.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
retval.Stop = input.LT(-1);
if ( (state.backtracking==0) )
{ retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);}
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
// Conversion of the second argument necessary, but harmless
retval.Tree = (CommonTree)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re);
}
finally
{
if ( state.backtracking > 0 )
{
Memoize(input, 61, constantCollectionInitializer_StartIndex);
}
}
return retval;
}
示例2: tikzpicture
//.........这里部分代码省略.........
}
break;
}
PushFollow(FOLLOW_tikzpicture_end_in_tikzpicture1023);
tikzpicture_end86 = tikzpicture_end();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_tikzpicture_end.Add(tikzpicture_end86.Tree);
}
// AST REWRITE
// elements: tikzpicture_end, tikzbody, tikzpicture_start, tikz_options
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
if ( state.backtracking==0 ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (object)adaptor.GetNilNode();
// 243:68: -> ^( IM_PICTURE tikzpicture_start ( tikz_options )? ( tikzbody )? tikzpicture_end )
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:243:71: ^( IM_PICTURE tikzpicture_start ( tikz_options )? ( tikzbody )? tikzpicture_end )
{
object root_1 = (object)adaptor.GetNilNode();
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(IM_PICTURE, "IM_PICTURE"), root_1);
adaptor.AddChild(root_1, stream_tikzpicture_start.NextTree());
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:243:102: ( tikz_options )?
if ( stream_tikz_options.HasNext() )
{
adaptor.AddChild(root_1, stream_tikz_options.NextTree());
}
stream_tikz_options.Reset();
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:243:116: ( tikzbody )?
if ( stream_tikzbody.HasNext() )
{
adaptor.AddChild(root_1, stream_tikzbody.NextTree());
}
stream_tikzbody.Reset();
adaptor.AddChild(root_1, stream_tikzpicture_end.NextTree());
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
break;
case 2 :
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:244:5: ( tikz_start ( tikz_options )? '{' ( tikzbody2 )? roundbr_end )
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:244:5: ( tikz_start ( tikz_options )? '{' ( tikzbody2 )? roundbr_end )
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:244:7: tikz_start ( tikz_options )? '{' ( tikzbody2 )? roundbr_end
{
PushFollow(FOLLOW_tikz_start_in_tikzpicture1048);
tikz_start87 = tikz_start();
state.followingStackPointer--;
if (state.failed) return retval;
示例3: concat
//.........这里部分代码省略.........
if ( input.LA(1) == Token.DOWN )
{
Match(input, Token.DOWN, null); if (state.failed) return retval;
if ( !(( ParentIsOfType(head, Concat) || DegenerateNumberOfChildren(head) )) )
{
if ( state.backtracking > 0 ) {state.failed = true; return retval;}
throw new FailedPredicateException(input, "concat", " ParentIsOfType($head, Concat) || DegenerateNumberOfChildren($head) ");
}
// C:\\nadir\\nadir\\Nadir\\Parsing\\NadirASTOptimizer.g:84:122: (e+= . )*
do
{
int alt11 = 2;
int LA11_0 = input.LA(1);
if ( ((LA11_0 >= TokenFirst && LA11_0 <= 250)) )
{
alt11 = 1;
}
switch (alt11)
{
case 1 :
// C:\\nadir\\nadir\\Nadir\\Parsing\\NadirASTOptimizer.g:0:0: e+= .
{
_last = (NadirAST)input.LT(1);
e = (NadirAST)input.LT(1);
MatchAny(input); if (state.failed) return retval;
if ( (state.backtracking == 1) )
if ( _first_1==null ) _first_1 = e;
if (list_e == null) list_e = new ArrayList();
list_e.Add(e);
if ( (state.backtracking == 1) ) {
retval.Tree = (NadirAST)_first_0;
if ( adaptor.GetParent(retval.Tree)!=null && adaptor.IsNil( adaptor.GetParent(retval.Tree) ) )
retval.Tree = (NadirAST)adaptor.GetParent(retval.Tree);}
}
break;
default:
goto loop11;
}
} while (true);
loop11:
; // Stops C# compiler whining that label 'loop11' has no statements
Match(input, Token.UP, null); if (state.failed) return retval;
}_last = _save_last_1;
}
// AST REWRITE
// elements: e
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels: e
if ( (state.backtracking == 1) ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_e = new RewriteRuleSubtreeStream(adaptor,"wildcard e",list_e);
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
root_0 = (NadirAST)adaptor.GetNilNode();
// 84:129: -> ( $e)*
{
// C:\\nadir\\nadir\\Nadir\\Parsing\\NadirASTOptimizer.g:84:132: ( $e)*
while ( stream_e.HasNext() )
{
adaptor.AddChild(root_0, stream_e.NextTree());
}
stream_e.Reset();
}
retval.Tree = (NadirAST)adaptor.RulePostProcessing(root_0);
input.ReplaceChildren(adaptor.GetParent(retval.Start),
adaptor.GetChildIndex(retval.Start),
adaptor.GetChildIndex(_last),
retval.Tree);}
}
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return retval;
}
示例4: tikznode_core
// throws RecognitionException [1]
// $ANTLR start "tikznode_core"
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:377:1: tikznode_core : ( tikznode_decorator )* tikzstring -> ^( IM_NODE ( tikznode_decorator )* tikzstring ) ;
public simpletikzParser.tikznode_core_return tikznode_core()
{
simpletikzParser.tikznode_core_return retval = new simpletikzParser.tikznode_core_return();
retval.Start = input.LT(1);
object root_0 = null;
simpletikzParser.tikznode_decorator_return tikznode_decorator197 = default(simpletikzParser.tikznode_decorator_return);
simpletikzParser.tikzstring_return tikzstring198 = default(simpletikzParser.tikzstring_return);
RewriteRuleSubtreeStream stream_tikzstring = new RewriteRuleSubtreeStream(adaptor,"rule tikzstring");
RewriteRuleSubtreeStream stream_tikznode_decorator = new RewriteRuleSubtreeStream(adaptor,"rule tikznode_decorator");
try
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:378:2: ( ( tikznode_decorator )* tikzstring -> ^( IM_NODE ( tikznode_decorator )* tikzstring ) )
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:378:4: ( tikznode_decorator )* tikzstring
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:378:4: ( tikznode_decorator )*
do
{
int alt51 = 2;
int LA51_0 = input.LA(1);
if ( (LA51_0 == 52 || LA51_0 == 54 || LA51_0 == 81) )
{
alt51 = 1;
}
switch (alt51)
{
case 1 :
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:378:4: tikznode_decorator
{
PushFollow(FOLLOW_tikznode_decorator_in_tikznode_core2317);
tikznode_decorator197 = tikznode_decorator();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_tikznode_decorator.Add(tikznode_decorator197.Tree);
}
break;
default:
goto loop51;
}
} while (true);
loop51:
; // Stops C# compiler whining that label 'loop51' has no statements
PushFollow(FOLLOW_tikzstring_in_tikznode_core2320);
tikzstring198 = tikzstring();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_tikzstring.Add(tikzstring198.Tree);
// AST REWRITE
// elements: tikzstring, tikznode_decorator
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
if ( state.backtracking==0 ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (object)adaptor.GetNilNode();
// 378:36: -> ^( IM_NODE ( tikznode_decorator )* tikzstring )
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:378:39: ^( IM_NODE ( tikznode_decorator )* tikzstring )
{
object root_1 = (object)adaptor.GetNilNode();
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(IM_NODE, "IM_NODE"), root_1);
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:378:49: ( tikznode_decorator )*
while ( stream_tikznode_decorator.HasNext() )
{
adaptor.AddChild(root_1, stream_tikznode_decorator.NextTree());
}
stream_tikznode_decorator.Reset();
adaptor.AddChild(root_1, stream_tikzstring.NextTree());
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
retval.Stop = input.LT(-1);
if ( state.backtracking==0 )
{ retval.Tree = (object)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);}
//.........这里部分代码省略.........
示例5: tikzpath
// throws RecognitionException [1]
// $ANTLR start "tikzpath"
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:310:1: tikzpath : path_start ( tikzpath_element )* semicolon_end -> ^( IM_PATH path_start ( tikzpath_element )* semicolon_end ) ;
public simpletikzParser.tikzpath_return tikzpath()
{
simpletikzParser.tikzpath_return retval = new simpletikzParser.tikzpath_return();
retval.Start = input.LT(1);
object root_0 = null;
simpletikzParser.path_start_return path_start148 = default(simpletikzParser.path_start_return);
simpletikzParser.tikzpath_element_return tikzpath_element149 = default(simpletikzParser.tikzpath_element_return);
simpletikzParser.semicolon_end_return semicolon_end150 = default(simpletikzParser.semicolon_end_return);
RewriteRuleSubtreeStream stream_tikzpath_element = new RewriteRuleSubtreeStream(adaptor,"rule tikzpath_element");
RewriteRuleSubtreeStream stream_path_start = new RewriteRuleSubtreeStream(adaptor,"rule path_start");
RewriteRuleSubtreeStream stream_semicolon_end = new RewriteRuleSubtreeStream(adaptor,"rule semicolon_end");
try
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:311:2: ( path_start ( tikzpath_element )* semicolon_end -> ^( IM_PATH path_start ( tikzpath_element )* semicolon_end ) )
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:311:4: path_start ( tikzpath_element )* semicolon_end
{
PushFollow(FOLLOW_path_start_in_tikzpath1765);
path_start148 = path_start();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_path_start.Add(path_start148.Tree);
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:311:15: ( tikzpath_element )*
do
{
int alt39 = 2;
int LA39_0 = input.LA(1);
if ( ((LA39_0 >= ID && LA39_0 <= COMMAND) || LA39_0 == 43 || LA39_0 == 45 || LA39_0 == 52 || LA39_0 == 54 || LA39_0 == 58 || LA39_0 == 77 || (LA39_0 >= 79 && LA39_0 <= 80) || (LA39_0 >= 82 && LA39_0 <= 91)) )
{
alt39 = 1;
}
switch (alt39)
{
case 1 :
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:311:15: tikzpath_element
{
PushFollow(FOLLOW_tikzpath_element_in_tikzpath1767);
tikzpath_element149 = tikzpath_element();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_tikzpath_element.Add(tikzpath_element149.Tree);
}
break;
default:
goto loop39;
}
} while (true);
loop39:
; // Stops C# compiler whining that label 'loop39' has no statements
PushFollow(FOLLOW_semicolon_end_in_tikzpath1770);
semicolon_end150 = semicolon_end();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_semicolon_end.Add(semicolon_end150.Tree);
// AST REWRITE
// elements: path_start, semicolon_end, tikzpath_element
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
if ( state.backtracking==0 ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (object)adaptor.GetNilNode();
// 311:47: -> ^( IM_PATH path_start ( tikzpath_element )* semicolon_end )
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:311:50: ^( IM_PATH path_start ( tikzpath_element )* semicolon_end )
{
object root_1 = (object)adaptor.GetNilNode();
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(IM_PATH, "IM_PATH"), root_1);
adaptor.AddChild(root_1, stream_path_start.NextTree());
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:311:71: ( tikzpath_element )*
while ( stream_tikzpath_element.HasNext() )
{
adaptor.AddChild(root_1, stream_tikzpath_element.NextTree());
}
stream_tikzpath_element.Reset();
adaptor.AddChild(root_1, stream_semicolon_end.NextTree());
adaptor.AddChild(root_0, root_1);
}
}
//.........这里部分代码省略.........
示例6: size
// throws RecognitionException [1]
// $ANTLR start "size"
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:432:1: size : '(' numberunit ( 'and' numberunit )? ')' -> ^( IM_SIZE ( numberunit )* ) ;
public simpletikzParser.size_return size()
{
simpletikzParser.size_return retval = new simpletikzParser.size_return();
retval.Start = input.LT(1);
object root_0 = null;
IToken char_literal245 = null;
IToken string_literal247 = null;
IToken char_literal249 = null;
simpletikzParser.numberunit_return numberunit246 = default(simpletikzParser.numberunit_return);
simpletikzParser.numberunit_return numberunit248 = default(simpletikzParser.numberunit_return);
object char_literal245_tree=null;
object string_literal247_tree=null;
object char_literal249_tree=null;
RewriteRuleTokenStream stream_78 = new RewriteRuleTokenStream(adaptor,"token 78");
RewriteRuleTokenStream stream_52 = new RewriteRuleTokenStream(adaptor,"token 52");
RewriteRuleTokenStream stream_53 = new RewriteRuleTokenStream(adaptor,"token 53");
RewriteRuleSubtreeStream stream_numberunit = new RewriteRuleSubtreeStream(adaptor,"rule numberunit");
try
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:433:2: ( '(' numberunit ( 'and' numberunit )? ')' -> ^( IM_SIZE ( numberunit )* ) )
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:433:6: '(' numberunit ( 'and' numberunit )? ')'
{
char_literal245=(IToken)Match(input,52,FOLLOW_52_in_size2702); if (state.failed) return retval;
if ( state.backtracking==0 ) stream_52.Add(char_literal245);
PushFollow(FOLLOW_numberunit_in_size2704);
numberunit246 = numberunit();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_numberunit.Add(numberunit246.Tree);
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:433:21: ( 'and' numberunit )?
int alt61 = 2;
int LA61_0 = input.LA(1);
if ( (LA61_0 == 78) )
{
alt61 = 1;
}
switch (alt61)
{
case 1 :
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:433:22: 'and' numberunit
{
string_literal247=(IToken)Match(input,78,FOLLOW_78_in_size2707); if (state.failed) return retval;
if ( state.backtracking==0 ) stream_78.Add(string_literal247);
PushFollow(FOLLOW_numberunit_in_size2709);
numberunit248 = numberunit();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_numberunit.Add(numberunit248.Tree);
}
break;
}
char_literal249=(IToken)Match(input,53,FOLLOW_53_in_size2713); if (state.failed) return retval;
if ( state.backtracking==0 ) stream_53.Add(char_literal249);
// AST REWRITE
// elements: numberunit
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
if ( state.backtracking==0 ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (object)adaptor.GetNilNode();
// 433:46: -> ^( IM_SIZE ( numberunit )* )
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:433:49: ^( IM_SIZE ( numberunit )* )
{
object root_1 = (object)adaptor.GetNilNode();
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(IM_SIZE, "IM_SIZE"), root_1);
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:433:59: ( numberunit )*
while ( stream_numberunit.HasNext() )
{
adaptor.AddChild(root_1, stream_numberunit.NextTree());
}
stream_numberunit.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
//.........这里部分代码省略.........
示例7: tikzdocument
//.........这里部分代码省略.........
}
break;
default:
goto loop1;
}
} while (true);
loop1:
; // Stops C# compiler whining that label 'loop1' has no statements
PushFollow(FOLLOW_tikzpicture_in_tikzdocument270);
tikzpicture4 = tikzpicture();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_tikzpicture.Add(tikzpicture4.Tree);
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:141:74: ( . )*
do
{
int alt2 = 2;
int LA2_0 = input.LA(1);
if ( ((LA2_0 >= IM_PATH && LA2_0 <= 94)) )
{
alt2 = 1;
}
else if ( (LA2_0 == EOF) )
{
alt2 = 2;
}
switch (alt2)
{
case 1 :
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:141:74: .
{
wildcard5 = (IToken)input.LT(1);
MatchAny(input); if (state.failed) return retval;
}
break;
default:
goto loop2;
}
} while (true);
loop2:
; // Stops C# compiler whining that label 'loop2' has no statements
// AST REWRITE
// elements: tikzpicture, tikz_styleorsetorcmd
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
if ( state.backtracking==0 ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (object)adaptor.GetNilNode();
// 141:77: -> ^( IM_DOCUMENT ( tikz_styleorsetorcmd )* tikzpicture )
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:141:80: ^( IM_DOCUMENT ( tikz_styleorsetorcmd )* tikzpicture )
{
object root_1 = (object)adaptor.GetNilNode();
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(IM_DOCUMENT, "IM_DOCUMENT"), root_1);
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:141:94: ( tikz_styleorsetorcmd )*
while ( stream_tikz_styleorsetorcmd.HasNext() )
{
adaptor.AddChild(root_1, stream_tikz_styleorsetorcmd.NextTree());
}
stream_tikz_styleorsetorcmd.Reset();
adaptor.AddChild(root_1, stream_tikzpicture.NextTree());
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
retval.Stop = input.LT(-1);
if ( state.backtracking==0 )
{ retval.Tree = (object)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);}
}
catch (RecognitionException e) {
throw e;
}
finally
{
}
return retval;
}
示例8: tikz_options
//.........这里部分代码省略.........
}
switch (alt7)
{
case 1 :
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:168:42: ','
{
char_literal30=(IToken)Match(input,47,FOLLOW_47_in_tikz_options468); if (state.failed) return retval;
if ( state.backtracking==0 ) stream_47.Add(char_literal30);
}
break;
}
}
break;
}
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:168:49: ( tikzstring )?
int alt9 = 2;
int LA9_0 = input.LA(1);
if ( (LA9_0 == 43) )
{
alt9 = 1;
}
switch (alt9)
{
case 1 :
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:168:49: tikzstring
{
PushFollow(FOLLOW_tikzstring_in_tikz_options473);
tikzstring31 = tikzstring();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_tikzstring.Add(tikzstring31.Tree);
}
break;
}
PushFollow(FOLLOW_squarebr_end_in_tikz_options476);
squarebr_end32 = squarebr_end();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_squarebr_end.Add(squarebr_end32.Tree);
// AST REWRITE
// elements: squarebr_end, squarebr_start, option
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
if ( state.backtracking==0 ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (object)adaptor.GetNilNode();
// 168:75: -> ^( IM_OPTIONS squarebr_start ( option )* squarebr_end )
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:168:78: ^( IM_OPTIONS squarebr_start ( option )* squarebr_end )
{
object root_1 = (object)adaptor.GetNilNode();
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(IM_OPTIONS, "IM_OPTIONS"), root_1);
adaptor.AddChild(root_1, stream_squarebr_start.NextTree());
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:168:106: ( option )*
while ( stream_option.HasNext() )
{
adaptor.AddChild(root_1, stream_option.NextTree());
}
stream_option.Reset();
adaptor.AddChild(root_1, stream_squarebr_end.NextTree());
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
retval.Stop = input.LT(-1);
if ( state.backtracking==0 )
{ retval.Tree = (object)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);}
}
catch (RecognitionException e) {
throw e;
}
finally
{
}
return retval;
}
示例9: tikz_set
//.........这里部分代码省略.........
PushFollow(FOLLOW_option_in_tikz_set974);
option80 = option();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_option.Add(option80.Tree);
}
break;
default:
goto loop25;
}
} while (true);
loop25:
; // Stops C# compiler whining that label 'loop25' has no statements
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:237:42: ( ',' )?
int alt26 = 2;
int LA26_0 = input.LA(1);
if ( (LA26_0 == 47) )
{
alt26 = 1;
}
switch (alt26)
{
case 1 :
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:237:42: ','
{
char_literal81=(IToken)Match(input,47,FOLLOW_47_in_tikz_set978); if (state.failed) return retval;
if ( state.backtracking==0 ) stream_47.Add(char_literal81);
}
break;
}
}
break;
}
PushFollow(FOLLOW_roundbr_end_in_tikz_set983);
roundbr_end82 = roundbr_end();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_roundbr_end.Add(roundbr_end82.Tree);
// AST REWRITE
// elements: option, tikz_set_start, roundbr_end
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
if ( state.backtracking==0 ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (object)adaptor.GetNilNode();
// 237:61: -> ^( IM_TIKZSET tikz_set_start ( option )* roundbr_end )
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:237:64: ^( IM_TIKZSET tikz_set_start ( option )* roundbr_end )
{
object root_1 = (object)adaptor.GetNilNode();
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(IM_TIKZSET, "IM_TIKZSET"), root_1);
adaptor.AddChild(root_1, stream_tikz_set_start.NextTree());
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:237:92: ( option )*
while ( stream_option.HasNext() )
{
adaptor.AddChild(root_1, stream_option.NextTree());
}
stream_option.Reset();
adaptor.AddChild(root_1, stream_roundbr_end.NextTree());
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
retval.Stop = input.LT(-1);
if ( state.backtracking==0 )
{ retval.Tree = (object)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);}
}
catch (RecognitionException e) {
throw e;
}
finally
{
}
return retval;
}
示例10: elseIfBranches
// $ANTLR start "elseIfBranches"
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:531:1: elseIfBranches : ( ElseIf condition core )* -> ^( ELSEIFBRANCHES ( ^( CONDITIONALBRANCH condition core ) )* ) ;
public PsimulexParser.elseIfBranches_return elseIfBranches() // throws RecognitionException [1]
{
PsimulexParser.elseIfBranches_return retval = new PsimulexParser.elseIfBranches_return();
retval.Start = input.LT(1);
int elseIfBranches_StartIndex = input.Index();
CommonTree root_0 = null;
IToken ElseIf218 = null;
PsimulexParser.condition_return condition219 = default(PsimulexParser.condition_return);
PsimulexParser.core_return core220 = default(PsimulexParser.core_return);
CommonTree ElseIf218_tree=null;
RewriteRuleTokenStream stream_ElseIf = new RewriteRuleTokenStream(adaptor,"token ElseIf");
RewriteRuleSubtreeStream stream_condition = new RewriteRuleSubtreeStream(adaptor,"rule condition");
RewriteRuleSubtreeStream stream_core = new RewriteRuleSubtreeStream(adaptor,"rule core");
try
{
if ( (state.backtracking > 0) && AlreadyParsedRule(input, 69) )
{
return retval;
}
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:531:17: ( ( ElseIf condition core )* -> ^( ELSEIFBRANCHES ( ^( CONDITIONALBRANCH condition core ) )* ) )
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:531:19: ( ElseIf condition core )*
{
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:531:19: ( ElseIf condition core )*
do
{
int alt52 = 2;
int LA52_0 = input.LA(1);
if ( (LA52_0 == ElseIf) )
{
alt52 = 1;
}
switch (alt52)
{
case 1 :
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:531:21: ElseIf condition core
{
ElseIf218=(IToken)Match(input,ElseIf,FOLLOW_ElseIf_in_elseIfBranches2882); if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_ElseIf.Add(ElseIf218);
PushFollow(FOLLOW_condition_in_elseIfBranches2884);
condition219 = condition();
state.followingStackPointer--;
if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_condition.Add(condition219.Tree);
PushFollow(FOLLOW_core_in_elseIfBranches2886);
core220 = core();
state.followingStackPointer--;
if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_core.Add(core220.Tree);
}
break;
default:
goto loop52;
}
} while (true);
loop52:
; // Stops C# compiler whining that label 'loop52' has no statements
// AST REWRITE
// elements: core, condition
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if ( (state.backtracking==0) ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
root_0 = (CommonTree)adaptor.GetNilNode();
// 531:46: -> ^( ELSEIFBRANCHES ( ^( CONDITIONALBRANCH condition core ) )* )
{
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:531:49: ^( ELSEIFBRANCHES ( ^( CONDITIONALBRANCH condition core ) )* )
{
CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(ELSEIFBRANCHES, "ELSEIFBRANCHES"), root_1);
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:531:67: ( ^( CONDITIONALBRANCH condition core ) )*
while ( stream_core.HasNext() || stream_condition.HasNext() )
{
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:531:69: ^( CONDITIONALBRANCH condition core )
{
CommonTree root_2 = (CommonTree)adaptor.GetNilNode();
root_2 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(CONDITIONALBRANCH, "CONDITIONALBRANCH"), root_2);
adaptor.AddChild(root_2, stream_condition.NextTree());
//.........这里部分代码省略.........
示例11: typeDeclarations
// $ANTLR start "typeDeclarations"
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:132:1: typeDeclarations : ( structDeclaration )* -> ^( TYPE_DECLARATIONS ( structDeclaration )* ) ;
public PsimulexParser.typeDeclarations_return typeDeclarations() // throws RecognitionException [1]
{
PsimulexParser.typeDeclarations_return retval = new PsimulexParser.typeDeclarations_return();
retval.Start = input.LT(1);
int typeDeclarations_StartIndex = input.Index();
CommonTree root_0 = null;
PsimulexParser.structDeclaration_return structDeclaration12 = default(PsimulexParser.structDeclaration_return);
RewriteRuleSubtreeStream stream_structDeclaration = new RewriteRuleSubtreeStream(adaptor,"rule structDeclaration");
try
{
if ( (state.backtracking > 0) && AlreadyParsedRule(input, 6) )
{
return retval;
}
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:133:5: ( ( structDeclaration )* -> ^( TYPE_DECLARATIONS ( structDeclaration )* ) )
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:133:9: ( structDeclaration )*
{
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:133:9: ( structDeclaration )*
do
{
int alt5 = 2;
int LA5_0 = input.LA(1);
if ( (LA5_0 == Struct) )
{
alt5 = 1;
}
switch (alt5)
{
case 1 :
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:0:0: structDeclaration
{
PushFollow(FOLLOW_structDeclaration_in_typeDeclarations519);
structDeclaration12 = structDeclaration();
state.followingStackPointer--;
if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_structDeclaration.Add(structDeclaration12.Tree);
}
break;
default:
goto loop5;
}
} while (true);
loop5:
; // Stops C# compiler whining that label 'loop5' has no statements
// AST REWRITE
// elements: structDeclaration
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if ( (state.backtracking==0) ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
root_0 = (CommonTree)adaptor.GetNilNode();
// 133:28: -> ^( TYPE_DECLARATIONS ( structDeclaration )* )
{
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:133:31: ^( TYPE_DECLARATIONS ( structDeclaration )* )
{
CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(TYPE_DECLARATIONS, "TYPE_DECLARATIONS"), root_1);
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:133:52: ( structDeclaration )*
while ( stream_structDeclaration.HasNext() )
{
adaptor.AddChild(root_1, stream_structDeclaration.NextTree());
}
stream_structDeclaration.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
retval.Stop = input.LT(-1);
if ( (state.backtracking==0) )
{ retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);}
}
catch (RecognitionException re)
//.........这里部分代码省略.........
示例12: statement
//.........这里部分代码省略.........
if ( (state.backtracking==0) ) stream_expression.Add(expression195.Tree);
}
break;
}
char_literal196=(IToken)Match(input,143,FOLLOW_143_in_statement2650); if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_143.Add(char_literal196);
// AST REWRITE
// elements: expression, Return
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if ( (state.backtracking==0) ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
root_0 = (CommonTree)adaptor.GetNilNode();
// 514:32: -> ^( RETURN_STATEMENT Return ( expression )? )
{
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:514:35: ^( RETURN_STATEMENT Return ( expression )? )
{
CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(RETURN_STATEMENT, "RETURN_STATEMENT"), root_1);
adaptor.AddChild(root_1, stream_Return.NextNode());
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:514:62: ( expression )?
if ( stream_expression.HasNext() )
{
adaptor.AddChild(root_1, stream_expression.NextTree());
}
stream_expression.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
break;
case 11 :
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:515:9: Break ';'
{
root_0 = (CommonTree)adaptor.GetNilNode();
Break197=(IToken)Match(input,Break,FOLLOW_Break_in_statement2673); if (state.failed) return retval;
if ( state.backtracking == 0 )
{Break197_tree = (CommonTree)adaptor.Create(Break197);
adaptor.AddChild(root_0, Break197_tree);
}
char_literal198=(IToken)Match(input,143,FOLLOW_143_in_statement2675); if (state.failed) return retval;
}
break;
case 12 :
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:517:9: ';'
{
root_0 = (CommonTree)adaptor.GetNilNode();
示例13: block
// $ANTLR start "block"
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:496:1: block : '{' ( statement )* '}' -> ^( BLOCK ( ^( STATEMENT statement ) )* ) ;
public PsimulexParser.block_return block() // throws RecognitionException [1]
{
PsimulexParser.block_return retval = new PsimulexParser.block_return();
retval.Start = input.LT(1);
int block_StartIndex = input.Index();
CommonTree root_0 = null;
IToken char_literal172 = null;
IToken char_literal174 = null;
PsimulexParser.statement_return statement173 = default(PsimulexParser.statement_return);
CommonTree char_literal172_tree=null;
CommonTree char_literal174_tree=null;
RewriteRuleTokenStream stream_144 = new RewriteRuleTokenStream(adaptor,"token 144");
RewriteRuleTokenStream stream_145 = new RewriteRuleTokenStream(adaptor,"token 145");
RewriteRuleSubtreeStream stream_statement = new RewriteRuleSubtreeStream(adaptor,"rule statement");
try
{
if ( (state.backtracking > 0) && AlreadyParsedRule(input, 63) )
{
return retval;
}
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:497:5: ( '{' ( statement )* '}' -> ^( BLOCK ( ^( STATEMENT statement ) )* ) )
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:497:9: '{' ( statement )* '}'
{
char_literal172=(IToken)Match(input,144,FOLLOW_144_in_block2398); if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_144.Add(char_literal172);
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:497:13: ( statement )*
do
{
int alt42 = 2;
int LA42_0 = input.LA(1);
if ( (LA42_0 == StringLiteral || LA42_0 == Identifier || (LA42_0 >= Reference && LA42_0 <= Iterator) || LA42_0 == Minus || (LA42_0 >= LogicalNot && LA42_0 <= If) || (LA42_0 >= For && LA42_0 <= ForEach) || LA42_0 == Loop || LA42_0 == 143 || LA42_0 == 149) )
{
alt42 = 1;
}
switch (alt42)
{
case 1 :
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:0:0: statement
{
PushFollow(FOLLOW_statement_in_block2400);
statement173 = statement();
state.followingStackPointer--;
if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_statement.Add(statement173.Tree);
}
break;
default:
goto loop42;
}
} while (true);
loop42:
; // Stops C# compiler whining that label 'loop42' has no statements
char_literal174=(IToken)Match(input,145,FOLLOW_145_in_block2403); if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_145.Add(char_literal174);
// AST REWRITE
// elements: statement
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if ( (state.backtracking==0) ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
root_0 = (CommonTree)adaptor.GetNilNode();
// 497:28: -> ^( BLOCK ( ^( STATEMENT statement ) )* )
{
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:497:31: ^( BLOCK ( ^( STATEMENT statement ) )* )
{
CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(BLOCK, "BLOCK"), root_1);
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:497:40: ( ^( STATEMENT statement ) )*
while ( stream_statement.HasNext() )
{
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:497:40: ^( STATEMENT statement )
{
CommonTree root_2 = (CommonTree)adaptor.GetNilNode();
root_2 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(STATEMENT, "STATEMENT"), root_2);
adaptor.AddChild(root_2, stream_statement.NextTree());
adaptor.AddChild(root_1, root_2);
//.........这里部分代码省略.........
示例14: constantArrayInitializer
//.........这里部分代码省略.........
{
int alt41 = 2;
int LA41_0 = input.LA(1);
if ( (LA41_0 == 147) )
{
alt41 = 1;
}
switch (alt41)
{
case 1 :
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:454:36: ',' constantData
{
char_literal169=(IToken)Match(input,147,FOLLOW_147_in_constantArrayInitializer2339); if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_147.Add(char_literal169);
PushFollow(FOLLOW_constantData_in_constantArrayInitializer2341);
constantData170 = constantData();
state.followingStackPointer--;
if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_constantData.Add(constantData170.Tree);
}
break;
default:
goto loop41;
}
} while (true);
loop41:
; // Stops C# compiler whining that label 'loop41' has no statements
char_literal171=(IToken)Match(input,148,FOLLOW_148_in_constantArrayInitializer2346); if (state.failed) return retval;
if ( (state.backtracking==0) ) stream_148.Add(char_literal171);
// AST REWRITE
// elements: constantData, constantData, dataType
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if ( (state.backtracking==0) ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval!=null ? retval.Tree : null);
root_0 = (CommonTree)adaptor.GetNilNode();
// 454:60: -> ^( ARRAY_INITIALIZER dataType constantData ( constantData )* )
{
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:454:63: ^( ARRAY_INITIALIZER dataType constantData ( constantData )* )
{
CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(ARRAY_INITIALIZER, "ARRAY_INITIALIZER"), root_1);
adaptor.AddChild(root_1, stream_dataType.NextTree());
adaptor.AddChild(root_1, stream_constantData.NextTree());
// C:\\Works\\Psimulex\\VapeTeam.Psimulex\\VapeTeam.Psimulex.Compiler.Antlr\\Grammar\\Psimulex.g:454:106: ( constantData )*
while ( stream_constantData.HasNext() )
{
adaptor.AddChild(root_1, stream_constantData.NextTree());
}
stream_constantData.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
retval.Stop = input.LT(-1);
if ( (state.backtracking==0) )
{ retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);}
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
// Conversion of the second argument necessary, but harmless
retval.Tree = (CommonTree)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re);
}
finally
{
if ( state.backtracking > 0 )
{
Memoize(input, 62, constantArrayInitializer_StartIndex);
}
}
return retval;
}
示例15: option_kv
// throws RecognitionException [1]
// $ANTLR start "option_kv"
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:176:1: option_kv : idd ( '=' iddornumberunitorstringorrange )? -> ^( IM_OPTION_KV idd ( iddornumberunitorstringorrange )? ) ;
public simpletikzParser.option_kv_return option_kv()
{
simpletikzParser.option_kv_return retval = new simpletikzParser.option_kv_return();
retval.Start = input.LT(1);
object root_0 = null;
IToken char_literal36 = null;
simpletikzParser.idd_return idd35 = default(simpletikzParser.idd_return);
simpletikzParser.iddornumberunitorstringorrange_return iddornumberunitorstringorrange37 = default(simpletikzParser.iddornumberunitorstringorrange_return);
object char_literal36_tree=null;
RewriteRuleTokenStream stream_45 = new RewriteRuleTokenStream(adaptor,"token 45");
RewriteRuleSubtreeStream stream_iddornumberunitorstringorrange = new RewriteRuleSubtreeStream(adaptor,"rule iddornumberunitorstringorrange");
RewriteRuleSubtreeStream stream_idd = new RewriteRuleSubtreeStream(adaptor,"rule idd");
try
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:177:2: ( idd ( '=' iddornumberunitorstringorrange )? -> ^( IM_OPTION_KV idd ( iddornumberunitorstringorrange )? ) )
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:177:4: idd ( '=' iddornumberunitorstringorrange )?
{
PushFollow(FOLLOW_idd_in_option_kv524);
idd35 = idd();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_idd.Add(idd35.Tree);
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:177:8: ( '=' iddornumberunitorstringorrange )?
int alt11 = 2;
int LA11_0 = input.LA(1);
if ( (LA11_0 == 45) )
{
alt11 = 1;
}
switch (alt11)
{
case 1 :
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:177:9: '=' iddornumberunitorstringorrange
{
char_literal36=(IToken)Match(input,45,FOLLOW_45_in_option_kv527); if (state.failed) return retval;
if ( state.backtracking==0 ) stream_45.Add(char_literal36);
PushFollow(FOLLOW_iddornumberunitorstringorrange_in_option_kv529);
iddornumberunitorstringorrange37 = iddornumberunitorstringorrange();
state.followingStackPointer--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_iddornumberunitorstringorrange.Add(iddornumberunitorstringorrange37.Tree);
}
break;
}
// AST REWRITE
// elements: idd, iddornumberunitorstringorrange
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
if ( state.backtracking==0 ) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (object)adaptor.GetNilNode();
// 177:47: -> ^( IM_OPTION_KV idd ( iddornumberunitorstringorrange )? )
{
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:177:50: ^( IM_OPTION_KV idd ( iddornumberunitorstringorrange )? )
{
object root_1 = (object)adaptor.GetNilNode();
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(IM_OPTION_KV, "IM_OPTION_KV"), root_1);
adaptor.AddChild(root_1, stream_idd.NextTree());
// C:\\_TUHH\\SVN\\projects\\wsn\\dibus\\SvgMap\\SvgNaviMap\\bargraph\\tikzedt\\TikzParser\\simpletikz.g:177:69: ( iddornumberunitorstringorrange )?
if ( stream_iddornumberunitorstringorrange.HasNext() )
{
adaptor.AddChild(root_1, stream_iddornumberunitorstringorrange.NextTree());
}
stream_iddornumberunitorstringorrange.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;retval.Tree = root_0;}
}
retval.Stop = input.LT(-1);
if ( state.backtracking==0 )
{ retval.Tree = (object)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, (IToken) retval.Start, (IToken) retval.Stop);}
}
catch (RecognitionException e) {
throw e;
//.........这里部分代码省略.........