error method
Reports a parsing error by creating a ParseError associated with the given token.
It also calls the optional errorCallback if provided.
Returns the created ParseError object, which should typically be thrown by the caller.
Implementation
ParseError error(Token token, String message) {
// Don't set panic mode globally, handle recovery via synchronize
// _panicMode = true; // Enter panic mode on error
// Return the error to be thrown by the caller
if (errorCallback != null) errorCallback!(message);
return ParseError(token, message);
}