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 @@ -15087,6 +15087,12 @@ impl<'a> Parser<'a> {
1508715087 match prev_token.token {
1508815088 Token::Whitespace(ref w) => match w {
1508915089 Whitespace::Newline => break,
15090+ Whitespace::SingleLineComment { comment, prefix: _ } => {
15091+ if comment.ends_with('\n') {
15092+ break;
15093+ }
15094+ look_back_count += 1;
15095+ }
1509015096 _ => look_back_count += 1,
1509115097 },
1509215098 _ => {
Original file line number Diff line number Diff line change @@ -2100,6 +2100,20 @@ fn parse_mssql_go_keyword() {
21002100 assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: Some ( 5 ) } ) ) ;
21012101 assert_eq ! ( stmts[ 3 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
21022102
2103+ let single_line_comment_preceding_go = "USE some_database; -- okay\n GO" ;
2104+ let stmts = ms ( )
2105+ . parse_sql_statements ( single_line_comment_preceding_go)
2106+ . unwrap ( ) ;
2107+ assert_eq ! ( stmts. len( ) , 2 ) ;
2108+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2109+
2110+ let multi_line_comment_preceding_go = "USE some_database; /* okay */\n GO" ;
2111+ let stmts = ms ( )
2112+ . parse_sql_statements ( multi_line_comment_preceding_go)
2113+ . unwrap ( ) ;
2114+ assert_eq ! ( stmts. len( ) , 2 ) ;
2115+ assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2116+
21032117 let comment_following_go = "USE some_database;\n GO -- okay" ;
21042118 let stmts = ms ( ) . parse_sql_statements ( comment_following_go) . unwrap ( ) ;
21052119 assert_eq ! ( stmts. len( ) , 2 ) ;
You can’t perform that action at this time.
0 commit comments