*/
private void highlightLexicalTokens() {
RecognizerSharedState state = new RecognizerSharedState();
state.errorRecovery = true; // don't issue 10 billion errors
PythonLexer lex = new PythonLexer(
new ANTLRStringStream(source) {
@Override
public String getSourceName() {
return path;
}
},
state);
lex.setErrorHandler(new RecordingErrorHandler() {
@Override
public void error(String message, PythonTree t) {
// don't println
}
@Override
public void reportError(BaseRecognizer br, RecognitionException re) {
// don't println
}
});
Token tok;
while ((tok = lex.nextToken()) != Token.EOF_TOKEN) {
switch (tok.getType()) {
case PythonLexer.STRING: {
int beg = ((CommonToken)tok).getStartIndex();
int end = ((CommonToken)tok).getStopIndex();
if (!docOffsets.contains(beg)) {