That's what I thought. I'll continue to pass it in, as the class @@variable approach feels much more brittle.
By the way I've noticed that these messages are not showing up on the list archive (http://librelist.com/browser/ruby.parslet/). Any particular reason why? Just curious. On Mon, Apr 1, 2013 at 4:55 PM, Nigel Thorne <[email protected]> wrote: > I attached a comment to your gist. Yes I found the same thing. > > > --- > "No man is an island... except Philip" > > > On Tue, Apr 2, 2013 at 12:29 AM, Thomas Ingram <[email protected]>wrote: > >> Thanks guys. Can we pretend this didn't happen? >> >> On another note it looks like the rule blocks are being class eval'd, so >> my `origin` instance method isn't even in scope. I'm passing it in when I >> call #apply, but is there a better way? >> >> >> On Mon, Apr 1, 2013 at 6:57 AM, Nigel Thorne <[email protected]>wrote: >> >>> >>> def initialize(origin,&block) >>> @origin = origin >>> super(&block) # <-----change your AST.rb to this >>> end >>> >>> transform.rb in Parslet was complaining that >>> >>> def rules >>> self.class.rules + @rules >>> end >>> >>> was adding nil. just to be sure I changed it to this... >>> >>> def rules >>> puts "#{self.class.rules.inspect} + #{@rules.inspect}" >>> self.class.rules + @rules >>> end >>> >>> which shows that @rules was nil >>> >>> @rules is initialized to [] in the initialize method... so the >>> constructor wasn't being called.. >>> >>> so... >>> >>> call super ;) >>> >>> >>> >>> --- >>> "No man is an island... except Philip" >>> >>> >>> On Mon, Apr 1, 2013 at 9:24 PM, Kaspar Schiess <[email protected]> wrote: >>> >>>> Hi Thomas, >>>> >>>> I think you're missing a call to 'super()' in your transform. Can you >>>> check in the code next time, so that I can test exactly what you're >>>> testing? >>>> >>>> regards, >>>> kaspar >>>> >>>> >>>> >>> >> >> >> -- >> Thomas Ingram >> > > -- Thomas Ingram
