@Override public String getMessage() { // sb is the next 100 characters of the text being parsed StringBuilder sb = new StringBuilder(); int curr; int counter = 0; curr = state.curr(); while (-1 != curr && ++counter < 100) { sb.append((char) curr); curr = state.next(); } String charInfo = "at or before character " + state.getCharPosition(); String lineInfo = "on or before line " + state.getLine(); return message + "\n" + charInfo + "\n" + lineInfo + "\n" + sb.toString(); }