Open francislan opened 1 year ago
The documentation is not clear enough: the function must return false
. Allowing the parser to proceed after an error needs more work.
Thanks for clarifying. Is there a bug that tracks "allow the parser to proceed after an error" or "allow parsing non-finite numbers"?
Not that I am aware of.
Description
The documentation has contradictory information:
Here, it says that parse_error() must return
false
but here, it says that "the return value indicates whether the parsing should continue, so the function should usually returnfalse
."However it seems that the code expects
parse_error()
to returnfalse
and doesn't continue parsing if it returnstrue
. See parser::sax_parse_internal() where it propagates the return value ofparse_error()
instead of only propagatingfalse
values.Example:
Should be
This would allow a SAX handler to deal with non-finite numbers, for example by stringifying them instead of failing parsing altogether. Of course a cleaner way would be for the parser to handle that natively by introducing a new method
virtual bool number_nonfinite(const string_t& s) = 0;
Reproduction steps
Have a SAX handler return
true
for someparse_error()
Expected vs. actual results
Expected: the parser to continue parsing the rest of the input. Actual: the parser stops.
Minimal code example
No response
Error messages
No response
Compiler and operating system
N/A
Library version
developer branch
Validation
develop
branch is used.