help-bison
[Top][All Lists]
Advanced

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

Re: Debug mode without using "-d"


From: Ervin Hegedüs
Subject: Re: Debug mode without using "-d"
Date: Mon, 9 Dec 2019 11:11:19 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

Hi Simon,

so many thanks for your help :).

On Sun, Dec 08, 2019 at 11:31:52PM +0100, Simon Richter wrote:
> On 08.12.19 19:46, Ervin Hegedüs wrote:
> 
> > I'ld like to control this feature through my code. I realized
> > that this option set a variable in generated source file:
> >
> >   1577  extern int yy_flex_debug;
> >   1578  int yy_flex_debug = 1;
> >
> >     if (argc > 1) {
> >         if (strcmp(argv[1], "debug") == 0) {
> >             yyset_debug(1);
> >         }
> >     ...
> >
> > but has no effect (if I use "flex" command without "-d").
> >
> > What am I missing?
> 
> The variable is initialized to 1 by default. If you want to leave the
> debug code in but disable it at runtime, your logic needs to set it to 0
> if no "debug" option was given.

ah, cool - now it works!

> Debug output from flex is usually not that useful to anyone not directly
> working on the parser, so the setting is seldom changed at runtime, and
> making it default-on if the debug code was generated allows people to
> add debug output to an existing program without changing other code,
> just by recompiling the lexer.

yes, I think it's clear for me - I'ld like to implement a parser
which will be a part of an API, and would like to give some help
the (API) users to get some debug information.

Many thanks again for your help,


regards,


a.




reply via email to

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