From: Philipp Hofmann Date: 2008-02-09T07:51:53+09:00 Subject: Re: ragel and ruby thanks for your answer, but i had that already. but for reference i figured it out: maybe i overread that somewhere, but the generated ruby class isn't meant to be instanciated. calling MyParser.parse without instanciation works. nevertheless the question remains why an accessor set at class level isn't accessible from an instance of the same class. g phil On Sat, Feb 09, 2008 at 06:37:18AM +0900, Judson Lester wrote: > This is sort of unconsidered, but it might help. In order to get > Ragel to work for me, I needed to add the following to the code > definition template: > > > %%{ > write init; > }%% > mark = nil > data = io.read > p = 0 > pe = data.length > stack = [] > top = 0 > %%write exec; > > > If I recall correctly, there's a way to go the other way: to have > Ragel generate different code for getting the next character, but it's > been a little while and I don't remember what it is. > > > > On Feb 8, 2008 12:49 PM, Philipp Hofmann wrote: > > > > > > Hi, > > > > I've been trying to generate ruby with ragel. But the generated code > > is complaing about undefined local variables > > > > Here an excerpt of the generated code: > > > > class MyParser > > > > # more generated code here ... > > > > class << self > > attr_accessor :mymachine_start > > end > > > > # and here ... > > > > def parse(input) > > > > # ... > > > > begin > > cs = mymachine_start > > end > > > > # ... > > > > end > > > > end > > > > If I prepend 'type.', which is deprecated, I know, it works for this > > case. But there are other accessor that are being set private, e. g. > > > > attr_accessor :_mymachine_trans_actions_wi > > private :_mymachine_trans_actions_wi, :_mymachine_trans_actions_wi= > > > > How is this mean to work? > > > > And why isn't an accessor set at class level not accessible from within > > an instance of this class in the first place? > > > > g phil > > > > > > >