summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2020-10-11 21:55:00 -0400
committerEric S. Raymond <esr@thyrsus.com>2020-10-12 05:35:24 -0400
commitdad680611b8373cac2e5dc60e7552535bded79c2 (patch)
tree2e3b38c590ebc381c17c1423334b8fdf1c302661 /src
parent526be1f459bdc907b9867609214e3667c040cdae (diff)
downloadflex-git-dad680611b8373cac2e5dc60e7552535bded79c2.tar.gz
Deprecate input(); document yyinput() for the C back end...
...leaving an "input" macro in place for legacy compatibility. input() had already become yyinput() in the C++ back end in order to avoid collision with predefibed C++ inoput. In a multi-language world, this is good policy in general. There's no real reason for C to be different, and excellent reason to pull all possible entry points into the yy namespace.
Diffstat (limited to 'src')
-rw-r--r--src/cpp-flex.skl28
-rw-r--r--src/flexdef.h2
-rw-r--r--src/main.c5
-rw-r--r--src/scan.l5
4 files changed, 15 insertions, 25 deletions
diff --git a/src/cpp-flex.skl b/src/cpp-flex.skl
index 4af7074..fccecd9 100644
--- a/src/cpp-flex.skl
+++ b/src/cpp-flex.skl
@@ -1424,18 +1424,17 @@ static void yy_flex_strncpy ( char *, const char *, int M4_YY_PROTO_LAST_ARG);
static int yy_flex_strlen ( const char * M4_YY_PROTO_LAST_ARG);
#endif
-m4_ifdef([[M4_MODE_NO_INPUT]], [[#define YY_NO_INPUT 1]])
+m4_ifdef([[M4_MODE_NO_YYINPUT]], [[#define YY_NO_YYINPUT 1]])
-#ifndef YY_NO_INPUT
-%if-c-only Standard (non-C++) definition
+#ifndef YY_NO_YYINPUT
+//%if-c-only Standard (non-C++) definition
%not-for-header
-#ifdef __cplusplus
static int yyinput ( M4_YY_PROTO_ONLY_ARG );
-#else
-static int input ( M4_YY_PROTO_ONLY_ARG );
+#ifndef __cplusplus
+#define input yyinput
#endif
%ok-for-header
-%endif
+//%endif
#endif
@@ -2720,13 +2719,8 @@ m4_ifdef( [[M4_MODE_YYLINENO]],
#endif
%if-c-only
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput (M4_YY_DEF_ONLY_ARG)
-#else
-static int input (M4_YY_DEF_ONLY_ARG)
-#endif
-
+#ifndef YY_NO_YYINPUT
+int yyinput (M4_YY_DEF_ONLY_ARG)
%endif
%if-c++-only
int yyFlexLexer::yyinput()
@@ -2774,11 +2768,7 @@ int yyFlexLexer::yyinput()
if ( ! YY_G(yy_did_buffer_switch_on_eof) ) {
YY_NEW_FILE;
}
-#ifdef __cplusplus
return yyinput(M4_YY_CALL_ONLY_ARG);
-#else
- return input(M4_YY_CALL_ONLY_ARG);
-#endif
case EOB_ACT_CONTINUE_SCAN:
YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
@@ -2810,7 +2800,7 @@ m4_ifdef([[M4_MODE_YYLINENO]], [[
return c;
}
%if-c-only
-#endif /* ifndef YY_NO_INPUT */
+#endif /* ifndef YY_NO_YYINPUT */
%endif
/** Immediately switch to a different input stream.
diff --git a/src/flexdef.h b/src/flexdef.h
index 75ff950..df564fd 100644
--- a/src/flexdef.h
+++ b/src/flexdef.h
@@ -338,7 +338,7 @@ struct ctrl_bundle_t {
bool never_interactive; // always use buffered input, don't check for tty.
bool lex_compat; // (-l), maximize compatibility with AT&T lex
bool long_align; // (-Ca flag), favor long-word alignment for speed
- bool no_input; // Suppress use of imnput()
+ bool no_yyinput; // suppress use of yyinput()
bool no_unistd; // suppress inclusion of unistd.h
bool posix_compat; // (-X) maximize compatibility with POSIX lex
char *prefix; // prefix for externally visible names, default "yy"
diff --git a/src/main.c b/src/main.c
index 9865e84..2a7d5c6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1585,8 +1585,8 @@ void readin (void)
if (ctrl.prefix != NULL)
visible_define_str ( "M4_MODE_PREFIX", ctrl.prefix);
- if (ctrl.no_input)
- visible_define("M4_MODE_NO_INPUT");
+ if (ctrl.no_yyinput)
+ visible_define("M4_MODE_NO_YYINPUT");
if (ctrl.no_yy_push_state)
visible_define("M4_YY_NO_PUSH_STATE");
@@ -1789,4 +1789,3 @@ void usage (void)
backing_name, "flex", outfile_path, "flex");
}
-
diff --git a/src/scan.l b/src/scan.l
index 94b5d72..31e41fd 100644
--- a/src/scan.l
+++ b/src/scan.l
@@ -384,7 +384,8 @@ M4QEND "]""]"
ctrl.useecs = ctrl.usemecs = false;
ctrl.use_read = ctrl.fulltbl = true;
}
- input ctrl.no_input = ! option_sense;
+ input ctrl.no_yyinput = ! option_sense;
+ yyinput ctrl.no_yyinput = ! option_sense;
interactive ctrl.interactive = (trit)option_sense;
lex-compat ctrl.posix_compat = option_sense;
posix-compat ctrl.posix_compat = option_sense;
@@ -659,7 +660,7 @@ M4QEND "]""]"
*/
&& (cclval = ccllookup( nmstr )) != 0 )
{
- if ( input() != ']' )
+ if ( yyinput() != ']' )
synerr( _( "bad character class" ) );
yylval = cclval;