[ragel-users] Something like #define macros for Ragel grammar?

Adrian Thurston adrian.thurston at esentire.com
Thu Dec 16 17:34:47 UTC 2010


This has been a desired feature for many years. A few times I've 
sketched out a solution, but it has never materialized. Your request has 
been noted it bumps the relative priority.

Thanks,
  Adrian

On 10-12-08 01:23 PM, IƱaki Baz Castillo wrote:
> Hi, my Ragel grammar have many lines like "Via" below:
>
>   via_parm   = ( sent_protocol LWS sent_by ( SEMI ( via_branch |
> header_param ) )* )
>                      >start_value %store_value;
>   Via           = ( "Via"i | "v"i )>write_value>start_field
> %write_field HCOLON via_parm
>                      ( COMMA %write_value via_parm )*;
>
>
> So I would like to use smething like a C #define. This is, adding at
> the top of my Ragel file:
>
>    #define COMMA_SEPARATED_VALUES(VALUE) ">write_value>start_field
>               %write_field HCOLON VALUE ( COMMA %write_value VALUE )*;"
>
> And then in the machine write:
>
>    Via = ( "Via"i | "v"i ) COMMA_SEPARATED_VALUE(via_parm)
>
>
> Of course this doesn't work. Is there a way to use "define" macros in
> Ragel prior to parsing the Ragel grammar? or must I use m4?
>
> Thanks a lot.
>
>

_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users


More information about the ragel-users mailing list