/*
 * @(#)ParserContext.java  2.5.0  18 August 2006
 *
 * Copyright 2006
 * College of Computer and Information Science
 * Northeastern University
 * Boston, MA  02115
 *
 * The Java Power Tools software may be used for educational
 * purposes as long as this copyright notice is retained intact
 * at the top of all source files.
 *
 * To discuss possible commercial use of this software, 
 * contact Richard Rasala at Northeastern University, 
 * College of Computer and Information Science,
 * 617-373-2462 or rasala@ccs.neu.edu.
 *
 * The Java Power Tools software has been designed and built
 * in collaboration with Viera Proulx and Jeff Raab.
 *
 * Should this software be modified, the words "Modified from 
 * Original" must be included as a comment below this notice.
 *
 * All publication rights are retained.  This software or its 
 * documentation may not be published in any media either
 * in whole or in part without explicit permission.
 *
 * This software was created with support from Northeastern 
 * University and from NSF grant DUE-9950829.
 */

package edu.neu.ccs.parser;

import java.util.*;

/**
 * <p>The class <code>ParserContext</code> is a
 * support class for the class <code>BaseParser</code>.
 * 
 * <p>The class allows the critical "state"
 * variables to be saved and restored in case the
 * <code>parse</code> method of <code>BaseParser</code>
 * is called recursively.</p>
 * 
 * <p>Currently the "state" variables are:</p>
 * 
 * <ul>
 *   <li><code>data</code>: the string being parsed</li>
 *   <li><code>next</code>: the current position in the string being parsed</li>
 *   <li><code>let_variables</code>: the current "let" variables</li>
 * </ul>
 * 
 * <p>We reserve the right to change this support class
 * in the future without a guarantee of backward
 * compatibility.  This class should not be used
 * directly by clients of Java Power Tools.</p>
 */
public class ParserContext {
    
    /** The string being parsed. */
    private String data = null;
    
    /** The current position in the string being parsed. */
    private int next = 0;
    
    /** The current "let" variables. */
    private Hashtable let_variables =null;
    
    
    /** The constructor that saves the parser context. */
    public ParserContext
        (String data, int next, Hashtable let_variables)
    {
        this.data = data;
        this.next = next;
        this.let_variables = let_variables;
    }
    
    
    /** Returns the string being parsed. */
    public String data() { return data; }
    
    /** Returns the current position in the string being parsed. */
    public int next() { return next; }
    
    /** Returns the current "let" variables. */
    public Hashtable let_variables() { return let_variables; }
    
}

