forked from jasder/antlr
Add a non-null default source Pair for CommonToken
This commit is contained in:
parent
1789e1685b
commit
bb36baeb21
|
@ -36,6 +36,9 @@ import org.antlr.v4.runtime.misc.Pair;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class CommonToken implements WritableToken, 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 type;
|
||||||
protected int line;
|
protected int line;
|
||||||
protected int charPositionInLine = -1; // set to invalid position
|
protected int charPositionInLine = -1; // set to invalid position
|
||||||
|
@ -78,6 +81,7 @@ public class CommonToken implements WritableToken, Serializable {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.channel = DEFAULT_CHANNEL;
|
this.channel = DEFAULT_CHANNEL;
|
||||||
this.text = text;
|
this.text = text;
|
||||||
|
this.source = EMPTY_SOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommonToken(Token oldToken) {
|
public CommonToken(Token oldToken) {
|
||||||
|
|
Loading…
Reference in New Issue