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 @@ -16407,6 +16407,12 @@ impl<'a> Parser<'a> {
1640716407 match prev_token.token {
1640816408 Token::Whitespace(ref w) => match w {
1640916409 Whitespace::Newline => break,
16410+ Whitespace::SingleLineComment { comment, prefix: _ } => {
16411+ if comment.ends_with('\n') {
16412+ break;
16413+ }
16414+ look_back_count += 1;
16415+ }
1641016416 _ => look_back_count += 1,
1641116417 },
1641216418 _ => {
Original file line number Diff line number Diff line change @@ -2553,6 +2553,20 @@ fn parse_mssql_go_keyword() {
25532553 assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: Some ( 5 ) } ) ) ;
25542554 assert_eq ! ( stmts[ 3 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
25552555
2556+ let single_line_comment_preceding_go = "USE some_database; -- okay\n GO" ;
2557+ let stmts = ms ( )
2558+ . parse_sql_statements ( single_line_comment_preceding_go)
2559+ . unwrap ( ) ;
2560+ assert_eq ! ( stmts. len( ) , 2 ) ;
2561+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2562+
2563+ let multi_line_comment_preceding_go = "USE some_database; /* okay */\n GO" ;
2564+ let stmts = ms ( )
2565+ . parse_sql_statements ( multi_line_comment_preceding_go)
2566+ . unwrap ( ) ;
2567+ assert_eq ! ( stmts. len( ) , 2 ) ;
2568+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2569+
25562570 let comment_following_go = "USE some_database;\n GO -- okay" ;
25572571 let stmts = ms ( ) . parse_sql_statements ( comment_following_go) . unwrap ( ) ;
25582572 assert_eq ! ( stmts. len( ) , 2 ) ;
You can’t perform that action at this time.
0 commit comments