File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19666,6 +19666,12 @@ impl<'a> Parser<'a> {
1966619666 match prev_token.token {
1966719667 Token::Whitespace(ref w) => match w {
1966819668 Whitespace::Newline => break,
19669+ Whitespace::SingleLineComment { comment, prefix: _ } => {
19670+ if comment.ends_with('\n') {
19671+ break;
19672+ }
19673+ look_back_count += 1;
19674+ }
1966919675 _ => look_back_count += 1,
1967019676 },
1967119677 _ => {
Original file line number Diff line number Diff line change @@ -2900,6 +2900,20 @@ fn parse_mssql_go_keyword() {
29002900 assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: Some ( 5 ) } ) ) ;
29012901 assert_eq ! ( stmts[ 3 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
29022902
2903+ let single_line_comment_preceding_go = "USE some_database; -- okay\n GO" ;
2904+ let stmts = ms ( )
2905+ . parse_sql_statements ( single_line_comment_preceding_go)
2906+ . unwrap ( ) ;
2907+ assert_eq ! ( stmts. len( ) , 2 ) ;
2908+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2909+
2910+ let multi_line_comment_preceding_go = "USE some_database; /* okay */\n GO" ;
2911+ let stmts = ms ( )
2912+ . parse_sql_statements ( multi_line_comment_preceding_go)
2913+ . unwrap ( ) ;
2914+ assert_eq ! ( stmts. len( ) , 2 ) ;
2915+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2916+
29032917 let comment_following_go = "USE some_database;\n GO -- okay" ;
29042918 let stmts = ms ( ) . parse_sql_statements ( comment_following_go) . unwrap ( ) ;
29052919 assert_eq ! ( stmts. len( ) , 2 ) ;
You can’t perform that action at this time.
0 commit comments