[w32file] Move MonoIO.Find{First,Next,Close} to managed
[mono.git] / mcs / jay / skeleton.cs
index f11cf4e2a3c3da5e209ba2a8c1ccdf4b79581953..dda3811bdbe610f45ff599005ef953b25c417a5f 100644 (file)
 .  public void yyerror (string message) {
 .    yyerror(message, null);
 .  }
-.
+.#pragma warning disable 649
 .  /* An EOF token */
 .  public int eof_token;
-.
+.#pragma warning restore 649
 .  /** (syntax) error message.
 .      Can be overwritten to control message format.
 .      @param message text to be displayed.
@@ -59,7 +59,9 @@ t    if ((name = yyNames[token]) != null) return name;
 t    return "[unknown]";
 t  }
 .
+.#pragma warning disable 414
 .  int yyExpectingState;
+.#pragma warning restore 414
 .  /** computes list of expected tokens on error by tracing the tables.
 .      @param state for which to compute the list.
 .      @return list of token names.
@@ -123,6 +125,16 @@ t    this.debug = (yydebug.yyDebug)yyd;
 .    return first;
 .  }
 .
+.      static int[] global_yyStates;
+.      static object[] global_yyVals;
+.#pragma warning disable 649
+.      protected bool use_global_stacks;
+.#pragma warning restore 649
+.      object[] yyVals;                                        // value stack
+.      object yyVal;                                           // value stack ptr
+.      int yyToken;                                            // current input
+.      int yyTop;
+.
 .  /** the generated parser.
 .      Maintains a state and a value stack, currently with fixed maximum size.
 .      @param yyLex scanner.
@@ -131,30 +143,36 @@ t    this.debug = (yydebug.yyDebug)yyd;
 .    */
 .  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 
-.    Object yyVal = null;                               // value stack ptr
-.    Object [] yyVals = new Object[yyMax];             // value stack
-.    int yyToken = -1;                                 // current input
+.    if (yyMax <= 0) yyMax = 256;              // initial size
+.    int yyState = 0;                   // state stack ptr
+.    int [] yyStates;                  // state stack 
+.    yyVal = null;
+.    yyToken = -1;
 .    int yyErrorFlag = 0;                              // #tks to shift
+.      if (use_global_stacks && global_yyStates != null) {
+.              yyVals = global_yyVals;
+.              yyStates = global_yyStates;
+.   } else {
+.              yyVals = new object [yyMax];
+.              yyStates = new int [yyMax];
+.              if (use_global_stacks) {
+.                      global_yyVals = yyVals;
+.                      global_yyStates = yyStates;
+.              }
+.      }
 .
  local         ## %{ ... %} after the first %%
 
-.    /*yyLoop:*/ for (int yyTop = 0;; ++ yyTop) {
+.    /*yyLoop:*/ for (yyTop = 0;; ++ yyTop) {
 .      if (yyTop >= yyStates.Length) {                 // dynamically increase
-.        int[] i = new int[yyStates.Length+yyMax];
-.        yyStates.CopyTo (i, 0);
-.        yyStates = i;
-.        Object[] o = new Object[yyVals.Length+yyMax];
-.        yyVals.CopyTo (o, 0);
-.        yyVals = o;
+.        global::System.Array.Resize (ref yyStates, yyStates.Length+yyMax);
+.        global::System.Array.Resize (ref yyVals, yyVals.Length+yyMax);
 .      }
 .      yyStates[yyTop] = yyState;
 .      yyVals[yyTop] = yyVal;
 t      if (debug != null) debug.push(yyState, yyVal);
 .
-.      /*yyDiscarded:*/ for (;;) {     // discarding a token does not change stack
+.      /*yyDiscarded:*/ while (true) { // discarding a token does not change stack
 .        int yyN;
 .        if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
 .          if (yyToken < 0) {
@@ -183,7 +201,7 @@ t              debug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
 .              yyExpectingState = yyState;
 .              // yyerror(String.Format ("syntax error, got token `{0}'", yyname (yyToken)), yyExpecting(yyState));
 t              if (debug != null) debug.error("syntax error");
-.              if (yyToken == 0 || yyToken == eof_token /* eof */) throw new yyParser.yyUnexpectedEof ();
+.              if (yyToken == 0 /*eof*/ || yyToken == eof_token) throw new yyParser.yyUnexpectedEof ();
 .              goto case 1;
 .            case 1: case 2:
 .              yyErrorFlag = 3;
@@ -217,7 +235,7 @@ t                                                   yyLex.value());
 .        int yyV = yyTop + 1-yyLen[yyN];
 t        if (debug != null)
 t          debug.reduce(yyState, yyStates[yyV-1], yyN, YYRules.getRule (yyN), yyLen[yyN]);
-.        yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
+.        yyVal = yyV > yyTop ? null : yyVals[yyV]; // yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
 .        switch (yyN) {
 
  actions               ## code from the actions within the grammar
@@ -248,9 +266,9 @@ t            if (debug != null) debug.accept(yyVal);
 .          yyState = yyDgoto[yyM];
 t        if (debug != null) debug.shift(yyStates[yyTop], yyState);
 .       goto continue_yyLoop;
-.      continue_yyDiscarded: continue; // implements the named-loop continue: 'continue yyDiscarded'
+.      continue_yyDiscarded: ; // implements the named-loop continue: 'continue yyDiscarded'
 .      }
-.    continue_yyLoop: continue;                // implements the named-loop continue: 'continue yyLoop'
+.    continue_yyLoop: ;                // implements the named-loop continue: 'continue yyLoop'
 .    }
 .  }
 .