Add a non-null default source Pair for CommonToken

This commit is contained in:
Sam Harwell 2013-02-22 13:35:47 -06:00
parent 1789e1685b
commit bb36baeb21
1 changed files with 4 additions and 0 deletions

View File

@ -36,6 +36,9 @@ import org.antlr.v4.runtime.misc.Pair;
import java.io.Serializable;
public class CommonToken implements WritableToken, Serializable {
protected static final Pair<TokenSource, CharStream> EMPTY_SOURCE =
new Pair<TokenSource, CharStream>(null, null);
protected int type;
protected int line;
protected int charPositionInLine = -1; // set to invalid position
@ -78,6 +81,7 @@ public class CommonToken implements WritableToken, Serializable {
this.type = type;
this.channel = DEFAULT_CHANNEL;
this.text = text;
this.source = EMPTY_SOURCE;
}
public CommonToken(Token oldToken) {