[ragel-users] Setting the "main := XXXX" value dynamically

Iñaki Baz Castillo ibc at aliax.net
Mon Feb 2 23:26:56 UTC 2009


Hi, I want to set the "main" value of a Ragel dynamically based on the content 
of a "main.h" file. Note however that I run Ragel using Ruby as host 
language.

I've tryed the following:

main.h
-----------------
#define KEYWORD "comment"
-----------------

my_script.rl
------------------
#!/usr/bin/env ruby

# String to parse.
data = ARGV[0]

%%{
	machine my_machine;
	import 'main.h' ;
	main := KEYWORD ;
	write data;
}%%

...
------------------


Unfortunatelly I get the following error when trying to compile my_script.rl 
file:

  my_script.rl: graph lookup of "KEYWORD" failed


Is there any way to achieve it? Thanks a lot.

-- 
Iñaki Baz Castillo




More information about the ragel-users mailing list