Skip to main content

Module ast

Module ast 

Source
Expand description

Syntax-faithful, span-rich AST for openCypher queries.

Produced by graphforge-cypher; consumed by graphforge-ir (the binder). No other crate should depend on this module directly.

Every public type is Clone + Debug + PartialEq + Serialize + Deserialize so the differential test harness can round-trip ASTs through JSON and compare parser outputs.

Struct fields carry span: Span to locate source positions — doc comments on these repetitive span fields are omitted intentionally.

Structs§

AstQuery
A fully parsed Cypher query.
BinaryOp
A binary infix expression: left op right.
CallClause
A CALL procedure YIELD ... clause.
CaseExpr
A CASE expression — simple (CASE expr WHEN … THEN …) or searched (CASE WHEN … THEN …).
CreateClause
A CREATE clause.
DeleteClause
A DELETE or DETACH DELETE clause.
ExistentialSubquery
A simple or full existential subquery.
FunctionCall
A function call: name(args), name(DISTINCT arg), or name(*).
LabelPredicate
A label predicate: n:Person used as a boolean expression.
ListComprehension
A list comprehension: [x IN list WHERE pred | projection].
ListLiteral
A list literal: [1, 2, 3].
MapLiteral
A map literal: {key: expr, …}.
MatchClause
A MATCH or OPTIONAL MATCH clause.
MergeClause
A MERGE clause (with optional ON CREATE / ON MATCH SET actions).
NodePattern
A node pattern: (var:Label {props}).
OrderByClause
An ORDER BY sub-clause carrying one or more sort keys.
ParamRef
A query parameter reference: $name.
PathPattern
A path pattern: one or more alternating node/relationship patterns.
PatternComprehension
A pattern comprehension: [(n)-[r]->(m) WHERE pred | r.weight].
PatternPredicate
A pattern predicate used as a boolean expression, e.g. (n)-->().
PropertyAccess
A property access: n.prop.
Quantifier
A quantifier predicate: all/any/none/single(var IN list WHERE pred).
RelPattern
A relationship pattern: -[var:TYPE*min..max {props}]->.
RemoveClause
A REMOVE clause.
ReturnClause
A RETURN clause.
ReturnItem
A single item in a RETURN or WITH projection.
SetClause
A SET clause.
SortItem
A single sort key.
UnaryOp
A unary prefix expression: NOT expr or -expr.
UnionClause
A UNION or UNION ALL clause joining two query halves.
UnwindClause
An UNWIND clause.
VarRef
A variable reference: n.
WhenClause
A single WHEN condition THEN result arm inside a CASE expression.
WhereClause
A WHERE clause (also used inline in MATCH/WITH).
WithClause
A WITH clause (pipeline stage with optional ORDER/SKIP/LIMIT/WHERE).

Enums§

AstClause
A top-level clause in a Cypher query.
BinaryOpKind
All binary operators in openCypher.
DialectVersion
openCypher dialect version.
Direction
Edge direction in a relationship pattern.
ExistentialSubqueryBody
Expr
A Cypher expression.
Literal
A scalar literal value: integer, float, string, boolean, or null.
PathElement
One element in a path pattern.
QuantifierKind
Which quantifier a Quantifier predicate applies.
RemoveItem
A single item inside a REMOVE clause.
SetItem
A single item inside a SET clause.
SortOrder
Sort direction.
StringOpKind
The operation in a STARTS WITH / ENDS WITH / CONTAINS string predicate.
UnaryOpKind
The operator in a unary expression.