. @param expected vector of acceptable tokens, if available.
. */
. public void yyerror (string message, string[] expected) {
-. if ((expected != null) && (expected.Length > 0)) {
+. if ((yacc_verbose_flag > 0) && (expected != null) && (expected.Length > 0)) {
. ErrorOutput.Write (message+", expecting");
. for (int n = 0; n < expected.Length; ++ n)
. ErrorOutput.Write (" "+expected[n]);
. /** debugging support, requires the package jay.yydebug.
. Set to null to suppress debugging messages.
. */
-t protected yydebug.yyDebug debug;
+t internal yydebug.yyDebug debug;
.
debug ## tables for debugging support
.
. @return result of the last reduction, if any.
. @throws yyException on irrecoverable parse error.
. */
-. public Object yyparse (yyParser.yyInput yyLex, Object yyd)
+. internal Object yyparse (yyParser.yyInput yyLex, Object yyd)
. {
t this.debug = (yydebug.yyDebug)yyd;
. return yyparse(yyLex);
. @return result of the last reduction, if any.
. @throws yyException on irrecoverable parse error.
. */
-. public Object yyparse (yyParser.yyInput yyLex)
-. {
+. 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
.
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);
. 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) {
. 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)
. switch (yyErrorFlag) {
.
. case 0:
-. yyerror("syntax error", yyExpecting(yyState));
+. // yyerror(String.Format ("syntax error, got token `{0}'", yyname (yyToken)), yyExpecting(yyState));
t if (debug != null) debug.error("syntax error");
. goto case 1;
. case 1: case 2:
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);
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];
t if (debug != null)
-t debug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]);
+t debug.reduce(yyState, yyStates[yyV-1], yyN, YYRules.getRule (yyN), yyLen[yyN]);
. yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
. switch (yyN) {
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))
. 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'
. }
. }
.
epilog ## text following second %%
.namespace yydebug {
. using System;
-. public interface yyDebug {
+. internal interface yyDebug {
. void push (int state, Object value);
. void lex (int state, int token, string name, Object value);
. void shift (int from, int to, int errorFlag);
. using System;
. /** thrown for irrecoverable syntax errors and stack overflow.
. */
-. public class yyException : System.Exception {
+. internal class yyException : System.Exception {
. public yyException (string message) : base (message) {
. }
. }
.
. /** must be implemented by a scanner object to supply input to the parser.
. */
-. public interface yyInput {
+. internal interface yyInput {
. /** move on to next token.
. @return false if positioned beyond tokens.
. @throws IOException on input error.