(→How to Debug a Flex Specification) |
|||
Line 17: | Line 17: | ||
In the CompactScanner.l file: | In the CompactScanner.l file: | ||
%option debug | %option debug | ||
− | |||
− | |||
− | |||
Also, the YYDEBUG environment variable will activate the debug messages '''both''' in Flex and YACC (allowing debug of token recognition by the scanner and use by the parser). In the command line (syntax may vary, depending on the actual environment definition circumstances): | Also, the YYDEBUG environment variable will activate the debug messages '''both''' in Flex and YACC (allowing debug of token recognition by the scanner and use by the parser). In the command line (syntax may vary, depending on the actual environment definition circumstances): |
There are various flags and variables to activate the debug functionality in Flex (there is no need to insert useless code such as printfs or similar).
The debug option will activate code for debugging as will the call to the set_debug method (see the scanner header file in Compact for an example).
In the CompactScanner.l file:
%option debug
Also, the YYDEBUG environment variable will activate the debug messages both in Flex and YACC (allowing debug of token recognition by the scanner and use by the parser). In the command line (syntax may vary, depending on the actual environment definition circumstances):
export YYDEBUG=1