@@ -28,7 +28,7 @@ Centre National de la Recherche Scientifique (CNRS).
2828 * This exception is thrown when parse errors are encountered. You can
2929 * explicitly create objects of this exception type by calling the method
3030 * generateParseException in the generated parser.
31- *
31+ *
3232 * You can modify this class to customize your error reporting mechanisms so
3333 * long as you retain the public fields.
3434 */
@@ -129,8 +129,7 @@ public String getMessage() {
129129 msg .append ("parse error [" );
130130 msg .append ((file != null ) ? file .toString () : "?" );
131131 msg .append (":" );
132- msg .append ((sourceRange != null ) ? sourceRange .toString ()
133- : "?" );
132+ msg .append ((sourceRange != null ) ? sourceRange .toString () : "?" );
134133 msg .append ("]\n " );
135134 msg .append (super .getMessage ());
136135 return msg .toString ();
@@ -152,14 +151,10 @@ public String getMessage() {
152151 }
153152 String retval = "parse error " ;
154153 retval += (file != null ) ? "[" + file + ":" : "[?:" ;
155- if (sourceRange != null ) {
156- retval += sourceRange .toString () + "]\n " ;
157- } else {
158- retval += currentToken .next .beginLine + "."
159- + currentToken .next .beginColumn + "-"
160- + currentToken .next .endLine + "."
161- + currentToken .next .endLine + "]\n " ;
162- }
154+ if (sourceRange == null ) {
155+ sourceRange = PanParserUtils .sourceRangeFromTokens (currentToken .next , currentToken .next );
156+ };
157+ retval += sourceRange .toString () + "]\n " ;
163158 retval += "\n Encountered: " ;
164159 Token tok = currentToken .next ;
165160 for (int i = 0 ; i < maxSize ; i ++) {
0 commit comments