Yes in that case returning the furthest failure gives better results.
However, this don���t give meaningful messages in all cases.
For exemple with the calculator I gave in my previous message, if I parse ���1+��� I want to get ���expression expected at: 2��� but instead it returns ���$- expected at 2'.
I���m not proposing to remove this feature but to let parsers decide to use it or not.
Something like (changes in bold):
PPParser>>parseWithContext: context
| result |
context initializeFor: self.
result := self parseOn: context.
"Return the furthest failure, it gives better results than the last failure"
(result isPetitFailure and: [ self wantsFurthestFailure and: [ context furthestFailure notNil ] ])
ifTrue: [ ^ context furthestFailure ].
^ result
PPParser>>wantsFurthestFailure
^ true
Like this, one can return the failures he wants.
PPPrattParser>>wantsFurthestFailure
^ false
Camille