File tree 2 files changed +20
-0
lines changed
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> {
15087
15087
match prev_token.token {
15088
15088
Token::Whitespace(ref w) => match w {
15089
15089
Whitespace::Newline => break,
15090
+ Whitespace::SingleLineComment { comment, prefix } => {
15091
+ if comment.ends_with('\n') {
15092
+ break;
15093
+ }
15094
+ look_back_count += 1;
15095
+ }
15090
15096
_ => look_back_count += 1,
15091
15097
},
15092
15098
_ => {
Original file line number Diff line number Diff line change @@ -2100,6 +2100,20 @@ fn parse_mssql_go_keyword() {
2100
2100
assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: Some ( 5 ) } ) ) ;
2101
2101
assert_eq ! ( stmts[ 3 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2102
2102
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
+
2103
2117
let comment_following_go = "USE some_database;\n GO -- okay" ;
2104
2118
let stmts = ms ( ) . parse_sql_statements ( comment_following_go) . unwrap ( ) ;
2105
2119
assert_eq ! ( stmts. len( ) , 2 ) ;
You can’t perform that action at this time.
0 commit comments