#	jay skeleton

#	character in column 1 determines outcome...
#		# is a comment
#		. is copied
#		t is copied as //t if -t is set
#	other lines are interpreted to call jay procedures

.//#if net_2_0
.//#pragma warning disable 1591, 162
.//#endif
.// created by jay 0.7 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
.
 prolog		## %{ ... %} prior to the first %%

.
.  /// <summary>
.  /// simplified error message.
.  /// </summary>
.  /// <param name="state">state</param>
.  /// <param name="token">token</param>
.  /// <param name="tokenValue">tokenValue</param>
.  /// <param name="expecting">expecting states</param>
.  public void yyerror (int state, int token, object tokenValue, string[] expecting) {
.    report.Error(lexer.Location, state, token, tokenValue, expecting); 
.  }
.
.  /// <summary>
.  /// debugging support, requires the package jay.yydebug.
.  /// Set to null to suppress debugging messages.
.  /// </summary>
t  protected yydebug.yyDebug debug;
.
 debug			## tables for debugging support
.
t  public static string yyname (int token) {
t    if ((token < 0) || (token > yyName.Length)) return "[illegal]";
t    string name;
t    if ((name = yyName[token]) != null) return name;
t    return "[unknown]";
t  }
.
.  /// <summary>
.  /// computes list of expected tokens on error by tracing the tables.
.  /// </summary>
.  /// <param name="state"> for which to compute the list.</param>
.  /// <returns>list of token names.</returns>
.  protected string[] yyExpecting (int state) {
.    int token, n, len = 0;
.    bool[] ok = new bool[yyName.Length];
.
.    if ((n = yySindex[state]) != 0)
.      for (token = n < 0 ? -n : 0;
.           (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
.        if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
.          ++ len;
.          ok[token] = true;
.        }
.    if ((n = yyRindex[state]) != 0)
.      for (token = n < 0 ? -n : 0;
.           (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
.        if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
.          ++ len;
.          ok[token] = true;
.        }
.
.    string [] result = new string[len];
.    for (n = token = 0; n < len;  ++ token)
.      if (ok[token]) result[n++] = yyName[token];
.    return result;
.  }
.
.  /// <summary>
.  /// the generated parser, with debugging messages.
.  /// Maintains a state and a value stack, currently with fixed maximum size.
.  /// </summary>
.  /// <param name="yyLex"> scanner.</param>
.  /// <param name="yyd"> debug message writer implementing yyDebug, or null.</param>
.  /// <returns>result of the last reduction, if any.</returns>
.  public Object yyparse (yyParser.yyInput yyLex, Object yyd)
.				 {
t    this.debug = (yydebug.yyDebug)yyd;
.    return yyparse(yyLex);
.  }
.
.  /// <summary>
.  /// initial size and increment of the state/value stack [default 256].
.  /// This is not final so that it can be overwritten outside of invocations
.  /// of yyparse().
.  /// </summary>
.  protected int yyMax;
.
.  /// <summary>
.  /// executed at the beginning of a reduce action.
.  /// Used as $$ = yyDefault($1), prior to the user-specified action, if any.
.  /// Can be overwritten to provide deep copy, etc.
.  /// </summary>
.  /// <param name="first"> value for $1, or null.</param>
.  /// <returns>first.</returns>
.  protected Object yyDefault (Object first) {
.    return first;
.  }
.
.  /// <summary>
.  /// the generated parser.
.  /// Maintains a state and a value stack, currently with fixed maximum size.
.  /// </summary>
.  /// <param name="yyLex"> scanner</param>
.  /// <returns>result of the last reduction, if any.</returns>
.  public 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 
.    Object yyVal = null;                               // value stack ptr
.    Object [] yyVals = new Object[yyMax];	        // value stack
.    int yyToken = -1;					// current input
.    int yyErrorFlag = 0;				// #tks to shift
.
 local		## %{ ... %} after the first %%

.    int yyTop = 0;
.    goto skip;
.    yyLoop:
.    yyTop++;
.    skip:
.    for (;; ++ yyTop) {
.      if (yyTop >= yyStates.Length) {			// dynamically increase
.        int[] i = new int[yyStates.Length+yyMax];
.        System.Array.Copy(yyStates, i, 0);
.        yyStates = i;
.        Object[] o = new Object[yyVals.Length+yyMax];
.        System.Array.Copy(yyVals, o, 0);
.        yyVals = o;
.      }
.      yyStates[yyTop] = yyState;
.      yyVals[yyTop] = yyVal;
t      if (debug != null) debug.push(yyState, yyVal);
.
.      yyDiscarded: for (;;) {	// discarding a token does not change stack
.        int yyN;
.        if ((yyN = yyDefRed[yyState]) == 0) {	// else [default] reduce (yyN)
.          if (yyToken < 0) {
.            yyToken = yyLex.advance() ? yyLex.token() : 0;
t            if (debug != null)
t              debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
.          }
.          if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0)
.              && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) {
t            if (debug != null)
t              debug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
.            yyState = yyTable[yyN];		// shift to yyN
.            yyVal = yyLex.value();
.            yyToken = -1;
.            if (yyErrorFlag > 0) -- yyErrorFlag;
.            goto yyLoop;
.          }
.          if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
.              && yyN < yyTable.Length && yyCheck[yyN] == yyToken)
.            yyN = yyTable[yyN];			// reduce (yyN)
.          else
.            switch (yyErrorFlag) {
.  
.            case 0:
.              yyerror(yyState,yyToken,yyLex.value(),yyExpecting(yyState));
t              if (debug != null) debug.error("syntax error");
.              goto case 1;
.            case 1: case 2:
.              yyErrorFlag = 3;
.              do {
.                if ((yyN = yySindex[yyStates[yyTop]]) != 0
.                    && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length
.                    && yyCheck[yyN] == Token.yyErrorCode) {
t                  if (debug != null)
t                    debug.shift(yyStates[yyTop], yyTable[yyN], 3);
.                  yyState = yyTable[yyN];
.                  yyVal = yyLex.value();
.                  goto yyLoop;
.                }
t                if (debug != null) debug.pop(yyStates[yyTop]);
.              } while (-- yyTop >= 0);
t              if (debug != null) debug.reject();
.              throw new yyParser.yyException("irrecoverable syntax error");
.  
.            case 3:
.              if (yyToken == 0) {
t                if (debug != null) debug.reject();
.                throw new yyParser.yyException("irrecoverable syntax error at end-of-file");
.              }
t              if (debug != null)
t                debug.discard(yyState, yyToken, yyname(yyToken),
t  							yyLex.value());
.              yyToken = -1;
.              goto 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]);
.        yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
.        switch (yyN) {

 actions		## code from the actions within the grammar

.        }
.        yyTop -= yyLen[yyN];
.        yyState = yyStates[yyTop];
.        int yyM = yyLhs[yyN];
.        if (yyState == 0 && yyM == 0) {
t          if (debug != null) debug.shift(0, yyFinal);
.          yyState = yyFinal;
.          if (yyToken < 0) {
.            yyToken = yyLex.advance() ? yyLex.token() : 0;
t            if (debug != null)
t               debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
.          }
.          if (yyToken == 0) {
t            if (debug != null) debug.accept(yyVal);
.            return yyVal;
.          }
.          goto yyLoop;
.        }
.        if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0)
.            && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState))
.          yyState = yyTable[yyN];
.        else
.          yyState = yyDgoto[yyM];
t        if (debug != null) debug.shift(yyStates[yyTop], yyState);
.	 goto yyLoop;
.      }
.    }
.  }
.
 tables			## tables for rules, default reduction, and action calls
