/*******************************************************************************
* Copyright (c) 2008 Scott Stanchfield.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Based on the ANTLR parser generator by Terence Parr, http://antlr.org
* Ric Klaren <klaren@cs.utwente.nl>
* Scott Stanchfield - Modifications for XML Parsing
*******************************************************************************/
package com.javadude.antxr;
public class CommonToken extends Token {
// most tokens will want line and text information
protected int line;
protected String text = null;
protected int col;
public CommonToken() {
// nothing
}
public CommonToken(int t, String txt) {
type = t;
setText(txt);
}
public CommonToken(String s) {
text = s;
}
@Override
public int getLine() {
return line;
}
@Override
public String getText() {
return text;
}
@Override
public void setLine(int l) {
line = l;
}
@Override
public void setText(String s) {
text = s;
}
@Override
public String toString() {
return "[\"" + getText() + "\",<" + type + ">,line=" + line + ",col=" + col + "]";
}
/** Return token's start column */
@Override
public int getColumn() {
return col;
}
@Override
public void setColumn(int c) {
col = c;
}
}