Skip to main content

Statement

Struct Statement 

Source
pub struct Statement {
    pub clauses: Vec<Clause>,
    pub union: Option<Box<UnionPart>>,
    pub preamble: PreambleMode,
    pub next: Option<Box<Statement>>,
    pub brace_wrapped: bool,
    pub definitions: Vec<LocalDefinition>,
}
Expand description

AST node types for the Cypher parser.

The AST uses enums for Clause, Expr, and PatternElement to avoid trait objects. Literal values use native Rust types (not CypherValue) since the AST is a compile-time concept.

Top-level AST node for a Cypher statement.

Fields§

§clauses: Vec<Clause>§union: Option<Box<UnionPart>>§preamble: PreambleMode

The CIP-150 preamble mode — top-level only; every nested body carries PreambleMode::Execute.

§next: Option<Box<Statement>>

CIP-213 <statement block> ::= <statement> [<next statement>...], <next statement> ::= NEXT <statement>. next chains this statement (which may itself carry its own .union chain, or be a sole Clause::Conditional) to the following NEXT stage’s own statement (which may in turn have a .next of its own). None means this is either not part of a NEXT chain, or is its final stage. Deliberately a sibling field to union/Conditional rather than nested inside them: per the CIP grammar, NEXT operates on a whole <statement> (union-chain-or-conditional), one level above where UNION/WHEN operate, so it’s threaded through the outermost Statement of each stage only – a stage’s own .union arms never carry their own independent .next chain.

§brace_wrapped: bool

CIP-146/CIP-242: true when this SingleQuery was written as [ USE <graph-expr> ] '{' <RegularQuery> '}' – top-level braces – rather than the plain unbraced form. The brace form’s content is otherwise indistinguishable from an unbraced statement (same clause list, same .union chain) once parsed, but CIP-242’s SHOW/TERMINATE composability rule (“Composing a SHOW command without YIELD fails”) treats an explicitly brace-wrapped bare SHOW (e.g. { SHOW INDEXES }) as composed, requiring YIELD, even though the identical clause list unbraced (SHOW INDEXES alone) is the lenient “canonical standalone” form that doesn’t need one – so this needs its own marker distinct from clause shape. Set only by parse_braced_single_query; every other Statement constructor leaves it false (via #[derive(Default)] field-by-field construction elsewhere).

§definitions: Vec<LocalDefinition>

CIP-231: the DEFINE <procedure definition> | <function definition> block parsed at the head of this statement block (only the top-level statement and braced nested bodies carry definitions; every statement-block parse site funnels through parse_statement_block, where they are parsed). Rewritten away – definitions and their call sites eliminated – by the front-end resolver (relate-front’s local_callables) before lowering; the planner/executor never see local callables. Default-empty so the derived and hand-written constructors of un-gated statements are unchanged.

Trait Implementations§

Source§

impl Clone for Statement

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Statement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Statement

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Statement

Manual PartialEq: deliberately ignores brace_wrapped. The unwrap rule – and the parser tests pinning it (test_brace_enclosed_top_level_query_is_transparent and friends) – treat a brace-wrapped SingleQuery as producing an AST indistinguishable from its unbraced spelling; brace_wrapped is out-of-band provenance a couple of CIP-242 composability checks read directly off the field (validate_show_composability), not part of that observable-content equivalence.

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.