This is G o o g l e's cache of
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
To link to or bookmark this page, use the following url:

Google is not affiliated with the authors of this page nor responsible for its content.

Flex Actions

Noeud:Flex Actions, Noeud «Previous»:Flex Regular Expressions, Noeud «Up»:Using Flex

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.

| Macro
Stands for "same as the next action".

ECHO Macro
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.