Even though the result is correct and makes much sense, would it be possible to simply have the longest matches?
Sure.
As you can see in the implementation and in the comment of #matchesIn:do: which is called by #matchesIn: the implementation tries the parser at each input position. You can skip over matches by using the following code instead:
Thanks.
[...]
Maybe that should be added? Maybe somebody has a better name :-)
What about matchesLongestIn: , or longestMatchesIn: ?
Alberto