]> granicus.if.org Git - graphviz/commitdiff
Fix bug 2470
authorEmden R. Gansner <erg@alum.mit.edu>
Thu, 24 Jul 2014 20:47:57 +0000 (16:47 -0400)
committerEmden R. Gansner <erg@alum.mit.edu>
Thu, 24 Jul 2014 20:47:57 +0000 (16:47 -0400)
lib/cgraph/scan.l

index 87db5d4b3dbd5ff23efaec6bbdd5f1381db91c1d..f6edf75762d612f72e6cc40fd21fee85e1841532 100644 (file)
@@ -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);
 }