diff options
author | Aaron Stone <sodabrew@users.sourceforge.net> | 2007-09-10 06:16:33 +0000 |
---|---|---|
committer | Aaron Stone <sodabrew@users.sourceforge.net> | 2007-09-10 06:16:33 +0000 |
commit | 7e635c2a527e7e780e995fb67dee4fc5e19eca48 (patch) | |
tree | bb4a4502dd8ec262e70ce25cb1f2b829d4f142bf /doc | |
parent | f1cce7961be770ac38c90bf4a519a2ad36c909a6 (diff) |
Introduce %option extra-type="your_type *" (resolves bug #1744505).
Diffstat (limited to 'doc')
-rw-r--r-- | doc/flex.texi | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/doc/flex.texi b/doc/flex.texi index e4a2f3d..f9a9e9e 100644 --- a/doc/flex.texi +++ b/doc/flex.texi @@ -4215,6 +4215,7 @@ after @code{yylex}, respectively. @example @verbatim int yylex_init ( yyscan_t * ptr_yy_globals ) ; + int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t * ptr_yy_globals ) ; int yylex ( yyscan_t yyscanner ) ; int yylex_destroy ( yyscan_t yyscanner ) ; @end verbatim @@ -4359,10 +4360,8 @@ be accessed from within the very first yyalloc, used to allocate the scanner itself. By default, @code{YY_EXTRA_TYPE} is defined as type @code{void *}. You -will have to cast @code{yyextra} and the return value from -@code{yyget_extra} to the appropriate value each time you access the -extra data. To avoid casting, you may override the default type by -defining @code{YY_EXTRA_TYPE} in section 1 of your scanner: +may redefine this type using @code{%option extra-type="your_type"} in +the scanner: @cindex YY_EXTRA_TYPE, defining your own type @example @@ -4371,9 +4370,9 @@ defining @code{YY_EXTRA_TYPE} in section 1 of your scanner: %{ #include <sys/stat.h> #include <unistd.h> - #define YY_EXTRA_TYPE struct stat* %} %option reentrant + %option extra-type="struct stat *" %% __filesize__ printf( "%ld", yyextra->st_size ); |