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 @@ -15093,6 +15093,12 @@ impl<'a> Parser<'a> {
15093
15093
match prev_token.token {
15094
15094
Token::Whitespace(ref w) => match w {
15095
15095
Whitespace::Newline => break,
15096
+ Whitespace::SingleLineComment { comment, prefix: _ } => {
15097
+ if comment.ends_with('\n') {
15098
+ break;
15099
+ }
15100
+ look_back_count += 1;
15101
+ }
15096
15102
_ => look_back_count += 1,
15097
15103
},
15098
15104
_ => {
Original file line number Diff line number Diff line change @@ -2117,6 +2117,20 @@ fn parse_mssql_go_keyword() {
2117
2117
assert_eq ! ( stmts[ 1 ] , Statement :: Go ( GoStatement { count: Some ( 5 ) } ) ) ;
2118
2118
assert_eq ! ( stmts[ 3 ] , Statement :: Go ( GoStatement { count: None } ) ) ;
2119
2119
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
+
2120
2134
let comment_following_go = "USE some_database;\n GO -- okay" ;
2121
2135
let stmts = ms ( ) . parse_sql_statements ( comment_following_go) . unwrap ( ) ;
2122
2136
assert_eq ! ( stmts. len( ) , 2 ) ;
You can’t perform that action at this time.
0 commit comments