// Path: Mouse/source/runtime/Source.java
// public interface Source
// {
//   //-------------------------------------------------------------------
//   //  Is the wrapper correctly initialized?
//   //  The wrapper's constructor may encounter errors that result
//   //  in the object not being properly initialized.
//   //  The method returns 'false' if this is the case.
//   //-------------------------------------------------------------------
//   boolean created();
// 
//   //-------------------------------------------------------------------
//   //  Returns position of the last character plus 1
//   //  (= length of the sequence).
//   //-------------------------------------------------------------------
//   int end();
// 
//   //-------------------------------------------------------------------
//   //  Returns character at position p.
//   //-------------------------------------------------------------------
//   char at(int p);
// 
//   //-------------------------------------------------------------------
//   //  Returns characters at positions p through q-1.
//   //-------------------------------------------------------------------
//   String at(int p, int q);
// 
//   //-------------------------------------------------------------------
//   //  Describes position p in user's terms.
//   //-------------------------------------------------------------------
//   String where(int p);
// }


import mouse.runtime.Source;
//=========================================================================
//
//  Part of PEG parser generator Mouse.
//
//  Copyright (C) 2009, 2010, 2013
//  by Roman R. Redziejowski (www.romanredz.se).
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
//-------------------------------------------------------------------------
//
//  Change log
//    090721 Created for Mouse 1.1.
//   Version 1.3
//    100504 Added c.diag to arguments of begin in saved and savedInner.
//    100504 In Cache(String) set diag to name instead of null.
//   Version 1.6
//    130416 Allowed m=0 to enable performance comparisons.
//
//=========================================================================

package mouse.runtime;



//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
//
//  ParserMemo
//
//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH


public class ParserMemo extends ParserBase
{
  //-------------------------------------------------------------------
  //  Cache size.
  //-------------------------------------------------------------------
  int cacheSize = 1;

  //-------------------------------------------------------------------
  //  Phrase to reuse.
  //-------------------------------------------------------------------
  Phrase reuse;

  //-------------------------------------------------------------------
  //  List of Cache objects for initialization.
  //-------------------------------------------------------------------
  protected Cache[] caches;

  //-------------------------------------------------------------------
  //  Constructor
  //-------------------------------------------------------------------
  protected ParserMemo()
    {}

  //-------------------------------------------------------------------
  //  Initialize
  //-------------------------------------------------------------------
// Path: Mouse/source/runtime/Source.java
// public interface Source
// {
//   //-------------------------------------------------------------------
//   //  Is the wrapper correctly initialized?
//   //  The wrapper's constructor may encounter errors that result
//   //  in the object not being properly initialized.
//   //  The method returns 'false' if this is the case.
//   //-------------------------------------------------------------------
//   boolean created();
// 
//   //-------------------------------------------------------------------
//   //  Returns position of the last character plus 1
//   //  (= length of the sequence).
//   //-------------------------------------------------------------------
//   int end();
// 
//   //-------------------------------------------------------------------
//   //  Returns character at position p.
//   //-------------------------------------------------------------------
//   char at(int p);
// 
//   //-------------------------------------------------------------------
//   //  Returns characters at positions p through q-1.
//   //-------------------------------------------------------------------
//   String at(int p, int q);
// 
//   //-------------------------------------------------------------------
//   //  Describes position p in user's terms.
//   //-------------------------------------------------------------------
//   String where(int p);
// }


// Path: Mouse/source/runtime/ParserMemo.java
import mouse.runtime.Source;

//=========================================================================
//
//  Part of PEG parser generator Mouse.
//
//  Copyright (C) 2009, 2010, 2013
//  by Roman R. Redziejowski (www.romanredz.se).
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
//-------------------------------------------------------------------------
//
//  Change log
//    090721 Created for Mouse 1.1.
//   Version 1.3
//    100504 Added c.diag to arguments of begin in saved and savedInner.
//    100504 In Cache(String) set diag to name instead of null.
//   Version 1.6
//    130416 Allowed m=0 to enable performance comparisons.
//
//=========================================================================

package mouse.runtime;



//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
//
//  ParserMemo
//
//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH


public class ParserMemo extends ParserBase
{
  //-------------------------------------------------------------------
  //  Cache size.
  //-------------------------------------------------------------------
  int cacheSize = 1;

  //-------------------------------------------------------------------
  //  Phrase to reuse.
  //-------------------------------------------------------------------
  Phrase reuse;

  //-------------------------------------------------------------------
  //  List of Cache objects for initialization.
  //-------------------------------------------------------------------
  protected Cache[] caches;

  //-------------------------------------------------------------------
  //  Constructor
  //-------------------------------------------------------------------
  protected ParserMemo()
    {}

  //-------------------------------------------------------------------
  //  Initialize
  //-------------------------------------------------------------------
  public void init(Source src)