flex.skl (flex-2.6.3) | : | flex.skl (flex-2.6.4) | ||
---|---|---|---|---|
%# -*-C-*- vi: set ft=c: | %# -*-C-*- vi: set ft=c: | |||
%# This file is processed in several stages. | %# This file is processed in several stages. | |||
%# Here are the stages, as best as I can describe: | %# Here are the stages, as best as I can describe: | |||
%# | %# | |||
%# 1. flex.skl is processed through GNU m4 during the | %# 1. flex.skl is processed through GNU m4 during the | |||
%# pre-compilation stage of flex. Only macros starting | %# pre-compilation stage of flex. Only macros starting | |||
%# with `m4preproc_' are processed, and quoting is normal. | %# with `m4preproc_' are processed, and quoting is normal. | |||
%# | %# | |||
%# 2. The preprocessed skeleton is translated verbatim into a | %# 2. The preprocessed skeleton is translated into a C array, saved | |||
%# C array, saved as "skel.c" and compiled into the flex binary. | %# as "skel.c" and compiled into the flex binary. The %# comment | |||
%# lines are removed. | ||||
%# | %# | |||
%# 3. At runtime, the skeleton is generated and filtered (again) | %# 3. At runtime, the skeleton is generated and filtered (again) | |||
%# through m4. Macros beginning with `m4_' will be processed. | %# through m4. Macros beginning with `m4_' will be processed. | |||
%# The quoting is "[[" and "]]" so we don't interfere with | %# The quoting is "[[" and "]]" so we don't interfere with | |||
%# user code. | %# user code. | |||
%# | %# | |||
%# All generate macros for the m4 stage contain the text "m4" or "M4" | %# All generate macros for the m4 stage contain the text "m4" or "M4" | |||
%# in them. This is to distinguish them from CPP macros. | %# in them. This is to distinguish them from CPP macros. | |||
%# The exception to this rule is YY_G, which is an m4 macro, | %# 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. | %# but it needs to be remain short because it is used everywhere. | |||
skipping to change at line 64 | skipping to change at line 65 | |||
%# the generated scanner as a C-style comment. This is to aid those who | %# the generated scanner as a C-style comment. This is to aid those who | |||
%# edit the skeleton. | %# edit the skeleton. | |||
%# | %# | |||
%not-for-header | %not-for-header | |||
%if-c-only | %if-c-only | |||
%if-not-reentrant | %if-not-reentrant | |||
m4_ifelse(M4_YY_PREFIX,yy,, | m4_ifelse(M4_YY_PREFIX,yy,, | |||
#define yy_create_buffer M4_YY_PREFIX[[_create_buffer]] | #define yy_create_buffer M4_YY_PREFIX[[_create_buffer]] | |||
#define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]] | #define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]] | |||
#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]] | #define yy_scan_buffer M4_YY_PREFIX[[_scan_buffer]] | |||
#define yy_scan_string M4_YY_PREFIX[[_scan_string]] | ||||
#define yy_scan_bytes M4_YY_PREFIX[[_scan_bytes]] | ||||
#define yy_init_buffer M4_YY_PREFIX[[_init_buffer]] | #define yy_init_buffer M4_YY_PREFIX[[_init_buffer]] | |||
#define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]] | #define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]] | |||
#define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]] | #define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]] | |||
#define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]] | #define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]] | |||
#define yypush_buffer_state M4_YY_PREFIX[[push_buffer_state]] | ||||
#define yypop_buffer_state M4_YY_PREFIX[[pop_buffer_state]] | ||||
#define yyensure_buffer_stack M4_YY_PREFIX[[ensure_buffer_stack]] | ||||
#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]] | ||||
#define yyin M4_YY_PREFIX[[in]] | #define yyin M4_YY_PREFIX[[in]] | |||
#define yyleng M4_YY_PREFIX[[leng]] | #define yyleng M4_YY_PREFIX[[leng]] | |||
#define yylex M4_YY_PREFIX[[lex]] | #define yylex M4_YY_PREFIX[[lex]] | |||
#define yylineno M4_YY_PREFIX[[lineno]] | #define yylineno M4_YY_PREFIX[[lineno]] | |||
#define yyout M4_YY_PREFIX[[out]] | #define yyout M4_YY_PREFIX[[out]] | |||
#define yyrestart M4_YY_PREFIX[[restart]] | #define yyrestart M4_YY_PREFIX[[restart]] | |||
#define yytext M4_YY_PREFIX[[text]] | #define yytext M4_YY_PREFIX[[text]] | |||
#define yywrap M4_YY_PREFIX[[wrap]] | #define yywrap M4_YY_PREFIX[[wrap]] | |||
#define yyalloc M4_YY_PREFIX[[alloc]] | #define yyalloc M4_YY_PREFIX[[alloc]] | |||
#define yyrealloc M4_YY_PREFIX[[realloc]] | #define yyrealloc M4_YY_PREFIX[[realloc]] | |||
skipping to change at line 107 | skipping to change at line 114 | |||
%# This is the m4 way to say "(stack_used || is_reentrant) | %# This is the m4 way to say "(stack_used || is_reentrant) | |||
m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]]) | m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]]) | |||
m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]]) | m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]]) | |||
%# Prefixes. | %# Prefixes. | |||
%# The complexity here is necessary so that m4 preserves | %# The complexity here is necessary so that m4 preserves | |||
%# the argument lists to each C function. | %# the argument lists to each C function. | |||
m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]]) | m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]]) | |||
m4preproc_define(`M4_GEN_PREFIX', | m4preproc_define(`M4_GEN_PREFIX',`` | |||
``[[#define yy$1 ]]M4_YY_PREFIX[[$1]] | [[#ifdef yy$1 | |||
m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'') | #define ]]M4_YY_PREFIX[[$1_ALREADY_DEFINED | |||
#else | ||||
#define yy$1 ]]M4_YY_PREFIX[[$1 | ||||
#endif]] | ||||
'm4preproc_divert(1)` | ||||
[[#ifndef ]]M4_YY_PREFIX[[$1_ALREADY_DEFINED | ||||
#undef yy$1 | ||||
#endif]]'m4preproc_divert(0)') | ||||
%if-c++-only | %if-c++-only | |||
/* The c++ scanner is a mess. The FlexLexer.h header file relies on the | /* The c++ scanner is a mess. The FlexLexer.h header file relies on the | |||
* following macro. This is required in order to pass the c++-multiple-scann ers | * following macro. This is required in order to pass the c++-multiple-scann ers | |||
* test in the regression suite. We get reports that it breaks inheritance. | * test in the regression suite. We get reports that it breaks inheritance. | |||
* We will address this in a future release of flex, or omit the C++ scanner | * We will address this in a future release of flex, or omit the C++ scanner | |||
* altogether. | * altogether. | |||
*/ | */ | |||
#define yyFlexLexer M4_YY_PREFIX[[FlexLexer]] | #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]] | |||
%endif | %endif | |||
%if-c-only | %if-c-only | |||
m4_ifelse(M4_YY_PREFIX,yy,, | ||||
M4_GEN_PREFIX(`_create_buffer') | M4_GEN_PREFIX(`_create_buffer') | |||
M4_GEN_PREFIX(`_delete_buffer') | M4_GEN_PREFIX(`_delete_buffer') | |||
M4_GEN_PREFIX(`_scan_buffer') | M4_GEN_PREFIX(`_scan_buffer') | |||
M4_GEN_PREFIX(`_scan_string') | M4_GEN_PREFIX(`_scan_string') | |||
M4_GEN_PREFIX(`_scan_bytes') | M4_GEN_PREFIX(`_scan_bytes') | |||
M4_GEN_PREFIX(`_init_buffer') | M4_GEN_PREFIX(`_init_buffer') | |||
M4_GEN_PREFIX(`_flush_buffer') | M4_GEN_PREFIX(`_flush_buffer') | |||
M4_GEN_PREFIX(`_load_buffer_state') | M4_GEN_PREFIX(`_load_buffer_state') | |||
M4_GEN_PREFIX(`_switch_to_buffer') | M4_GEN_PREFIX(`_switch_to_buffer') | |||
M4_GEN_PREFIX(`push_buffer_state') | M4_GEN_PREFIX(`push_buffer_state') | |||
skipping to change at line 157 | skipping to change at line 172 | |||
M4_GEN_PREFIX(`get_leng') | M4_GEN_PREFIX(`get_leng') | |||
M4_GEN_PREFIX(`get_text') | M4_GEN_PREFIX(`get_text') | |||
M4_GEN_PREFIX(`get_lineno') | M4_GEN_PREFIX(`get_lineno') | |||
M4_GEN_PREFIX(`set_lineno') | M4_GEN_PREFIX(`set_lineno') | |||
m4_ifdef( [[M4_YY_REENTRANT]], | m4_ifdef( [[M4_YY_REENTRANT]], | |||
[[ | [[ | |||
M4_GEN_PREFIX(`get_column') | M4_GEN_PREFIX(`get_column') | |||
M4_GEN_PREFIX(`set_column') | M4_GEN_PREFIX(`set_column') | |||
]]) | ]]) | |||
M4_GEN_PREFIX(`wrap') | M4_GEN_PREFIX(`wrap') | |||
) | ||||
%endif | %endif | |||
m4_ifdef( [[M4_YY_BISON_LVAL]], | m4_ifdef( [[M4_YY_BISON_LVAL]], | |||
[[ | [[ | |||
M4_GEN_PREFIX(`get_lval') | M4_GEN_PREFIX(`get_lval') | |||
M4_GEN_PREFIX(`set_lval') | M4_GEN_PREFIX(`set_lval') | |||
]]) | ]]) | |||
m4_ifdef( [[<M4_YY_BISON_LLOC>]], | m4_ifdef( [[<M4_YY_BISON_LLOC>]], | |||
[[ | [[ | |||
M4_GEN_PREFIX(`get_lloc') | M4_GEN_PREFIX(`get_lloc') | |||
M4_GEN_PREFIX(`set_lloc') | M4_GEN_PREFIX(`set_lloc') | |||
]]) | ]]) | |||
m4_ifelse(M4_YY_PREFIX,yy,, | ||||
M4_GEN_PREFIX(`alloc') | M4_GEN_PREFIX(`alloc') | |||
M4_GEN_PREFIX(`realloc') | M4_GEN_PREFIX(`realloc') | |||
M4_GEN_PREFIX(`free') | M4_GEN_PREFIX(`free') | |||
) | ||||
%if-c-only | %if-c-only | |||
m4_ifelse(M4_YY_PREFIX,yy,, | ||||
m4_ifdef( [[M4_YY_NOT_REENTRANT]], | m4_ifdef( [[M4_YY_NOT_REENTRANT]], | |||
[[ | [[ | |||
M4_GEN_PREFIX(`text') | M4_GEN_PREFIX(`text') | |||
M4_GEN_PREFIX(`leng') | M4_GEN_PREFIX(`leng') | |||
M4_GEN_PREFIX(`in') | M4_GEN_PREFIX(`in') | |||
M4_GEN_PREFIX(`out') | M4_GEN_PREFIX(`out') | |||
M4_GEN_PREFIX(`_flex_debug') | M4_GEN_PREFIX(`_flex_debug') | |||
M4_GEN_PREFIX(`lineno') | M4_GEN_PREFIX(`lineno') | |||
]]) | ]]) | |||
) | ||||
%endif | %endif | |||
m4_ifdef( [[M4_YY_TABLES_EXTERNAL]], | m4_ifdef( [[M4_YY_TABLES_EXTERNAL]], | |||
[[ | [[ | |||
M4_GEN_PREFIX(`tables_fload') | M4_GEN_PREFIX(`tables_fload') | |||
M4_GEN_PREFIX(`tables_destroy') | M4_GEN_PREFIX(`tables_destroy') | |||
M4_GEN_PREFIX(`TABLES_NAME') | M4_GEN_PREFIX(`TABLES_NAME') | |||
]]) | ]]) | |||
/* First, we deal with platform-specific or compiler-specific issues. */ | /* First, we deal with platform-specific or compiler-specific issues. */ | |||
skipping to change at line 214 | skipping to change at line 234 | |||
%if-tables-serialization | %if-tables-serialization | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <netinet/in.h> | #include <netinet/in.h> | |||
%endif | %endif | |||
/* end standard C headers. */ | /* end standard C headers. */ | |||
%if-c-or-c++ | %if-c-or-c++ | |||
m4preproc_include(`flexint.h') | m4preproc_include(`flexint.h') | |||
%endif | %endif | |||
%if-c++-only | ||||
/* begin standard C++ headers. */ | /* begin standard C++ headers. */ | |||
%if-c++-only | ||||
#include <iostream> | #include <iostream> | |||
#include <errno.h> | #include <errno.h> | |||
#include <cstdlib> | #include <cstdlib> | |||
#include <cstdio> | #include <cstdio> | |||
#include <cstring> | #include <cstring> | |||
/* end standard C++ headers. */ | /* end standard C++ headers. */ | |||
%endif | %endif | |||
/* TODO: this is always defined, so inline it */ | /* TODO: this is always defined, so inline it */ | |||
#define yyconst const | #define yyconst const | |||
skipping to change at line 1652 | skipping to change at line 1672 | |||
else | else | |||
ret_val = EOB_ACT_CONTINUE_SCAN; | ret_val = EOB_ACT_CONTINUE_SCAN; | |||
if ((YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_bu f_size) { | if ((YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_bu f_size) { | |||
/* Extend the array by 50%, plus the number we really need. */ | /* Extend the array by 50%, plus the number we really need. */ | |||
int new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_cha rs) >> 1); | int new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_cha rs) >> 1); | |||
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( | |||
(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size M4_YY_CALL_LAST_ARG ); | (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size M4_YY_CALL_LAST_ARG ); | |||
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | |||
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buf fer()" ); | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buf fer()" ); | |||
/* "- 2" to take care of EOB's */ | ||||
YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); | ||||
} | } | |||
YY_G(yy_n_chars) += number_to_move; | YY_G(yy_n_chars) += number_to_move; | |||
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_ CHAR; | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_ CHAR; | |||
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUF FER_CHAR; | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUF FER_CHAR; | |||
YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; | YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; | |||
return ret_val; | return ret_val; | |||
} | } | |||
skipping to change at line 1882 | skipping to change at line 1904 | |||
} | } | |||
%if-c++-only | %if-c++-only | |||
/** Delegate to the new version that takes an istream reference. | /** Delegate to the new version that takes an istream reference. | |||
* @param input_file A readable stream. | * @param input_file A readable stream. | |||
* M4_YY_DOC_PARAM | * M4_YY_DOC_PARAM | |||
* @note This function does not reset the start condition to @c INITIAL . | * @note This function does not reset the start condition to @c INITIAL . | |||
*/ | */ | |||
void yyFlexLexer::yyrestart( std::istream* input_file ) | void yyFlexLexer::yyrestart( std::istream* input_file ) | |||
{ | { | |||
if( ! input_file ) { | ||||
input_file = &yyin; | ||||
} | ||||
yyrestart( *input_file ); | yyrestart( *input_file ); | |||
} | } | |||
%endif | %endif | |||
/** Switch to a different input buffer. | /** Switch to a different input buffer. | |||
* @param new_buffer The new input buffer. | * @param new_buffer The new input buffer. | |||
* M4_YY_DOC_PARAM | * M4_YY_DOC_PARAM | |||
*/ | */ | |||
%if-c-only | %if-c-only | |||
void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer) | void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer) | |||
skipping to change at line 2041 | skipping to change at line 2066 | |||
{ | { | |||
int oerrno = errno; | int oerrno = errno; | |||
M4_YY_DECL_GUTS_VAR(); | M4_YY_DECL_GUTS_VAR(); | |||
yy_flush_buffer( b M4_YY_CALL_LAST_ARG); | yy_flush_buffer( b M4_YY_CALL_LAST_ARG); | |||
%if-c-only | %if-c-only | |||
b->yy_input_file = file; | b->yy_input_file = file; | |||
%endif | %endif | |||
%if-c++-only | %if-c++-only | |||
b->yy_input_file = (&file == 0) ? NULL : file.rdbuf(); | b->yy_input_file = file.rdbuf(); | |||
%endif | %endif | |||
b->yy_fill_buffer = 1; | b->yy_fill_buffer = 1; | |||
/* If b is the current buffer, then yy_init_buffer was _probably_ | /* If b is the current buffer, then yy_init_buffer was _probably_ | |||
* called from yyrestart() or through yy_get_next_buffer. | * called from yyrestart() or through yy_get_next_buffer. | |||
* In that case, we don't want to reset the lineno or column. | * In that case, we don't want to reset the lineno or column. | |||
*/ | */ | |||
if (b != YY_CURRENT_BUFFER){ | if (b != YY_CURRENT_BUFFER){ | |||
b->yy_bs_lineno = 1; | b->yy_bs_lineno = 1; | |||
b->yy_bs_column = 0; | b->yy_bs_column = 0; | |||
skipping to change at line 2408 | skipping to change at line 2433 | |||
#ifndef YY_EXIT_FAILURE | #ifndef YY_EXIT_FAILURE | |||
#define YY_EXIT_FAILURE 2 | #define YY_EXIT_FAILURE 2 | |||
#endif | #endif | |||
%if-c-only | %if-c-only | |||
static void yynoreturn yy_fatal_error YYFARGS1(const char*, msg) | static void yynoreturn yy_fatal_error YYFARGS1(const char*, msg) | |||
{ | { | |||
M4_YY_DECL_GUTS_VAR(); | M4_YY_DECL_GUTS_VAR(); | |||
M4_YY_NOOP_GUTS_VAR(); | M4_YY_NOOP_GUTS_VAR(); | |||
(void) fprintf( stderr, "%s\n", msg ); | fprintf( stderr, "%s\n", msg ); | |||
exit( YY_EXIT_FAILURE ); | exit( YY_EXIT_FAILURE ); | |||
} | } | |||
%endif | %endif | |||
%if-c++-only | %if-c++-only | |||
void yyFlexLexer::LexerError( const char* msg ) | void yyFlexLexer::LexerError( const char* msg ) | |||
{ | { | |||
M4_YY_DECL_GUTS_VAR(); | M4_YY_DECL_GUTS_VAR(); | |||
std::cerr << msg << std::endl; | std::cerr << msg << std::endl; | |||
exit( YY_EXIT_FAILURE ); | exit( YY_EXIT_FAILURE ); | |||
} | } | |||
skipping to change at line 3360 | skipping to change at line 3385 | |||
#undef YY_FLUSH_BUFFER | #undef YY_FLUSH_BUFFER | |||
#undef yy_set_bol | #undef yy_set_bol | |||
#undef yy_new_buffer | #undef yy_new_buffer | |||
#undef yy_set_interactive | #undef yy_set_interactive | |||
#undef YY_DO_BEFORE_ACTION | #undef YY_DO_BEFORE_ACTION | |||
#ifdef YY_DECL_IS_OURS | #ifdef YY_DECL_IS_OURS | |||
#undef YY_DECL_IS_OURS | #undef YY_DECL_IS_OURS | |||
#undef YY_DECL | #undef YY_DECL | |||
#endif | #endif | |||
m4preproc_undivert(1) | ||||
]]) | ]]) | |||
End of changes. 17 change blocks. | ||||
9 lines changed or deleted | 35 lines changed or added |