diff options
author | Heikki Linnakangas | 2011-03-10 07:01:27 +0000 |
---|---|---|
committer | Heikki Linnakangas | 2011-03-10 07:06:56 +0000 |
commit | 74a09d92101f36a5fe66f4f74253708931546e4c (patch) | |
tree | 5ec8c34bca654bec448728d3570d06a869361274 | |
parent | 2d8de0a50b54cc0ed430ffa96dc8776dfe95d5ff (diff) |
Fix bugs in the isolation tester flex rules.
Tom Lane pointed out that it was giving a warning: "-s option given but
default rule can be matched". That was because there was no rule to handle
newline in a quoted string. I made that throw an error.
Also, line number tracking was broken, giving incorrect line number on
error. Fixed that too.
-rw-r--r-- | src/test/isolation/specscanner.l | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/test/isolation/specscanner.l b/src/test/isolation/specscanner.l index 6752aca82d..c3193917c0 100644 --- a/src/test/isolation/specscanner.l +++ b/src/test/isolation/specscanner.l @@ -32,10 +32,9 @@ static void addlitchar(const char c); %x qstr non_newline [^\n\r] -space [ \t\n\r\f] +space [ \t\r\f] comment ("#"{non_newline}*) -whitespace ({space}+|{comment}) %% @@ -46,10 +45,10 @@ step { return(STEP); } teardown { return(TEARDOWN); } [\n] { yyline++; } -{whitespace} { - /* ignore */ - } +{comment} { /* ignore */ } +{space} { /* ignore */ } + /* Quoted strings: "foo" */ \" { litbufpos = 0; BEGIN(qstr); @@ -61,27 +60,36 @@ teardown { return(TEARDOWN); } return(string); } <qstr>. { addlitchar(yytext[0]); } +<qstr>\n { yyerror("unexpected newline in quoted string"); } +<qstr><<EOF>> { yyerror("unterminated quoted string"); } + /* SQL blocks: { UPDATE ... } */ "{" { litbufpos = 0; BEGIN(sql); } - <sql>"}" { litbuf[litbufpos] = '\0'; yylval.str = strdup(litbuf); BEGIN(INITIAL); return(sqlblock); } -<sql>[^}] { addlitchar(yytext[0]);} - +<sql>. { + addlitchar(yytext[0]); + } +<sql>\n { + yyline++; + addlitchar(yytext[0]); + } +<sql><<EOF>> { + yyerror("unterminated sql block"); + } . { fprintf(stderr, "syntax error at line %d: unexpected character \"%s\"\n", yyline, yytext); exit(1); } - %% static void |