From: Martin Q. <mar...@im...> - 2005-02-15 07:26:24
|
On Mon, Jan 24, 2005 at 05:06:27PM -0500, Dowling, William (Will) (TS USA) = wrote: > One limitation of the flexml-generated parser is that its prototype is > fixed within flexml: > int yylex() > In order to pass in a parameter to the generated parser, I had to resort > to a flex command line that contained this (I am generating C++ code, > hence the class declaration) >=20 > -PLinksXML \ > -DYY_DECL=3D'"class LinksAPIStart; static LinksAPIStart * > private_Start_ptr; int LinksXMLlex(LinksAPIStart *LinksAPIStart_ptr)"' \ > -DYY_USER_INIT=3D'"private_Start_ptr=3DLinksAPIStart_ptr;"' >=20 > This trick allows me to refer to the parameter passed into the parser > (LinksAPIStart_ptr) using the name private_Start_ptr in my .act file. >=20 > I sure would like a cleaner way to do this. Any ideas? It took me so long to answer because I'm really not sure to understand. What I can tell you is that we also want to embeed several parsers in the same code, and that I was thinking about implementing the -P flag to flexml. It does not look really related to your issue, now that I look more in detail to write this mail, does it? So I guess the answer is that I don't have any better idea ;) Sorry about that, Mt. |