Skip to main content

parse_script

Function parse_script 

Source
pub fn parse_script(script_content: &str) -> Result<Vec<String>>
Expand description

Parse a CQL script into individual statements

Handles:

  • Semicolon-terminated statements
  • Line comments (– comment)
  • Block comments (/* comment */)
  • String literals with both single and double quotes
  • Escaped quotes (doubled quotes like ‘’ or “”)
  • Strings with embedded semicolons
  • Multi-line statements
  • Blank lines and whitespace

Returns a vector of trimmed statement strings (without trailing semicolons)

§Errors

Returns an error if:

  • An unterminated statement is found (missing semicolon)
  • An unterminated string literal is found
  • An unterminated block comment is found