// Path: src/main/java/com/jenkov/container/script/ParserException.java
// public class ParserException extends ContainerException {
// 
//     public ParserException(String errorContext, String errorCode, String errorMessage) {
//         super(errorContext, errorCode, errorMessage);
//     }
// 
//     public ParserException(String errorContext, String errorCode, String errorMessage, Throwable cause) {
//         super(errorContext, errorCode, errorMessage, cause);
//     }
// }


import com.jenkov.container.script.ParserException;
import java.io.*;
import java.util.Stack;
package com.jenkov.container.script;



/**
 * @author Jakob Jenkov - Copyright 2004-2006 Jenkov Development
 */
public class ParserInput {

    protected ScriptTokenizer scriptTokenizer = null;
    protected Stack<ParserMark> marks  = new Stack<ParserMark>();

    /**
     * @deprecated Use the constructor that takes a Reader instead.
     * @param input
     */
    public ParserInput(InputStream input) {
        this.scriptTokenizer = new ScriptTokenizer(new ScriptTokenizerInputBuffer(new InputStreamReader(input)));
    }

    public ParserInput(Reader reader) {
        this.scriptTokenizer = new ScriptTokenizer(new ScriptTokenizerInputBuffer(reader));
    }
    

    public ParserInput(String input){
        this.scriptTokenizer = new ScriptTokenizer(new ScriptTokenizerInputBuffer(new StringReader(input)));
    }






    public void factoryStart(){
        this.scriptTokenizer.factoryStart();
    }

    public boolean isNextElseBacktrack(Token expectedToken){
        mark();
        Token nextToken = nextToken();
        boolean matches = expectedToken.equals(nextToken);
        if(matches) clearMark();
        else        backtrack();
        return matches;
    }

    public void assertNextToken(Token token){
        Token nextToken = nextToken();
        if(nextToken == null || !nextToken.equals(token)){
// Path: src/main/java/com/jenkov/container/script/ParserException.java
// public class ParserException extends ContainerException {
// 
//     public ParserException(String errorContext, String errorCode, String errorMessage) {
//         super(errorContext, errorCode, errorMessage);
//     }
// 
//     public ParserException(String errorContext, String errorCode, String errorMessage, Throwable cause) {
//         super(errorContext, errorCode, errorMessage, cause);
//     }
// }


// Path: src/main/java/com/jenkov/container/script/ParserInput.java
import com.jenkov.container.script.ParserException;
import java.io.*;
import java.util.Stack;

package com.jenkov.container.script;



/**
 * @author Jakob Jenkov - Copyright 2004-2006 Jenkov Development
 */
public class ParserInput {

    protected ScriptTokenizer scriptTokenizer = null;
    protected Stack<ParserMark> marks  = new Stack<ParserMark>();

    /**
     * @deprecated Use the constructor that takes a Reader instead.
     * @param input
     */
    public ParserInput(InputStream input) {
        this.scriptTokenizer = new ScriptTokenizer(new ScriptTokenizerInputBuffer(new InputStreamReader(input)));
    }

    public ParserInput(Reader reader) {
        this.scriptTokenizer = new ScriptTokenizer(new ScriptTokenizerInputBuffer(reader));
    }
    

    public ParserInput(String input){
        this.scriptTokenizer = new ScriptTokenizer(new ScriptTokenizerInputBuffer(new StringReader(input)));
    }






    public void factoryStart(){
        this.scriptTokenizer.factoryStart();
    }

    public boolean isNextElseBacktrack(Token expectedToken){
        mark();
        Token nextToken = nextToken();
        boolean matches = expectedToken.equals(nextToken);
        if(matches) clearMark();
        else        backtrack();
        return matches;
    }

    public void assertNextToken(Token token){
        Token nextToken = nextToken();
        if(nextToken == null || !nextToken.equals(token)){
            throw new ParserException(