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 @@ -15093,6 +15093,12 @@ impl<'a> Parser<'a> {
1509315093 match prev_token.token {
1509415094 Token::Whitespace(ref w) => match w {
1509515095 Whitespace::Newline => break,
15096+ Whitespace::SingleLineComment { comment, prefix: _ } => {
15097+ if comment.ends_with('\n') {
15098+ break;
15099+ }
15100+ look_back_count += 1;
15101+ }
1509615102 _ => look_back_count += 1,
1509715103 },
1509815104 _ => {
Original file line number Diff line number Diff line change @@ -2117,6 +2117,20 @@ fn parse_mssql_go_keyword() {
21172117 assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: Some ( 5 ) } ) ) ;
21182118 assert_eq ! ( stmts[ 3 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
21192119
2120+ let single_line_comment_preceding_go = "USE some_database; -- okay\n GO" ;
2121+ let stmts = ms ( )
2122+ . parse_sql_statements ( single_line_comment_preceding_go)
2123+ . unwrap ( ) ;
2124+ assert_eq ! ( stmts. len( ) , 2 ) ;
2125+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2126+
2127+ let multi_line_comment_preceding_go = "USE some_database; /* okay */\n GO" ;
2128+ let stmts = ms ( )
2129+ . parse_sql_statements ( multi_line_comment_preceding_go)
2130+ . unwrap ( ) ;
2131+ assert_eq ! ( stmts. len( ) , 2 ) ;
2132+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2133+
21202134 let comment_following_go = "USE some_database;\n GO -- okay" ;
21212135 let stmts = ms ( ) . parse_sql_statements ( comment_following_go) . unwrap ( ) ;
21222136 assert_eq ! ( stmts. len( ) , 2 ) ;
You can’t perform that action at this time.
0 commit comments