aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-04-30 10:07:33 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-04-30 10:07:33 +0300
commitd38a65f812c74acc859c8ea36e26c28cfbeffcc9 (patch)
tree0f4aa60e1fe39a04863657d94afff46a82215e09 /awkgram.c
parentf586cd49506935eb48a6afeaff6988087f947ed1 (diff)
parent665ec924795675c32d7178613367ec9f7a7d08e1 (diff)
downloadegawk-d38a65f812c74acc859c8ea36e26c28cfbeffcc9.tar.gz
egawk-d38a65f812c74acc859c8ea36e26c28cfbeffcc9.tar.bz2
egawk-d38a65f812c74acc859c8ea36e26c28cfbeffcc9.zip
Merge branch 'gawk-4.1-stable'
Diffstat (limited to 'awkgram.c')
-rw-r--r--awkgram.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/awkgram.c b/awkgram.c
index ea8c48d8..85e416da 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -5554,7 +5554,7 @@ yylex(void)
/*
* Here is what's ok with brackets:
*
- * [[] [^[] []] [^]] [.../...]
+ * [..[..] []] [^]] [.../...]
* [...\[...] [...\]...] [...\/...]
*
* (Remember that all of the above are inside /.../)
@@ -5562,7 +5562,7 @@ yylex(void)
* The code for \ handles \[, \] and \/.
*
* Otherwise, track the first open [ position, and if
- * an embedded [ or ] occurs, allow it to pass through
+ * an embedded ] occurs, allow it to pass through
* if it's right after the first [ or after [^.
*
* Whew!
@@ -5573,19 +5573,21 @@ yylex(void)
for (;;) {
c = nextc(false);
+ cur_index = tok - tokstart;
if (gawk_mb_cur_max == 1 || nextc_is_1stbyte) switch (c) {
case '[':
+ if (nextc(false) == ':' || in_brack == 0)
+ in_brack++;
+ pushback();
+ if (in_brack == 1)
+ b_index = tok - tokstart;
+ break;
case ']':
- cur_index = tok - tokstart;
if (in_brack > 0
&& (cur_index == b_index + 1
|| (cur_index == b_index + 2 && tok[-1] == '^')))
; /* do nothing */
- else if (c == '[') {
- in_brack++;
- if (in_brack == 1)
- b_index = tok - tokstart;
- } else {
+ else {
in_brack--;
if (in_brack == 0)
b_index = -1;