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 @@ -17366,6 +17366,12 @@ impl<'a> Parser<'a> {
1736617366 match prev_token.token {
1736717367 Token::Whitespace(ref w) => match w {
1736817368 Whitespace::Newline => break,
17369+ Whitespace::SingleLineComment { comment, prefix: _ } => {
17370+ if comment.ends_with('\n') {
17371+ break;
17372+ }
17373+ look_back_count += 1;
17374+ }
1736917375 _ => look_back_count += 1,
1737017376 },
1737117377 _ => {
Original file line number Diff line number Diff line change @@ -2569,6 +2569,20 @@ fn parse_mssql_go_keyword() {
25692569 assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: Some ( 5 ) } ) ) ;
25702570 assert_eq ! ( stmts[ 3 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
25712571
2572+ let single_line_comment_preceding_go = "USE some_database; -- okay\n GO" ;
2573+ let stmts = ms ( )
2574+ . parse_sql_statements ( single_line_comment_preceding_go)
2575+ . unwrap ( ) ;
2576+ assert_eq ! ( stmts. len( ) , 2 ) ;
2577+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2578+
2579+ let multi_line_comment_preceding_go = "USE some_database; /* okay */\n GO" ;
2580+ let stmts = ms ( )
2581+ . parse_sql_statements ( multi_line_comment_preceding_go)
2582+ . unwrap ( ) ;
2583+ assert_eq ! ( stmts. len( ) , 2 ) ;
2584+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2585+
25722586 let comment_following_go = "USE some_database;\n GO -- okay" ;
25732587 let stmts = ms ( ) . parse_sql_statements ( comment_following_go) . unwrap ( ) ;
25742588 assert_eq ! ( stmts. len( ) , 2 ) ;
You can’t perform that action at this time.
0 commit comments