Flex Actions
When a pattern is matched, the corresponding action is triggered. The
actions default to nothing, i.e., discard the current token. In the
output, the actions are embedded in the yylex
function,
therefore, using return
sets the return value of yylex
.
All the actions may use:
const char * yytext
|
Variable |
size_t yyleng
|
Variable |
Pointer to the beginning and length of the input string that matched the
regular expression.
|
Stands for "same as the next action".
|
Propagate the token to FILE *yyout , which defaults to the
standard output. This is the default action.
|
If defined, evaluated at the first invocation of yylex . This
macro can be used to perform some initialization of your scanners: it
will be execute as soon as you start them.
But be aware that if you run your scanner on several inputs, then only
the first run will trigger this code. If you need to perform some
initialization at each new file, you will have to find some other means.
|
Executed each time a rule matches, after yytext and yyleng
were set, but before the action is triggered.
|
user-yylex-prologue
|
Macro |
Executed each time yylex is invoked. See example 6.11 for its definition.
|