From ed8b3f558fe8dd65bfc8f7c66146e035cc622932 Mon Sep 17 00:00:00 2001 From: "Emden R. Gansner" Date: Thu, 24 Jul 2014 16:47:57 -0400 Subject: [PATCH] Fix bug 2470 --- lib/cgraph/scan.l | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/cgraph/scan.l b/lib/cgraph/scan.l index 87db5d4b3..f6edf7576 100644 --- a/lib/cgraph/scan.l +++ b/lib/cgraph/scan.l @@ -221,10 +221,28 @@ void yyerror(char *str) agxbput (&xb, ": "); } agxbput (&xb, str); - sprintf(buf," in line %d near '", line_num); + sprintf(buf," in line %d", line_num); agxbput (&xb, buf); - agxbput (&xb, yytext); - agxbput (&xb,"'\n"); + if (*yytext) { + agxbput(&xb," near '"); + agxbput (&xb, yytext); + agxbputc (&xb, '\''); + } + else switch (YYSTATE) { + case qstring : + sprintf(buf, " scanning a quoted string (missing endquote? longer than %d?)", YY_BUF_SIZE); + agxbput (&xb, buf); + break; + case hstring : + sprintf(buf, " scanning a HTML string (missing '>'? bad nesting? longer than %d?)", YY_BUF_SIZE); + agxbput (&xb, buf); + break; + case comment : + sprintf(buf, " scanning a /*...*/ comment (missing '*/? longer than %d?)", YY_BUF_SIZE); + agxbput (&xb, buf); + break; + } + agxbputc (&xb, '\n'); agerr(AGERR,agxbuse(&xb)); agxbfree(&xb); } -- 2.40.0