diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-10-09 21:34:11 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-10-09 21:34:11 +0300 |
commit | 5134a77df39775f8e892f0b28cdcf8aa556aadbb (patch) | |
tree | 5971c170520688da80c4148c9216d8bcca3b8a97 | |
parent | 430a560a150bb77d5443973db5d00f4bd54dd603 (diff) | |
parent | 8e4ebdf25bb000f7c84e6cba7c01975c01536f44 (diff) | |
download | egawk-5134a77df39775f8e892f0b28cdcf8aa556aadbb.tar.gz egawk-5134a77df39775f8e892f0b28cdcf8aa556aadbb.tar.bz2 egawk-5134a77df39775f8e892f0b28cdcf8aa556aadbb.zip |
Merge branch 'gawk-4.1-stable'
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | awkgram.c | 7 | ||||
-rw-r--r-- | awkgram.y | 7 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 3 | ||||
-rw-r--r-- | test/Makefile.in | 8 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/badassign1.awk | 1 | ||||
-rw-r--r-- | test/badassign1.ok | 3 |
9 files changed, 42 insertions, 2 deletions
@@ -1,3 +1,8 @@ +2013-10-09 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (mk_assignment): Rework switch to handle Op_assign, + and to provide a better error message upon unknown opcode. + 2013-09-28 Arnold D. Robbins <arnold@skeeve.com> * dfa.c: Sync with GNU grep. @@ -7576,8 +7576,13 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op) case Op_push_array: tp->opcode = Op_push_lhs; break; + case Op_field_assign: + yyerror(_("cannot assign a value to the result of a field post-increment expression")); + break; default: - cant_happen(); + yyerror(_("invalid target of assignment (opcode %s)"), + opcode2str(tp->opcode)); + break; } tp->do_reference = (op->opcode != Op_assign); /* check for uninitialized reference */ @@ -5028,8 +5028,13 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op) case Op_push_array: tp->opcode = Op_push_lhs; break; + case Op_field_assign: + yyerror(_("cannot assign a value to the result of a field post-increment expression")); + break; default: - cant_happen(); + yyerror(_("invalid target of assignment (opcode %s)"), + opcode2str(tp->opcode)); + break; } tp->do_reference = (op->opcode != Op_assign); /* check for uninitialized reference */ diff --git a/test/ChangeLog b/test/ChangeLog index b1c3e7b9..ec6d73d3 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2013-10-09 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (badassign1): New test. + * badassign1.awk, badassign1.ok: New files. + 2013-09-25 Arnold D. Robbins <arnold@skeeve.com> * Makfile.am (randtest): New test. diff --git a/test/Makefile.am b/test/Makefile.am index d09e6988..fef12a37 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -113,6 +113,8 @@ EXTRA_DIST = \ backw.in \ backw.ok \ badargs.ok \ + badassign1.awk \ + badassign1.ok \ beginfile1.awk \ beginfile1.ok \ beginfile2.in \ @@ -933,6 +935,7 @@ BASIC_TESTS = \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath \ back89 backgsub \ + badassign1 \ childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ diff --git a/test/Makefile.in b/test/Makefile.in index 0b7f1f46..d1db6460 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -331,6 +331,8 @@ EXTRA_DIST = \ backw.in \ backw.ok \ badargs.ok \ + badassign1.awk \ + badassign1.ok \ beginfile1.awk \ beginfile1.ok \ beginfile2.in \ @@ -1150,6 +1152,7 @@ BASIC_TESTS = \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath \ back89 backgsub \ + badassign1 \ childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ @@ -2380,6 +2383,11 @@ backgsub: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +badassign1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + childin: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index a1791a92..df272ce8 100644 --- a/test/Maketests +++ b/test/Maketests @@ -120,6 +120,11 @@ backgsub: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +badassign1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + childin: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/badassign1.awk b/test/badassign1.awk new file mode 100644 index 00000000..5614f4a4 --- /dev/null +++ b/test/badassign1.awk @@ -0,0 +1 @@ +BEGIN { $i++ = 3 ; print i } diff --git a/test/badassign1.ok b/test/badassign1.ok new file mode 100644 index 00000000..c5ade3b3 --- /dev/null +++ b/test/badassign1.ok @@ -0,0 +1,3 @@ +gawk: badassign1.awk:1: BEGIN { $i++ = 3 ; print i } +gawk: badassign1.awk:1: ^ cannot assign a value to the result of a field post-increment expression +EXIT CODE: 1 |