.
 epilog			## text following second %%
.namespace yydebug {
.        using System;
.	 public interface yyDebug {
.        /// <summary>
.        /// Push a state an its value.
.        /// </summary>
.        /// <param name="state">state to push</param>
.        /// <param name="value">state value</param>
.		 void push (int state, Object value);
.
.        /// <summary>
.        /// Get a token.
.        /// </summary>
.        /// <param name="state">state</param>
.        /// <param name="token">token</param>
.        /// <param name="name">name</param>
.        /// <param name="value">state value</param>
.		 void lex (int state, int token, string name, Object value);
.		 
.        /// <summary>
.        /// Advance from a state.
.        /// </summary>
.        /// <param name="from">start state</param>
.        /// <param name="to">end state</param>
.        /// <param name="errorFlag">error flag</param>
.		 void shift (int from, int to, int errorFlag);
.		 
.        /// <summary>
.        /// Pop a state.
.        /// </summary>
.        /// <param name="state">state</param>
.		 void pop (int state);
.		 
.        /// <summary>
.        /// Discard state.
.        /// </summary>
.        /// <param name="state">state</param>
.        /// <param name="token">token</param>
.        /// <param name="name">name</param>
.        /// <param name="value">state value</param>
.		 void discard (int state, int token, string name, Object value);
.		 
.        /// <summary>
.        /// Reduce state.
.        /// </summary>
.        /// <param name="from">from</param>
.        /// <param name="to">to</param>
.        /// <param name="rule">rule</param>
.        /// <param name="text">text</param>
.        /// <param name="len">len</param>
.		 void reduce (int from, int to, int rule, string text, int len);
.		 
.        /// <summary>
.        /// Advance from a state.
.        /// </summary>
.        /// <param name="from">start state</param>
.        /// <param name="to">end state</param>
.		 void shift (int from, int to);
.		 
.        /// <summary>
.        /// Accept state.
.        /// </summary>
.        /// <param name="value">value</param>
.		 void accept (Object value);
.		
.        /// <summary>
.        /// Error.
.        /// </summary>
.        /// <param name="message">message</param> 
.		 void error (string message);
.		 
.        /// <summary>
.        /// Reject state.
.        /// </summary>
.		 void reject ();
.	 }
.	
.    /// <summary>
.    /// Single debug class.
.    /// </summary> 
.	 class yyDebugSimple : yyDebug {
.        /// <summary>
.        /// Print string on a new line.
.        /// </summary>
.        /// <param name="s">string to print</param>
.		 void println (string s){
.			 Console.Error.WriteLine(s);
.		 }
.		 
.        /// <summary>
.        /// Push a state an its value.
.        /// </summary>
.        /// <param name="state">state to push</param>
.        /// <param name="value">state value</param>
.		 public void push (int state, Object value) {
.			 println("push\tstate "+state+"\tvalue "+value);
.		 }
.
.        /// <summary>
.        /// Get a token.
.        /// </summary>
.        /// <param name="state">state</param>
.        /// <param name="token">token</param>
.        /// <param name="name">name</param>
.        /// <param name="value">state value</param>	 
.		 public void lex (int state, int token, string name, Object value) {
.			 println("lex\tstate "+state+"\treading "+name+"\tvalue "+value);
.		 }
.		 
.        /// <summary>
.        /// Advance from a state.
.        /// </summary>
.        /// <param name="from">start state</param>
.        /// <param name="to">end state</param>
.        /// <param name="errorFlag">error flag</param>
.		 public void shift (int from, int to, int errorFlag) {
.			 switch (errorFlag) {
.			 default:				// normally
.				 println("shift\tfrom state "+from+" to "+to);
.				 break;
.			 case 0: case 1: case 2:		// in error recovery
.				 println("shift\tfrom state "+from+" to "+to
.					     +"\t"+errorFlag+" left to recover");
.				 break;
.			 case 3:				// normally
.				 println("shift\tfrom state "+from+" to "+to+"\ton error");
.				 break;
.			 }
.		 }
.		 
.        /// <summary>
.        /// Pop a state.
.        /// </summary>
.        /// <param name="state">state</param>
.		 public void pop (int state) {
.			 println("pop\tstate "+state+"\ton error");
.		 }
.		 
.        /// <summary>
.        /// Discard state.
.        /// </summary>
.        /// <param name="state">state</param>
.        /// <param name="token">token</param>
.        /// <param name="name">name</param>
.        /// <param name="value">state value</param>
.		 public void discard (int state, int token, string name, Object value) {
.			 println("discard\tstate "+state+"\ttoken "+name+"\tvalue "+value);
.		 }
.		 
.        /// <summary>
.        /// Reduce state.
.        /// </summary>
.        /// <param name="from">from</param>
.        /// <param name="to">to</param>
.        /// <param name="rule">rule</param>
.        /// <param name="text">text</param>
.        /// <param name="len">len</param>
.		 public void reduce (int from, int to, int rule, string text, int len) {
.			 println("reduce\tstate "+from+"\tuncover "+to
.				     +"\trule ("+rule+") "+text);
.		 }
.		 
.        /// <summary>
.        /// Shift state.
.        /// </summary>
.        /// <param name="from">start state</param>
.        /// <param name="to">end state</param>
.		 public void shift (int from, int to) {
.			 println("goto\tfrom state "+from+" to "+to);
.		 }
.		 
.        /// <summary>
.        /// Accept state.
.        /// </summary>
.        /// <param name="value">value</param>
.		 public void accept (Object value) {
.			 println("accept\tvalue "+value);
.		 }
.		
.        /// <summary>
.        /// Error.
.        /// </summary>
.        /// <param name="message">message</param> 
.		 public void error (string message) {
.			 println("error\t"+message);
.		 }
.		 
.        /// <summary>
.        /// Reject state.
.        /// </summary>
.		 public void reject () {
.			 println("reject");
.		 }
.		 
.	 }
.}
. /// <summary>
. /// Token constants.
. /// </summary>
. public class Token {
.  public const int EOF = 0;
 tokens public const int
. }
. namespace yyParser {
.  using System;
. /// <summary>
. /// Thrown for irrecoverable syntax errors and stack overflow.
. /// </summary>
.  public class yyException : System.Exception {
.    /// <summary>
.    /// Exception.
.    /// </summary>
.    /// <param name="message">message</param>
.    public yyException (string message) : base (message) {
.    }
.  }
.
. /// <summary>
. /// Must be implemented by a scanner object to supply input to the parser.
. /// </summary>
.  public interface yyInput {
.    /// <summary>
.    /// Move on to next token.
.    /// </summary>
.	 /// <returns>false if positioned beyond tokens</returns>
.    bool advance (); // throws java.io.IOException;
.
.    /// <summary>
.    /// Classifies current token. Should not be called if advance() returned false.
.    /// </summary>
.	 /// <returns>current %token or single character</returns>
.    int token ();
.
.    /// <summary>
.    /// Associated with current token. Should not be called if advance() returned false.
.    /// </summary>
.	 /// <returns>value for token()</returns>
.    Object value ();
.  }
. }
.} // close outermost namespace, that MUST HAVE BEEN opened in the prolog
.//#if net_2_0
.//#pragma warning restore 1591, 162
.//#endif
