I tried to reproduce the issue on my workspace:
<snip>
octalDigit := PPPredicateObjectParser anyOf: '01234567'.
octalDigits := octalDigit plus.
zeroToThree := PPPredicateObjectParser anyOf: '0123'.
octalEscape := $\ asParser , ( (zeroToThree , octalDigit , octalDigit)
/ (octalDigit , octalDigit) / octalDigit ).
(octalEscape end parse: '\000') isPetitFailure
</snip>
In this case, it seems that changing the order of the different options
( (zeroToThree , octalDigit , octalDigit) / (octalDigit , octalDigit)
/ octalDigit )
matters. In fact, with the longest option, it is able to recognize all
the possibility.
So, is it correct that I have to put always the longest option in this cases?
Are there other approaches?
Finally, it does not work in the compiled PPJavaGrammar class.
Is there a way to reset all the variables, so that they will be
recompiled again?
Thank you,
Alberto
On 27 July 2010 17:08, Alberto Bacchelli <alberto.bacchelli(a)usi.ch> wrote:
[...]
Is there something wrong with my implementation,
or didn't I understand correctly the '/' operator?
I also tried to change the implementation of octalEscape in the following way
(to put the longest match as the first option), but without good results:
<snip>
PPJavaGrammar>>octalEscape
^ $\ asParser , ( (zeroToThree , octalDigit , octalDigit) /
(octalDigit , octalDigit) / octalDigit )
</snip>