-m4_changecom
%# -*-C-*- vi: set ft=c:
+%# This file is processed in several stages.
+%# Here are the stages, as best as I can describe:
+%#
+%# 1. flex.skl is processed through GNU m4 during the
+%# pre-compilation stage of flex. Only macros starting
+%# with `m4preproc_' are processed, and quoting is normal.
+%#
+%# 2. The preprocessed skeleton is translated verbatim into a
+%# C array, saved as "skel.c" and compiled into the flex binary.
+%#
+%# 3. At runtime, the skeleton is generated and filtered (again)
+%# through m4. Macros beginning with `m4_' will be processed.
+%# The quoting is "[[" and "]]" so we don't interfere with
+%# user code.
+%#
+%# All generate macros for the m4 stage contain the text "m4" or "M4"
+%# in them. This is to distinguish them from CPP macros.
+%# The exception to this rule is YY_G, which is an m4 macro,
+%# but it needs to be remain short because it is used everywhere.
+%#
/* A lexical scanner generated by flex */
-%# Lines in this skeleton starting with a '%' character are "control lines"
+%# Macros for preproc stage.
+m4preproc_changecom
+
+%# Macros for runtime processing stage.
+m4_changecom
+m4_changequote
+m4_changequote([[, ]])
+
+%#
+%# Lines in this skeleton starting with a "%" character are "control lines"
%# and affect the generation of the scanner. The possible control codes are
%# listed and processed in misc.c.
%#
#define FLEX_BETA
#endif
+%# Some negated symbols
+m4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]])
+m4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]])
+
+%# Prefixes.
+%# The complexity here is necessary so that m4 preserves
+%# the argument lists to each C function.
+
+
+m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
+
+m4preproc_define(`M4_GEN_PREFIX',
+ ``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
+
+%if-c++-only
+ /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+ * following macro.
+ */
+ #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]]
+%endif
+
+%if-c-only
+ M4_GEN_PREFIX(`_create_buffer')
+ M4_GEN_PREFIX(`_delete_buffer')
+ M4_GEN_PREFIX(`_scan_buffer')
+ M4_GEN_PREFIX(`_scan_string')
+ M4_GEN_PREFIX(`_scan_bytes')
+ M4_GEN_PREFIX(`_init_buffer')
+ M4_GEN_PREFIX(`_flush_buffer')
+ M4_GEN_PREFIX(`_load_buffer_state')
+ M4_GEN_PREFIX(`_switch_to_buffer')
+ M4_GEN_PREFIX(`push_buffer_state')
+ M4_GEN_PREFIX(`pop_buffer_state')
+ M4_GEN_PREFIX(`ensure_buffer_stack')
+ M4_GEN_PREFIX(`lex')
+ M4_GEN_PREFIX(`restart')
+ M4_GEN_PREFIX(`lex_init')
+ M4_GEN_PREFIX(`lex_destroy')
+ M4_GEN_PREFIX(`get_debug')
+ M4_GEN_PREFIX(`set_debug')
+ M4_GEN_PREFIX(`get_extra')
+ M4_GEN_PREFIX(`set_extra')
+ M4_GEN_PREFIX(`get_in')
+ M4_GEN_PREFIX(`set_in')
+ M4_GEN_PREFIX(`get_out')
+ M4_GEN_PREFIX(`set_out')
+ M4_GEN_PREFIX(`get_leng')
+ M4_GEN_PREFIX(`get_text')
+ M4_GEN_PREFIX(`get_lineno')
+ M4_GEN_PREFIX(`set_lineno')
+ M4_GEN_PREFIX(`wrap')
+%endif
+
+m4_ifdef( [[M4_YY_BISON_BRIDGE]],
+[[
+ M4_GEN_PREFIX(`get_lval')
+ M4_GEN_PREFIX(`set_lval')
+]])
+
+m4_ifdef( [[M4_YY_BISON_BRIDGE_LOCATIONS]],
+[[
+ M4_GEN_PREFIX(`get_lloc')
+ M4_GEN_PREFIX(`set_lloc')
+]])
+
+
+ M4_GEN_PREFIX(`alloc')
+ M4_GEN_PREFIX(`realloc')
+ M4_GEN_PREFIX(`free')
+
+%if-c-only
+m4_ifdef( [[M4_YY_REENTRANT]],,
+[[
+ M4_GEN_PREFIX(`text')
+ M4_GEN_PREFIX(`leng')
+ M4_GEN_PREFIX(`in')
+ M4_GEN_PREFIX(`out')
+ M4_GEN_PREFIX(`_flex_debug')
+ M4_GEN_PREFIX(`lineno')
+]])
+%endif
+
+
+m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
+[[
+ M4_GEN_PREFIX(`tables_fload')
+ M4_GEN_PREFIX(`tables_destroy')
+ M4_GEN_PREFIX(`TABLES_NAME')
+]])
+
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
/* end standard C headers. */
%if-c-or-c++
-m4_include(`flexint.h')
+m4preproc_include(`flexint.h')
%endif
%if-c++-only
#ifdef __cplusplus
-/* C++ compilers don't understand traditional function definitions. */
-#ifdef YY_TRADITIONAL_FUNC_DEFS
-#undef YY_TRADITIONAL_FUNC_DEFS
-#endif
-
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
-/* We're not in a C++ compiler, so by default,
- we generate C99 function defs, unless you explicitly ask
- for traditional defs by defining YY_TRADITIONAL_FUNC_DEFS */
-
#if __STDC__
#define YY_USE_CONST
#define yyconst
#endif
-/* For compilers that can't 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. */
#define YY_NULL 0
+%ok-for-header
+%not-for-header
/* Promotes a possibly negative, possibly signed char to an unsigned
* integer for use as an array index. If the signed char is negative,
* we want to instead treat it as an 8-bit unsigned char, hence the
* double cast.
*/
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+%ok-for-header
+
+
%if-reentrant
typedef void* yyscan_t;
#endif
-/* For use wherever a Global is accessed or assigned. */
-#define YY_G(var) (((struct yyguts_t*)yyscanner)->var)
+%# Declare yyguts variable
+m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])
+%# For use wherever a Global is accessed or assigned.
+m4_define( [[YY_G]], [[yyg->$1]])
-/* For use in function prototypes to append the additional argument. */
-#define YY_PROTO_LAST_ARG , yyscan_t yyscanner
-#define YY_PROTO_ONLY_ARG yyscan_t yyscanner
+%# For use in function prototypes to append the additional argument.
+m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])
+m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])
-/* For use in function definitions to append the additional argument. */
-#ifdef YY_TRADITIONAL_FUNC_DEFS
-#define YY_DEF_LAST_ARG , yyscanner
-#define YY_DEF_ONLY_ARG yyscanner
-#else
-#define YY_DEF_LAST_ARG , yyscan_t yyscanner
-#define YY_DEF_ONLY_ARG yyscan_t yyscanner
-#endif
-#define YY_DECL_LAST_ARG yyscan_t yyscanner;
+%# For use in function definitions to append the additional argument.
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
+[[
+ m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
+ m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
+]],
+[[
+ m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])
+ m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])
+]])
+m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])
+
+%# For use in function calls to pass the additional argument.
+m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])
+m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])
-/* For use in function calls to pass the additional argument. */
-#define YY_CALL_LAST_ARG , yyscanner
-#define YY_CALL_ONLY_ARG yyscanner
+%# For use in function documentation to adjust for additional argument.
+m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
/* For convenience, these vars (plus the bison vars far below)
are macros in the reentrant scanner. */
#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
-/* Define these macros to be no-ops. */
-#define YY_G(var) (var)
-#define YY_PROTO_LAST_ARG
-#define YY_PROTO_ONLY_ARG void
-#define YY_DEF_LAST_ARG
-#ifdef YY_TRADITIONAL_FUNC_DEFS
-#define YY_DEF_ONLY_ARG
-#else
-#define YY_DEF_ONLY_ARG void
-#endif
-#define YY_DECL_LAST_ARG
-#define YY_CALL_LAST_ARG
-#define YY_CALL_ONLY_ARG
-
-%endif
-
-
-/* For compilers that need traditional function definitions.
- * e.g.,
- * The function prototype taking 2 arguments
- * int foo (int x, char* y)
- *
- * ...should be written as
- * int foo YYFARGS2(int,x, char*,y)
- *
- * ...which could possibly generate
- * int foo (x,y,yyscanner)
- * int x;
- * char * y;
- * yyscan_t yyscanner;
- */
-#ifdef YY_TRADITIONAL_FUNC_DEFS
-/* Generate traditional function defs */
-#define YYFARGS0(v) (YY_DEF_ONLY_ARG) YY_DECL_LAST_ARG
-#define YYFARGS1(t1,n1) (n1 YY_DEF_LAST_ARG) t1 n1; YY_DECL_LAST_ARG
-#define YYFARGS2(t1,n1,t2,n2) (n1,n2 YY_DEF_LAST_ARG) t1 n1; t2 n2; YY_DECL_LAST_ARG
-#define YYFARGS3(t1,n1,t2,n2,t3,n3) (n1,n2,n3 YY_DEF_LAST_ARG) t1 n1; t2 n2; t3 n3; YY_DECL_LAST_ARG
-#else
-/* Generate C99 function defs. */
-#define YYFARGS0(v) (YY_DEF_ONLY_ARG)
-#define YYFARGS1(t1,n1) (t1 n1 YY_DEF_LAST_ARG)
-#define YYFARGS2(t1,n1,t2,n2) (t1 n1,t2 n2 YY_DEF_LAST_ARG)
-#define YYFARGS3(t1,n1,t2,n2,t3,n3) (t1 n1,t2 n2,t3 n3 YY_DEF_LAST_ARG)
-#endif
-
+%# Define these macros to be no-ops.
+m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])
+m4_define( [[YY_G]], [[($1)]])
+m4_define( [[M4_YY_PROTO_LAST_ARG]])
+m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])
+m4_define( [[M4_YY_DEF_LAST_ARG]])
+
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
+[[
+ m4_define( [[M4_YY_DEF_ONLY_ARG]])
+]],
+[[
+ m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])
+]])
+m4_define([[M4_YY_DECL_LAST_ARG]])
+m4_define([[M4_YY_CALL_LAST_ARG]])
+m4_define([[M4_YY_CALL_ONLY_ARG]])
+m4_define( [[M4_YY_DOC_PARAM]], [[]])
+
+%endif
+
+
+m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
+[[
+%# For compilers that need traditional function definitions.
+%# e.g.,
+%# The function prototype taking 2 arguments
+%# int foo (int x, char* y)
+%#
+%# ...should be written as
+%# int foo YYFARGS2(int,x, char*,y)
+%#
+%# ...which could possibly generate
+%# int foo (x,y,yyscanner)
+%# int x;
+%# char * y;
+%# yyscan_t yyscanner;
+%#
+%# Generate traditional function defs
+ m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)
+ M4_YY_DECL_LAST_ARG]])
+ m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG)
+ $1 $2;
+ M4_YY_DECL_LAST_ARG]])
+ m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG)
+ $1 $2;
+ $3 $4;
+ M4_YY_DECL_LAST_ARG]])
+ m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG)
+ $1 $2;
+ $3 $4;
+ $5 $6;
+ M4_YY_DECL_LAST_ARG]])
+]],
+[[
+%# Generate C99 function defs.
+ m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])
+ m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])
+ m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])
+ m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])
+]])
+
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
#define BEGIN YY_G(yy_start) = 1 + 2 *
+]])
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START ((YY_G(yy_start) - 1) / 2)
#define YYSTATE YY_START
+]])
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+]])
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin YY_CALL_LAST_ARG )
+#define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
+]])
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
#define YY_END_OF_BUFFER_CHAR 0
+]])
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
#endif
+]])
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
%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
-
-#ifdef YY_USE_LINENO
-/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
- * access to the local variable yy_act. Since yyless() is a macro, it would break
- * existing scanners that call yyless() from OUTSIDE yylex.
- * One obvious solution it to make yy_act a global. I tried that, and saw
- * a 5% performance hit in a non-yylineno scanner, because yy_act is
- * normally declared as a register variable-- so it's not worth it.
- */
-#define YY_LESS_LINENO(n) \
- do { \
- int yyl;\
- for ( yyl = n; yyl < yyleng; ++yyl )\
- if ( yytext[yyl] == '\n' )\
- --yylineno;\
- }while(0)
-#else
-#define YY_LESS_LINENO(n)
-#endif
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
+]])
+
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
+ m4_ifdef( [[M4_YY_USE_LINENO]],
+ [[
+ /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+ * access to the local variable yy_act. Since yyless() is a macro, it would break
+ * existing scanners that call yyless() from OUTSIDE yylex.
+ * One obvious solution it to make yy_act a global. I tried that, and saw
+ * a 5% performance hit in a non-yylineno scanner, because yy_act is
+ * normally declared as a register variable-- so it is not worth it.
+ */
+ #define YY_LESS_LINENO(n) \
+ do { \
+ int yyl;\
+ for ( yyl = n; yyl < yyleng; ++yyl )\
+ if ( yytext[yyl] == '\n' )\
+ --yylineno;\
+ }while(0)
+ ]],
+ [[
+ #define YY_LESS_LINENO(n)
+ ]])
+]])
+
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
+/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
{ \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
+]])
-#define unput(c) yyunput( c, YY_G(yytext_ptr) YY_CALL_LAST_ARG )
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
+#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
+]])
/* The following is because we cannot portably get our hands on size_t
* (without autoconf's help, which isn't available because we want
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 */
%if-not-reentrant
/* Stack of input buffers. */
-static size_t yy_buffer_stack_top = 0; /*<< index of top of stack. */
-static size_t yy_buffer_stack_max = 0; /*<< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /*<< Stack as an array. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
%endif
%ok-for-header
%endif
+
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
#define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
: NULL)
+]])
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
#define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
+]])
%if-c-only Standard (non-C++) definition
%not-for-header
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
-
static int yy_n_chars; /* number of characters read into yy_ch_buf */
-
-
int yyleng;
/* Points to current character in buffer. */
%ok-for-header
%endif
-void yyrestart YY_PARAMS(( FILE *input_file YY_PROTO_LAST_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 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 );
+]])
-void yy_switch_to_buffer YY_PARAMS(( YY_BUFFER_STATE new_buffer YY_PROTO_LAST_ARG ));
-void yy_load_buffer_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-YY_BUFFER_STATE yy_create_buffer YY_PARAMS(( FILE *file, int size YY_PROTO_LAST_ARG ));
-void yy_delete_buffer YY_PARAMS(( YY_BUFFER_STATE b YY_PROTO_LAST_ARG ));
-void yy_init_buffer YY_PARAMS(( YY_BUFFER_STATE b, FILE *file YY_PROTO_LAST_ARG ));
-void yy_flush_buffer YY_PARAMS(( YY_BUFFER_STATE b YY_PROTO_LAST_ARG ));
-void yypush_buffer_state YY_PARAMS(( YY_BUFFER_STATE new_buffer YY_PROTO_LAST_ARG ));
-void yypop_buffer_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
+#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
+]])
-%not-for-header
-static void yyensure_buffer_stack YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-%ok-for-header
-
-#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER YY_CALL_LAST_ARG)
-
-YY_BUFFER_STATE yy_scan_buffer YY_PARAMS(( char *base, yy_size_t size YY_PROTO_LAST_ARG ));
-YY_BUFFER_STATE yy_scan_string YY_PARAMS(( yyconst char *yy_str YY_PROTO_LAST_ARG ));
-YY_BUFFER_STATE yy_scan_bytes YY_PARAMS(( yyconst char *bytes, int len 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 YY_PROTO_LAST_ARG ));
-void *yyrealloc YY_PARAMS(( void *, yy_size_t YY_PROTO_LAST_ARG ));
-void yyfree YY_PARAMS(( void * 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]],,
+[[
#define yy_new_buffer yy_create_buffer
+]])
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
#define yy_set_interactive(is_interactive) \
{ \
if ( ! YY_CURRENT_BUFFER ){ \
- yyensure_buffer_stack (YY_CALL_ONLY_ARG); \
+ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG); \
+ yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
+]])
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
#define yy_set_bol(at_bol) \
{ \
if ( ! YY_CURRENT_BUFFER ){\
- yyensure_buffer_stack (YY_CALL_ONLY_ARG); \
+ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG); \
+ yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
+]])
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+]])
%% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
%if-c-only Standard (non-C++) definition
-%not-for-header
-static yy_state_type yy_get_previous_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-static yy_state_type yy_try_NUL_trans YY_PARAMS(( yy_state_type current_state YY_PROTO_LAST_ARG));
-static int yy_get_next_buffer YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-static void yy_fatal_error YY_PARAMS(( yyconst char msg[] YY_PROTO_LAST_ARG ));
-%ok-for-header
+
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
+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_ifdef( [[M4_YY_IN_HEADER]],,
+[[
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
*yy_cp = '\0'; \
%% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
YY_G(yy_c_buf_p) = yy_cp;
+]])
-%not-for-header
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
%% [4.0] data tables for the DFA and the user's section 1 definitions go here
-%ok-for-header
+]])
+m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
+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.
*/
-#ifndef YY_NO_UNISTD_H
%if-c-only
#include <unistd.h>
%endif
%if-c++-only
#include <unistd.h>
%endif
-#endif /* !YY_NO_UNISTD_H */
+]])
#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
%if-c-only Reentrant structure and macros (non-C++).
%if-reentrant
-%not-for-header
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
/* Holds the entire state of the reentrant scanner. */
struct yyguts_t
{
/* The rest are the same as the globals declared in the non-reentrant scanner. */
FILE *yyin_r, *yyout_r;
- size_t yy_buffer_stack_top; /*<< index of top of stack. */
- size_t yy_buffer_stack_max; /*<< capacity of stack. */
- YY_BUFFER_STATE * yy_buffer_stack; /*<< Stack as an array. */
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
+ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
char yy_hold_char;
int yy_n_chars;
int yyleng_r;
int yylineno_r;
int yy_flex_debug_r;
-#ifdef YY_USES_REJECT
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
yy_state_type *yy_state_buf;
yy_state_type *yy_state_ptr;
char *yy_full_match;
int yy_lp;
-#endif
+]])
-#ifdef YY_TEXT_IS_ARRAY
+m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
+[[
char yytext_r[YYLMAX];
char *yytext_ptr;
int yy_more_offset;
int yy_prev_more_offset;
-#else
+]],
+[[
char *yytext_r;
int yy_more_flag;
int yy_more_len;
-#endif
+]])
-%if-bison-bridge
+m4_ifdef( [[M4_YY_BISON_BRIDGE]],
+[[
YYSTYPE * yylval_r;
-#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+]])
+
+m4_ifdef( [[M4_YY_BISON_BRIDGE_LOCATIONS]],
+[[
YYLTYPE * yylloc_r;
-#endif
-%endif
+]])
- };
-%ok-for-header
+ }; /* end struct yyguts_t */
+]])
-%not-for-header
-static int yy_init_globals YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-%ok-for-header
-%not-for-header These go in the .c file only.
-/* This must go here because YYSTYPE and YYLTYPE are included
- * from bison output in section 1.*/
+m4_ifdef( [[M4_YY_IN_HEADER]],
+[[
+static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
%if-reentrant
-%if-bison-bridge
-# define yylval YY_G(yylval_r)
-# if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
-# define yylloc YY_G(yylloc_r)
-# endif
-%endif
-%endif
-%ok-for-header
+m4_ifdef( [[M4_YY_IN_HEADER]],,
+[[
+ m4_ifdef( [[M4_YY_BISON_BRIDGE]],
+ [[
+ /* This must go here because YYSTYPE and YYLTYPE are included
+ * from bison output in section 1.*/
+ # define yylval YY_G(yylval_r)
+ ]])
+
+ m4_ifdef( [[M4_YY_BISON_BRIDGE_LOCATIONS]],
+ [[
+ # define yylloc YY_G(yylloc_r)
+ ]])
+]])
%endif
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
-#ifndef YY_NO_DESTROY
-int yylex_destroy YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-
-#ifndef YY_NO_GET_DEBUG
-int yyget_debug YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-
-#ifndef YY_NO_SET_DEBUG
-void yyset_debug YY_PARAMS(( int debug_flag YY_PROTO_LAST_ARG ));
-#endif
-
-#ifndef YY_NO_GET_EXTRA
-YY_EXTRA_TYPE yyget_extra YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-
-#ifndef YY_NO_SET_EXTRA
-void yyset_extra YY_PARAMS(( YY_EXTRA_TYPE user_defined YY_PROTO_LAST_ARG ));
-#endif
-
-#ifndef YY_NO_GET_IN
-FILE *yyget_in YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-
-#ifndef YY_NO_SET_IN
-void yyset_in YY_PARAMS(( FILE * in_str YY_PROTO_LAST_ARG ));
-#endif
+m4_ifdef( [[M4_YY_NO_DESTROY]],,
+[[
+int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
+[[
+int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
+[[
+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 M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
+[[
+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 M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_IN]],,
+[[
+void yyset_in M4_YY_PARAMS( FILE * in_str M4_YY_PROTO_LAST_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_OUT]],,
+[[
+FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_OUT]],,
+[[
+void yyset_out M4_YY_PARAMS( FILE * out_str M4_YY_PROTO_LAST_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_LENG]],,
+[[
+int yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
+[[
+char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
+[[
+int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+
+m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
+[[
+void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );
+]])
-#ifndef YY_NO_GET_OUT
-FILE *yyget_out YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-
-#ifndef YY_NO_SET_OUT
-void yyset_out YY_PARAMS(( FILE * out_str YY_PROTO_LAST_ARG ));
-#endif
-
-#ifndef YY_NO_GET_LENG
-int yyget_leng YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-
-#ifndef YY_NO_GET_TEXT
-char *yyget_text YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+%if-bison-bridge
+m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
+[[
+YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
-#ifndef YY_NO_GET_LINENO
-int yyget_lineno YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
-#ifndef YY_NO_SET_LINENO
-void yyset_lineno YY_PARAMS(( int line_number YY_PROTO_LAST_ARG ));
-#endif
+m4_ifdef( [[M4_YY_BISON_BRIDGE_LOCATIONS]],
+[[
+ m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
+ [[
+ YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+ ]])
-%if-bison-bridge
-#ifndef YY_NO_GET_LVAL
-YYSTYPE * yyget_lval YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-void yyset_lval YY_PARAMS(( YYSTYPE * yylvalp YY_PROTO_LAST_ARG ));
-#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
-#ifndef YY_NO_GET_LLOC
- YYLTYPE *yyget_lloc YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-#ifndef YY_NO_SET_LLOC
- void yyset_lloc YY_PARAMS(( YYLTYPE * yyllocp YY_PROTO_LAST_ARG ));
-#endif
-#endif /* YYLTYPE */
+ m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
+ [[
+ void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
+ ]])
+]])
%endif
+%endif End reentrant structures and macros.
/* Macros after this point can all be overridden by user definitions in
* section 1.
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
-extern "C" int yywrap YY_PARAMS(( YY_PROTO_ONLY_ARG ));
+extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
#else
-extern int yywrap YY_PARAMS(( YY_PROTO_ONLY_ARG ));
+extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
#endif
#endif
%not-for-header
-#ifndef YY_NO_UNPUT
-static void yyunput YY_PARAMS(( int c, char *buf_ptr YY_PROTO_LAST_ARG));
-#endif
+ m4_ifdef( [[M4_YY_NO_UNPUT]],,
+ [[
+ 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 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 * 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(( YY_PROTO_ONLY_ARG ));
+static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
#else
-static int input YY_PARAMS(( YY_PROTO_ONLY_ARG ));
+static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
#endif
%ok-for-header
%endif
%if-c-only
-#if YY_STACK_USED
-%if-not-reentrant
-%not-for-header
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-%ok-for-header
-%endif
-
-#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PARAMS(( int new_state YY_PROTO_LAST_ARG));
-#endif
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-
-#else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
-#endif
+%# TODO: This is messy.
+m4_ifdef( [[M4_YY_STACK_USED]],
+[[
+
+m4_ifdef( [[M4_YY_REENTRANT]],,
+[[
+ m4_ifdef( [[M4_YY_IN_HEADER]],,
+ [[
+ static int yy_start_stack_ptr = 0;
+ static int yy_start_stack_depth = 0;
+ static int *yy_start_stack = 0;
+ ]])
+]])
+
+m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+[[
+ m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
+ [[
+ 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 M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+ ]])
+ m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
+ [[
+ static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+ ]])
+]])
+
+]],
+[[
+m4_define( [[M4_YY_NO_PUSH_STATE]])
+m4_define( [[M4_YY_NO_POP_STATE]])
+m4_define( [[M4_YY_NO_TOP_STATE]])
+]])
%endif
/* Amount of stuff to slurp up with each read. */
#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) yy_fatal_error( msg YY_CALL_LAST_ARG)
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
%endif
%if-c++-only
#define YY_FATAL_ERROR(msg) LexerError( msg )
%endif
#endif
+]])
%if-tables-serialization structures and prototypes
-m4_include(`tables_shared.h')
+m4preproc_include(`tables_shared.h')
/* Load the DFA tables from the given stream. */
-int yytables_fload YY_PARAMS ((FILE * fp 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 ((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
* easily add parameters.
*/
#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
%if-c-only Standard (non-C++) definition
-/* If the bison pure parser is used, then bison will provide
- one or two additional arguments. */
-%if-bison-bridge
-# if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
-# define YY_LEX_PROTO YY_PARAMS((YYSTYPE * yylvalp, YYLTYPE * yyllocp YY_PROTO_LAST_ARG))
-# define YY_LEX_DECLARATION YYFARGS2(YYSTYPE *,yylvalp, YYLTYPE *,yyllocp)
-# else
-# define YY_LEX_PROTO YY_PARAMS((YYSTYPE * yylvalp YY_PROTO_LAST_ARG))
-# define YY_LEX_DECLARATION YYFARGS1(YYSTYPE *,yylvalp)
-# endif
-%endif
+m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
+m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
-%if-not-bison-bridge
-# define YY_LEX_PROTO YY_PARAMS((YY_PROTO_ONLY_ARG))
-# define YY_LEX_DECLARATION YYFARGS0(void)
-%endif
+m4_ifdef( [[M4_YY_BISON_BRIDGE]],
+[[
+ m4_dnl The bison pure parser is used. Redefine yylex to
+ m4_dnl accept the lval parameter.
+
+ m4_define( [[M4_YY_LEX_PROTO]],
+ [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
+ m4_define( [[M4_YY_LEX_DECLARATION]],
+ [[YYFARGS1(YYSTYPE *,yylval_param)]])
+]])
+m4_ifdef( [[M4_YY_BISON_BRIDGE_LOCATIONS]],
+[[
+ m4_dnl Locations are used. yylex should also accept the ylloc parameter.
-extern int yylex YY_LEX_PROTO;
+ m4_define( [[M4_YY_LEX_PROTO]],
+ [[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)]])
+]])
-#define YY_DECL int yylex YY_LEX_DECLARATION
+extern int yylex M4_YY_LEX_PROTO;
+
+#define YY_DECL int yylex M4_YY_LEX_DECLARATION
%endif
%if-c++-only C++ definition
#define YY_DECL int yyFlexLexer::yylex()
%endif
-#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.
+ */
YY_DECL
- {
+{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
-%if-bison-bridge
-%if-not-reentrant
- YYSTYPE * yylval;
-# if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
- YYLTYPE * yylloc;
-# endif
-%endif
-%endif
+ M4_YY_DECL_GUTS_VAR();
+
+m4_ifdef( [[M4_YY_REENTRANT]],,
+[[
+ m4_ifdef( [[M4_YY_BISON_BRIDGE]],
+ [[
+ YYSTYPE * yylval;
+ ]])
+ m4_ifdef( [[M4_YY_BISON_BRIDGE_LOCATIONS]],
+ [[
+ YYLTYPE * yylloc;
+ ]])
+]])
%% [7.0] user's declarations go here
-%if-bison-bridge
- yylval = yylvalp;
-#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
- yylloc = yyllocp;
-#endif
-%endif
+m4_ifdef( [[M4_YY_BISON_BRIDGE]],
+[[
+ yylval = yylval_param;
+]])
+
+m4_ifdef( [[M4_YY_BISON_BRIDGE_LOCATIONS]],
+[[
+ yylloc = yylloc_param;
+]])
if ( YY_G(yy_init) )
{
YY_USER_INIT;
#endif
-#ifdef YY_USES_REJECT
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
if ( ! YY_G(yy_state_buf) )
- YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_BUF_SIZE + 2 YY_CALL_LAST_ARG);
-#endif
+ YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_BUF_SIZE + 2 M4_YY_CALL_LAST_ARG);
+]])
if ( ! YY_G(yy_start) )
YY_G(yy_start) = 1; /* first start state */
%endif
if ( ! YY_CURRENT_BUFFER ) {
- yyensure_buffer_stack (YY_CALL_ONLY_ARG);
+ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG);
+ yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
}
- yy_load_buffer_state( YY_CALL_ONLY_ARG );
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
}
while ( 1 ) /* loops until end-of-file is reached */
YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
- yy_current_state = yy_get_previous_state( YY_CALL_ONLY_ARG );
+ yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
/* Okay, we're now positioned to make the NUL
* transition. We couldn't have
* will run more slowly).
*/
- yy_next_state = yy_try_NUL_trans( yy_current_state YY_CALL_LAST_ARG);
+ yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
}
}
- else switch ( yy_get_next_buffer( YY_CALL_ONLY_ARG ) )
+ else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
{
case EOB_ACT_END_OF_FILE:
{
YY_G(yy_did_buffer_switch_on_eof) = 0;
- if ( yywrap( YY_CALL_ONLY_ARG ) )
+ if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
YY_G(yy_c_buf_p) =
YY_G(yytext_ptr) + yy_amount_of_matched_text;
- yy_current_state = yy_get_previous_state( YY_CALL_ONLY_ARG );
+ yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
yy_cp = YY_G(yy_c_buf_p);
yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
YY_G(yy_c_buf_p) =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
- yy_current_state = yy_get_previous_state( YY_CALL_ONLY_ARG );
+ yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
yy_cp = YY_G(yy_c_buf_p);
yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
- } /* end of yylex */
+} /* end of yylex */
%ok-for-header
%if-c++-only
%not-for-header
yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
- {
+{
yyin = arg_yyin;
yyout = arg_yyout;
yy_c_buf_p = 0;
YY_G(yy_buffer_stack_max) = 0;
-#ifdef YY_USES_REJECT
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
-#else
+]],
+[[
yy_state_buf = 0;
-#endif
- }
+]])
+}
yyFlexLexer::~yyFlexLexer()
- {
+{
delete [] yy_state_buf;
- yyfree( yy_start_stack YY_CALL_LAST_ARG );
- yy_delete_buffer( YY_CURRENT_BUFFER YY_CALL_LAST_ARG);
- }
+ yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
+ yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
+}
void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
- {
+{
if ( new_in )
{
- yy_delete_buffer( YY_CURRENT_BUFFER YY_CALL_LAST_ARG);
- yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE YY_CALL_LAST_ARG) YY_CALL_LAST_ARG);
+ yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
+ yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
}
if ( new_out )
yyout = new_out;
- }
+}
#ifdef YY_INTERACTIVE
int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
#else
int yyFlexLexer::LexerInput( char* buf, int max_size )
#endif
- {
+{
if ( yyin->eof() || yyin->fail() )
return 0;
else
return yyin->gcount();
#endif
- }
+}
void yyFlexLexer::LexerOutput( const char* buf, int size )
- {
+{
(void) yyout->write( buf, size );
- }
+}
%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_CONTINUE_SCAN - continue scanning from current position
* 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
int yyFlexLexer::yy_get_next_buffer()
%endif
- {
+{
+ M4_YY_DECL_GUTS_VAR();
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = YY_G(yytext_ptr);
register int number_to_move, i;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
+]],
+[[
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
yyrealloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 YY_CALL_LAST_ARG );
+ b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
}
else
/* Can't grow it, we don't own it. */
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
number_to_move - 1;
-#endif
+]])
}
if ( num_to_read > YY_READ_BUF_SIZE )
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin YY_CALL_LAST_ARG);
+ yyrestart( yyin M4_YY_CALL_LAST_ARG);
}
else
YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
return ret_val;
- }
-%ok-for-header
+}
+]])
/* yy_get_previous_state - get the state just before the EOB char was reached */
%if-c++-only
yy_state_type yyFlexLexer::yy_get_previous_state()
%endif
- {
+{
register yy_state_type yy_current_state;
register char *yy_cp;
+ M4_YY_DECL_GUTS_VAR();
%% [15.0] code to get the start state into yy_current_state goes here
}
return yy_current_state;
- }
+}
/* yy_try_NUL_trans - try to make a transition on the NUL character
%if-c++-only
yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
%endif
- {
+{
register int yy_is_jam;
+ M4_YY_DECL_GUTS_VAR();
%% [17.0] code to find the next state, and perhaps do backing up, goes here
return yy_is_jam ? 0 : yy_current_state;
- }
+}
%if-c-only
-#ifndef YY_NO_UNPUT
+m4_ifdef( [[M4_YY_NO_UNPUT]],,
+[[
static void yyunput YYFARGS2( int,c, register char *,yy_bp)
%endif
%if-c++-only
void yyFlexLexer::yyunput( int c, register char* yy_bp)
%endif
- {
+{
register char *yy_cp = YY_G(yy_c_buf_p);
+ M4_YY_DECL_GUTS_VAR();
/* undo effects of setting up yytext */
*yy_cp = YY_G(yy_hold_char);
*--yy_cp = (char) c;
%% [18.0] update yylineno here
-#ifdef YY_USE_LINENO
+m4_ifdef( [[M4_YY_USE_LINENO]],
+[[
if ( c == '\n' )
--yylineno;
-#endif
+]])
+
YY_G(yytext_ptr) = yy_bp;
YY_G(yy_hold_char) = *yy_cp;
YY_G(yy_c_buf_p) = yy_cp;
- }
+}
%if-c-only
-#endif /* ifndef YY_NO_UNPUT */
+]])
%endif
%if-c-only
%if-c++-only
int yyFlexLexer::yyinput()
%endif
-
- {
+{
int c;
+ M4_YY_DECL_GUTS_VAR();
*YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
int offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
++YY_G(yy_c_buf_p);
- switch ( yy_get_next_buffer( YY_CALL_ONLY_ARG ) )
+ switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
{
case EOB_ACT_LAST_MATCH:
/* This happens because yy_g_n_b()
*/
/* Reset buffer status. */
- yyrestart( yyin YY_CALL_LAST_ARG);
+ yyrestart( yyin M4_YY_CALL_LAST_ARG);
/*FALLTHROUGH*/
case EOB_ACT_END_OF_FILE:
{
- if ( yywrap( YY_CALL_ONLY_ARG ) )
+ if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
return EOF;
if ( ! YY_G(yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
#ifdef __cplusplus
- return yyinput(YY_CALL_ONLY_ARG);
+ return yyinput(M4_YY_CALL_ONLY_ARG);
#else
- return input(YY_CALL_ONLY_ARG);
+ return input(M4_YY_CALL_ONLY_ARG);
#endif
}
%% [19.0] update BOL and yylineno
return c;
- }
+}
%if-c-only
#endif /* ifndef YY_NO_INPUT */
%endif
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * M4_YY_DOC_PARAM
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
%if-c-only
void yyrestart YYFARGS1( FILE *,input_file)
%endif
%if-c++-only
void yyFlexLexer::yyrestart( std::istream* input_file )
%endif
- {
+{
+ M4_YY_DECL_GUTS_VAR();
+
if ( ! YY_CURRENT_BUFFER ){
- yyensure_buffer_stack (YY_CALL_ONLY_ARG);
+ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG);
+ yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
}
- yy_init_buffer( YY_CURRENT_BUFFER, input_file YY_CALL_LAST_ARG);
- yy_load_buffer_state( YY_CALL_ONLY_ARG );
- }
+ yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
+}
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * M4_YY_DOC_PARAM
+ */
%if-c-only
void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)
%endif
%if-c++-only
void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
%endif
- {
+{
+ M4_YY_DECL_GUTS_VAR();
+
/* TODO. We should be able to replace this entire function body
* with
* yypop_buffer_state();
* yypush_buffer_state(new_buffer);
*/
- yyensure_buffer_stack (YY_CALL_ONLY_ARG);
+ yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
if ( YY_CURRENT_BUFFER == new_buffer )
return;
}
YY_CURRENT_BUFFER_LVALUE = new_buffer;
- yy_load_buffer_state( YY_CALL_ONLY_ARG );
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
* to go ahead and always set it.
*/
YY_G(yy_did_buffer_switch_on_eof) = 1;
- }
+}
%if-c-only
- void yy_load_buffer_state YYFARGS0(void)
+static void yy_load_buffer_state YYFARGS0(void)
%endif
%if-c++-only
void yyFlexLexer::yy_load_buffer_state()
%endif
- {
+{
+ M4_YY_DECL_GUTS_VAR();
YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
- }
+}
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * M4_YY_DOC_PARAM
+ * @return the allocated buffer state.
+ */
%if-c-only
YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)
%endif
%if-c++-only
YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
%endif
- {
+{
YY_BUFFER_STATE b;
+ m4_dnl M4_YY_DECL_GUTS_VAR();
- b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) YY_CALL_LAST_ARG );
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
- b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 YY_CALL_LAST_ARG );
+ b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
- yy_init_buffer( b, file YY_CALL_LAST_ARG);
+ yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
return b;
- }
+}
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * M4_YY_DOC_PARAM
+ */
%if-c-only
void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
%endif
%if-c++-only
void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
%endif
- {
+{
+ M4_YY_DECL_GUTS_VAR();
+
if ( ! b )
return;
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
- yyfree( (void *) b->yy_ch_buf YY_CALL_LAST_ARG );
+ yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
- yyfree( (void *) b YY_CALL_LAST_ARG );
- }
+ yyfree( (void *) b M4_YY_CALL_LAST_ARG );
+}
%if-c-only
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
+m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],,
+[[
+ m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
+ [[
#ifndef __cplusplus
-extern int isatty YY_PARAMS(( int ));
+extern int isatty M4_YY_PARAMS( int );
#endif /* __cplusplus */
-#endif /* !YY_NEVER_INTERACTIVE */
-#endif /* !YY_ALWAYS_INTERACTIVE */
+ ]])
+]])
+%endif
+
+%if-c++-only
+m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
+[[
+extern "C" int isatty M4_YY_PARAMS( int );
+]])
%endif
%if-c-only
- void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
+ static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
%endif
%if-c++-only
-#ifndef YY_NEVER_INTERACTIVE
-extern "C" int isatty YY_PARAMS(( int ));
-#endif
-void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
+ void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
%endif
- {
+{
int oerrno = errno;
+ m4_dnl M4_YY_DECL_GUTS_VAR();
- yy_flush_buffer( b YY_CALL_LAST_ARG);
+ yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
b->yy_input_file = file;
b->yy_fill_buffer = 1;
%if-c-only
-#if YY_ALWAYS_INTERACTIVE
+m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
+[[
b->yy_is_interactive = 1;
-#else
-#if YY_NEVER_INTERACTIVE
- b->yy_is_interactive = 0;
-#else
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-#endif
-#endif
+]],
+[[
+ m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
+ [[
+ b->yy_is_interactive = 0;
+ ]],
+ [[
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+ ]])
+]])
%endif
%if-c++-only
b->yy_is_interactive = 0;
%endif
errno = oerrno;
- }
+}
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * M4_YY_DOC_PARAM
+ */
%if-c-only
void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
%endif
%if-c++-only
void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
%endif
- {
+{
+ M4_YY_DECL_GUTS_VAR();
if ( ! b )
return;
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == YY_CURRENT_BUFFER )
- yy_load_buffer_state( YY_CALL_ONLY_ARG );
- }
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
+}
%if-c-or-c++
/** Pushes the new state onto the stack. The new state becomes
* the current state. This function will allocate the stack
* if necessary.
+ * @param new_buffer The new state.
+ * M4_YY_DOC_PARAM
*/
%if-c-only
void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
%endif
{
+ M4_YY_DECL_GUTS_VAR();
if (new_buffer == NULL)
return;
- yyensure_buffer_stack(YY_CALL_ONLY_ARG);
+ yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
/* This block is copied from yy_switch_to_buffer. */
if ( YY_CURRENT_BUFFER )
YY_CURRENT_BUFFER_LVALUE = new_buffer;
/* copied from yy_switch_to_buffer. */
- yy_load_buffer_state( YY_CALL_ONLY_ARG );
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
YY_G(yy_did_buffer_switch_on_eof) = 1;
}
%endif
%if-c-or-c++
-/** Removes and DELETES the top of the stack, if present.
- * The next element becomes the new top, if present.
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ * M4_YY_DOC_PARAM
*/
%if-c-only
void yypop_buffer_state YYFARGS0(void)
void yyFlexLexer::yypop_buffer_state (void)
%endif
{
+ M4_YY_DECL_GUTS_VAR();
if (!YY_CURRENT_BUFFER)
return;
- yy_delete_buffer(YY_CURRENT_BUFFER YY_CALL_LAST_ARG);
+ yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
YY_CURRENT_BUFFER_LVALUE = NULL;
if (YY_G(yy_buffer_stack_top) > 0)
--YY_G(yy_buffer_stack_top);
if (YY_CURRENT_BUFFER) {
- yy_load_buffer_state( YY_CALL_ONLY_ARG );
+ yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
YY_G(yy_did_buffer_switch_on_eof) = 1;
}
}
%if-c-or-c++
-/** Allocates the stack if it does not exist.
+/* Allocates the stack if it does not exist.
* Guarantees space for at least one push.
*/
%if-c-only
%endif
{
int num_to_alloc;
+ M4_YY_DECL_GUTS_VAR();
if (!YY_G(yy_buffer_stack)) {
num_to_alloc = 1;
YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
- YY_CALL_LAST_ARG);
+ M4_YY_CALL_LAST_ARG);
memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
(YY_G(yy_buffer_stack),
num_to_alloc * sizeof(struct yy_buffer_state*)
- YY_CALL_LAST_ARG);
+ M4_YY_CALL_LAST_ARG);
/* zero only the new slots.*/
memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
-#ifndef YY_NO_SCAN_BUFFER
+m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
+[[
%if-c-only
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * M4_YY_DOC_PARAM
+ * @return the newly allocated buffer state object.
+ */
YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
- {
+{
YY_BUFFER_STATE b;
+ m4_dnl M4_YY_DECL_GUTS_VAR();
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
/* They forgot to leave room for the EOB's. */
return 0;
- b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) YY_CALL_LAST_ARG );
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
- yy_switch_to_buffer( b YY_CALL_LAST_ARG );
+ yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
return b;
- }
+}
%endif
-#endif
+]])
-#ifndef YY_NO_SCAN_STRING
+m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
+[[
%if-c-only
-YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,yy_str)
- {
- int len;
- for ( len = 0; yy_str[len]; ++len )
- ;
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param str a NUL-terminated string to scan
+ * M4_YY_DOC_PARAM
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *,str)
+{
+ m4_dnl M4_YY_DECL_GUTS_VAR();
- return yy_scan_bytes( yy_str, len YY_CALL_LAST_ARG);
- }
+ return yy_scan_bytes( str, strlen(str) M4_YY_CALL_LAST_ARG);
+}
%endif
-#endif
+]])
-#ifndef YY_NO_SCAN_BYTES
+m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
+[[
%if-c-only
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * M4_YY_DOC_PARAM
+ * @return the newly allocated buffer state object.
+ */
YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,bytes, int ,len)
- {
+{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
int i;
+ m4_dnl M4_YY_DECL_GUTS_VAR();
/* Get memory for full buffer, including space for trailing EOB's. */
n = len + 2;
- buf = (char *) yyalloc( n YY_CALL_LAST_ARG );
+ buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
- b = yy_scan_buffer( buf, n YY_CALL_LAST_ARG);
+ b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
b->yy_is_our_buffer = 1;
return b;
- }
+}
%endif
-#endif
+]])
-#ifndef YY_NO_PUSH_STATE
+m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
+[[
%if-c-only
static void yy_push_state YYFARGS1( int ,new_state)
%endif
%if-c++-only
void yyFlexLexer::yy_push_state( int new_state )
%endif
- {
+{
+ M4_YY_DECL_GUTS_VAR();
if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
{
yy_size_t new_size;
new_size = YY_G(yy_start_stack_depth) * sizeof( int );
if ( ! YY_G(yy_start_stack) )
- YY_G(yy_start_stack) = (int *) yyalloc( new_size YY_CALL_LAST_ARG );
+ YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
else
YY_G(yy_start_stack) = (int *) yyrealloc(
- (void *) YY_G(yy_start_stack), new_size YY_CALL_LAST_ARG );
+ (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
if ( ! YY_G(yy_start_stack) )
YY_FATAL_ERROR(
YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
BEGIN(new_state);
- }
-#endif
+}
+]])
-#ifndef YY_NO_POP_STATE
+m4_ifdef( [[M4_YY_NO_POP_STATE]],,
+[[
%if-c-only
static void yy_pop_state YYFARGS0(void)
%endif
%if-c++-only
void yyFlexLexer::yy_pop_state()
%endif
- {
+{
+ M4_YY_DECL_GUTS_VAR();
if ( --YY_G(yy_start_stack_ptr) < 0 )
YY_FATAL_ERROR( "start-condition stack underflow" );
BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
- }
-#endif
+}
+]])
-#ifndef YY_NO_TOP_STATE
+m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
+[[
%if-c-only
static int yy_top_state YYFARGS0(void)
%endif
%if-c++-only
int yyFlexLexer::yy_top_state()
%endif
- {
+{
+ M4_YY_DECL_GUTS_VAR();
return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
- }
-#endif
+}
+]])
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
%if-c-only
static void yy_fatal_error YYFARGS1(yyconst char*, msg)
- {
+{
+ m4_dnl M4_YY_DECL_GUTS_VAR();
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
- }
+}
%endif
%if-c++-only
void yyFlexLexer::LexerError( yyconst char msg[] )
- {
+{
+ M4_YY_DECL_GUTS_VAR();
std::cerr << msg << std::endl;
exit( YY_EXIT_FAILURE );
- }
+}
%endif
/* Redefine yyless() so it works in section 3 code. */
%if-c-only
%if-reentrant
-#ifndef YY_NO_GET_EXTRA
+m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
+[[
+/** Get the user-defined data for this scanner.
+ * M4_YY_DOC_PARAM
+ */
YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
{
+ M4_YY_DECL_GUTS_VAR();
return yyextra;
}
-#endif /* !YY_NO_GET_EXTRA */
+]])
%endif
-#ifndef YY_NO_GET_LINENO
+m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
+[[
+/** Get the current line number.
+ * M4_YY_DOC_PARAM
+ */
int yyget_lineno YYFARGS0(void)
{
+ M4_YY_DECL_GUTS_VAR();
return yylineno;
}
-#endif /* !YY_NO_GET_LINENO */
+]])
-#ifndef YY_NO_GET_IN
+m4_ifdef( [[M4_YY_NO_GET_IN]],,
+[[
+/** Get the input stream.
+ * M4_YY_DOC_PARAM
+ */
FILE *yyget_in YYFARGS0(void)
{
+ M4_YY_DECL_GUTS_VAR();
return yyin;
}
-#endif /* !YY_NO_GET_IN */
+]])
-#ifndef YY_NO_GET_OUT
+m4_ifdef( [[M4_YY_NO_GET_OUT]],,
+[[
+/** Get the output stream.
+ * M4_YY_DOC_PARAM
+ */
FILE *yyget_out YYFARGS0(void)
{
+ M4_YY_DECL_GUTS_VAR();
return yyout;
}
-#endif /* !YY_NO_GET_OUT */
+]])
-#ifndef YY_NO_GET_LENG
+m4_ifdef( [[M4_YY_NO_GET_LENG]],,
+[[
+/** Get the length of the current token.
+ * M4_YY_DOC_PARAM
+ */
int yyget_leng YYFARGS0(void)
{
+ M4_YY_DECL_GUTS_VAR();
return yyleng;
}
-#endif /* !YY_NO_GET_LENG */
+]])
-#ifndef YY_NO_GET_TEXT
+/** Get the current token.
+ * M4_YY_DOC_PARAM
+ */
+m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
+[[
char *yyget_text YYFARGS0(void)
{
+ M4_YY_DECL_GUTS_VAR();
return yytext;
}
-#endif /* !YY_NO_GET_TEXT */
+]])
%if-reentrant
-#ifndef YY_NO_SET_EXTRA
+m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
+[[
+/** Set the user-defined data. This data is never touched by the scanner.
+ * @param user_defined The data to be associated with this scanner.
+ * M4_YY_DOC_PARAM
+ */
void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
{
+ M4_YY_DECL_GUTS_VAR();
yyextra = user_defined ;
}
-#endif /* !YY_NO_SET_EXTRA */
+]])
%endif
-#ifndef YY_NO_SET_LINENO
+m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
+[[
+/** Set the current line number.
+ * @param line_number
+ * M4_YY_DOC_PARAM
+ */
void yyset_lineno YYFARGS1( int ,line_number)
{
+ M4_YY_DECL_GUTS_VAR();
yylineno = line_number;
}
-#endif /* !YY_NO_SET_LINENO */
+]])
-#ifndef YY_NO_SET_IN
+m4_ifdef( [[M4_YY_NO_SET_IN]],,
+[[
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ * M4_YY_DOC_PARAM
+ * @see yy_switch_to_buffer
+ */
void yyset_in YYFARGS1( FILE * ,in_str)
{
+ M4_YY_DECL_GUTS_VAR();
yyin = in_str ;
}
-#endif /* !YY_NO_SET_IN */
+]])
-#ifndef YY_NO_SET_OUT
+m4_ifdef( [[M4_YY_NO_SET_OUT]],,
+[[
void yyset_out YYFARGS1( FILE * ,out_str)
{
+ M4_YY_DECL_GUTS_VAR();
yyout = out_str ;
}
-#endif /* !YY_NO_SET_OUT */
+]])
-#ifndef YY_NO_GET_DEBUG
+m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
+[[
int yyget_debug YYFARGS0(void)
{
+ M4_YY_DECL_GUTS_VAR();
return yy_flex_debug;
}
-#endif /* !YY_NO_GET_DEBUG */
+]])
-#ifndef YY_NO_SET_DEBUG
+m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
+[[
void yyset_debug YYFARGS1( int ,bdebug)
{
+ M4_YY_DECL_GUTS_VAR();
yy_flex_debug = bdebug ;
}
-#endif /* !YY_NO_SET_DEBUG */
+]])
%endif
%if-reentrant
/* Accessor methods for yylval and yylloc */
%if-bison-bridge
-#ifndef YY_NO_GET_LVAL
+m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
+[[
YYSTYPE * yyget_lval YYFARGS0(void)
{
+ M4_YY_DECL_GUTS_VAR();
return yylval;
}
-#endif /* !YY_NO_GET_LVAL */
+]])
-#ifndef YY_NO_SET_LVAL
-void yyset_lval YYFARGS1( YYSTYPE * ,yylvalp)
+m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
+[[
+void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
{
- yylval = yylvalp;
+ M4_YY_DECL_GUTS_VAR();
+ yylval = yylval_param;
}
-#endif /* !YY_NO_SET_LVAL */
+]])
-#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
-#ifndef YY_NO_GET_LLOC
+m4_ifdef( [[M4_YY_BISON_BRIDGE_LOCATIONS]],
+[[
+ m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
+ [[
YYLTYPE *yyget_lloc YYFARGS0(void)
{
+ M4_YY_DECL_GUTS_VAR();
return yylloc;
}
-#endif /* !YY_NO_GET_LLOC */
+ ]])
-#ifndef YY_NO_SET_LLOC
-void yyset_lloc YYFARGS1( YYLTYPE * ,yyllocp)
+ m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
+ [[
+void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
{
- yylloc = yyllocp;
+ M4_YY_DECL_GUTS_VAR();
+ yylloc = yylloc_param;
}
-#endif /* !YY_NO_SET_LLOC */
+ ]])
+]])
-#endif /* YYLTYPE */
%endif
static int yy_init_globals YYFARGS0(void)
- {
+{
+ M4_YY_DECL_GUTS_VAR();
/* Initialization is the same as for the non-reentrant scanner.
This function is called once per scanner lifetime. */
/* We do not touch yylineno unless the option is enabled. */
-#ifdef YY_USE_LINENO
+m4_ifdef( [[M4_YY_USE_LINENO]],
+[[
yylineno = 1;
-#endif
+]])
YY_G(yy_buffer_stack) = 0;
YY_G(yy_buffer_stack_top) = 0;
YY_G(yy_buffer_stack_max) = 0;
YY_G(yy_start_stack_depth) = 0;
YY_G(yy_start_stack) = (int *) 0;
-#ifdef YY_USES_REJECT
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
YY_G(yy_state_buf) = 0;
YY_G(yy_state_ptr) = 0;
YY_G(yy_full_match) = 0;
YY_G(yy_lp) = 0;
-#endif
+]])
-#ifdef YY_TEXT_IS_ARRAY
+m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
+[[
YY_G(yytext_ptr) = 0;
YY_G(yy_more_offset) = 0;
YY_G(yy_prev_more_offset) = 0;
-#endif
+]])
/* Defined in main.c */
#ifdef YY_STDINIT
* yylex_init()
*/
return 0;
- }
+}
/* User-visible API */
* 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;
return 1;
memset(*ptr_yy_globals,0,sizeof(struct yyguts_t));
return yy_init_globals ( *ptr_yy_globals );
- }
+}
%endif
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
int yylex_destroy YYFARGS0(void)
{
- int i;
+ M4_YY_DECL_GUTS_VAR();
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
- yy_delete_buffer( YY_CURRENT_BUFFER YY_CALL_LAST_ARG );
+ yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
YY_CURRENT_BUFFER_LVALUE = NULL;
- yypop_buffer_state(YY_CALL_ONLY_ARG);
+ yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
}
/* Destroy the stack itself. */
- yyfree(YY_G(yy_buffer_stack) YY_CALL_LAST_ARG);
+ yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
YY_G(yy_buffer_stack) = NULL;
-#if defined(YY_STACK_USED) || defined(YY_REENTRANT)
+%# This is the m4 way to say "if (stack_used || is_reentrant){ destroy_stack }"
+m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_DESTROY_START_STACK]])]])
+m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_DESTROY_START_STACK]])]])
+m4_ifdef( [[M4_YY_DESTROY_START_STACK]],
+[[
/* Destroy the start condition stack. */
- yyfree( YY_G(yy_start_stack) YY_CALL_LAST_ARG );
+ yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
YY_G(yy_start_stack) = NULL;
-#endif
+]])
-#ifdef YY_USES_REJECT
- yyfree ( YY_G(yy_state_buf) YY_CALL_LAST_ARG);
-#endif
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
+ yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
+]])
%if-reentrant
/* Destroy the main struct (reentrant only). */
- yyfree ( yyscanner YY_CALL_LAST_ARG );
+ yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
%endif
return 0;
}
%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)
- {
+{
register int i;
+ M4_YY_DECL_GUTS_VAR();
for ( i = 0; i < n; ++i )
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)
- {
+{
register int n;
+ M4_YY_DECL_GUTS_VAR();
for ( n = 0; s[n]; ++n )
;
return n;
- }
+}
#endif
+]])
-/* You may override yyalloc by defining YY_NO_FLEX_ALLOC and linking to
- * your own version */
-#ifndef YY_NO_FLEX_ALLOC
+m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
+[[
void *yyalloc YYFARGS1( yy_size_t ,size)
- {
+{
return (void *) malloc( size );
- }
-#endif
+}
+]])
-/* You may override yyrealloc by defining YY_NO_FLEX_REALLOC and linking
- * to your own version. */
-#ifndef YY_NO_FLEX_REALLOC
+m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
+[[
void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)
- {
+{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
- }
-#endif
+}
+]])
-/* You may override yyfree by defining YY_NO_FLEX_FREE and linking to
- * your own version.*/
-#ifndef YY_NO_FLEX_FREE
+m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
+[[
void yyfree YYFARGS1( void *,ptr)
- {
+{
free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
- }
-#endif
+}
+]])
%if-tables-serialization definitions
-m4_include(`tables_shared.c')
+m4preproc_include(`tables_shared.c')
static int yytbl_read8 (void *v, struct yytbl_reader * rd)
{
}
/** Read the header */
-static int yytbl_hdr_read YYFARGS2 (struct yytbl_hdr *, th, struct yytbl_reader *, rd)
+static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
{
int bytes;
memset (th, 0, sizeof (struct yytbl_hdr));
return -1;
if (th->th_magic != YYTBL_MAGIC){
- yy_fatal_error("bad magic number" /*TODO: not fatal.*/ YY_CALL_LAST_ARG);
+ yy_fatal_error("bad magic number" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
return -1;
}
/* Sanity check on header size. Greater than 1k suggests some funny business. */
if (th->th_hsize < 16 || th->th_hsize > 1024){
- yy_fatal_error("insane header size detected" /*TODO: not fatal.*/ YY_CALL_LAST_ARG);
+ yy_fatal_error("insane header size detected" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
return -1;
}
/* Allocate enough space for the version and name fields */
bytes = th->th_hsize - 14;
- th->th_version = (char *) yyalloc (bytes YY_CALL_LAST_ARG);
+ th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
/* we read it all into th_version, and point th_name into that data */
if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
errno = EIO;
- yyfree(th->th_version YY_CALL_LAST_ARG);
+ yyfree(th->th_version M4_YY_CALL_LAST_ARG);
th->th_version = NULL;
return -1;
}
* @param dmap pointer to first element in list
* @return NULL if not found.
*/
-static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2 (struct yytbl_dmap *, dmap,
+static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
int, id)
{
while (dmap->dm_id)
* @param dmap used to performing mapping
* @return 0 on success
*/
-static int yytbl_data_load YYFARGS2 (struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
+static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
{
struct yytbl_data td;
struct yytbl_dmap *transdmap=0;
* inside the loop below. This scanner might not even have a transition
* table, which is ok.
*/
- transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION YY_CALL_LAST_ARG);
+ transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
- if ((dmap = yytbl_dmap_lookup (dmap, td.td_id YY_CALL_LAST_ARG)) == NULL){
- yy_fatal_error("table id not found in map." /*TODO: not fatal.*/ YY_CALL_LAST_ARG);
+ if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
+ yy_fatal_error("table id not found in map." /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
return -1;
}
else
bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
- if(YY_TABLES_VERIFY)
+ if(M4_YY_TABLES_VERIFY)
/* We point to the array itself */
p = dmap->dm_arr;
else
/* We point to the address of a pointer. */
- *dmap->dm_arr = p = (void *) yyalloc (bytes YY_CALL_LAST_ARG);
+ *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
}
/* If it's a struct, we read 2 integers to get one element */
t32 = t8;
break;
default:
- yy_fatal_error("invalid td_flags" /*TODO: not fatal.*/ YY_CALL_LAST_ARG);
+ yy_fatal_error("invalid td_flags" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
return -1;
}
}
switch (dmap->dm_sz) {
case sizeof (int32_t):
- if (YY_TABLES_VERIFY){
+ if (M4_YY_TABLES_VERIFY){
if( ((int32_t *) v)[0] != (int32_t) t32)
- yy_fatal_error("tables verification failed at YYTD_STRUCT int32_t" YY_CALL_LAST_ARG);
+ yy_fatal_error("tables verification failed at YYTD_STRUCT int32_t" M4_YY_CALL_LAST_ARG);
}else
((int32_t *) v)[0] = (int32_t) t32;
break;
case sizeof (int16_t):
- if (YY_TABLES_VERIFY ){
+ if (M4_YY_TABLES_VERIFY ){
if(((int16_t *) v)[0] != (int16_t) t32)
- yy_fatal_error("tables verification failed at YYTD_STRUCT int16_t" YY_CALL_LAST_ARG);
+ yy_fatal_error("tables verification failed at YYTD_STRUCT int16_t" M4_YY_CALL_LAST_ARG);
}else
((int16_t *) v)[0] = (int16_t) t32;
break;
case sizeof(int8_t):
- if (YY_TABLES_VERIFY ){
+ if (M4_YY_TABLES_VERIFY ){
if( ((int8_t *) v)[0] != (int8_t) t32)
- yy_fatal_error("tables verification failed at YYTD_STRUCT int8_t" YY_CALL_LAST_ARG);
+ yy_fatal_error("tables verification failed at YYTD_STRUCT int8_t" M4_YY_CALL_LAST_ARG);
}else
((int8_t *) v)[0] = (int8_t) t32;
break;
default:
- yy_fatal_error("invalid dmap->dm_sz for struct" /*TODO: not fatal.*/ YY_CALL_LAST_ARG);
+ yy_fatal_error("invalid dmap->dm_sz for struct" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
return -1;
}
if (!transdmap){
- yy_fatal_error("transition table not found" /*TODO: not fatal.*/ YY_CALL_LAST_ARG);
+ yy_fatal_error("transition table not found" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
return -1;
}
- if( YY_TABLES_VERIFY)
+ if( M4_YY_TABLES_VERIFY)
v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
else
v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
- if(YY_TABLES_VERIFY ){
+ if(M4_YY_TABLES_VERIFY ){
if( ((struct yy_trans_info **) p)[0] != v)
- yy_fatal_error("tables verification failed at YYTD_PTRANS" YY_CALL_LAST_ARG);
+ yy_fatal_error("tables verification failed at YYTD_PTRANS" M4_YY_CALL_LAST_ARG);
}else
((struct yy_trans_info **) p)[0] = v;
/* t32 is a plain int. copy data, then incrememnt p. */
switch (dmap->dm_sz) {
case sizeof (int32_t):
- if(YY_TABLES_VERIFY ){
+ if(M4_YY_TABLES_VERIFY ){
if( ((int32_t *) p)[0] != (int32_t) t32)
- yy_fatal_error("tables verification failed at int32_t" YY_CALL_LAST_ARG);
+ yy_fatal_error("tables verification failed at int32_t" M4_YY_CALL_LAST_ARG);
}else
((int32_t *) p)[0] = (int32_t) t32;
p = ((int32_t *) p) + 1;
break;
case sizeof (int16_t):
- if(YY_TABLES_VERIFY ){
+ if(M4_YY_TABLES_VERIFY ){
if( ((int16_t *) p)[0] != (int16_t) t32)
- yy_fatal_error("tables verification failed at int16_t" YY_CALL_LAST_ARG);
+ yy_fatal_error("tables verification failed at int16_t" M4_YY_CALL_LAST_ARG);
}else
((int16_t *) p)[0] = (int16_t) t32;
p = ((int16_t *) p) + 1;
break;
case sizeof (int8_t):
- if(YY_TABLES_VERIFY ){
+ if(M4_YY_TABLES_VERIFY ){
if( ((int8_t *) p)[0] != (int8_t) t32)
- yy_fatal_error("tables verification failed at int8_t" YY_CALL_LAST_ARG);
+ yy_fatal_error("tables verification failed at int8_t" M4_YY_CALL_LAST_ARG);
}else
((int8_t *) p)[0] = (int8_t) t32;
p = ((int8_t *) p) + 1;
break;
default:
- yy_fatal_error("invalid dmap->dm_sz for plain int" /*TODO: not fatal.*/ YY_CALL_LAST_ARG);
+ yy_fatal_error("invalid dmap->dm_sz for plain int" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
return -1;
}
}
%define-yytables The name for this specific scanner's tables.
/* Find the key and load the DFA tables from the given stream. */
-static int yytbl_fload YYFARGS2 (FILE *, fp, const char *, key)
+static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
{
int rv=0;
struct yytbl_hdr th;
/* Keep trying until we find the right set of tables or end of file. */
while (!feof(rd.fp)) {
rd.bread = 0;
- if (yytbl_hdr_read (&th, &rd YY_CALL_LAST_ARG) != 0){
+ if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
rv = -1;
goto return_rv;
}
if (strcmp(th.th_name,key) != 0){
/* Skip ahead to next set */
fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
- yyfree(th.th_version YY_CALL_LAST_ARG);
+ yyfree(th.th_version M4_YY_CALL_LAST_ARG);
th.th_version = NULL;
}
else
while (rd.bread < th.th_ssize){
/* Load the data tables */
- if(yytbl_data_load (yydmap,&rd YY_CALL_LAST_ARG) != 0){
+ if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
rv = -1;
goto return_rv;
}
return_rv:
if(th.th_version){
- yyfree(th.th_version YY_CALL_LAST_ARG);
+ yyfree(th.th_version M4_YY_CALL_LAST_ARG);
th.th_version = NULL;
}
}
/** Load the DFA tables for this scanner from the given stream. */
-int yytables_fload YYFARGS1 (FILE *, fp)
+int yytables_fload YYFARGS1(FILE *, fp)
{
- if( yytbl_fload(fp, YYTABLES_NAME YY_CALL_LAST_ARG) != 0)
+
+ if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
return -1;
return 0;
}
{
struct yytbl_dmap *dmap=0;
- if(!YY_TABLES_VERIFY){
+ if(!M4_YY_TABLES_VERIFY){
/* Walk the dmap, freeing the pointers */
for(dmap=yydmap; dmap->dm_id; dmap++) {
void * v;
v = dmap->dm_arr;
if(v && *(char**)v){
- yyfree(*(char**)v YY_CALL_LAST_ARG);
+ yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
*(char**)v = NULL;
}
}
/* end table serialization code definitions */
%endif
-#if YY_MAIN
-int main YY_PARAMS((void));
+
+m4_ifdef([[M4_YY_MAIN]], [[
+int main M4_YY_PARAMS(void);
int main ()
- {
+{
%if-reentrant
yyscan_t lexer;
%endif
return 0;
- }
-#endif
+}
+]])
+
%ok-for-header
+#undef YY_NEW_FILE
+#undef YY_FLUSH_BUFFER
+#undef yy_set_bol
+#undef yy_new_buffer
+#undef yy_set_interactive
+#undef yytext_ptr
+#undef YY_DO_BEFORE_ACTION
+
+#ifdef YY_DECL_IS_OURS
+#undef YY_DECL_IS_OURS
+#undef YY_DECL
+#endif
int fullspd, gen_line_dirs, performance_report, backing_up_report;
int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap,
csize;
-int reentrant, bison_bridge;
+int reentrant, bison_bridge, bison_bridge_locations;
int yymore_used, reject, real_reject, continued_action, in_rule;
int yymore_really_used, reject_really_used;
int datapos, dataline, linenum, out_linenum;
jmp_buf flex_main_jmp_buf;
bool *rule_has_nl, *ccl_has_nl;
int nlch = '\n';
+bool ansi_func_defs, ansi_func_protos;
bool tablesext, tablesverify, gentables;
char *tablesfilename=0,*tablesname=0;
extern unsigned _stklen = 16384;
#endif
+/* From scan.l */
+extern FILE* yyout;
+
static char outfile_path[MAXLINE];
static int outfile_created = 0;
static char *skelname = NULL;
+/* For debugging. The max number of filters to apply to skeleton. */
+static int preproc_level = 1000;
+
int flex_main PROTO ((int argc, char *argv[]));
int main PROTO ((int argc, char *argv[]));
-void fix_line_dirs PROTO ((char *, char *, char *, int));
int flex_main (argc, argv)
int argc;
* exit(n);
*/
exit_status = setjmp (flex_main_jmp_buf);
- if (exit_status)
+ if (exit_status){
+ fflush(stdout);
+ fclose(stdout);
+ while (wait(0) > 0){
+ }
return exit_status - 1;
+ }
flexinit (argc, argv);
use_read = false;
}
- /* See comments in flexend() for an explanation of this error condition. */
- if (use_stdout && headerfilename)
- flexerror (_
- ("Can't specify header option if writing to stdout."));
#if 0
/* This makes no sense whatsoever. I'm removing it. */
}
}
+ if (!ansi_func_defs)
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_ANSI_FUNC_DEFS", NULL);
+
+ if (!ansi_func_protos)
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_ANSI_FUNC_PROTOS", NULL);
+
if (!use_stdout) {
FILE *prev_stdout;
outfile_created = 1;
}
+ /* Setup the filter chain. */
+ output_chain = filter_create_int(NULL, filter_tee_header, headerfilename);
+ filter_create_ext(output_chain,"m4","-P",0);
+ filter_create_int(output_chain, filter_fix_linedirs, NULL);
+
+ /* For debugging, only run the requested number of filters. */
+ if (preproc_level > 0) {
+ filter_truncate(output_chain, preproc_level);
+ filter_apply_chain(output_chain);
+ }
+ yyout = stdout;
+
+
/* always generate the tablesverify flag. */
- action_define ("YY_TABLES_VERIFY", tablesverify ? 1 : 0);
+ buf_m4_define (&m4defs_buf, "M4_YY_TABLES_VERIFY", tablesverify ? "1" : "0");
if (tablesext)
gentables = false;
char *pname = 0;
int nbytes = 0;
- action_define ("YY_TABLES_EXTERNAL", 1);
+ buf_m4_define (&m4defs_buf, "M4_YY_TABLES_EXTERNAL", NULL);
if (!tablesfilename) {
nbytes = strlen (prefix) +
lerrsf (_("can't open skeleton file %s"), skelname);
if (reentrant) {
- outn ("#define YY_REENTRANT 1");
+ buf_m4_define (&m4defs_buf, "M4_YY_REENTRANT", NULL);
if (yytext_is_array)
- outn ("#define YY_TEXT_IS_ARRAY");
+ buf_m4_define (&m4defs_buf, "M4_YY_TEXT_IS_ARRAY", NULL);
}
if ( bison_bridge)
- outn ("#define YY_BISON_BRIDGE 1");
+ buf_m4_define (&m4defs_buf, "M4_YY_BISON_BRIDGE", NULL);
- if (strcmp (prefix, "yy")) {
-#define GEN_PREFIX(name) out_str3( "#define yy%s %s%s\n", name, prefix, name )
- if (C_plus_plus)
- GEN_PREFIX ("FlexLexer");
- else {
- outn ("#ifndef YY_REENTRANT");
- GEN_PREFIX ("text");
- GEN_PREFIX ("leng");
- GEN_PREFIX ("in");
- GEN_PREFIX ("out");
- GEN_PREFIX ("_flex_debug");
- outn ("#endif");
- GEN_PREFIX ("_create_buffer");
- GEN_PREFIX ("_delete_buffer");
- GEN_PREFIX ("_scan_buffer");
- GEN_PREFIX ("_scan_string");
- GEN_PREFIX ("_scan_bytes");
- GEN_PREFIX ("_init_buffer");
- GEN_PREFIX ("_flush_buffer");
- GEN_PREFIX ("_load_buffer_state");
- GEN_PREFIX ("_switch_to_buffer");
- GEN_PREFIX ("push_buffer_state");
- GEN_PREFIX ("pop_buffer_state");
- GEN_PREFIX ("ensure_buffer_stack");
- GEN_PREFIX ("lex");
- GEN_PREFIX ("restart");
- GEN_PREFIX ("lex_init");
- GEN_PREFIX ("lex_destroy");
- GEN_PREFIX ("get_debug");
- GEN_PREFIX ("set_debug");
- GEN_PREFIX ("get_extra");
- GEN_PREFIX ("set_extra");
- GEN_PREFIX ("get_in");
- GEN_PREFIX ("set_in");
- GEN_PREFIX ("get_out");
- GEN_PREFIX ("set_out");
- GEN_PREFIX ("get_leng");
- GEN_PREFIX ("get_text");
- GEN_PREFIX ("get_lineno");
- GEN_PREFIX ("set_lineno");
-
- outn ("#ifdef YY_BISON_BRIDGE");
- GEN_PREFIX ("get_lval");
- GEN_PREFIX ("set_lval");
- GEN_PREFIX ("get_lloc");
- GEN_PREFIX ("set_lloc");
- outn ("#endif");
-
- }
+ if ( bison_bridge_locations)
+ buf_m4_define (&m4defs_buf, "M4_YY_BISON_BRIDGE_LOCATIONS", NULL);
- /* The alloc/realloc/free functions are used internally by the
- * generated scanner for both and C++.
- */
- GEN_PREFIX ("alloc");
- GEN_PREFIX ("realloc");
- GEN_PREFIX ("free");
-
- if (!reentrant)
- GEN_PREFIX ("lineno");
-
- if (do_yywrap)
- GEN_PREFIX ("wrap");
-
- if (tablesext){
- GEN_PREFIX ("tables_fload");
- GEN_PREFIX ("tables_destroy");
- GEN_PREFIX ("TABLES_NAME");
- }
-
- outn ("");
- }
+ buf_m4_define(&m4defs_buf, "M4_YY_PREFIX", prefix);
if (did_outfilename)
line_directive_out (stdout, 0);
if (do_yylineno)
- buf_strdefine (&userdef_buf, "YY_USE_LINENO", "1");
+ buf_m4_define (&m4defs_buf, "M4_YY_USE_LINENO", NULL);
/* Create the alignment type. */
buf_strdefine (&userdef_buf, "YY_INT_ALIGNED",
long_align ? "long int" : "short int");
+ /* Define the start condition macros. */
+ {
+ struct Buf tmpbuf;
+ buf_init(&tmpbuf, sizeof(char));
+ for (i = 1; i <= lastsc; i++) {
+ char *str, *fmt = "#define %s %d\n";
+
+ str = (char*)flex_alloc(strlen(fmt) + strlen(scname[i]) + (int)(1 + log(i)/log(10)) + 2);
+ sprintf(str, fmt, scname[i], i - 1);
+ buf_strappend(&tmpbuf, str);
+ free(str);
+ }
+ buf_m4_define(&m4defs_buf, "M4_YY_SC_DEFS", tmpbuf.elts);
+ buf_destroy(&tmpbuf);
+ }
+
+ /* Dump the m4 definitions. */
+ buf_print_strings(&m4defs_buf, stdout);
+ m4defs_buf.nelts = 0; /* memory leak here. */
+
/* Dump the user defined preproc directives. */
if (userdef_buf.elts)
outn ((char *) (userdef_buf.elts));
/* %% [1.0] */
}
-/* Alter #line directives from the generated source, destined
- * for the generated header. We chaneg the line number and filename.
- * linebuf is modified in place.
- */
-void fix_line_dirs (linebuf, outfilename, headerfilename, nlines)
- char *linebuf;
- char *outfilename;
- char *headerfilename;
- int nlines;
-{
- char *pname, *p;
-
- /* Match pattern: ^#line +[:digit:]+ +"outfilename" */
- p = linebuf;
- if (strncmp (p, "#line ", 6))
- return;
- p += 6;
-
- /* match spaces */
- while (*p == ' ')
- p++;
- if (!isdigit (*p))
- return;
-
- /* match numbers */
- while (isdigit (*p))
- p++;
- if (*p != ' ')
- return;
-
- /* match spaces */
- while (*p == ' ')
- p++;
- if (*p != '"')
- return;
- p++;
-
- pname = p;
-
- /* find end of filename. Note: If scanner filename has
- * embedded '"' chars, then the generated #line directive
- * may fail. */
- while (*p != '\0' && *p != '"')
- p++;
- if (*p != '"')
- return;
-
- if (strncmp (pname, outfilename, p - pname) != 0)
- return;
-
- /* We have a match. */
-
- sprintf (linebuf, "#line %d \"%s\"\n", nlines + 2, headerfilename);
-}
-
/* flexend - terminate flex
*
* note
{
static int called_before = -1; /* prevent infinite recursion. */
int tblsiz;
- int i;
if (++called_before)
FLEX_EXIT (exit_status);
skelname);
}
- /* flex generates the header file by rewinding the output FILE
- * pointer. However, since we can't rewind stdout, we must disallow
- * %option header if we are writing to stdout. This is a kludge.
- * This kludge can be rewritten when we get around to buffering
- * Section 1 of the input file, because then we'll have seen all the
- * %options BEFORE we begin generating the scanner. The lack of
- * buffering causes other problems, too. For example, it is the
- * reason we currently can't provide a mechanism to allow the user
- * to inject arbitrary class members into the generated C++ scanner. - JM
- */
- if (headerfilename && exit_status == 0 && outfile_created
- && !ferror (stdout)) {
- /* Copy the file we just wrote to a header file. */
-#define LINE_SZ 512
- FILE *header_out;
- char linebuf[LINE_SZ];
- int nlines = 0;
- int discard = 0;
-
- /* rewind the outfile file. */
- fflush (stdout);
- fseek (stdout, 0L, SEEK_SET);
-
- header_out = fopen (headerfilename, "w");
- if (header_out == NULL)
- lerrsf (_("could not create %s"), headerfilename);
-
- fprintf (header_out, "#ifndef %sHEADER_H\n", prefix);
- fprintf (header_out, "#define %sHEADER_H 1\n", prefix);
- fprintf (header_out, "#define %sIN_HEADER 1\n\n", prefix);
- fflush (header_out);
-
- nlines = 4;
- while (fgets (linebuf, LINE_SZ, stdout)) {
- if (strstr (linebuf, "YY-DISCARD-FROM-HEADER"))
- discard++;
- else if (strstr
- (linebuf, "YY-END-DISCARD-FROM-HEADER")) {
- discard--;
- continue;
- }
-
- if (discard)
- continue;
-
- fix_line_dirs (linebuf, outfilename,
- headerfilename, nlines);
- fputs (linebuf, header_out);
- nlines++;
- }
-
- fprintf (header_out, "#line %d \"%s\"\n", (++nlines) + 1,
- headerfilename);
-
- /* Print the start conditions. */
+#if 0
fprintf (header_out,
"#ifdef YY_HEADER_EXPORT_START_CONDITIONS\n");
fprintf (header_out,
fprintf (header_out,
"#undef INITIAL\n#define INITIAL 0\n");
for (i = 2; i <= lastsc; i++)
- fprintf (header_out, "#define %s %d\n", scname[i],
- i - 1);
+ fprintf (header_out, "#define %s %d\n", scname[i], i - 1);
fprintf (header_out,
"#endif /* YY_HEADER_EXPORT_START_CONDITIONS */\n\n");
"YYLMAX",
"YYSTATE",
"YY_AT_BOL",
- "YY_BISON_BRIDGE",
"YY_BREAK",
"YY_BUFFER_EOF_PENDING",
"YY_BUFFER_NEW",
"YY_BUFFER_NORMAL",
"YY_BUF_SIZE",
- "YY_CALL_LAST_ARG",
- "YY_CALL_ONLY_ARG",
+ "M4_YY_CALL_LAST_ARG",
+ "M4_YY_CALL_ONLY_ARG",
"YY_CURRENT_BUFFER",
"YY_DECL",
- "YY_DECL_LAST_ARG",
- "YY_DEF_LAST_ARG",
- "YY_DEF_ONLY_ARG",
+ "M4_YY_DECL_LAST_ARG",
+ "M4_YY_DEF_LAST_ARG",
+ "M4_YY_DEF_ONLY_ARG",
"YY_DO_BEFORE_ACTION",
"YY_END_OF_BUFFER",
"YY_END_OF_BUFFER_CHAR",
"YY_MORE_ADJ",
"YY_NEED_STRLEN",
"YY_NEW_FILE",
- "YY_NO_FLEX_ALLOC",
- "YY_NO_FLEX_FREE",
- "YY_NO_FLEX_REALLOC",
- "YY_NO_GET_DEBUG",
- "YY_NO_GET_EXTRA",
- "YY_NO_GET_IN",
- "YY_NO_GET_LENG",
- "YY_NO_GET_LINENO",
- "YY_NO_GET_LLOC",
- "YY_NO_GET_LVAL",
- "YY_NO_GET_OUT",
- "YY_NO_GET_TEXT",
- "YY_NO_INPUT",
- "YY_NO_POP_STATE",
- "YY_NO_PUSH_STATE",
- "YY_NO_SCAN_BUFFER",
- "YY_NO_SCAN_BYTES",
- "YY_NO_SCAN_STRING",
- "YY_NO_SET_DEBUG",
- "YY_NO_SET_EXTRA",
- "YY_NO_SET_IN",
- "YY_NO_SET_LINENO",
- "YY_NO_SET_LLOC",
- "YY_NO_SET_LVAL",
- "YY_NO_SET_OUT",
- "YY_NO_TOP_STATE",
- "YY_NO_UNISTD_H",
- "YY_NO_UNPUT",
"YY_NULL",
"YY_NUM_RULES",
"YY_ONLY_ARG",
"YY_PARAMS",
"YY_PROTO",
- "YY_PROTO_LAST_ARG",
- "YY_PROTO_ONLY_ARG void",
+ "M4_YY_PROTO_LAST_ARG",
+ "M4_YY_PROTO_ONLY_ARG void",
"YY_READ_BUF_SIZE",
"YY_REENTRANT",
"YY_RESTORE_YY_MORE_OFFSET",
"YY_RULE_SETUP",
"YY_SC_TO_UI",
"YY_SKIP_YYWRAP",
- "YY_STACK_USED",
"YY_START",
"YY_START_STACK_INCR",
"YY_STATE_EOF",
"YY_STDINIT",
- "YY_TEXT_IS_ARRAY",
"YY_TRAILING_HEAD_MASK",
"YY_TRAILING_MASK",
"YY_USER_ACTION",
- "YY_USES_REJECT",
"YY_USE_CONST",
- "YY_USE_LINENO",
"YY_USE_PROTOS",
"unput",
"yyTABLES_NAME",
headerfilename);
fflush (header_out);
fclose (header_out);
- }
+#endif
if (exit_status != 0 && outfile_created) {
if (ferror (stdout))
fputs ("--reentrant", stderr);
if (bison_bridge)
fputs ("--bison-bridge", stderr);
+ if (bison_bridge_locations)
+ fputs ("--bison-locations", stderr);
if (use_stdout)
putc ('t', stderr);
if (printstats)
yymore_really_used = reject_really_used = unspecified;
interactive = csize = unspecified;
do_yywrap = gen_line_dirs = usemecs = useecs = true;
- reentrant = bison_bridge = false;
+ reentrant = bison_bridge = bison_bridge_locations = false;
performance_report = 0;
did_outfilename = 0;
prefix = "yy";
tablesext = tablesverify = false;
gentables = true;
tablesfilename = tablesname = NULL;
+ ansi_func_defs = ansi_func_protos = true;
sawcmpflag = false;
buf_init (&defs_buf, sizeof (char *)); /* list of strings */
buf_init (&yydmap_buf, sizeof (char)); /* one long string */
+ {
+ const char * m4defs_init_str[] = {"m4_changequote\n",
+ "m4_changequote([[, ]])\n"};
+ buf_init (&m4defs_buf, sizeof (char *));
+ buf_append (&m4defs_buf, &m4defs_init_str, 2);
+ }
+
+ /* initialize regex lib */
+ flex_init_regex();
/* Enable C++ if program name ends with '+'. */
program_name = basename2 (argv[0], 0);
posix_compat = true;
break;
+ case OPT_PREPROC_LEVEL:
+ preproc_level = strtol(arg,NULL,0);
+ break;
+
case OPT_MAIN:
buf_strdefine (&userdef_buf, "YY_MAIN", "1");
do_yywrap = false;
bison_bridge = true;
break;
+ case OPT_BISON_BRIDGE_LOCATIONS:
+ bison_bridge = bison_bridge_locations = true;
+ break;
+
case OPT_REENTRANT:
reentrant = true;
break;
break;
case OPT_NO_UNISTD_H:
- buf_strdefine (&userdef_buf, "YY_NO_UNISTD_H",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_UNISTD_H", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_UNISTD_H",0);
break;
case OPT_TABLES_FILE:
break;
case OPT_ALWAYS_INTERACTIVE:
- buf_strdefine (&userdef_buf,
- "YY_ALWAYS_INTERACTIVE", "1");
+ buf_m4_define (&m4defs_buf, "M4_YY_ALWAYS_INTERACTIVE", 0);
break;
case OPT_NEVER_INTERACTIVE:
- buf_strdefine (&userdef_buf,
- "YY_NEVER_INTERACTIVE", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NEVER_INTERACTIVE", 0);
break;
case OPT_ARRAY:
break;
case OPT_STACK:
- buf_strdefine (&userdef_buf, "YY_STACK_USED", "1");
+ //buf_strdefine (&userdef_buf, "YY_STACK_USED", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_STACK_USED",0);
break;
case OPT_STDINIT:
reject_really_used = false;
break;
+ case OPT_NO_ANSI_FUNC_DEFS:
+ ansi_func_defs = false;
+ break;
+
+ case OPT_NO_ANSI_FUNC_PROTOS:
+ ansi_func_protos = false;
+ break;
+
case OPT_NO_YY_PUSH_STATE:
- buf_strdefine (&userdef_buf, "YY_NO_PUSH_STATE",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_PUSH_STATE", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_PUSH_STATE",0);
break;
case OPT_NO_YY_POP_STATE:
- buf_strdefine (&userdef_buf, "YY_NO_POP_STATE",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_POP_STATE", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_POP_STATE",0);
break;
case OPT_NO_YY_TOP_STATE:
- buf_strdefine (&userdef_buf, "YY_NO_TOP_STATE",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_TOP_STATE", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_TOP_STATE",0);
break;
case OPT_NO_UNPUT:
- buf_strdefine (&userdef_buf, "YY_NO_UNPUT", "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_UNPUT", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_UNPUT",0);
break;
case OPT_NO_YY_SCAN_BUFFER:
- buf_strdefine (&userdef_buf, "YY_NO_SCAN_BUFFER",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_SCAN_BUFFER", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BUFFER",0);
break;
case OPT_NO_YY_SCAN_BYTES:
- buf_strdefine (&userdef_buf, "YY_NO_SCAN_BYTES",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_SCAN_BYTES", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BYTES",0);
break;
case OPT_NO_YY_SCAN_STRING:
- buf_strdefine (&userdef_buf, "YY_NO_SCAN_STRING",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_SCAN_STRING", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_STRING",0);
break;
case OPT_NO_YYGET_EXTRA:
- buf_strdefine (&userdef_buf, "YY_NO_GET_EXTRA",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_EXTRA", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_EXTRA",0);
break;
case OPT_NO_YYSET_EXTRA:
- buf_strdefine (&userdef_buf, "YY_NO_SET_EXTRA",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_EXTRA", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_EXTRA",0);
break;
case OPT_NO_YYGET_LENG:
- buf_strdefine (&userdef_buf, "YY_NO_GET_LENG",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_LENG", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LENG",0);
break;
case OPT_NO_YYGET_TEXT:
- buf_strdefine (&userdef_buf, "YY_NO_GET_TEXT",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_TEXT", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_TEXT",0);
break;
case OPT_NO_YYGET_LINENO:
- buf_strdefine (&userdef_buf, "YY_NO_GET_LINENO",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_LINENO", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LINENO",0);
break;
case OPT_NO_YYSET_LINENO:
- buf_strdefine (&userdef_buf, "YY_NO_SET_LINENO",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_LINENO", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LINENO",0);
break;
case OPT_NO_YYGET_IN:
- buf_strdefine (&userdef_buf, "YY_NO_GET_IN", "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_IN", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_IN",0);
break;
case OPT_NO_YYSET_IN:
- buf_strdefine (&userdef_buf, "YY_NO_SET_IN", "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_IN", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_IN",0);
break;
case OPT_NO_YYGET_OUT:
- buf_strdefine (&userdef_buf, "YY_NO_GET_OUT", "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_OUT", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_OUT",0);
break;
case OPT_NO_YYSET_OUT:
- buf_strdefine (&userdef_buf, "YY_NO_SET_OUT", "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_OUT", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_OUT",0);
break;
case OPT_NO_YYGET_LVAL:
- buf_strdefine (&userdef_buf, "YY_NO_GET_LVAL",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_LVAL", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LVAL",0);
break;
case OPT_NO_YYSET_LVAL:
- buf_strdefine (&userdef_buf, "YY_NO_SET_LVAL",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_LVAL", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LVAL",0);
break;
case OPT_NO_YYGET_LLOC:
- buf_strdefine (&userdef_buf, "YY_NO_GET_LLOC",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_GET_LLOC", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LLOC",0);
break;
case OPT_NO_YYSET_LLOC:
- buf_strdefine (&userdef_buf, "YY_NO_SET_LLOC",
- "1");
+ //buf_strdefine (&userdef_buf, "YY_NO_SET_LLOC", "1");
+ buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LLOC",0);
break;
} /* switch */
("variable trailing context rules cannot be used with -f or -F"));
}
- if (reject)
- outn ("\n#define YY_USES_REJECT");
+ if (reject){
+ out_m4_define( "M4_YY_USES_REJECT", NULL);
+ //outn ("\n#define YY_USES_REJECT");
+ }
if (!do_yywrap) {
outn ("\n#define yywrap(n) 1");
OUT_BEGIN_CODE ();
/* In reentrant scanner, stdinit is handled in flex.skl. */
if (do_stdinit) {
- outn ("#ifdef YY_REENTRANT");
- outn ("#ifdef VMS");
- outn ("#ifdef __VMS_POSIX");
- outn ("#define YY_STDINIT");
- outn ("#endif");
- outn ("#else");
- outn ("#define YY_STDINIT");
- outn ("#endif");
- outn ("#else /* end YY_REENTRANT */");
+ if (reentrant){
+ outn ("#ifdef VMS");
+ outn ("#ifdef __VMS_POSIX");
+ outn ("#define YY_STDINIT");
+ outn ("#endif");
+ outn ("#else");
+ outn ("#define YY_STDINIT");
+ outn ("#endif");
+ }
+
outn ("#ifdef VMS");
outn ("#ifndef __VMS_POSIX");
outn (yy_nostdinit);
}
else {
- outn ("#ifndef YY_REENTRANT");
- outn (yy_nostdinit);
- outn ("#endif");
+ if(!reentrant)
+ outn (yy_nostdinit);
}
OUT_END_CODE ();
}
" -P, --prefix=STRING use STRING as prefix instead of \"yy\"\n"
" -R, --reentrant generate a reentrant C scanner\n"
" --bison-bridge scanner for bison pure parser.\n"
+ " --bison-locations include yylloc support.\n"
" --stdinit initialize yyin/yyout to stdin/stdout\n"
+ " --noansi-definitions old-style function definitions\n"
+ " --noansi-prototypes empty parameter list in prototypes\n"
" --nounistd do not include <unistd.h>\n"
" --noFUNCTION do not generate a particular FUNCTION\n"
"\n" "Miscellaneous:\n"