aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-10-11 20:50:26 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-10-11 20:50:26 +0300
commitc867589418a96bc619799854c1b2258bb23e2c4e (patch)
tree5f0971ffd92322e488abe1e9ebe52f5cd2ce8899 /awkgram.c
parent0e76eb8a521da76446bee6d3cda612c77190af4f (diff)
parent611dc46d8b216c22f05604e8df6bee7aa59e5977 (diff)
downloadegawk-c867589418a96bc619799854c1b2258bb23e2c4e.tar.gz
egawk-c867589418a96bc619799854c1b2258bb23e2c4e.tar.bz2
egawk-c867589418a96bc619799854c1b2258bb23e2c4e.zip
Merge branch 'gawk-4.1-stable'
Diffstat (limited to 'awkgram.c')
-rw-r--r--awkgram.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/awkgram.c b/awkgram.c
index 0acc1702..f8f80ad5 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -149,8 +149,8 @@ const char *const ruletab[] = {
static bool in_print = false; /* lexical scanning kludge for print */
static int in_parens = 0; /* lexical scanning kludge for print */
static int sub_counter = 0; /* array dimension counter for use in delete */
-static char *lexptr = NULL; /* pointer to next char during parsing */
-static char *lexend;
+static char *lexptr; /* pointer to next char during parsing */
+static char *lexend; /* end of buffer */
static char *lexptr_begin; /* keep track of where we were for error msgs */
static char *lexeme; /* beginning of lexeme for debugging */
static bool lexeof; /* seen EOF for current source? */
@@ -4706,7 +4706,8 @@ yyerror(const char *m, ...)
if (thisline == NULL) {
cp = lexeme;
if (*cp == '\n') {
- cp--;
+ if (cp > lexptr_begin)
+ cp--;
mesg = _("unexpected newline or end of string");
}
for (; cp != lexptr_begin && *cp != '\n'; --cp)
@@ -4717,6 +4718,8 @@ yyerror(const char *m, ...)
}
/* NL isn't guaranteed */
bp = lexeme;
+ if (bp < thisline)
+ bp = thisline + 1;
while (bp < lexend && *bp && *bp != '\n')
bp++;
} else {