Closed GoogleCodeExporter closed 8 years ago
On a related note: Unterminated "quoted strings" are also a concern.
The sample:
msc {
a,b;
a->b[label="my text];
}
will give the following error:
Error detected at line 3: syntax error, unexpected 'string', expecting ',' or ']'.
But the true error is that I was missing a " to terminate the label text. What
happens here is that the scanner is forced to reject the "TOK_QSTRING" rule and
since
no other rule matches (starts with) a ", it falls back to using the default rule
(printing the " to stdout). Now it parses two strings ("my" and "text")
separately,
which causes the parser to choke. Had the sample text been a single word it
would
have continued without any errors and just printed the " to the screen.
This particular problem can be fixed by (among things) inserting a rule:
\"(\\\"|[^\"])* { fprintf(stderr, "Unterminated quoted string at line
%d.\n",
lex_linenum); exit(EXIT_FAILURE); }
(and add the #include <stdlib.h> for exit() and the "failure macro")
~Niels
Original comment by NThykier@gmail.com
on 4 Jul 2009 at 4:35
This issue was closed by r35.
Original comment by Michael....@gmail.com
on 5 Jul 2009 at 8:19
Original issue reported on code.google.com by
NThykier@gmail.com
on 3 Jul 2009 at 11:34