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
Description: OpenPGP digital signature