-m4_dnl -*-C-*- vi: set ft=c:
-m4_dnl This file is processed in several stages.
-m4_dnl Here are the stages, as best as I can describe:
-m4_dnl
-m4_dnl 1. flex.skl is processed through GNU m4 during the
-m4_dnl pre-compilation stage of flex.
-m4_dnl 2. The preprocessed skeleton is translated verbatim into a
-m4_dnl C array, saved as "skel.c" and compiled into the flex binary.
-m4_dnl 3. At runtime, the skeleton is generated and filtered (again)
-m4_dnl through m4.
-m4_dnl
+%# -*-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.
+%#
/* A lexical scanner generated by flex */
+
+%# Macros for preproc stage.
+m4preproc_changecom
+
+%# Macros for runtime processing stage.
m4_changecom
+m4_changequote([[, ]])
-m4_dnl
-m4_dnl Create macros for the generation phase, not the preproc phase.
-m4_dnl
-`m4_changecom'
-m4_define(`YYDEFINE',``m4_define($@)'')
-m4_define(`YYIFDEF',``m4_ifdef($@)'')
%#
-
-%# Lines in this skeleton starting with a '%' character are "control lines"
+%# 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.
%#
/* 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. */
+/* C++ compilers do not understand traditional function definitions. */
#ifdef YY_TRADITIONAL_FUNC_DEFS
#undef YY_TRADITIONAL_FUNC_DEFS
#endif
#else /* ! __cplusplus */
-/* We're not in a C++ compiler, so by default,
+/* We are 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 */
#define yyconst
#endif
-/* For compilers that can't handle prototypes.
+/* For compilers that can not handle prototypes.
* e.g.,
* The function prototype
* int foo(int x, char* y);
typedef void* yyscan_t;
#endif
-/* For use wherever a Global is accessed or assigned. */
-#define YY_G(var) (((struct yyguts_t*)yyscanner)->var)
+%# For use wherever a Global is accessed or assigned.
+m4_define( [[YY_G]], [[(((struct yyguts_t*)yyscanner)->$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( [[YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])
+m4_define( [[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_TRADITIONAL_FUNC_DEFS]],
+ m4_define( [[YY_DEF_LAST_ARG]], [[, yyscanner]])
+ m4_define( [[YY_DEF_ONLY_ARG]], [[yyscanner]])
+,
+ m4_define( [[YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])
+ m4_define( [[YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])
+)
+m4_define( [[YY_DECL_LAST_ARG]], [[yyscan_t 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 calls to pass the additional argument.
+m4_define( [[YY_CALL_LAST_ARG]], [[, yyscanner]])
+m4_define( [[YY_CALL_ONLY_ARG]], [[yyscanner]])
/* For convenience, these vars (plus the bison vars far below)
are macros in the reentrant scanner. */
%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
+%# Define these macros to be no-ops.
+m4_define( [[YY_G]], [[($1)]])
+m4_define( [[YY_PROTO_LAST_ARG]])
+m4_define( [[YY_PROTO_ONLY_ARG]], [[void]])
+m4_define( [[YY_DEF_LAST_ARG]])
+
+m4_ifdef( [[M4_YY_TRADITIONAL_FUNC_DEFS]],
+ m4_define( [[YY_DEF_ONLY_ARG]])
+,
+ m4_define( [[YY_DEF_ONLY_ARG]], [[void]])
+)
+m4_define([[YY_DECL_LAST_ARG]])
+m4_define([[YY_CALL_LAST_ARG]])
+m4_define([[YY_CALL_ONLY_ARG]])
%endif
* 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
+m4_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
+,
+%# Generate C99 function defs.
+ m4_define( [[YYFARGS0]], [[(YY_DEF_ONLY_ARG)]])
+ m4_define( [[YYFARGS1]], [[($1 $2 YY_DEF_LAST_ARG)]])
+ m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 YY_DEF_LAST_ARG)]])
+ m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 YY_DEF_LAST_ARG)]])
+)
/* 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
* 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.
+ * normally declared as a register variable-- so it is not worth it.
*/
#define YY_LESS_LINENO(n) \
do { \
*
* 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.
+ * done when it reached the ";" after the yyless() call.
*/
-/* Return all but the first 'n' matched characters back to the input stream. */
+/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
* 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
+m4_ifdef( [[M4_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 *
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
char yytext_r[YYLMAX];
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
-#ifndef YY_NO_DESTROY
+m4_ifdef( [[M4_YY_NO_DESTROY]],,
+[[
int yylex_destroy YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+]])
-#ifndef YY_NO_GET_DEBUG
+m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
+[[
int yyget_debug YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+]])
-#ifndef YY_NO_SET_DEBUG
+m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
+[[
void yyset_debug YY_PARAMS(( int debug_flag YY_PROTO_LAST_ARG ));
-#endif
+]])
-#ifndef YY_NO_GET_EXTRA
+m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
+[[
YY_EXTRA_TYPE yyget_extra YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+]])
-#ifndef YY_NO_SET_EXTRA
+m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
+[[
void yyset_extra YY_PARAMS(( YY_EXTRA_TYPE user_defined YY_PROTO_LAST_ARG ));
-#endif
+]])
-#ifndef YY_NO_GET_IN
+m4_ifdef( [[M4_YY_NO_GET_IN]],,
+[[
FILE *yyget_in YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+]])
-#ifndef YY_NO_SET_IN
+m4_ifdef( [[M4_YY_NO_SET_IN]],,
+[[
void yyset_in YY_PARAMS(( FILE * in_str YY_PROTO_LAST_ARG ));
-#endif
+]])
-#ifndef YY_NO_GET_OUT
+m4_ifdef( [[M4_YY_NO_GET_OUT]],,
+[[
FILE *yyget_out YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+]])
-#ifndef YY_NO_SET_OUT
+m4_ifdef( [[M4_YY_NO_SET_OUT]],,
+[[
void yyset_out YY_PARAMS(( FILE * out_str YY_PROTO_LAST_ARG ));
-#endif
+]])
-#ifndef YY_NO_GET_LENG
+m4_ifdef( [[M4_YY_NO_GET_LENG]],,
+[[
int yyget_leng YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+]])
-#ifndef YY_NO_GET_TEXT
+m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
+[[
char *yyget_text YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+]])
-#ifndef YY_NO_GET_LINENO
+m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
+[[
int yyget_lineno YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+]])
-#ifndef YY_NO_SET_LINENO
+m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
+[[
void yyset_lineno YY_PARAMS(( int line_number YY_PROTO_LAST_ARG ));
-#endif
+]])
%if-bison-bridge
-#ifndef YY_NO_GET_LVAL
+m4_ifdef( [[M4_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
+m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
+[[
YYLTYPE *yyget_lloc YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-#ifndef YY_NO_SET_LLOC
+]])
+m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
+[[
void yyset_lloc YY_PARAMS(( YYLTYPE * yyllocp YY_PROTO_LAST_ARG ));
-#endif
+]])
#endif /* YYLTYPE */
%endif
#endif
%not-for-header
-#ifndef YY_NO_UNPUT
+m4_ifdef( [[M4_YY_NO_UNPUT]],,
+[[
static void yyunput YY_PARAMS(( int c, char *buf_ptr YY_PROTO_LAST_ARG));
-#endif
+]])
%ok-for-header
%endif
%ok-for-header
%endif
-#ifndef YY_NO_PUSH_STATE
+m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
+[[
static void yy_push_state YY_PARAMS(( int new_state YY_PROTO_LAST_ARG));
-#endif
-#ifndef YY_NO_POP_STATE
+]])
+m4_ifdef( [[M4_YY_NO_POP_STATE]],,
+[[
static void yy_pop_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
-#ifndef YY_NO_TOP_STATE
+]])
+m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
+[[
static int yy_top_state YY_PARAMS(( YY_PROTO_ONLY_ARG ));
-#endif
+]])
#else
#define YY_NO_PUSH_STATE 1
#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));
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
+]])
if ( ! YY_G(yy_start) )
YY_G(yy_start) = 1; /* first start state */
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()
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;
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
number_to_move - 1;
-#endif
+]])
}
if ( num_to_read > YY_READ_BUF_SIZE )
-#ifndef YY_NO_SCAN_BUFFER
+m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
+[[
%if-c-only
YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
{
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)
{
return yy_scan_bytes( yy_str, len YY_CALL_LAST_ARG);
}
%endif
-#endif
+]])
-#ifndef YY_NO_SCAN_BYTES
+m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
+[[
%if-c-only
YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,bytes, int ,len)
{
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
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
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
{
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
%if-reentrant
-#ifndef YY_NO_GET_EXTRA
+m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
+[[
YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
{
return yyextra;
}
-#endif /* !YY_NO_GET_EXTRA */
+]])
%endif
-#ifndef YY_NO_GET_LINENO
+m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
+[[
int yyget_lineno YYFARGS0(void)
{
return yylineno;
}
-#endif /* !YY_NO_GET_LINENO */
+]])
-#ifndef YY_NO_GET_IN
+m4_ifdef( [[M4_YY_NO_GET_IN]],,
+[[
FILE *yyget_in YYFARGS0(void)
{
return yyin;
}
-#endif /* !YY_NO_GET_IN */
+]])
-#ifndef YY_NO_GET_OUT
+m4_ifdef( [[M4_YY_NO_GET_OUT]],,
+[[
FILE *yyget_out YYFARGS0(void)
{
return yyout;
}
-#endif /* !YY_NO_GET_OUT */
+]])
-#ifndef YY_NO_GET_LENG
+m4_ifdef( [[M4_YY_NO_GET_LENG]],,
+[[
int yyget_leng YYFARGS0(void)
{
return yyleng;
}
-#endif /* !YY_NO_GET_LENG */
+]])
-#ifndef YY_NO_GET_TEXT
+m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
+[[
char *yyget_text YYFARGS0(void)
{
return yytext;
}
-#endif /* !YY_NO_GET_TEXT */
+]])
%if-reentrant
-#ifndef YY_NO_SET_EXTRA
+m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
+[[
void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
{
yyextra = user_defined ;
}
-#endif /* !YY_NO_SET_EXTRA */
+]])
%endif
-#ifndef YY_NO_SET_LINENO
+m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
+[[
void yyset_lineno YYFARGS1( int ,line_number)
{
yylineno = line_number;
}
-#endif /* !YY_NO_SET_LINENO */
+]])
-#ifndef YY_NO_SET_IN
+m4_ifdef( [[M4_YY_NO_SET_IN]],,
+[[
void yyset_in YYFARGS1( FILE * ,in_str)
{
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)
{
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)
{
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)
{
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)
{
return yylval;
}
-#endif /* !YY_NO_GET_LVAL */
+]])
-#ifndef YY_NO_SET_LVAL
+m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
+[[
void yyset_lval YYFARGS1( YYSTYPE * ,yylvalp)
{
yylval = yylvalp;
}
-#endif /* !YY_NO_SET_LVAL */
+]])
#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
-#ifndef YY_NO_GET_LLOC
+m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
+[[
YYLTYPE *yyget_lloc YYFARGS0(void)
{
return yylloc;
}
-#endif /* !YY_NO_GET_LLOC */
+]])
-#ifndef YY_NO_SET_LLOC
+m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
+[[
void yyset_lloc YYFARGS1( YYLTYPE * ,yyllocp)
{
yylloc = yyllocp;
}
-#endif /* !YY_NO_SET_LLOC */
+]])
#endif /* YYLTYPE */
%endif
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
YY_G(yytext_ptr) = 0;
YY_G(yy_start_stack) = NULL;
#endif
-#ifdef YY_USES_REJECT
+m4_ifdef( [[M4_YY_USES_REJECT]],
+[[
yyfree ( YY_G(yy_state_buf) YY_CALL_LAST_ARG);
-#endif
+]])
%if-reentrant
/* Destroy the main struct (reentrant only). */
}
#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
*/
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));
* @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;
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
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);
}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);
}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);
}else
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);
}else
/* 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);
}else
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);
}else
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);
}else
%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;
}
/** 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)
return -1;
{
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;
/* end table serialization code definitions */
%endif
-#if YY_MAIN
+
+m4_ifdef([[M4_YY_MAIN]], [[
int main YY_PARAMS((void));
int main ()
return 0;
}
-#endif
+]])
%ok-for-header
/* Setup the filter chain. */
output_chain = filter_create(NULL,"m4","-P",0);
+ /* filter_create(output_chain,"cat",0); */
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;
lerrsf (_("can't open skeleton file %s"), skelname);
if (reentrant) {
+ buf_m4_define (&m4defs_buf, "M4_YY_REENTRANT", NULL);
outn ("#define YY_REENTRANT 1");
if (yytext_is_array)
outn ("#define YY_TEXT_IS_ARRAY");
buf_strdefine (&userdef_buf, "YY_INT_ALIGNED",
long_align ? "long int" : "short int");
+ /* Dump the m4 definitions. */
+ buf_print_strings(&m4defs_buf, stdout);
+
/* Dump the user defined preproc directives. */
if (userdef_buf.elts)
outn ((char *) (userdef_buf.elts));
"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_TRAILING_HEAD_MASK",
"YY_TRAILING_MASK",
"YY_USER_ACTION",
- "YY_USES_REJECT",
"YY_USE_CONST",
"YY_USE_LINENO",
"YY_USE_PROTOS",
buf_init (&userdef_buf, sizeof (char)); /* one long string */
buf_init (&defs_buf, sizeof (char *)); /* list of strings */
buf_init (&yydmap_buf, sizeof (char)); /* one long string */
+ buf_init (&m4defs_buf, sizeof (char *)); /* list of strings */
/* Enable C++ if program name ends with '+'. */
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_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){
+ buf_m4_define( &m4defs_buf, "M4_YY_USES_REJECT", NULL);
+ //outn ("\n#define YY_USES_REJECT");
+ }
if (!do_yywrap) {
outn ("\n#define yywrap(n) 1");