diff options
author | Raja R Harinath <harinath@hurrynot.org> | 2006-05-29 14:22:57 +0400 |
---|---|---|
committer | Raja R Harinath <harinath@hurrynot.org> | 2006-05-29 14:22:57 +0400 |
commit | 4180766ba1ffb342170e7a1c268804c7670165b2 (patch) | |
tree | 9bfcf7418bd6a161552c335b188efc435f46a9bd /mcs/jay | |
parent | 14d4a2286cae3c15bedbab771baaf6b2bf245019 (diff) |
* skeleton.cs: Implement a better translation for named-loop continues.
Remove "unreachable code" warnings in the generated code.
svn path=/trunk/mcs/; revision=61223
Diffstat (limited to 'mcs/jay')
-rwxr-xr-x | mcs/jay/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/jay/skeleton.cs | 23 |
2 files changed, 15 insertions, 13 deletions
diff --git a/mcs/jay/ChangeLog b/mcs/jay/ChangeLog index cd7a30d51dd..c6d7089dd54 100755 --- a/mcs/jay/ChangeLog +++ b/mcs/jay/ChangeLog @@ -1,3 +1,8 @@ +2006-05-29 Raja R Harinath <rharinath@novell.com> + + * skeleton.cs: Implement a better translation for named-loop continues. + Remove "unreachable code" warnings in the generated code. + 2006-04-03 Zoltan Varga <vargaz@gmail.com> * output.c skeleton skeleton.cs: Initialize the jay debug tables diff --git a/mcs/jay/skeleton.cs b/mcs/jay/skeleton.cs index fcdedcffc8a..8584cb24a18 100644 --- a/mcs/jay/skeleton.cs +++ b/mcs/jay/skeleton.cs @@ -121,7 +121,7 @@ t this.debug = (yydebug.yyDebug)yyd; . @throws yyException on irrecoverable parse error. . */ . internal Object yyparse (yyParser.yyInput yyLex) -. { +. { . if (yyMax <= 0) yyMax = 256; // initial size . int yyState = 0; // state stack ptr . int [] yyStates = new int[yyMax]; // state stack @@ -132,12 +132,7 @@ t this.debug = (yydebug.yyDebug)yyd; . local ## %{ ... %} after the first %% -. int yyTop = 0; -. goto skip; -. yyLoop: -. yyTop++; -. skip: -. for (;; ++ yyTop) { +. /*yyLoop:*/ for (int yyTop = 0;; ++ yyTop) { . if (yyTop >= yyStates.Length) { // dynamically increase . int[] i = new int[yyStates.Length+yyMax]; . yyStates.CopyTo (i, 0); @@ -150,7 +145,7 @@ t this.debug = (yydebug.yyDebug)yyd; . yyVals[yyTop] = yyVal; t if (debug != null) debug.push(yyState, yyVal); . -. yyDiscarded: for (;;) { // discarding a token does not change stack +. /*yyDiscarded:*/ for (;;) { // discarding a token does not change stack . int yyN; . if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN) . if (yyToken < 0) { @@ -167,7 +162,7 @@ t debug.shift(yyState, yyTable[yyN], yyErrorFlag-1); . yyVal = yyLex.value(); . yyToken = -1; . if (yyErrorFlag > 0) -- yyErrorFlag; -. goto yyLoop; +. goto continue_yyLoop; . } . if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0 . && yyN < yyTable.Length && yyCheck[yyN] == yyToken) @@ -189,7 +184,7 @@ t if (debug != null) t debug.shift(yyStates[yyTop], yyTable[yyN], 3); . yyState = yyTable[yyN]; . yyVal = yyLex.value(); -. goto yyLoop; +. goto continue_yyLoop; . } t if (debug != null) debug.pop(yyStates[yyTop]); . } while (-- yyTop >= 0); @@ -205,7 +200,7 @@ t if (debug != null) t debug.discard(yyState, yyToken, yyname(yyToken), t yyLex.value()); . yyToken = -1; -. goto yyDiscarded; // leave stack alone +. goto continue_yyDiscarded; // leave stack alone . } . } . int yyV = yyTop + 1-yyLen[yyN]; @@ -233,7 +228,7 @@ t debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value()); t if (debug != null) debug.accept(yyVal); . return yyVal; . } -. goto yyLoop; +. goto continue_yyLoop; . } . if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0) . && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState)) @@ -241,8 +236,10 @@ t if (debug != null) debug.accept(yyVal); . else . yyState = yyDgoto[yyM]; t if (debug != null) debug.shift(yyStates[yyTop], yyState); -. goto yyLoop; +. goto continue_yyLoop; +. continue_yyDiscarded: continue; // implements the named-loop continue: 'continue yyDiscarded' . } +. continue_yyLoop: continue; // implements the named-loop continue: 'continue yyLoop' . } . } . |