use of org.antlr.runtime.Lexer in project coffeescript-eclipse by adamschmideg.
the class FirstCommentIncludingXtextTokenStream method toString.
@Override
public String toString() {
if (p == -1) {
fillBuffer();
}
if (tokenSource instanceof Lexer) {
if (tokens.isEmpty())
return "";
Token lastToken = (Token) tokens.get(tokens.size() - 1);
if (lastToken instanceof CommonToken) {
CommonToken commonStop = (CommonToken) lastToken;
CharStream charStream = ((Lexer) tokenSource).getCharStream();
String result = charStream.substring(0, commonStop.getStopIndex());
return result;
}
}
return super.toString();
}
Aggregations