diff options
author | Demi Obenour <demiobenour@gmail.com> | 2016-09-23 11:28:56 -0400 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2016-09-25 16:12:14 -0400 |
commit | e50d903620be9b81e8dd89d1ed1063c13836ff26 (patch) | |
tree | 2af5809689166b1e2a809208193c7e9d2301aaa8 | |
parent | 7528bc0aee69c32fad8ffd8c84a4008627b7e445 (diff) |
no longer generate K&R C scanners
-rw-r--r-- | doc/flex.texi | 23 | ||||
-rw-r--r-- | src/flex.skl | 323 | ||||
-rw-r--r-- | src/flexdef.h | 1 | ||||
-rw-r--r-- | src/main.c | 18 | ||||
-rw-r--r-- | src/options.c | 4 | ||||
-rw-r--r-- | src/options.h | 2 | ||||
-rw-r--r-- | src/scan.l | 2 | ||||
-rw-r--r-- | tests/.gitignore | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 10 | ||||
-rw-r--r-- | tests/noansi_nr.l | 67 | ||||
-rw-r--r-- | tests/noansi_nr.txt | 5 | ||||
-rw-r--r-- | tests/noansi_r.l | 69 | ||||
-rw-r--r-- | tests/noansi_r.txt | 4 |
13 files changed, 102 insertions, 430 deletions
diff --git a/doc/flex.texi b/doc/flex.texi index 6af69df..c71dc59 100644 --- a/doc/flex.texi +++ b/doc/flex.texi @@ -1491,15 +1491,14 @@ the scanning routine using a K&R-style/non-prototyped function declaration, you must terminate the definition with a semi-colon (;). @code{flex} generates @samp{C99} function definitions by -default. However flex does have the ability to generate obsolete, er, -@samp{traditional}, function definitions. This is to support +default. Flex used toFlex used to have the ability to generate obsolete, er, +@samp{traditional}, function definitions. This was to support bootstrapping gcc on old systems. Unfortunately, traditional definitions prevent us from using any standard data types smaller than -int (such as short, char, or bool) as function arguments. For this -reason, future versions of @code{flex} may generate standard C99 code -only, leaving K&R-style functions to the historians. Currently, if you -do @strong{not} want @samp{C99} definitions, then you must use -@code{%option noansi-definitions}. +int (such as short, char, or bool) as function arguments. Furthermore, +traditional definitions support added extra complexity in the skeleton file. +For this reason, current versions of @code{flex} generate standard C99 code +only, leaving K&R-style functions to the historians. @cindex stdin, default for yyin @cindex yyin @@ -2860,19 +2859,13 @@ calls @code{yylex()} again). @opindex ---option-ansi-definitions @opindex ansi-definitions @item --ansi-definitions, @code{%option ansi-definitions} -instruct flex to generate ANSI C99 definitions for functions. -This option is enabled by default. -If @code{%option noansi-definitions} is specified, then the obsolete style -is generated. +Deprecated, ignored @anchor{option-ansi-prototypes} @opindex ---option-ansi-prototypes @opindex ansi-prototypes @item --ansi-prototypes, @code{%option ansi-prototypes} -instructs flex to generate ANSI C99 prototypes for functions. -This option is enabled by default. -If @code{noansi-prototypes} is specified, then -prototypes will have empty parameter lists. +Deprecated, ignored @anchor{option-bison-bridge} @opindex ---bison-bridge diff --git a/src/flex.skl b/src/flex.skl index e9e3ba3..ccec415 100644 --- a/src/flex.skl +++ b/src/flex.skl @@ -232,25 +232,6 @@ m4preproc_include(`flexint.h') #define yynoreturn #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 @@ -284,16 +265,8 @@ m4_define( [[YY_G]], [[yyg->$1]]) 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. -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_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. @@ -340,60 +313,19 @@ 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_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]], [[]]) +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_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_NOT_IN_HEADER]], [[ @@ -402,32 +334,16 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], * definition of BEGIN. */ #define BEGIN YY_G(yy_start) = 1 + 2 * -]]) - -m4_ifdef( [[M4_YY_NOT_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_NOT_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_NOT_IN_HEADER]], -[[ /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG ) -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ #define YY_END_OF_BUFFER_CHAR 0 ]]) @@ -477,10 +393,6 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ m4_ifdef( [[M4_YY_USE_LINENO]], [[ /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires @@ -509,10 +421,6 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], #define YY_LESS_LINENO(n) #define YY_LINENO_REWIND_TO(ptr) ]]) -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ @@ -526,10 +434,6 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ #define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG ) ]]) @@ -630,10 +534,6 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], #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_NOT_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. */ @@ -661,43 +561,35 @@ static int yy_did_buffer_switch_on_eof; %ok-for-header %endif -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_NOT_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 yyrestart ( FILE *input_file M4_YY_PROTO_LAST_ARG ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size M4_YY_PROTO_LAST_ARG ); +void yy_delete_buffer ( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG ); +void yy_flush_buffer ( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG ); +void yypop_buffer_state ( M4_YY_PROTO_ONLY_ARG ); m4_ifdef( [[M4_YY_NOT_IN_HEADER]], [[ +static void yyensure_buffer_stack ( M4_YY_PROTO_ONLY_ARG ); +static void yy_load_buffer_state ( M4_YY_PROTO_ONLY_ARG ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG ); #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_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 ); +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str M4_YY_PROTO_LAST_ARG ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len M4_YY_PROTO_LAST_ARG ); %endif -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 ); +void *yyalloc ( yy_size_t M4_YY_PROTO_LAST_ARG ); +void *yyrealloc ( void *, yy_size_t M4_YY_PROTO_LAST_ARG ); +void yyfree ( void * M4_YY_PROTO_LAST_ARG ); m4_ifdef( [[M4_YY_NOT_IN_HEADER]], [[ #define yy_new_buffer yy_create_buffer -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ @@ -707,10 +599,6 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ @@ -720,10 +608,6 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) ]]) @@ -738,10 +622,10 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], m4_ifdef( [[M4_YY_NOT_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 yynoreturn yy_fatal_error M4_YY_PARAMS( yyconst char* msg M4_YY_PROTO_LAST_ARG ); +static yy_state_type yy_get_previous_state ( M4_YY_PROTO_ONLY_ARG ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state M4_YY_PROTO_LAST_ARG); +static int yy_get_next_buffer ( M4_YY_PROTO_ONLY_ARG ); +static void yynoreturn yy_fatal_error ( const char* msg M4_YY_PROTO_LAST_ARG ); ]]) %endif @@ -758,10 +642,6 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], *yy_cp = '\0'; \ %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ YY_G(yy_c_buf_p) = yy_cp; -]]) - -m4_ifdef( [[M4_YY_NOT_IN_HEADER]], -[[ %% [4.0] data tables for the DFA and the user's section 1 definitions go here ]]) @@ -873,7 +753,7 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]], %if-c-only m4_ifdef( [[M4_YY_NOT_IN_HEADER]], [[ -static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +static int yy_init_globals ( M4_YY_PROTO_ONLY_ARG ); ]]) %endif @@ -894,9 +774,9 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], ]]) ]]) -int yylex_init M4_YY_PARAMS(yyscan_t* scanner); +int yylex_init (yyscan_t* scanner); -int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); +int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); %endif @@ -907,74 +787,74 @@ int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner m4_ifdef( [[M4_YY_NO_DESTROY]],, [[ -int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +int yylex_destroy ( M4_YY_PROTO_ONLY_ARG ); ]]) m4_ifdef( [[M4_YY_NO_GET_DEBUG]],, [[ -int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +int yyget_debug ( 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 ); +void yyset_debug ( 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 ); +YY_EXTRA_TYPE yyget_extra ( 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 ); +void yyset_extra ( 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 ); +FILE *yyget_in ( 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 ); +void yyset_in ( 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 ); +FILE *yyget_out ( 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 ); +void yyset_out ( 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 ); + int yyget_leng ( M4_YY_PROTO_ONLY_ARG ); ]]) m4_ifdef( [[M4_YY_NO_GET_TEXT]],, [[ -char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +char *yyget_text ( M4_YY_PROTO_ONLY_ARG ); ]]) m4_ifdef( [[M4_YY_NO_GET_LINENO]],, [[ -int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +int yyget_lineno ( 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 ); +void yyset_lineno ( int _line_number M4_YY_PROTO_LAST_ARG ); ]]) m4_ifdef( [[M4_YY_REENTRANT]], [[ m4_ifdef( [[M4_YY_NO_GET_COLUMN]],, [[ -int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +int yyget_column ( M4_YY_PROTO_ONLY_ARG ); ]]) ]]) @@ -982,28 +862,28 @@ m4_ifdef( [[M4_YY_REENTRANT]], [[ m4_ifdef( [[M4_YY_NO_SET_COLUMN]],, [[ -void yyset_column M4_YY_PARAMS( int _column_no M4_YY_PROTO_LAST_ARG ); +void yyset_column ( int _column_no M4_YY_PROTO_LAST_ARG ); ]]) ]]) %if-bison-bridge m4_ifdef( [[M4_YY_NO_GET_LVAL]],, [[ -YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +YYSTYPE * yyget_lval ( M4_YY_PROTO_ONLY_ARG ); ]]) -void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG ); +void yyset_lval ( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG ); m4_ifdef( [[<M4_YY_BISON_LLOC>]], [[ m4_ifdef( [[M4_YY_NO_GET_LLOC]],, [[ - YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); + YYLTYPE *yyget_lloc ( M4_YY_PROTO_ONLY_ARG ); ]]) m4_ifdef( [[M4_YY_NO_SET_LLOC]],, [[ - void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG ); + void yyset_lloc ( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG ); ]]) ]]) %endif @@ -1014,9 +894,9 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]], #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +extern "C" int yywrap ( M4_YY_PROTO_ONLY_ARG ); #else -extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +extern int yywrap ( M4_YY_PROTO_ONLY_ARG ); #endif #endif @@ -1024,27 +904,27 @@ extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); #ifndef YY_NO_UNPUT m4_ifdef( [[M4_YY_NO_UNPUT]],, [[ - static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG); + static void yyunput ( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG); ]]) #endif %ok-for-header %endif #ifndef yytext_ptr -static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG); +static void yy_flex_strncpy ( char *, const char *, int M4_YY_PROTO_LAST_ARG); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG); +static int yy_flex_strlen ( const 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 M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +static int yyinput ( M4_YY_PROTO_ONLY_ARG ); #else -static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG ); +static int input ( M4_YY_PROTO_ONLY_ARG ); #endif %ok-for-header %endif @@ -1070,15 +950,15 @@ 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); + static void yy_push_state ( 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 ); + static void yy_pop_state ( 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 ); + static int yy_top_state ( M4_YY_PROTO_ONLY_ARG ); ]]) ]]) @@ -1166,10 +1046,10 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], m4preproc_include(`tables_shared.h') /* Load the DFA tables from the given stream. */ -int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG); +int yytables_fload (FILE * fp M4_YY_PROTO_LAST_ARG); /* Unload the tables from memory. */ -int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG); +int yytables_destroy (M4_YY_PROTO_ONLY_ARG); %not-for-header /** Describes a mapping from a serialized table id to its deserialized state in @@ -1208,8 +1088,8 @@ struct yytbl_reader { %if-c-only Standard (non-C++) definition -m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]]) -m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]]) +m4_define( [[M4_YY_LEX_PROTO]], [[(M4_YY_PROTO_ONLY_ARG)]]) +m4_define( [[M4_YY_LEX_DECLARATION]], [[(M4_YY_DEF_ONLY_ARG)]]) m4_ifdef( [[M4_YY_BISON_LVAL]], [[ @@ -1217,7 +1097,7 @@ m4_ifdef( [[M4_YY_BISON_LVAL]], m4_dnl accept the lval parameter. m4_define( [[M4_YY_LEX_PROTO]], [[\]] - [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]]) + [[(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]]) m4_define( [[M4_YY_LEX_DECLARATION]], [[\]] [[YYFARGS1(YYSTYPE *,yylval_param)]]) ]]) @@ -1227,7 +1107,7 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]], m4_dnl Locations are used. yylex should also accept the ylloc parameter. m4_define( [[M4_YY_LEX_PROTO]], [[\]] - [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]]) + [[(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]]) m4_define( [[M4_YY_LEX_DECLARATION]], [[\]] [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]]) ]]) @@ -1650,7 +1530,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], * EOB_ACT_END_OF_FILE - end of file */ %if-c-only -static int yy_get_next_buffer YYFARGS0(void) +static int yy_get_next_buffer (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only int yyFlexLexer::yy_get_next_buffer() @@ -1799,7 +1679,7 @@ m4_ifdef( [[M4_YY_USES_REJECT]], %if-c-only %not-for-header - static yy_state_type yy_get_previous_state YYFARGS0(void) + static yy_state_type yy_get_previous_state (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only yy_state_type yyFlexLexer::yy_get_previous_state() @@ -1902,9 +1782,9 @@ m4_ifdef( [[M4_YY_USE_LINENO]], %if-c-only #ifndef YY_NO_INPUT #ifdef __cplusplus - static int yyinput YYFARGS0(void) + static int yyinput (M4_YY_DEF_ONLY_ARG) #else - static int input YYFARGS0(void) + static int input (M4_YY_DEF_ONLY_ARG) #endif %endif @@ -2062,7 +1942,7 @@ void yyFlexLexer::yyrestart( std::istream* input_file ) %if-c-only -static void yy_load_buffer_state YYFARGS0(void) +static void yy_load_buffer_state (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only void yyFlexLexer::yy_load_buffer_state() @@ -2290,7 +2170,7 @@ void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer) * M4_YY_DOC_PARAM */ %if-c-only -void yypop_buffer_state YYFARGS0(void) +void yypop_buffer_state (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only void yyFlexLexer::yypop_buffer_state (void) @@ -2318,7 +2198,7 @@ void yyFlexLexer::yypop_buffer_state (void) * Guarantees space for at least one push. */ %if-c-only -static void yyensure_buffer_stack YYFARGS0(void) +static void yyensure_buffer_stack (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only void yyFlexLexer::yyensure_buffer_stack(void) @@ -2424,7 +2304,7 @@ m4_ifdef( [[M4_YY_NO_SCAN_STRING]],, * @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 *, yystr) +YY_BUFFER_STATE yy_scan_string YYFARGS1( const char *, yystr) { m4_dnl M4_YY_DECL_GUTS_VAR(); @@ -2444,7 +2324,7 @@ m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],, * M4_YY_DOC_PARAM * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, int ,_yybytes_len) +YY_BUFFER_STATE yy_scan_bytes YYFARGS2( const char *,yybytes, int ,_yybytes_len) { YY_BUFFER_STATE b; char *buf; @@ -2516,7 +2396,7 @@ m4_ifdef( [[M4_YY_NO_PUSH_STATE]],, m4_ifdef( [[M4_YY_NO_POP_STATE]],, [[ %if-c-only - static void yy_pop_state YYFARGS0(void) + static void yy_pop_state (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only void yyFlexLexer::yy_pop_state() @@ -2534,7 +2414,7 @@ m4_ifdef( [[M4_YY_NO_POP_STATE]],, m4_ifdef( [[M4_YY_NO_TOP_STATE]],, [[ %if-c-only - static int yy_top_state YYFARGS0(void) + static int yy_top_state (M4_YY_DEF_ONLY_ARG) %endif %if-c++-only int yyFlexLexer::yy_top_state() @@ -2550,7 +2430,7 @@ m4_ifdef( [[M4_YY_NO_TOP_STATE]],, #endif %if-c-only -static void yynoreturn yy_fatal_error YYFARGS1(yyconst char*, msg) +static void yynoreturn yy_fatal_error YYFARGS1(const char*, msg) { M4_YY_DECL_GUTS_VAR(); M4_YY_NOOP_GUTS_VAR(); @@ -2559,7 +2439,7 @@ static void yynoreturn yy_fatal_error YYFARGS1(yyconst char*, msg) } %endif %if-c++-only -void yyFlexLexer::LexerError( yyconst char* msg ) +void yyFlexLexer::LexerError( const char* msg ) { M4_YY_DECL_GUTS_VAR(); std::cerr << msg << std::endl; @@ -2595,7 +2475,7 @@ 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) +YY_EXTRA_TYPE yyget_extra (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); return yyextra; @@ -2608,7 +2488,7 @@ m4_ifdef( [[M4_YY_NO_GET_LINENO]],, /** Get the current line number. * M4_YY_DOC_PARAM */ -int yyget_lineno YYFARGS0(void) +int yyget_lineno (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); @@ -2628,7 +2508,7 @@ m4_ifdef( [[M4_YY_NO_GET_COLUMN]],, /** Get the current column number. * M4_YY_DOC_PARAM */ -int yyget_column YYFARGS0(void) +int yyget_column (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); @@ -2647,7 +2527,7 @@ m4_ifdef( [[M4_YY_NO_GET_IN]],, /** Get the input stream. * M4_YY_DOC_PARAM */ -FILE *yyget_in YYFARGS0(void) +FILE *yyget_in (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); return yyin; @@ -2659,7 +2539,7 @@ m4_ifdef( [[M4_YY_NO_GET_OUT]],, /** Get the output stream. * M4_YY_DOC_PARAM */ -FILE *yyget_out YYFARGS0(void) +FILE *yyget_out (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); return yyout; @@ -2671,7 +2551,7 @@ m4_ifdef( [[M4_YY_NO_GET_LENG]],, /** Get the length of the current token. * M4_YY_DOC_PARAM */ -int yyget_leng YYFARGS0(void) +int yyget_leng (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); return yyleng; @@ -2683,7 +2563,7 @@ int yyget_leng YYFARGS0(void) */ m4_ifdef( [[M4_YY_NO_GET_TEXT]],, [[ -char *yyget_text YYFARGS0(void) +char *yyget_text (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); return yytext; @@ -2776,7 +2656,7 @@ void yyset_out YYFARGS1( FILE * ,_out_str) m4_ifdef( [[M4_YY_NO_GET_DEBUG]],, [[ -int yyget_debug YYFARGS0(void) +int yyget_debug (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); return yy_flex_debug; @@ -2799,7 +2679,7 @@ void yyset_debug YYFARGS1( int ,_bdebug) %if-bison-bridge m4_ifdef( [[M4_YY_NO_GET_LVAL]],, [[ -YYSTYPE * yyget_lval YYFARGS0(void) +YYSTYPE * yyget_lval (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); return yylval; @@ -2819,7 +2699,7 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]], [[ m4_ifdef( [[M4_YY_NO_GET_LLOC]],, [[ -YYLTYPE *yyget_lloc YYFARGS0(void) +YYLTYPE *yyget_lloc (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); return yylloc; @@ -2845,14 +2725,7 @@ void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param) * 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. */ -m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]], -[[ -int yylex_init( ptr_yy_globals ) - yyscan_t* ptr_yy_globals; -]], -[[ int yylex_init(yyscan_t* ptr_yy_globals) -]]) { if (ptr_yy_globals == NULL){ errno = EINVAL; @@ -2880,15 +2753,7 @@ int yylex_init(yyscan_t* ptr_yy_globals) * The user defined value in the first argument will be available to yyalloc in * the yyextra field. */ -m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]], -[[ -int yylex_init_extra( yy_user_defined, ptr_yy_globals ) - YY_EXTRA_TYPE yy_user_defined; - yyscan_t* ptr_yy_globals; -]], -[[ int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) -]]) { struct yyguts_t dummy_yyguts; @@ -2919,7 +2784,7 @@ int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) %# Actually, that ended an if-rentrant section %if-c-only -static int yy_init_globals YYFARGS0(void) +static int yy_init_globals (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); /* Initialization is the same as for the non-reentrant scanner. @@ -2982,7 +2847,7 @@ m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]], %if-c-only SNIP! this currently causes conflicts with the c++ scanner /* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy YYFARGS0(void) +int yylex_destroy (M4_YY_DEF_ONLY_ARG) { M4_YY_DECL_GUTS_VAR(); @@ -3034,7 +2899,7 @@ m4_ifdef( [[M4_YY_NOT_IN_HEADER]], m4_ifdef( [[M4_YY_NOT_IN_HEADER]], [[ #ifndef yytext_ptr -static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n) +static void yy_flex_strncpy YYFARGS3( char*,s1, const char *,s2, int,n) { M4_YY_DECL_GUTS_VAR(); M4_YY_NOOP_GUTS_VAR(); @@ -3049,7 +2914,7 @@ static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n) m4_ifdef( [[M4_YY_NOT_IN_HEADER]], [[ #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YYFARGS1( yyconst char *,s) +static int yy_flex_strlen YYFARGS1( const char *,s) { int n; for ( n = 0; s[n]; ++n ) @@ -3474,7 +3339,7 @@ int yytables_fload YYFARGS1(FILE *, fp) } /** Destroy the loaded tables, freeing memory, etc.. */ -int yytables_destroy YYFARGS0(void) +int yytables_destroy (M4_YY_DEF_ONLY_ARG) { struct yytbl_dmap *dmap=0; @@ -3498,7 +3363,7 @@ int yytables_destroy YYFARGS0(void) m4_ifdef([[M4_YY_MAIN]], [[ -int main M4_YY_PARAMS(void); +int main (void); int main () { diff --git a/src/flexdef.h b/src/flexdef.h index 83e8888..a727ede 100644 --- a/src/flexdef.h +++ b/src/flexdef.h @@ -358,7 +358,6 @@ extern int interactive, lex_compat, posix_compat, do_yylineno; extern int useecs, fulltbl, usemecs, fullspd; extern int gen_line_dirs, performance_report, backing_up_report; extern int reentrant, bison_bridge_lval, bison_bridge_lloc; -extern bool ansi_func_defs, ansi_func_protos; extern int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap; extern int csize; extern int yymore_used, reject, real_reject, continued_action, in_rule; @@ -106,7 +106,6 @@ int num_input_files; 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; @@ -311,12 +310,6 @@ void check_options (void) } } - 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 (extra_type) buf_m4_define( &m4defs_buf, "M4_EXTRA_TYPE_DEFS", extra_type); @@ -972,7 +965,6 @@ void flexinit (int argc, char **argv) tablesext = tablesverify = false; gentables = true; tablesfilename = tablesname = NULL; - ansi_func_defs = ansi_func_protos = true; sawcmpflag = false; @@ -1349,14 +1341,6 @@ void flexinit (int argc, char **argv) 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_m4_define( &m4defs_buf, "M4_YY_NO_PUSH_STATE",0); @@ -1847,8 +1831,6 @@ void usage (void) " --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" diff --git a/src/options.c b/src/options.c index 39d020e..3f3a39f 100644 --- a/src/options.c +++ b/src/options.c @@ -213,10 +213,6 @@ optspec_t flexopts[] = { , {"--nowarn", OPT_NO_WARN, 0} , /* Suppress warning messages. */ - {"--noansi-definitions", OPT_NO_ANSI_FUNC_DEFS, 0} - , - {"--noansi-prototypes", OPT_NO_ANSI_FUNC_PROTOS, 0} - , {"--yyclass=NAME", OPT_YYCLASS, 0} , {"--yylineno", OPT_YYLINENO, 0} diff --git a/src/options.h b/src/options.h index ac3391c..8555343 100644 --- a/src/options.h +++ b/src/options.h @@ -68,8 +68,6 @@ enum flexopt_flag_t { OPT_META_ECS, OPT_NEVER_INTERACTIVE, OPT_NO_ALIGN, - OPT_NO_ANSI_FUNC_DEFS, - OPT_NO_ANSI_FUNC_PROTOS, OPT_NO_DEBUG, OPT_NO_DEFAULT, OPT_NO_ECS, @@ -340,8 +340,6 @@ M4QEND "]]" interactive = option_sense; } array yytext_is_array = option_sense; - ansi-definitions ansi_func_defs = option_sense; - ansi-prototypes ansi_func_protos = option_sense; backup backing_up_report = option_sense; batch interactive = ! option_sense; bison-bridge bison_bridge_lval = option_sense; diff --git a/tests/.gitignore b/tests/.gitignore index 5bece86..69c482d 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -63,10 +63,6 @@ multiple_scanners_nr multiple_scanners_nr_[12].[ch] multiple_scanners_r multiple_scanners_r_[12].[ch] -noansi_nr -noansi_nr.c -noansi_r -noansi_r.c posix posix.c posixly_correct diff --git a/tests/Makefile.am b/tests/Makefile.am index ffdfa78..0fa8b8f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -83,8 +83,6 @@ simple_tests = \ mem_r \ multiple_scanners_nr \ multiple_scanners_r \ - noansi_nr \ - noansi_r \ posix \ posixly_correct \ prefix_nr \ @@ -152,10 +150,6 @@ mem_nr_SOURCES = mem_nr.l mem_r_SOURCES = mem_r.l multiple_scanners_nr_SOURCES = multiple_scanners_nr_main.c multiple_scanners_nr_1.l multiple_scanners_nr_2.l multiple_scanners_r_SOURCES = multiple_scanners_r_main.c multiple_scanners_r_1.l multiple_scanners_r_2.l -noansi_nr_SOURCES = noansi_nr.l -noansi_nr_CFLAGS = $(CFLAGS) -noansi_r_SOURCES = noansi_r.l -noansi_r_CFLAGS = $(CFLAGS) posix_SOURCES = posix.l posixly_correct_SOURCES = posixly_correct.l prefix_nr_SOURCES = prefix_nr.l @@ -244,8 +238,6 @@ CLEANFILES = \ multiple_scanners_r_1.h \ multiple_scanners_r_2.c \ multiple_scanners_r_2.h \ - noansi_nr.c \ - noansi_r.c \ posix.c \ posixly_correct.c \ prefix_nr.c \ @@ -309,8 +301,6 @@ EXTRA_DIST = \ lineno_trailing.one.txt \ mem_nr.txt \ mem_r.txt \ - noansi_nr.txt \ - noansi_r.txt \ prefix_nr.txt \ prefix_r.txt \ pthread_1.txt \ diff --git a/tests/noansi_nr.l b/tests/noansi_nr.l deleted file mode 100644 index db075a4..0000000 --- a/tests/noansi_nr.l +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is part of flex. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -/* TEST scanner. - Basic non-reentrant scanner, but with non-ansi function defs. - Compile with: flex scanner.l - - Sample Input: - # this is a comment - foo = true - bar = "string value" - integer = 43 -*/ -%{ -#include "config.h" -%} - -%option prefix="test" -%option nounput noyywrap noyylineno warn nodefault noinput -%option noansi-prototypes noansi-definitions - -IDENT [[:alnum:]_-] -WS [[:blank:]] -%% - -^{IDENT}+{WS}*={WS}*(true|false){WS}*\r?\n { return 100;} -^{IDENT}+{WS}*={WS}*\"[^\"\n\r]*\"{WS}*\r?\n { return 101;} -^{IDENT}+{WS}*={WS}*[[:digit:]]+{WS}*\r?\n { return 102;} -^{WS}*#.*\r?\n { } -^{WS}*\r?\n { } -.|\n { fprintf(stderr,"Invalid line.\n"); exit(-1);} - -%% - -int main(void); - -int main () -{ - yyin = stdin; - yyout = stdout; - while( yylex() ) - { - } - printf("TEST RETURNING OK.\n"); - return 0; -} - diff --git a/tests/noansi_nr.txt b/tests/noansi_nr.txt deleted file mode 100644 index 642e0fb..0000000 --- a/tests/noansi_nr.txt +++ /dev/null @@ -1,5 +0,0 @@ -# this is a comment -foo = "bar" -num = 43 -setting = false - diff --git a/tests/noansi_r.l b/tests/noansi_r.l deleted file mode 100644 index 1387829..0000000 --- a/tests/noansi_r.l +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This file is part of flex. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -/* A reentrant scanner. - This file will not compile under flex version <= 2.5.4. - Sample Input: - # this is a comment - foo = true - bar = "string value" - integer = 43 -*/ -%{ -#include "config.h" -%} - -%option prefix="test" -%option nounput noyywrap noyylineno warn nodefault noinput -%option reentrant -%option noansi-definitions noansi-prototypes - -IDENT [[:alnum:]_-] -WS [[:blank:]] -%% - -^{IDENT}+{WS}*={WS}*(true|false){WS}*\r?\n { return 100;} -^{IDENT}+{WS}*={WS}*\"[^\"\n\r]*\"{WS}*\r?\n { return 101;} -^{IDENT}+{WS}*={WS}*[[:digit:]]+{WS}*\r?\n { return 102;} -^{WS}*#.*\r?\n { } -^{WS}*\r?\n { } -.|\n { fprintf(stderr,"Invalid line.\n"); exit(-1);} - -%% - -int main(void); - -int main (void) -{ - yyscan_t lexer; - yylex_init( &lexer ); - yyset_out ( stdout,lexer); - yyset_in ( stdin, lexer); - while( yylex(lexer) ) - { - } - yylex_destroy( lexer ); - printf("TEST RETURNING OK.\n"); - return 0; -} - diff --git a/tests/noansi_r.txt b/tests/noansi_r.txt deleted file mode 100644 index 2160628..0000000 --- a/tests/noansi_r.txt +++ /dev/null @@ -1,4 +0,0 @@ -# this is a comment -foo = "bar" -num = 43 -setting = false |