[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, feature/namespaces, updated. gawk-4.1.0-
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, feature/namespaces, updated. gawk-4.1.0-2620-gb078f45 |
Date: |
Fri, 7 Jul 2017 05:06:32 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, feature/namespaces has been updated
via b078f45cf3f77853c3dd5b8cb24a28e0419486b4 (commit)
from 2db602e8d173c1795c0a7dea0a5ff35f80ef0bcb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=b078f45cf3f77853c3dd5b8cb24a28e0419486b4
commit b078f45cf3f77853c3dd5b8cb24a28e0419486b4
Author: Arnold D. Robbins <address@hidden>
Date: Fri Jul 7 12:06:06 2017 +0300
Improve error message if EOF in middle of a rule or function.
diff --git a/ChangeLog b/ChangeLog
index 2d598b5..d3aeadb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2017-07-07 Arnold D. Robbins <address@hidden>
+ * awkgram.y (yyerror): Produce better diagnostics for source
+ files that are not whole syntactic units.
+
+2017-07-07 Arnold D. Robbins <address@hidden>
+
* gawapi.h: Bring descriptive comments up to date, minor edits.
* io.c: Add some initial comments to functions where they were missing.
diff --git a/awkgram.c b/awkgram.c
index ad06685..493e214 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -4821,6 +4821,9 @@ yyerror(const char *m, ...)
char *buf;
int count;
static char end_of_file_line[] = "(END OF FILE)";
+ static char syntax_error[] = "syntax error";
+ static size_t syn_err_len = sizeof(syntax_error) - 1;
+ bool generic_error = (strncmp(m, syntax_error, syn_err_len) == 0);
print_included_from();
@@ -4851,7 +4854,11 @@ yyerror(const char *m, ...)
bp = thisline + strlen(thisline);
}
- msg("%.*s", (int) (bp - thisline), thisline);
+ if (lexeof && mesg == NULL && generic_error) {
+ msg("%s", end_of_file_line);
+ mesg = _("source files / command-line arguments must contain
complete functions or rules");
+ } else
+ msg("%.*s", (int) (bp - thisline), thisline);
va_start(args, m);
if (mesg == NULL)
diff --git a/awkgram.y b/awkgram.y
index 4b15b55..4c19966 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -2387,6 +2387,9 @@ yyerror(const char *m, ...)
char *buf;
int count;
static char end_of_file_line[] = "(END OF FILE)";
+ static char syntax_error[] = "syntax error";
+ static size_t syn_err_len = sizeof(syntax_error) - 1;
+ bool generic_error = (strncmp(m, syntax_error, syn_err_len) == 0);
print_included_from();
@@ -2417,7 +2420,11 @@ yyerror(const char *m, ...)
bp = thisline + strlen(thisline);
}
- msg("%.*s", (int) (bp - thisline), thisline);
+ if (lexeof && mesg == NULL && generic_error) {
+ msg("%s", end_of_file_line);
+ mesg = _("source files / command-line arguments must contain
complete functions or rules");
+ } else
+ msg("%.*s", (int) (bp - thisline), thisline);
va_start(args, m);
if (mesg == NULL)
diff --git a/test/ChangeLog b/test/ChangeLog
index 6456fc1..d894dbe 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2017-07-07 Arnold D. Robbins <address@hidden>
+
+ * Makefile.am (eofsrc1): New test.
+ * eofsrc1a.awk, eofsrc1b.awk, eofsrc1.ok: New files.
+ * unterm.ok: Updated after code change.
+
2017-07-01 Arnold D. Robbins <address@hidden>
* Makefile.am (nsprof2): New test.
diff --git a/test/Makefile.am b/test/Makefile.am
index d51323d..5efae6c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -251,6 +251,9 @@ EXTRA_DIST = \
dynlj.ok \
eofsplit.awk \
eofsplit.ok \
+ eofsrc1a.awk \
+ eofsrc1b.awk \
+ eofsrc1.ok \
errno.awk \
errno.in \
errno.ok \
@@ -1208,7 +1211,7 @@ BASIC_TESTS = \
callparam childin clobber closebad clsflnam compare compare2 concat1
concat2 \
concat3 concat4 concat5 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress
dynlj \
- eofsplit exit2 exitval1 exitval2 exitval3 \
+ eofsplit eofsrc1 exit2 exitval1 exitval2 exitval3 \
fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray
fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln
\
fstabplus funsemnl funsmnam funstack \
@@ -2436,6 +2439,11 @@ nsprof2:
@$(AWK) --pretty-print=_$@ -f "$(srcdir)"/address@hidden < /dev/null
@-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+eofsrc1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f "$(srcdir)"/address@hidden -f
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
# Targets generated for other tests:
include Maketests
diff --git a/test/Makefile.in b/test/Makefile.in
index 4d81b85..553a086 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -509,6 +509,9 @@ EXTRA_DIST = \
dynlj.ok \
eofsplit.awk \
eofsplit.ok \
+ eofsrc1a.awk \
+ eofsrc1b.awk \
+ eofsrc1.ok \
errno.awk \
errno.in \
errno.ok \
@@ -1465,7 +1468,7 @@ BASIC_TESTS = \
callparam childin clobber closebad clsflnam compare compare2 concat1
concat2 \
concat3 concat4 concat5 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress
dynlj \
- eofsplit exit2 exitval1 exitval2 exitval3 \
+ eofsplit eofsrc1 exit2 exitval1 exitval2 exitval3 \
fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray
fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln
\
fstabplus funsemnl funsmnam funstack \
@@ -2873,6 +2876,11 @@ nsprof2:
@echo $@
@$(AWK) --pretty-print=_$@ -f "$(srcdir)"/address@hidden < /dev/null
@-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+eofsrc1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f "$(srcdir)"/address@hidden -f
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
Gt-dummy:
# file Maketests, generated from Makefile.am by the Gentests program
addcomma:
diff --git a/test/eofsrc1.ok b/test/eofsrc1.ok
new file mode 100644
index 0000000..64d85b3
--- /dev/null
+++ b/test/eofsrc1.ok
@@ -0,0 +1,3 @@
+gawk: ./eofsrc1a.awk:2: (END OF FILE)
+gawk: ./eofsrc1a.awk:2: ^ source files / command-line arguments must contain
complete functions or rules
+EXIT CODE: 1
diff --git a/test/eofsrc1a.awk b/test/eofsrc1a.awk
new file mode 100644
index 0000000..55143c2
--- /dev/null
+++ b/test/eofsrc1a.awk
@@ -0,0 +1,2 @@
+BEGIN {
+ n = 5
diff --git a/test/eofsrc1b.awk b/test/eofsrc1b.awk
new file mode 100644
index 0000000..0dad216
--- /dev/null
+++ b/test/eofsrc1b.awk
@@ -0,0 +1,2 @@
+ print n
+}
diff --git a/test/unterm.ok b/test/unterm.ok
index 760d370..399f626 100644
--- a/test/unterm.ok
+++ b/test/unterm.ok
@@ -1,5 +1,5 @@
gawk: unterm.awk:1:
BEGIN{x=".........................................................................................................................................................................................................................................................}
gawk: unterm.awk:1: ^ unterminated string
-gawk: unterm.awk:1:
BEGIN{x=".........................................................................................................................................................................................................................................................}
-gawk: unterm.awk:1: ^ syntax error
+gawk: unterm.awk:1: (END OF FILE)
+gawk: unterm.awk:1: ^ source files / command-line arguments must
contain complete functions or rules
EXIT CODE: 1
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
awkgram.c | 9 ++++++++-
awkgram.y | 9 ++++++++-
test/ChangeLog | 6 ++++++
test/Makefile.am | 10 +++++++++-
test/Makefile.in | 10 +++++++++-
test/eofsrc1.ok | 3 +++
test/eofsrc1a.awk | 2 ++
test/eofsrc1b.awk | 2 ++
test/unterm.ok | 4 ++--
10 files changed, 54 insertions(+), 6 deletions(-)
create mode 100644 test/eofsrc1.ok
create mode 100644 test/eofsrc1a.awk
create mode 100644 test/eofsrc1b.awk
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, feature/namespaces, updated. gawk-4.1.0-2620-gb078f45,
Arnold Robbins <=