I'd like to know about error messaging capabilities.
javacc 5.0
Assumptions:
I have 5 fields with 5 numbers each ... with some separator.
f.e.:
01234*56789*12391*98765
I cannot change the format and have a specification saying that the first 5 digits are variable say A, the next B ...
| <#NUM_CHAR: ["0"-"9"]>
| <N5: <NUM_CHAR><NUM_CHAR><NUM_CHAR><NUM_CHAR><NUM_CHAR> >
| <DELIMITER: *>
Sometimes I get data violating the format. Example: 4 instead of 5 digits. How can I tell which variable A,B,... is meant?
Parse error says only: <N5> expected, got: 1234
My silly workaround is this:
{ currentField = "A"; } (t = <N5>) { obj.setA(t.image); }
and in the parseexception case I attach the "currentField" value to the error msg. How would a pro do this? :-)
---
first i tried this:
| <A: N5>
| <B: N5>
...
Since <N5> was the first public occurrance ... all <A.>, <B.> (dots for non-html markup) always showed up as <N5> which isnt very distinctive.
---
2)
| <N5: <NUM_CHAR><NUM_CHAR><NUM_CHAR><NUM_CHAR><NUM_CHAR> >
According to the FAQ this should work but doesnt:
| <N5: <NUM_CHAR>{5} >
???