/** * Copyright 2011 Oliver Buchtala * * This file is part of ndogen. * * ndogen is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ndogen is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ndogen. If not, see <http://www.gnu.org/licenses/>. */ package org.ndogen.antlr; import org.antlr.runtime.CharStream; public class DebugCharStream implements CharStream { CharStream input; public DebugCharStream(CharStream input) { this.input = input; } public String substring(int start, int stop) { return input.substring(start, stop); } public void consume() { input.consume(); } public int LA(int i) { return input.LA(i); } public int LT(int i) { return input.LT(i); } public int mark() { return input.mark(); } public int getLine() { return input.getLine(); } public void setLine(int line) { input.setLine(line); } public int index() { return input.index(); } public void setCharPositionInLine(int pos) { input.setCharPositionInLine(pos); } public int getCharPositionInLine() { return input.getCharPositionInLine(); } public void rewind(int marker) { input.rewind(marker); } public void rewind() { input.rewind(); } public void release(int marker) { input.release(marker); } public void seek(int index) { input.seek(index); } public int size() { return input.size(); } public String getSourceName() { return input.getSourceName(); } @Override public String toString() { return input.substring(input.index(), input.size()-1); } }