// $ANTLR start method // T.g:39:1: method : m= 'method' ID '(' ')' body ; public TParser.method_return method() // throws RecognitionException [1] { TParser.method_return retval = new TParser.method_return(); retval.start = input.LT(1); IToken m = null; try { // T.g:40:5: (m= 'method' ID '(' ')' body ) // T.g:40:9: m= 'method' ID '(' ')' body { m = (IToken)input.LT(1); Match(input, 7, FOLLOW_7_in_method78); Match(input, ID, FOLLOW_ID_in_method80); Match(input, 8, FOLLOW_8_in_method82); Match(input, 9, FOLLOW_9_in_method84); PushFollow(FOLLOW_body_in_method86); body(); state.followingStackPointer--; tokens.Replace(m, "public void"); } retval.stop = input.LT(-1); } catch (RecognitionException re) { ReportError(re); Recover(input, re); } finally { } return(retval); }
// throws RecognitionException [1] // $ANTLR start method // T.g:39:1: method : m= 'method' ID '(' ')' body ; public TParser.method_return method() { TParser.method_return retval = new TParser.method_return(); retval.start = input.LT(1); IToken m = null; try { // T.g:40:5: (m= 'method' ID '(' ')' body ) // T.g:40:9: m= 'method' ID '(' ')' body { m = (IToken)input.LT(1); Match(input,7,FOLLOW_7_in_method78); Match(input,ID,FOLLOW_ID_in_method80); Match(input,8,FOLLOW_8_in_method82); Match(input,9,FOLLOW_9_in_method84); PushFollow(FOLLOW_body_in_method86); body(); state.followingStackPointer--; tokens.Replace(m, "public void"); } retval.stop = input.LT(-1); } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { } return retval; }
TokenRewriteStream tokens; // avoid typecasts all over // $ANTLR start program // T.g:26:1: program : ( method )+ ; public void program() // throws RecognitionException [1] { TParser.method_return method1 = null; tokens = (TokenRewriteStream)input; IToken start = input.LT(1); try { // T.g:31:5: ( ( method )+ ) // T.g:31:9: ( method )+ { // T.g:31:9: ( method )+ int cnt1 = 0; do { int alt1 = 2; int LA1_0 = input.LA(1); if ((LA1_0 == 7)) { alt1 = 1; } switch (alt1) { case 1: // T.g:31:9: method { PushFollow(FOLLOW_method_in_program46); method1 = method(); state.followingStackPointer--; } break; default: if (cnt1 >= 1) { goto loop1; } EarlyExitException eee = new EarlyExitException(1, input); throw eee; } cnt1++; } while (true); loop1: ; // Stops C# compiler whinging that label 'loop1' has no statements tokens.InsertBefore(start, "public class Wrapper {\n"); // note the reference to the last token matched for method: tokens.InsertAfter(((method1 != null) ? ((IToken)method1.stop) : null), "\n}\n"); } } catch (RecognitionException re) { ReportError(re); Recover(input, re); } finally { } return; }