Hi David,

Normally one does not include ragel files that have write statements in them.

-Adrian

On 12-08-21 02:56 PM, David James wrote:
For some reason, Ragel is outputting constant static data (from `%%
write data`) **outside** of the places where I tell it.

I'm getting duplicate "write data" code generated:
1. a place where it should not: at the top of the file, outside of the
MyLexer class
2. the place where it should: inside MyLexer

Here is what I'm doing:

%%{
   machine my_lexer;
   include other_lexer "other_lexer.rl";
   # ...
}%%
class MyLexer < BaseLexer
   %% write data;
   def self.run_ragel(data, eof)
     %% write init;
     %% write exec;
   end
end

class BaseLexer
   # ...
   # (helper methods, shared across different lexers)
   # ...

   def self.run(string)
     data = string.unpack("c*")
     run_ragel(data, data.length)
   end
end

I suspect this has to do with the `include` statement. I'm new to Ragel,
but I've read the manual thoroughly. This is certainly not behavior that
would be expected. Is there something I'm not factoring in?

I even tried putting the %%{ }%% block inside the `class MyLexer <
BaseLexer` body -- even though I did not think that should make a
difference. It did not help.

Do I file a bug report here -- or is there an issue tracker? I can
create a minimal example to reproduce -- unless this is a known bug that
is already being worked on.



_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users


_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users

Reply via email to