Next: Common Patterns, Previous: C Scanners with Bison Parsers, Up: Appendices [Contents][Index]
The macro processor m4
8
must be installed wherever flex is installed.
flex
invokes ‘m4’, found by searching the directories in the
PATH
environment variable. Any code you place in section 1 or in the
actions will be sent through m4. Please follow these rules to protect your
code from unwanted m4
processing.
m4
macro names. If for
some reason you need m4_ as a prefix, use a preprocessor #define to get your
symbol past m4 unmangled.
x[y[z]]
. The solution is simple. To get the literal string
"]]"
, use "]""]"
. To get the array notation x[y[z]]
,
use x[y[z] ]
. Flex will attempt to detect these sequences in user code, and
escape them. However, it’s best to avoid this complexity where possible, by
removing such sequences from your code.
m4
is only required at the time you run flex
. The generated
scanner is ordinary C or C++, and does not require m4
.
The use of m4 is subject to change in future revisions of flex. It is not part of the public API of flex. Do not depend on it.