Skip to main content

ParsedStatement

Struct ParsedStatement 

Source
pub struct ParsedStatement<'a>(/* private fields */);
Expand description

Parse result for one successfully recognized SQLite statement.

Contains statement-local data:

  • Typed AST root (root()).
  • Optional token stream (tokens()).
  • Optional comments (comments()).
  • Original source slice (source()).

Implementations§

Source§

impl<'a> ParsedStatement<'a>

Source

pub fn root(&'a self) -> Option<Stmt<'a>>

Typed AST root for the statement.

Returns None for comment-only input (valid SQL with no actual statement, e.g. /* no-op */).

Mirrors C syntaqlite_result_root for PARSE_OK.

Source

pub fn source(&self) -> &'a str

The source text bound to this result.

Source

pub fn tokens(&self) -> impl Iterator<Item = ParserToken<'a>>

Statement-local token stream with parser usage flags.

Requires collect_tokens: true in ParserConfig.

Source

pub fn comments(&self) -> impl Iterator<Item = Comment<'a>>

Comments that belong to this statement.

Requires collect_tokens: true in ParserConfig.

Source

pub fn erase(&self) -> AnyParsedStatement<'a>

Convert this result into the grammar-agnostic AnyParsedStatement.

Use this when handing statement data to grammar-independent tooling.

Source

pub fn macro_regions(&self) -> impl Iterator<Item = MacroRegion> + use<'_, 'a>

Macro expansion call-site spans recorded during parsing.

Source

pub fn dump(&self, out: &mut String, indent: usize)

Dump the AST as indented text into out.