Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit74a09d9

Browse files
committed
Fix bugs in the isolation tester flex rules.
Tom Lane pointed out that it was giving a warning: "-s option given butdefault rule can be matched". That was because there was no rule to handlenewline in a quoted string. I made that throw an error.Also, line number tracking was broken, giving incorrect line number onerror. Fixed that too.
1 parent2d8de0a commit74a09d9

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

‎src/test/isolation/specscanner.l

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ static void addlitchar(const char c);
3232
%xqstr
3333

3434
non_newline[^\n\r]
35-
space[\t\n\r\f]
35+
space[\t\r\f]
3636

3737
comment("#"{non_newline}*)
38-
whitespace({space}+|{comment})
3938

4039
%%
4140

@@ -46,10 +45,10 @@ step{ return(STEP); }
4645
teardown{return(TEARDOWN); }
4746

4847
[\n]{ yyline++; }
49-
{whitespace}{
50-
/* ignore */
51-
}
48+
{comment}{/* ignore */ }
49+
{space}{/* ignore */ }
5250

51+
/* Quoted strings: "foo" */
5352
\"{
5453
litbufpos =0;
5554
BEGIN(qstr);
@@ -61,27 +60,36 @@ teardown{ return(TEARDOWN); }
6160
return(string);
6261
}
6362
<qstr>.{addlitchar(yytext[0]); }
63+
<qstr>\n{yyerror("unexpected newline in quoted string"); }
64+
<qstr><<EOF>>{yyerror("unterminated quoted string"); }
6465

66+
/* SQL blocks: { UPDATE ... } */
6567
"{"{
6668

6769
litbufpos =0;
6870
BEGIN(sql);
6971
}
70-
7172
<sql>"}"{
7273
litbuf[litbufpos] ='\0';
7374
yylval.str =strdup(litbuf);
7475
BEGIN(INITIAL);
7576
return(sqlblock);
7677
}
77-
<sql>[^}]{addlitchar(yytext[0]);}
78-
78+
<sql>.{
79+
addlitchar(yytext[0]);
80+
}
81+
<sql>\n{
82+
yyline++;
83+
addlitchar(yytext[0]);
84+
}
85+
<sql><<EOF>>{
86+
yyerror("unterminated sql block");
87+
}
7988

8089
.{
8190
fprintf(stderr,"syntax error at line %d: unexpected character\"%s\"\n", yyline, yytext);
8291
exit(1);
8392
}
84-
8593
%%
8694

8795
staticvoid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp