int (such as short, char, or bool) as function arguments. For this
reason, future versions of @code{flex} may generate standard C99 code
only, leaving K&R-style functions to the historians. Currently, if you
-do @strong{not} want @samp{C99} definitions, then you must define
-@code{YY_TRADITIONAL_FUNC_DEFS}.
+do @strong{not} want @samp{C99} definitions, then you must use
+@code{%option noansi-definitions}.
@cindex stdin, default for yyin
@cindex yyin
@table @samp
-@anchor{option-bison-locations}
-@opindex ---bison-bridge
-@opindex bison-bridge
-@item --bison-bridge, @code{%option bison-bridge}
-instructs flex to generate a C scanner that is
-meant to be called by a
-@code{GNU bison}
-parser. The scanner has minor API changes for
-@code{bison}
-compatibility. In particular, the declaration of
-@code{yylex}
-is modified, and support for
-@code{yylval}
-and
-@code{yylloc}
-is incorporated. @xref{Bison Bridge}.
+@anchor{option-ansi-definitions}
+@opindex ---option-ansi-definitions
+@opindex ansi-definitions
+@item --ansi-definitions, @code{%option ansi-definitions}
+instruct flex to generate ANSI C99 definitions for functions.
+This option is enabled by default.
+If @code{%option noansi-definitions} is specified, then the obsolete style
+is generated.
+
+@anchor{option-ansi-prototypes}
+@opindex ---option-ansi-prototypes
+@opindex ansi-prototypes
+@item --ansi-prototypes, @code{%option ansi-prototypes}
+instructs flex to generate ANSI C99 prototypes for functions.
+This option is enabled by default.
+If @code{noansi-prototypes} is specified, then
+prototypes will have empty parameter lists.
@anchor{option-bison-bridge}
@opindex ---bison-bridge
@code{bison}
compatibility. In particular, the declaration of
@code{yylex}
-is modified, and support for
-@code{yylval}
-and
-@code{yylloc}
-is incorporated. @xref{Bison Bridge}.
-
+is modified to take an additional parameter,
+@code{yylval}.
+@xref{Bison Bridge}.
+@anchor{option-bison-locations}
+@opindex ---bison-locations
+@opindex bison-locations
+@item --bison-locations, @code{%option bison-locations}
+instruct flex that
+@code{GNU bison} @code{%locations} are being used.
+This means @code{yylex} will be passed
+an additional parameter, @code{yylloc}. This option
+implies @code{%option bison-bridge}.
+@xref{Bison Bridge}.
@anchor{option-noline}
@opindex -L
@code{flex} unless @code{%option yylineno} is enabled. This is to allow
the user to maintain the line count independently of @code{flex}.
+@anchor{bison-functions}
The following functions and macros are made available when @code{%option
bison-bridge} (@samp{--bison-bridge}) is specified:
A compatible @code{bison} scanner is generated by declaring @samp{%option
bison-bridge} or by supplying @samp{--bison-bridge} when invoking @code{flex}
-from the command line. This instructs @code{flex} that the macros
-@code{yylval} and @code{yylloc} may be used. The data types for
-@code{yylval} and @code{yylloc}, (@code{YYSTYPE} and @code{YYLTYPE},
-are typically defined in a header file, included in section 1 of the
-@code{flex} input file. If @code{%option bison-bridge} is
-specified, @code{flex} provides support for the functions
-@code{yyget_lval}, @code{yyset_lval}, @code{yyget_lloc}, and
-@code{yyset_lloc}, defined below, and the corresponding macros
-@code{yylval} and @code{yylloc}, for use within actions.
-
-@deftypefun YYSTYPE* yyget_lval ( yyscan_t scanner )
-@end deftypefun
-@deftypefun YYLTYPE* yyget_lloc ( yyscan_t scanner )
-@end deftypefun
+from the command line. This instructs @code{flex} that the macro
+@code{yylval} may be used. The data type for
+@code{yylval}, @code{YYSTYPE},
+is typically defined in a header file, included in section 1 of the
+@code{flex} input file. For a list of functions and macros
+available, @xref{bison-functions}.
-@deftypefun void yyset_lval ( YYSTYPE* lvalp, yyscan_t scanner )
-@end deftypefun
-@deftypefun void yyset_lloc ( YYLTYPE* llocp, yyscan_t scanner )
-@end deftypefun
-
-Where yyscan_t is defined in the reentrant scanner @footnote{The bison bridge
-works with non-reentrant scanners, too.}. Accordingly, the declaration of
-yylex becomes one of the following:
+The declaration of yylex becomes,
@findex yylex (reentrant version)
@example
@verbatim
int yylex ( YYSTYPE * lvalp, yyscan_t scanner );
+@end verbatim
+@end example
+
+If @code{%option bison-locations} is specified, then the declaration
+becomes,
+
+@findex yylex (reentrant version)
+@example
+@verbatim
int yylex ( YYSTYPE * lvalp, YYLTYPE * llocp, yyscan_t scanner );
@end verbatim
@end example
-Note that the macros @code{yylval} and @code{yylloc} evaluate to
-pointers. Support for @code{yylloc} is optional in @code{bison}, so it
-is optional in @code{flex} as well. This support is automatically
-handled by @code{flex}. Specifically, support for @code{yyloc} is only
-present in a @code{flex} scanner if the preprocessor symbol
-@code{YYLTYPE} is defined. The following is an example of a @code{flex}
-scanner that is compatible with @code{bison}.
+Note that the macros @code{yylval} and @code{yylloc} evaluate to pointers.
+Support for @code{yylloc} is optional in @code{bison}, so it is optional in
+@code{flex} as well. The following is an example of a @code{flex} scanner that
+is compatible with @code{bison}.
@cindex bison, scanner to be called from bison
@example
#include "y.tab.h" /* Generated by bison. */
%}
- %option reentrant-bison
+ %option bison-bridge bison-locations
%
[[:digit:]]+ { yylval->num = atoi(yytext); return NUMBER;}
#define YYPARSE_PARAM scanner
#define YYLEX_PARAM scanner
%}
+ %locations
%pure_parser
%union {
int num;
#define yyconst
#endif
-/* For compilers that can not handle prototypes.
- * e.g.,
- * The function prototype
- * int foo(int x, char* y);
- *
- * ...should be written as
- * int foo YY_PARAMS((int x, char* y));
- *
- * ...which could possibly generate
- * int foo ();
- */
-#ifdef YY_NO_PROTOS
-#define YY_PARAMS(proto) ()
-#else
-#define YY_PARAMS(proto) proto
-#endif
+%# For compilers that can not handle prototypes.
+%# e.g.,
+%# The function prototype
+%# int foo(int x, char* y);
+%#
+%# ...should be written as
+%# int foo M4_YY_PARAMS(int x, char* y);
+%#
+%# ...which could possibly generate
+%# int foo ();
+%#
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
+[[
+ m4_define( [[M4_YY_PARAMS]], [[()]])
+]],
+[[
+ m4_define( [[M4_YY_PARAMS]], [[($*)]])
+]])
%not-for-header
/* Returned upon end-of-file. */
m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])
%# For use in function definitions to append the additional argument.
-m4_ifdef( [[M4_YY_TRADITIONAL_FUNC_DEFS]],
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
[[
m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
#define yylineno YY_G(yylineno_r)
#define yy_flex_debug YY_G(yy_flex_debug_r)
-int yylex_init YY_PARAMS((yyscan_t* scanner));
+int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
%endif
%if-not-reentrant
m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])
m4_define( [[M4_YY_DEF_LAST_ARG]])
-m4_ifdef( [[M4_YY_TRADITIONAL_FUNC_DEFS]],
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
[[
m4_define( [[M4_YY_DEF_ONLY_ARG]])
]],
%endif
-m4_ifdef( [[M4_YY_TRADITIONAL_FUNC_DEFS]],
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
[[
%# For compilers that need traditional function definitions.
%# e.g.,
%endif
%endif
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
+]])
m4_ifdef( [[M4_YY_IN_HEADER]],,
[[
int yy_fill_buffer;
int yy_buffer_status;
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
/* When an EOF's been seen but there's still some text to process
* just pointing yyin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
+]])
};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
%ok-for-header
%endif
-void yyrestart YY_PARAMS(( FILE *input_file M4_YY_PROTO_LAST_ARG ));
-void yy_switch_to_buffer YY_PARAMS(( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG ));
-YY_BUFFER_STATE yy_create_buffer YY_PARAMS(( FILE *file, int size M4_YY_PROTO_LAST_ARG ));
-void yy_delete_buffer YY_PARAMS(( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG ));
-void yy_flush_buffer YY_PARAMS(( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG ));
-void yypush_buffer_state YY_PARAMS(( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG ));
-void yypop_buffer_state YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );
+void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
+YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );
+void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
+void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
+void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
+void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
m4_ifdef( [[M4_YY_IN_HEADER]],,
[[
-static void yyensure_buffer_stack YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
-static void yy_load_buffer_state YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
-static void yy_init_buffer YY_PARAMS(( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG ));
+static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );
]])
m4_ifdef( [[M4_YY_IN_HEADER]],,
#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
]])
-YY_BUFFER_STATE yy_scan_buffer YY_PARAMS(( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG ));
-YY_BUFFER_STATE yy_scan_string YY_PARAMS(( yyconst char *yy_str M4_YY_PROTO_LAST_ARG ));
-YY_BUFFER_STATE yy_scan_bytes YY_PARAMS(( yyconst char *bytes, int len M4_YY_PROTO_LAST_ARG ));
+YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );
+YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );
+YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, int len M4_YY_PROTO_LAST_ARG );
%endif
-void *yyalloc YY_PARAMS(( yy_size_t M4_YY_PROTO_LAST_ARG ));
-void *yyrealloc YY_PARAMS(( void *, yy_size_t M4_YY_PROTO_LAST_ARG ));
-void yyfree YY_PARAMS(( void * M4_YY_PROTO_LAST_ARG ));
+void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );
+void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );
+void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );
m4_ifdef( [[M4_YY_IN_HEADER]],,
[[
m4_ifdef( [[M4_YY_IN_HEADER]],,
[[
-static yy_state_type yy_get_previous_state YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
-static yy_state_type yy_try_NUL_trans YY_PARAMS(( yy_state_type current_state M4_YY_PROTO_LAST_ARG));
-static int yy_get_next_buffer YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
-static void yy_fatal_error YY_PARAMS(( yyconst char msg[] M4_YY_PROTO_LAST_ARG ));
+static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG);
+static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );
]])
%endif
M4_YY_SC_DEFS
m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
+m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
+[[
/* Special case for "unistd.h", since it is non-ANSI. We include it way
* down here because we want the user's section 1 to have been scanned first.
* The user has a chance to override it with an option.
*/
-m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
-[[
%if-c-only
#include <unistd.h>
%endif
m4_ifdef( [[M4_YY_IN_HEADER]],
[[
-static int yy_init_globals YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
%if-reentrant
m4_ifdef( [[M4_YY_NO_DESTROY]],,
[[
-int yylex_destroy YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
[[
-int yyget_debug YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
[[
-void yyset_debug YY_PARAMS(( int debug_flag M4_YY_PROTO_LAST_ARG ));
+void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
]])
m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
[[
-YY_EXTRA_TYPE yyget_extra YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
[[
-void yyset_extra YY_PARAMS(( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG ));
+void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
]])
m4_ifdef( [[M4_YY_NO_GET_IN]],,
[[
-FILE *yyget_in YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_SET_IN]],,
[[
-void yyset_in YY_PARAMS(( FILE * in_str M4_YY_PROTO_LAST_ARG ));
+void yyset_in M4_YY_PARAMS( FILE * in_str M4_YY_PROTO_LAST_ARG );
]])
m4_ifdef( [[M4_YY_NO_GET_OUT]],,
[[
-FILE *yyget_out YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_SET_OUT]],,
[[
-void yyset_out YY_PARAMS(( FILE * out_str M4_YY_PROTO_LAST_ARG ));
+void yyset_out M4_YY_PARAMS( FILE * out_str M4_YY_PROTO_LAST_ARG );
]])
m4_ifdef( [[M4_YY_NO_GET_LENG]],,
[[
-int yyget_leng YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+int yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
[[
-char *yyget_text YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
[[
-int yyget_lineno YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
[[
-void yyset_lineno YY_PARAMS(( int line_number M4_YY_PROTO_LAST_ARG ));
+void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );
]])
%if-bison-bridge
m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
[[
-YYSTYPE * yyget_lval YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
-void yyset_lval YY_PARAMS(( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG ));
+void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
m4_ifdef( [[M4_YY_BISON_BRIDGE_LOCATIONS]],
[[
m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
[[
- YYLTYPE *yyget_lloc YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+ YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
[[
- void yyset_lloc YY_PARAMS(( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG ));
+ void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
]])
]])
%endif
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
-extern "C" int yywrap YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
#else
-extern int yywrap YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
#endif
#endif
%not-for-header
m4_ifdef( [[M4_YY_NO_UNPUT]],,
[[
- static void yyunput YY_PARAMS(( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG));
+ static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);
]])
%ok-for-header
%endif
#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PARAMS(( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG));
+static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PARAMS(( yyconst char * M4_YY_PROTO_LAST_ARG));
+static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
#endif
#ifndef YY_NO_INPUT
%if-c-only Standard (non-C++) definition
%not-for-header
#ifdef __cplusplus
-static int yyinput YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
#else
-static int input YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
#endif
%ok-for-header
%endif
[[
m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
[[
- static void yy_push_state YY_PARAMS(( int new_state M4_YY_PROTO_LAST_ARG));
+ static void yy_push_state M4_YY_PARAMS( int new_state M4_YY_PROTO_LAST_ARG);
]])
m4_ifdef( [[M4_YY_NO_POP_STATE]],,
[[
- static void yy_pop_state YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+ static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
[[
- static int yy_top_state YY_PARAMS(( M4_YY_PROTO_ONLY_ARG ));
+ static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
]])
]])
#define YY_READ_BUF_SIZE 8192
#endif
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
/* Copy whatever the last rule matched to the standard output. */
-
#ifndef ECHO
%if-c-only Standard (non-C++) definition
/* This used to be an fputs(), but since the string might contain NUL's,
#define ECHO LexerOutput( yytext, yyleng )
%endif
#endif
+]])
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
%endif
#endif
+]])
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
/* No semi-colon after return; correct usage is to write "yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif
+]])
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
%if-c-only
#define YY_FATAL_ERROR(msg) LexerError( msg )
%endif
#endif
+]])
%if-tables-serialization structures and prototypes
m4preproc_include(`tables_shared.h')
/* Load the DFA tables from the given stream. */
-int yytables_fload YY_PARAMS ((FILE * fp M4_YY_PROTO_LAST_ARG));
+int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
/* Unload the tables from memory. */
-int yytables_destroy YY_PARAMS ((M4_YY_PROTO_ONLY_ARG));
+int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
%not-for-header
/** Describes a mapping from a serialized table id to its deserialized state in
%if-c-only Standard (non-C++) definition
-m4_define( [[M4_YY_LEX_PROTO]], [[YY_PARAMS((M4_YY_PROTO_ONLY_ARG))]])
+m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
m4_ifdef( [[M4_YY_BISON_BRIDGE]],
m4_dnl accept the lval parameter.
m4_define( [[M4_YY_LEX_PROTO]],
- [[YY_PARAMS((YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG))]])
+ [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
m4_define( [[M4_YY_LEX_DECLARATION]],
[[YYFARGS1(YYSTYPE *,yylval_param)]])
]])
m4_dnl Locations are used. yylex should also accept the ylloc parameter.
m4_define( [[M4_YY_LEX_PROTO]],
- [[YY_PARAMS((YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG))]])
+ [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
m4_define( [[M4_YY_LEX_DECLARATION]],
[[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
]])
%endif
#endif /* !YY_DECL */
-
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
/* Code executed at the beginning of each rule, after yytext and yyleng
* have been set up.
*/
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
+]])
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
+]])
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
%% [6.0] YY_RULE_SETUP definition goes here
+]])
%not-for-header
/** The main scanner function which does all the work.
%ok-for-header
%endif
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
/* yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
* EOB_ACT_END_OF_FILE - end of file
*/
%if-c-only
-%not-for-header
static int yy_get_next_buffer YYFARGS0(void)
%endif
%if-c++-only
return ret_val;
}
-%ok-for-header
+]])
/* yy_get_previous_state - get the state just before the EOB char was reached */
m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
[[
#ifndef __cplusplus
-extern int isatty YY_PARAMS(( int ));
+extern int isatty M4_YY_PARAMS( int );
#endif /* __cplusplus */
]])
]])
%if-c++-only
m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
[[
-extern "C" int isatty YY_PARAMS(( int ));
+extern "C" int isatty M4_YY_PARAMS( int );
]])
%endif
* the ONLY reentrant function that doesn't take the scanner as the last argument.
* That's why we explicitly handle the declaration, instead of using our macros.
*/
-#ifndef YY_TRADITIONAL_FUNC_DEFS
-int yylex_init(yyscan_t* ptr_yy_globals)
-#else
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
+[[
int yylex_init( ptr_yy_globals )
yyscan_t* ptr_yy_globals;
-#endif
+]],
+[[
+int yylex_init(yyscan_t* ptr_yy_globals)
+]])
{
if (ptr_yy_globals == NULL){
errno = EINVAL;
%endif
-/* Internal utility routines. */
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+/*
+ * Internal utility routines.
+ */
+]])
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
#ifndef yytext_ptr
static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
{
s1[i] = s2[i];
}
#endif
+]])
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen YYFARGS1( yyconst char *,s)
{
return n;
}
#endif
+]])
m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
[[
m4_ifdef([[M4_YY_MAIN]], [[
-int main YY_PARAMS((void));
+int main M4_YY_PARAMS(void);
int main ()
{