本文整理汇总了C#中RewriteRuleSubtreeStream.Next方法的典型用法代码示例。如果您正苦于以下问题:C# RewriteRuleSubtreeStream.Next方法的具体用法?C# RewriteRuleSubtreeStream.Next怎么用?C# RewriteRuleSubtreeStream.Next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RewriteRuleSubtreeStream
的用法示例。
在下文中一共展示了RewriteRuleSubtreeStream.Next方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: declaraciones_api
// throws RecognitionException [1]
// $ANTLR start declaraciones_api
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:63:1: declaraciones_api : (lista+= declaracion_api )* -> ^( LISTADECLARACIONESAPI ( $lista)* ) ;
public declaraciones_api_return declaraciones_api()
{
declaraciones_api_return retval = new declaraciones_api_return();
retval.start = input.LT(1);
FkvmAST root_0 = null;
IList list_lista = null;
RuleReturnScope lista = null;
RewriteRuleSubtreeStream stream_declaracion_api = new RewriteRuleSubtreeStream(adaptor,"rule declaracion_api");
try
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:63:19: ( (lista+= declaracion_api )* -> ^( LISTADECLARACIONESAPI ( $lista)* ) )
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:63:21: (lista+= declaracion_api )*
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:63:21: (lista+= declaracion_api )*
do
{
int alt1 = 2;
int LA1_0 = input.LA(1);
if ( (LA1_0 == 24) )
{
alt1 = 1;
}
switch (alt1)
{
case 1 :
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:63:22: lista+= declaracion_api
{
PushFollow(FOLLOW_declaracion_api_in_declaraciones_api134);
lista = declaracion_api();
followingStackPointer_--;
stream_declaracion_api.Add(lista.Tree);
if (list_lista == null) list_lista = new ArrayList();
list_lista.Add(lista);
}
break;
default:
goto loop1;
}
} while (true);
loop1:
; // Stops C# compiler whinging that label 'loop1' has no statements
// AST REWRITE
// elements: lista
// token labels:
// rule labels: retval
// token list labels:
// rule list labels: lista
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
RewriteRuleSubtreeStream stream_lista = new RewriteRuleSubtreeStream(adaptor, "token lista", list_lista);
root_0 = (FkvmAST)adaptor.GetNilNode();
// 63:47: -> ^( LISTADECLARACIONESAPI ( $lista)* )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:63:50: ^( LISTADECLARACIONESAPI ( $lista)* )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(LISTADECLARACIONESAPI, "LISTADECLARACIONESAPI"), root_1);
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:63:74: ( $lista)*
while ( stream_lista.HasNext() )
{
adaptor.AddChild(root_1, ((ParserRuleReturnScope)stream_lista.Next()).Tree);
}
stream_lista.Reset();
adaptor.AddChild(root_0, root_1);
}
}
}
retval.stop = input.LT(-1);
retval.tree = (FkvmAST)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return retval;
//.........这里部分代码省略.........
示例2: declaracion_api
// throws RecognitionException [1]
// $ANTLR start declaracion_api
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:65:1: declaracion_api : 'api' tipo IDENT '(' lista_decl ')' ';' -> ^( DECLARACIONAPI tipo IDENT ) ;
public declaracion_api_return declaracion_api()
{
declaracion_api_return retval = new declaracion_api_return();
retval.start = input.LT(1);
FkvmAST root_0 = null;
IToken string_literal3 = null;
IToken IDENT5 = null;
IToken char_literal6 = null;
IToken char_literal8 = null;
IToken char_literal9 = null;
tipo_return tipo4 = null;
lista_decl_return lista_decl7 = null;
FkvmAST string_literal3_tree=null;
FkvmAST IDENT5_tree=null;
FkvmAST char_literal6_tree=null;
FkvmAST char_literal8_tree=null;
FkvmAST char_literal9_tree=null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor,"token IDENT");
RewriteRuleTokenStream stream_24 = new RewriteRuleTokenStream(adaptor,"token 24");
RewriteRuleTokenStream stream_25 = new RewriteRuleTokenStream(adaptor,"token 25");
RewriteRuleTokenStream stream_26 = new RewriteRuleTokenStream(adaptor,"token 26");
RewriteRuleTokenStream stream_27 = new RewriteRuleTokenStream(adaptor,"token 27");
RewriteRuleSubtreeStream stream_tipo = new RewriteRuleSubtreeStream(adaptor,"rule tipo");
RewriteRuleSubtreeStream stream_lista_decl = new RewriteRuleSubtreeStream(adaptor,"rule lista_decl");
try
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:65:17: ( 'api' tipo IDENT '(' lista_decl ')' ';' -> ^( DECLARACIONAPI tipo IDENT ) )
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:65:19: 'api' tipo IDENT '(' lista_decl ')' ';'
{
string_literal3 = (IToken)input.LT(1);
Match(input,24,FOLLOW_24_in_declaracion_api155);
stream_24.Add(string_literal3);
PushFollow(FOLLOW_tipo_in_declaracion_api157);
tipo4 = tipo();
followingStackPointer_--;
stream_tipo.Add(tipo4.Tree);
IDENT5 = (IToken)input.LT(1);
Match(input,IDENT,FOLLOW_IDENT_in_declaracion_api159);
stream_IDENT.Add(IDENT5);
char_literal6 = (IToken)input.LT(1);
Match(input,25,FOLLOW_25_in_declaracion_api161);
stream_25.Add(char_literal6);
PushFollow(FOLLOW_lista_decl_in_declaracion_api163);
lista_decl7 = lista_decl();
followingStackPointer_--;
stream_lista_decl.Add(lista_decl7.Tree);
char_literal8 = (IToken)input.LT(1);
Match(input,26,FOLLOW_26_in_declaracion_api165);
stream_26.Add(char_literal8);
char_literal9 = (IToken)input.LT(1);
Match(input,27,FOLLOW_27_in_declaracion_api167);
stream_27.Add(char_literal9);
if(!symtable.ContainsKey(IDENT5.Text))
{
symtable.Add(IDENT5.Text, new Symbol(input.ToString(tipo4.start,tipo4.stop), -1));
}
// AST REWRITE
// elements: tipo, IDENT
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (FkvmAST)adaptor.GetNilNode();
// 70:8: -> ^( DECLARACIONAPI tipo IDENT )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:70:11: ^( DECLARACIONAPI tipo IDENT )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(DECLARACIONAPI, "DECLARACIONAPI"), root_1);
adaptor.AddChild(root_1, stream_tipo.Next());
adaptor.AddChild(root_1, stream_IDENT.Next());
adaptor.AddChild(root_0, root_1);
}
}
}
retval.stop = input.LT(-1);
//.........这里部分代码省略.........
示例3: programa
// throws RecognitionException [1]
// $ANTLR start programa
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:61:1: programa : declaraciones_api principal -> ^( PROGRAMA declaraciones_api principal ) ;
public programa_return programa()
{
programa_return retval = new programa_return();
retval.start = input.LT(1);
FkvmAST root_0 = null;
declaraciones_api_return declaraciones_api1 = null;
principal_return principal2 = null;
RewriteRuleSubtreeStream stream_principal = new RewriteRuleSubtreeStream(adaptor,"rule principal");
RewriteRuleSubtreeStream stream_declaraciones_api = new RewriteRuleSubtreeStream(adaptor,"rule declaraciones_api");
try
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:61:10: ( declaraciones_api principal -> ^( PROGRAMA declaraciones_api principal ) )
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:61:12: declaraciones_api principal
{
PushFollow(FOLLOW_declaraciones_api_in_programa110);
declaraciones_api1 = declaraciones_api();
followingStackPointer_--;
stream_declaraciones_api.Add(declaraciones_api1.Tree);
PushFollow(FOLLOW_principal_in_programa112);
principal2 = principal();
followingStackPointer_--;
stream_principal.Add(principal2.Tree);
// AST REWRITE
// elements: principal, declaraciones_api
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (FkvmAST)adaptor.GetNilNode();
// 61:40: -> ^( PROGRAMA declaraciones_api principal )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:61:43: ^( PROGRAMA declaraciones_api principal )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(PROGRAMA, "PROGRAMA"), root_1);
adaptor.AddChild(root_1, stream_declaraciones_api.Next());
adaptor.AddChild(root_1, stream_principal.Next());
adaptor.AddChild(root_0, root_1);
}
}
}
retval.stop = input.LT(-1);
retval.tree = (FkvmAST)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return retval;
}
示例4: decl
// throws RecognitionException [1]
// $ANTLR start decl
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:96:1: decl : tipo IDENT -> ^( DECLARACIONPARAM tipo IDENT ) ;
public decl_return decl()
{
decl_return retval = new decl_return();
retval.start = input.LT(1);
FkvmAST root_0 = null;
IToken IDENT29 = null;
tipo_return tipo28 = null;
FkvmAST IDENT29_tree=null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor,"token IDENT");
RewriteRuleSubtreeStream stream_tipo = new RewriteRuleSubtreeStream(adaptor,"rule tipo");
try
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:96:6: ( tipo IDENT -> ^( DECLARACIONPARAM tipo IDENT ) )
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:96:8: tipo IDENT
{
PushFollow(FOLLOW_tipo_in_decl385);
tipo28 = tipo();
followingStackPointer_--;
stream_tipo.Add(tipo28.Tree);
IDENT29 = (IToken)input.LT(1);
Match(input,IDENT,FOLLOW_IDENT_in_decl387);
stream_IDENT.Add(IDENT29);
// AST REWRITE
// elements: IDENT, tipo
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (FkvmAST)adaptor.GetNilNode();
// 96:19: -> ^( DECLARACIONPARAM tipo IDENT )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:96:22: ^( DECLARACIONPARAM tipo IDENT )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(DECLARACIONPARAM, "DECLARACIONPARAM"), root_1);
adaptor.AddChild(root_1, stream_tipo.Next());
adaptor.AddChild(root_1, stream_IDENT.Next());
adaptor.AddChild(root_0, root_1);
}
}
}
retval.stop = input.LT(-1);
retval.tree = (FkvmAST)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return retval;
}
示例5: lista_instrucciones
// throws RecognitionException [1]
// $ANTLR start lista_instrucciones
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:74:1: lista_instrucciones : (lista+= instruccion )* -> ^( LISTAINSTRUCCIONES ( $lista)* ) ;
public lista_instrucciones_return lista_instrucciones()
{
lista_instrucciones_return retval = new lista_instrucciones_return();
retval.start = input.LT(1);
FkvmAST root_0 = null;
IList list_lista = null;
RuleReturnScope lista = null;
RewriteRuleSubtreeStream stream_instruccion = new RewriteRuleSubtreeStream(adaptor,"rule instruccion");
try
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:74:21: ( (lista+= instruccion )* -> ^( LISTAINSTRUCCIONES ( $lista)* ) )
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:74:23: (lista+= instruccion )*
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:74:23: (lista+= instruccion )*
do
{
int alt2 = 2;
int LA2_0 = input.LA(1);
if ( ((LA2_0 >= IDENT && LA2_0 <= LIT_LOGICO) || LA2_0 == 25 || LA2_0 == 33 || (LA2_0 >= 35 && LA2_0 <= 41) || (LA2_0 >= 50 && LA2_0 <= 51) || LA2_0 == 54) )
{
alt2 = 1;
}
switch (alt2)
{
case 1 :
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:74:24: lista+= instruccion
{
PushFollow(FOLLOW_instruccion_in_lista_instrucciones213);
lista = instruccion();
followingStackPointer_--;
stream_instruccion.Add(lista.Tree);
if (list_lista == null) list_lista = new ArrayList();
list_lista.Add(lista);
}
break;
default:
goto loop2;
}
} while (true);
loop2:
; // Stops C# compiler whinging that label 'loop2' has no statements
// AST REWRITE
// elements: lista
// token labels:
// rule labels: retval
// token list labels:
// rule list labels: lista
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
RewriteRuleSubtreeStream stream_lista = new RewriteRuleSubtreeStream(adaptor, "token lista", list_lista);
root_0 = (FkvmAST)adaptor.GetNilNode();
// 74:45: -> ^( LISTAINSTRUCCIONES ( $lista)* )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:74:48: ^( LISTAINSTRUCCIONES ( $lista)* )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(LISTAINSTRUCCIONES, "LISTAINSTRUCCIONES"), root_1);
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:74:69: ( $lista)*
while ( stream_lista.HasNext() )
{
adaptor.AddChild(root_1, ((ParserRuleReturnScope)stream_lista.Next()).Tree);
}
stream_lista.Reset();
adaptor.AddChild(root_0, root_1);
}
}
}
retval.stop = input.LT(-1);
retval.tree = (FkvmAST)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return retval;
//.........这里部分代码省略.........
示例6: llamada
// throws RecognitionException [1]
// $ANTLR start llamada
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:141:1: llamada : IDENT '(' lista_expr ')' -> ^( LLAMADA IDENT lista_expr ) ;
public llamada_return llamada()
{
llamada_return retval = new llamada_return();
retval.start = input.LT(1);
FkvmAST root_0 = null;
IToken IDENT93 = null;
IToken char_literal94 = null;
IToken char_literal96 = null;
lista_expr_return lista_expr95 = null;
FkvmAST IDENT93_tree=null;
FkvmAST char_literal94_tree=null;
FkvmAST char_literal96_tree=null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor,"token IDENT");
RewriteRuleTokenStream stream_25 = new RewriteRuleTokenStream(adaptor,"token 25");
RewriteRuleTokenStream stream_26 = new RewriteRuleTokenStream(adaptor,"token 26");
RewriteRuleSubtreeStream stream_lista_expr = new RewriteRuleSubtreeStream(adaptor,"rule lista_expr");
try
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:141:9: ( IDENT '(' lista_expr ')' -> ^( LLAMADA IDENT lista_expr ) )
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:141:11: IDENT '(' lista_expr ')'
{
IDENT93 = (IToken)input.LT(1);
Match(input,IDENT,FOLLOW_IDENT_in_llamada825);
stream_IDENT.Add(IDENT93);
char_literal94 = (IToken)input.LT(1);
Match(input,25,FOLLOW_25_in_llamada827);
stream_25.Add(char_literal94);
PushFollow(FOLLOW_lista_expr_in_llamada829);
lista_expr95 = lista_expr();
followingStackPointer_--;
stream_lista_expr.Add(lista_expr95.Tree);
char_literal96 = (IToken)input.LT(1);
Match(input,26,FOLLOW_26_in_llamada831);
stream_26.Add(char_literal96);
// AST REWRITE
// elements: lista_expr, IDENT
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (FkvmAST)adaptor.GetNilNode();
// 141:36: -> ^( LLAMADA IDENT lista_expr )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:141:39: ^( LLAMADA IDENT lista_expr )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(LLAMADA, "LLAMADA"), root_1);
adaptor.AddChild(root_1, stream_IDENT.Next());
adaptor.AddChild(root_1, stream_lista_expr.Next());
adaptor.AddChild(root_0, root_1);
}
}
}
retval.stop = input.LT(-1);
retval.tree = (FkvmAST)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return retval;
}
示例7: lista_expr
//.........这里部分代码省略.........
Match(input,31,FOLLOW_31_in_lista_expr854);
stream_31.Add(char_literal97);
PushFollow(FOLLOW_expresion_in_lista_expr858);
lista = expresion();
followingStackPointer_--;
stream_expresion.Add(lista.Tree);
if (list_lista == null) list_lista = new ArrayList();
list_lista.Add(lista);
}
break;
default:
goto loop19;
}
} while (true);
loop19:
; // Stops C# compiler whinging that label 'loop19' has no statements
// AST REWRITE
// elements: lista
// token labels:
// rule labels: retval
// token list labels:
// rule list labels: lista
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
RewriteRuleSubtreeStream stream_lista = new RewriteRuleSubtreeStream(adaptor, "token lista", list_lista);
root_0 = (FkvmAST)adaptor.GetNilNode();
// 143:55: -> ^( LISTAEXPRESIONES ( $lista)* )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:143:58: ^( LISTAEXPRESIONES ( $lista)* )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(LISTAEXPRESIONES, "LISTAEXPRESIONES"), root_1);
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:143:77: ( $lista)*
while ( stream_lista.HasNext() )
{
adaptor.AddChild(root_1, ((ParserRuleReturnScope)stream_lista.Next()).Tree);
}
stream_lista.Reset();
adaptor.AddChild(root_0, root_1);
}
}
}
break;
case 2 :
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:144:15:
{
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (FkvmAST)adaptor.GetNilNode();
// 144:15: -> ^( LISTAEXPRESIONES )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:144:18: ^( LISTAEXPRESIONES )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(LISTAEXPRESIONES, "LISTAEXPRESIONES"), root_1);
adaptor.AddChild(root_0, root_1);
}
}
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (FkvmAST)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return retval;
}
示例8: lista_decl
//.........这里部分代码省略.........
Match(input,31,FOLLOW_31_in_lista_decl329);
stream_31.Add(char_literal27);
PushFollow(FOLLOW_decl_in_lista_decl333);
ld = decl();
followingStackPointer_--;
stream_decl.Add(ld.Tree);
if (list_ld == null) list_ld = new ArrayList();
list_ld.Add(ld);
}
break;
default:
goto loop4;
}
} while (true);
loop4:
; // Stops C# compiler whinging that label 'loop4' has no statements
// AST REWRITE
// elements: ld
// token labels:
// rule labels: retval
// token list labels:
// rule list labels: ld
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
RewriteRuleSubtreeStream stream_ld = new RewriteRuleSubtreeStream(adaptor, "token ld", list_ld);
root_0 = (FkvmAST)adaptor.GetNilNode();
// 92:39: -> ^( LISTAPARAMETROS ( $ld)* )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:92:42: ^( LISTAPARAMETROS ( $ld)* )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(LISTAPARAMETROS, "LISTAPARAMETROS"), root_1);
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:92:60: ( $ld)*
while ( stream_ld.HasNext() )
{
adaptor.AddChild(root_1, ((ParserRuleReturnScope)stream_ld.Next()).Tree);
}
stream_ld.Reset();
adaptor.AddChild(root_0, root_1);
}
}
}
break;
case 2 :
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:93:14:
{
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (FkvmAST)adaptor.GetNilNode();
// 93:14: -> ^( LISTAPARAMETROS )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:93:17: ^( LISTAPARAMETROS )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(LISTAPARAMETROS, "LISTAPARAMETROS"), root_1);
adaptor.AddChild(root_0, root_1);
}
}
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (FkvmAST)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return retval;
}
示例9: inst_decl
// throws RecognitionException [1]
// $ANTLR start inst_decl
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:85:1: inst_decl : tipo IDENT ';' -> ^( DECLARACION tipo IDENT ) ;
public inst_decl_return inst_decl()
{
inst_decl_return retval = new inst_decl_return();
retval.start = input.LT(1);
FkvmAST root_0 = null;
IToken IDENT25 = null;
IToken char_literal26 = null;
tipo_return tipo24 = null;
FkvmAST IDENT25_tree=null;
FkvmAST char_literal26_tree=null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor,"token IDENT");
RewriteRuleTokenStream stream_27 = new RewriteRuleTokenStream(adaptor,"token 27");
RewriteRuleSubtreeStream stream_tipo = new RewriteRuleSubtreeStream(adaptor,"rule tipo");
try
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:85:11: ( tipo IDENT ';' -> ^( DECLARACION tipo IDENT ) )
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:85:13: tipo IDENT ';'
{
PushFollow(FOLLOW_tipo_in_inst_decl295);
tipo24 = tipo();
followingStackPointer_--;
stream_tipo.Add(tipo24.Tree);
IDENT25 = (IToken)input.LT(1);
Match(input,IDENT,FOLLOW_IDENT_in_inst_decl297);
stream_IDENT.Add(IDENT25);
char_literal26 = (IToken)input.LT(1);
Match(input,27,FOLLOW_27_in_inst_decl299);
stream_27.Add(char_literal26);
if(!symtable.ContainsKey(IDENT25.Text))
{
symtable.Add(IDENT25.Text, new Symbol(input.ToString(tipo24.start,tipo24.stop), numVars++));
}
// AST REWRITE
// elements: tipo, IDENT
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (FkvmAST)adaptor.GetNilNode();
// 90:8: -> ^( DECLARACION tipo IDENT )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:90:11: ^( DECLARACION tipo IDENT )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(DECLARACION, "DECLARACION"), root_1);
adaptor.AddChild(root_1, stream_tipo.Next());
adaptor.AddChild(root_1, stream_IDENT.Next());
adaptor.AddChild(root_0, root_1);
}
}
}
retval.stop = input.LT(-1);
retval.tree = (FkvmAST)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return retval;
}
示例10: inst_asig
// throws RecognitionException [1]
// $ANTLR start inst_asig
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:98:1: inst_asig : IDENT '=' expresion ';' -> ^( ASIGNACION IDENT expresion ) ;
public inst_asig_return inst_asig()
{
inst_asig_return retval = new inst_asig_return();
retval.start = input.LT(1);
FkvmAST root_0 = null;
IToken IDENT30 = null;
IToken char_literal31 = null;
IToken char_literal33 = null;
expresion_return expresion32 = null;
FkvmAST IDENT30_tree=null;
FkvmAST char_literal31_tree=null;
FkvmAST char_literal33_tree=null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor,"token IDENT");
RewriteRuleTokenStream stream_32 = new RewriteRuleTokenStream(adaptor,"token 32");
RewriteRuleTokenStream stream_27 = new RewriteRuleTokenStream(adaptor,"token 27");
RewriteRuleSubtreeStream stream_expresion = new RewriteRuleSubtreeStream(adaptor,"rule expresion");
try
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:98:11: ( IDENT '=' expresion ';' -> ^( ASIGNACION IDENT expresion ) )
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:98:13: IDENT '=' expresion ';'
{
IDENT30 = (IToken)input.LT(1);
Match(input,IDENT,FOLLOW_IDENT_in_inst_asig406);
stream_IDENT.Add(IDENT30);
char_literal31 = (IToken)input.LT(1);
Match(input,32,FOLLOW_32_in_inst_asig408);
stream_32.Add(char_literal31);
PushFollow(FOLLOW_expresion_in_inst_asig410);
expresion32 = expresion();
followingStackPointer_--;
stream_expresion.Add(expresion32.Tree);
char_literal33 = (IToken)input.LT(1);
Match(input,27,FOLLOW_27_in_inst_asig412);
stream_27.Add(char_literal33);
// AST REWRITE
// elements: IDENT, expresion
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (FkvmAST)adaptor.GetNilNode();
// 98:37: -> ^( ASIGNACION IDENT expresion )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:98:40: ^( ASIGNACION IDENT expresion )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(ASIGNACION, "ASIGNACION"), root_1);
adaptor.AddChild(root_1, stream_IDENT.Next());
adaptor.AddChild(root_1, stream_expresion.Next());
adaptor.AddChild(root_0, root_1);
}
}
}
retval.stop = input.LT(-1);
retval.tree = (FkvmAST)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
}
finally
{
}
return retval;
}
示例11: expMenos
// throws RecognitionException [1]
// $ANTLR start expMenos
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:131:1: expMenos : ( '-' expNo -> ^( MENOSUNARIO expNo ) | ( '+' )? expNo -> expNo );
public expMenos_return expMenos()
{
expMenos_return retval = new expMenos_return();
retval.start = input.LT(1);
FkvmAST root_0 = null;
IToken char_literal81 = null;
IToken char_literal83 = null;
expNo_return expNo82 = null;
expNo_return expNo84 = null;
FkvmAST char_literal81_tree=null;
FkvmAST char_literal83_tree=null;
RewriteRuleTokenStream stream_51 = new RewriteRuleTokenStream(adaptor,"token 51");
RewriteRuleTokenStream stream_50 = new RewriteRuleTokenStream(adaptor,"token 50");
RewriteRuleSubtreeStream stream_expNo = new RewriteRuleSubtreeStream(adaptor,"rule expNo");
try
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:131:10: ( '-' expNo -> ^( MENOSUNARIO expNo ) | ( '+' )? expNo -> expNo )
int alt16 = 2;
int LA16_0 = input.LA(1);
if ( (LA16_0 == 51) )
{
alt16 = 1;
}
else if ( ((LA16_0 >= IDENT && LA16_0 <= LIT_LOGICO) || LA16_0 == 25 || LA16_0 == 50 || LA16_0 == 54) )
{
alt16 = 2;
}
else
{
NoViableAltException nvae_d16s0 =
new NoViableAltException("131:1: expMenos : ( '-' expNo -> ^( MENOSUNARIO expNo ) | ( '+' )? expNo -> expNo );", 16, 0, input);
throw nvae_d16s0;
}
switch (alt16)
{
case 1 :
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:131:12: '-' expNo
{
char_literal81 = (IToken)input.LT(1);
Match(input,51,FOLLOW_51_in_expMenos732);
stream_51.Add(char_literal81);
PushFollow(FOLLOW_expNo_in_expMenos734);
expNo82 = expNo();
followingStackPointer_--;
stream_expNo.Add(expNo82.Tree);
// AST REWRITE
// elements: expNo
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "token retval", (retval!=null ? retval.Tree : null));
root_0 = (FkvmAST)adaptor.GetNilNode();
// 131:22: -> ^( MENOSUNARIO expNo )
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:131:25: ^( MENOSUNARIO expNo )
{
FkvmAST root_1 = (FkvmAST)adaptor.GetNilNode();
root_1 = (FkvmAST)adaptor.BecomeRoot(adaptor.Create(MENOSUNARIO, "MENOSUNARIO"), root_1);
adaptor.AddChild(root_1, stream_expNo.Next());
adaptor.AddChild(root_0, root_1);
}
}
}
break;
case 2 :
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:132:12: ( '+' )? expNo
{
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:132:12: ( '+' )?
int alt15 = 2;
int LA15_0 = input.LA(1);
if ( (LA15_0 == 50) )
{
alt15 = 1;
}
switch (alt15)
{
case 1 :
// D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:132:12: '+'
{
char_literal83 = (IToken)input.LT(1);
//.........这里部分代码省略.........