Skip to main content

strip_comments

Function strip_comments 

Source
pub fn strip_comments(sql: &str) -> String
Expand description

Blank out every comment in sql, preserving byte offsets and line breaks.

Comment bytes become spaces (newlines are kept) so the result has exactly the same length and line structure as the input. This lets semantic analysis run on comment-free SQL while diagnostics still resolve to the original source position.