/** * 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; import org.antlr.runtime.CharStream; import org.antlr.runtime.Token; public class NamedToken implements Token { String name; Token delegate; public NamedToken(String name, Token delegate) { super(); this.name = name; this.delegate = delegate; } @Override public String toString() { return "<"+name+">"+delegate.toString(); } public int getChannel() { return delegate.getChannel(); } public int getCharPositionInLine() { return delegate.getCharPositionInLine(); } public CharStream getInputStream() { return delegate.getInputStream(); } public int getLine() { return delegate.getLine(); } public String getText() { return delegate.getText(); } public int getTokenIndex() { return delegate.getTokenIndex(); } public int getType() { return delegate.getType(); } public void setChannel(int channel) { delegate.setChannel(channel); } public void setCharPositionInLine(int pos) { delegate.setCharPositionInLine(pos); } public void setInputStream(CharStream input) { delegate.setInputStream(input); } public void setLine(int line) { delegate.setLine(line); } public void setText(String text) { delegate.setText(text); } public void setTokenIndex(int index) { delegate.setTokenIndex(index); } public void setType(int ttype) { delegate.setType(ttype); } }