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: Simon Richter
Subject: Re: Debug mode without using "-d"
Date: Sun, 8 Dec 2019 23:31:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Hi Ervin,

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.

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.

   Simon

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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