[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with multiple parsers

From: Laurence Finston
Subject: Problem with multiple parsers
Date: Wed, 28 Jan 2015 14:59:16 +0100


I've used multiple parsers in a few projects using the `%name-prefix' option.  
Some other files included more than one of the generated header files which 
meant that the %union type had to be the same for all the parsers.  However, in 
practice, this wasn't a problem.  In addition, I use a suffix for all token 
declarations so that there's no interference between tokens from the different 
parsers or between tokens and other macros.

I am also generating a reentrant parser and using locations so the declaration 
of, e.g., zzlex

zzlex(YYSTYPE* value,
      YYLTYPE* location,
      yyscan_t parameter);

I just noticed that `%name-prefix' is now deprecated, so I tried to use 
`%define api-prefix' instead.  In the Flex code for the scanners, I use 
`%option prefix' (as before).  

Everything works fine with `%name-prefix'.  When I try to use `%define 
api-prefix' instead, I get an error when linking:

undefined reference to `zzlex(ZZSTYPE*, ZZLTYPE*, void*)'

Flex doesn't define ZZSTYPE or ZZLTYPE.  I've tried various things, but none of 
them worked.

Does anyone know a solution for this problem?

I was happy with `%name-prefix' but I don't want my code to depend on it if it 
may be removed at some point.  It would also be nice if the %union types in the 
different parsers could be different.


Laurence Finston

reply via email to

[Prev in Thread] Current Thread [Next in Thread]