From: William F. D. <wil...@th...> - 2006-09-12 18:16:17
|
Hi Staffan, I have checked in a change to flexml that should allow you to do what you want (sourceforge bug #1526054). Specify -h some_header.h on the flexml command line, and the generated file will have #include "some_header.h" at the bottom of the %{...%} section in the generated .l file. For example, you can put into the .h file something like #define YY_DECL \ static int static_lexer_param; int lexer(int lexer_param) #define YY_USER_INIT \ static_lexer_param =3D lexer_param; to change the name and signature of the generated scanner (and in this case, have access in the action code to a parameter passed into the lexer.) You could also redefine YY_INPUT here. Cheers, Will On Sun, 2006-09-10 at 06:49 +0800, sea...@he... wrote: > It's nice to see there's active development going on over at flexml > headquarters! >=20 > What you suggest, a way of putting a piece of user defined code at the > top of the .l file, is basically what I had in mind (that's what I > did, but manually). I cannot think of any scenarious where such an > approach would not suffice or a better solution. >=20 > Implementation-wise, I hope you can sort it out and wish you the best > of luck. >=20 > Sincerely, > Staffan Gim=E5ker >=20 --=20 William F Dowling wil...@th... www.scientific.thomson.com |