Reputation: 533
How to report parser warnings? Similar to reporting error, but the parser must not stop. Only log warning message and the subexpression caused the warning.
Example input:
select * from table where row>='' && row<>'hello'
Expected output:
Warning: expression is always true: row>=''
Warning: && is deprecated, use AND: row>='' && row<>'hello'
Warning: <> is deprecated, use !=: row<>'hello'
Upvotes: 4
Views: 446
Reputation: 11521
If you want to continue parsing you can register an error handler as before, except that you have to specify accept
as the handlers policy:
rule<Iterator> r = ... > !eps;
on_error<accept>(r, handler);
The appended > !eps
forces the error in any case and invokes the handler
as usual, but it will accept the match after the 'error', continuing as if nothing happened.
Upvotes: 4