File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -15254,6 +15254,12 @@ impl<'a> Parser<'a> {
1525415254 match prev_token.token {
1525515255 Token::Whitespace(ref w) => match w {
1525615256 Whitespace::Newline => break,
15257+ Whitespace::SingleLineComment { comment, prefix: _ } => {
15258+ if comment.ends_with('\n') {
15259+ break;
15260+ }
15261+ look_back_count += 1;
15262+ }
1525715263 _ => look_back_count += 1,
1525815264 },
1525915265 _ => {
Original file line number Diff line number Diff line change @@ -2203,6 +2203,20 @@ fn parse_mssql_go_keyword() {
22032203 assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: Some ( 5 ) } ) ) ;
22042204 assert_eq ! ( stmts[ 3 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
22052205
2206+ let single_line_comment_preceding_go = "USE some_database; -- okay\n GO" ;
2207+ let stmts = ms ( )
2208+ . parse_sql_statements ( single_line_comment_preceding_go)
2209+ . unwrap ( ) ;
2210+ assert_eq ! ( stmts. len( ) , 2 ) ;
2211+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2212+
2213+ let multi_line_comment_preceding_go = "USE some_database; /* okay */\n GO" ;
2214+ let stmts = ms ( )
2215+ . parse_sql_statements ( multi_line_comment_preceding_go)
2216+ . unwrap ( ) ;
2217+ assert_eq ! ( stmts. len( ) , 2 ) ;
2218+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2219+
22062220 let comment_following_go = "USE some_database;\n GO -- okay" ;
22072221 let stmts = ms ( ) . parse_sql_statements ( comment_following_go) . unwrap ( ) ;
22082222 assert_eq ! ( stmts. len( ) , 2 ) ;
You can’t perform that action at this time.
0 commit comments