summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-12-28 07:07:59 -0800
committerKaz Kylheku <kaz@kylheku.com>2023-12-28 07:07:59 -0800
commitdd9398ff7d4776aa67951800aeb402a94d42f50f (patch)
tree7183f9d9011ad2d341d10f85fb51b5dcb0eeb195
parent07912e6dd718e22b318eaa7d7c3793f6c86ea40d (diff)
downloadtxr-dd9398ff7d4776aa67951800aeb402a94d42f50f.tar.gz
txr-dd9398ff7d4776aa67951800aeb402a94d42f50f.tar.bz2
txr-dd9398ff7d4776aa67951800aeb402a94d42f50f.zip
build: automate clean-up of shipped scanner and parser
* Makefile (shipped): Copy the shipped materials unconditionally, rather than checking if they are different. If a patch exists for a shipped file, then apply it. * lex.yy.c.shipped, y.tab.c.shipped: Updated. * lex.yy.c.patch, y.tab.c.patch: New files.
-rw-r--r--Makefile3
-rw-r--r--lex.yy.c.patch13
-rw-r--r--lex.yy.c.shipped4
-rw-r--r--y.tab.c.patch28
-rw-r--r--y.tab.c.shipped5
5 files changed, 44 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index cb24327f..e3f40c99 100644
--- a/Makefile
+++ b/Makefile
@@ -283,10 +283,9 @@ lex.yy.c: $(top_srcdir)parser.l
shipped:
$(V)$(foreach NAME,$(SHIPPED), \
- if ! cmp -s $(NAME) $(NAME).shipped; then \
$(call ABBREV3SH,COPY,$(NAME).shipped,$(NAME)); \
cp $(NAME) $(NAME).shipped; \
- fi;)
+ [ -e $(NAME).patch ] && patch < $(NAME).patch || true;)
else
diff --git a/lex.yy.c.patch b/lex.yy.c.patch
new file mode 100644
index 00000000..b722d2f6
--- /dev/null
+++ b/lex.yy.c.patch
@@ -0,0 +1,13 @@
+--- lex.yy.c.shipped 2023-12-28 00:00:00.000000000 -0800
++++ lex.yy.c.shipped 2023-12-28 00:00:00.000000000 -0800
+@@ -4804,8 +4804,8 @@
+ /* Create the reject buffer large enough to save one state per allowed character. */
+ if ( ! yyg->yy_state_buf )
+ yyg->yy_state_buf = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE , yyscanner);
+- if ( ! yyg->yy_state_buf )
+- YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
++ if ( ! yyg->yy_state_buf )
++ YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
+
+ if ( ! yyg->yy_start )
+ yyg->yy_start = 1; /* first start state */
diff --git a/lex.yy.c.shipped b/lex.yy.c.shipped
index 64837e26..625c0552 100644
--- a/lex.yy.c.shipped
+++ b/lex.yy.c.shipped
@@ -4804,8 +4804,8 @@ YY_DECL
/* Create the reject buffer large enough to save one state per allowed character. */
if ( ! yyg->yy_state_buf )
yyg->yy_state_buf = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE , yyscanner);
- if ( ! yyg->yy_state_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
+ if ( ! yyg->yy_state_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
if ( ! yyg->yy_start )
yyg->yy_start = 1; /* first start state */
diff --git a/y.tab.c.patch b/y.tab.c.patch
new file mode 100644
index 00000000..d5de8485
--- /dev/null
+++ b/y.tab.c.patch
@@ -0,0 +1,28 @@
+--- y.tab.c.shipped 2023-12-28 00:00:00.000000000 -0800
++++ y.tab.c.shipped 2023-12-28 00:00:00.000000000 -0800
+@@ -2975,9 +2975,6 @@
+ /* The semantic value of the lookahead symbol. */
+ YYSTYPE yylval;
+
+- /* Number of syntax errors so far. */
+- int yynerrs;
+-
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+@@ -3031,7 +3028,6 @@
+
+ yystate = 0;
+ yyerrstatus = 0;
+- yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+@@ -7047,7 +7043,6 @@
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+- ++yynerrs;
+ #if ! YYERROR_VERBOSE
+ yyerror (scnr, parser, YY_("syntax error"));
+ #else
diff --git a/y.tab.c.shipped b/y.tab.c.shipped
index f1377d67..334ed2f6 100644
--- a/y.tab.c.shipped
+++ b/y.tab.c.shipped
@@ -2975,9 +2975,6 @@ int yychar;
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
- /* Number of syntax errors so far. */
- int yynerrs;
-
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
@@ -3031,7 +3028,6 @@ YYSTYPE yylval;
yystate = 0;
yyerrstatus = 0;
- yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
@@ -7047,7 +7043,6 @@ yyerrlab:
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
- ++yynerrs;
#if ! YYERROR_VERBOSE
yyerror (scnr, parser, YY_("syntax error"));
#else