Subject: | better/prettier error handling |
Date: | Sat, 2 Jul 2011 20:44:01 +0200 |
To: | bug-regexp-grammars [...] rt.cpan.org |
From: | "Nicolas GEORGES (CPAN)" <xlat [...] cpan.org> |
For exemple, when running the following:
C:\perl510\geni\Regexp-Grammars-1.013\demo>perl demo_error.pl
1+2-5x5
Extra junk after expression at index 1: '+2-5x5'
Expected end of input, but found '+2-5x5' instead
Expected valid input, but found '+2-5x5' instead
Expected literal, but found '1+2-5x5' instead
Expected valid arithmetic expression, but found '1+2-5x5' instead
I would like to produce a message like :
Extra junk after expression at index 5: 'x5'
or
1+2-5x5
.....^__ Expected valid arithmetic expression
May be I miss something like <commit> that is available in Parse::RecDescent
?
In which case I could insert it at the right place in the grammar.
TIA,
Nicolas.