Re: Debug mode without using "-d"
Simon Richter <[email protected]>
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Message-ID | <[email protected]> |
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
signature.asc
(application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEtjuqOJSXmNjSiX3Tfr04e7CZCBEFAl3tedgACgkQfr04e7CZ CBG4UggAgMRyHf+Tjux7tDeURVHD/BHRTPEwZHsH995W9kss+zpgYepOADw9zYEs lfMVphBbvzMar/KluCgo8hzVwOhvGXx7MOwHPVuXpihN5wevuXQZfd4rVeJHtxXu TRn4n5ZQSjU+w7HyG0Xnrz329oy4XFW5xmusEsFvpNtilXuV/xrnY5bkMqq8hreL 2gaDk6Z/gsPer0MtSpybG/AgnkU9/GgmTK/wof/LQp5elLN8Dlc2+Afj5PeFPUUf gsUhCpHn1/vuPLLM9tZ9/7G03aqF9jg9GvsJ1aCsc/rhNF5xwMuHNY9gdCEt8kjs QdOJjZ4MbTRU3Rt+FSXKSmhxjfQqEQ== =07ux -----END PGP SIGNATURE-----