[Pharo-dev] petit parser longest match
norbert at hartl.name
Wed Nov 20 05:15:52 EST 2013
I talked to Lukas two years ago about parsing the longest match . He committed it to PetitBeta back then. Now I need it and I had a look at the current parsers but didn’t find one that can do the same. Is there a parser that can do longest match?
If not I would propose adding that to the default petit parser package. Lukas’ proposal back then was
| start element longestEnd longestElement |
start := aStream position.
1 to: parsers size do: [ :index |
element := (parsers at: index)
(longestEnd isNil or: [ longestEnd < aStream position ]) ifTrue: [
longestEnd := aStream position.
longestElement := element ].
aStream position: start ].
aStream position: longestEnd.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev