Investigating more, it looks like #tap really is missing from 1.8.6 (but
present in 1.8.7), and it looks to me like that was the nature of the
problem, not any input problems.
Fortunately, it also looks like this is really easy to fix. I added this
code to the top of my file to monkey patch a pure ruby implementation of
Object#tap back in, and Parslet seems to be working as expected now.
(Looks like the actual 1.8.7 implementation is C, not pure ruby, so, you
know, maybe there are performance implications, but I doubt it and don't
care that much).
Again, thanks for Parslet, using it is hands-down the most delightful
parsing experience I've ever had.
unless Object.method_defined?(:tap)
class Object
def tap
yield(self)
return self
end
end
end
On 3/14/2011 3:16 AM, Kaspar Schiess wrote:
>> It may very well be that 1.8.6 wont work. But judging from your stack
>> trace, this might be related to input you're giving as well;
>> Parslet::Atoms::Re constructs a regular expression from the range you're
>> feeding it (match('...')) - and that seems to fail. Maybe if you give us
>> something to work with (a piece of your grammar that reproduces the
>> error), somebody here will be able to reproduce this and narrow it down?
> And a correction ;) .. Is #tap really missing from 1.8.6? I guess that
> would kill compatibility, because I am a fan ;)
>
> kaspar
>