summaryrefslogtreecommitdiff
path: root/awkgram.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-05-09 14:09:53 +0300
committerArnold D. Robbins <arnold@skeeve.com>2013-05-09 14:09:53 +0300
commitf23270d71c3cdb85b79677f07378eac9e6bcafb5 (patch)
tree89be05f5275de3c01a8e92729b4bc04739c62f06 /awkgram.c
parent1ecf59325e466aed32ebfe71da3b7af8c15306cb (diff)
downloadgawk-f23270d71c3cdb85b79677f07378eac9e6bcafb5.tar.gz
Make /regex/ a 2nd arg to index() a fatal error.
Diffstat (limited to 'awkgram.c')
-rw-r--r--awkgram.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/awkgram.c b/awkgram.c
index f6cc6de0..10fd4215 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -6533,6 +6533,12 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
ip->opcode = Op_push_array;
}
}
+ else if (r->builtin == do_index) {
+ arg = subn->nexti->lasti->nexti; /* 2nd arg list */
+ ip = arg->lasti;
+ if (ip->opcode == Op_match_rec)
+ fatal(_("index: regexp constant as second argument is not allowed"));
+ }
#ifdef ARRAYDEBUG
else if (r->builtin == do_adump) {
ip = subn->nexti->lasti;