// if reader != null, reset it
public static PyException fixParseError(ReaderCharStream reader, Throwable t, String filename) {
if (t instanceof ParseException) {
ParseException e = (ParseException) t;
Token tok = e.currentToken;
int col = 0;
int line = 0;
if (tok != null && tok.next != null) {
col = tok.next.beginColumn;
line = tok.next.beginLine;