This commit is contained in:
Terence Parr 2012-07-01 12:20:54 -07:00
parent db66257d7e
commit 37396d6040
1 changed files with 6 additions and 4 deletions

View File

@ -52,16 +52,18 @@ public class CommonTokenFactory implements TokenFactory<CommonToken> {
int channel, int start, int stop,
int line, int charPositionInLine)
{
if ( copyText && text==null ) {
CharStream input = source.getInputStream();
text = input.getText(Interval.of(start,stop));
}
CommonToken t = new CommonToken(source, type, channel, start, stop);
t.setLine(line);
t.setCharPositionInLine(charPositionInLine);
if ( text!=null ) {
t.setText(text);
}
else {
if ( copyText ) {
CharStream input = source.getInputStream();
t.setText(input.getText(Interval.of(start,stop)));
}
}
return t;
}