Skip to main content

Module ast

Module ast 

Source
Expand description

The arena-backed abstract syntax tree.

Invariant: a node is an index into an arena, never a box, so an adversarial nesting depth costs one vector push per node and a walker can be iterative. Every node carries the span it was parsed from, and no node has been normalised: NOT IN, IS NOT DISTINCT FROM and an implicit alias are all distinct nodes rather than reconstructions, because a diagnostic that has to guess what the user wrote points at the wrong place.

Identifiers are interned once per parse. The interned form keeps the original spelling and an ASCII-folded lookup key, because SQL name resolution is case-insensitive while sqlite_schema records the spelling the user chose.

Structs§

Ast
The arena every node of one parse lives in.
ColumnDef
One column of a CREATE TABLE.
CommonTableExpr
A common table expression.
Delete
A DELETE statement.
ExprId
An expression node.
ForeignKeyClause
A foreign-key clause, on a column or on a table.
FromTerm
One term of a FROM clause, with the join that attached it.
FromTermId
A FROM term.
IndexedColumn
One indexed column of a table constraint or an index.
Insert
An INSERT statement.
Name
An interned identifier: what was written and what it matches.
NameId
An identifier, interned per parse.
OrderTerm
One term of an ORDER BY.
ResultColumn
One result column of a SELECT.
Select
A complete SELECT: a WITH prefix, compound arms, and the tail clauses.
SelectCore
One arm of a compound SELECT.
SelectCoreId
One arm of a compound SELECT.
SelectId
A compound SELECT.
Update
An UPDATE statement.
Upsert
An UPSERT clause.
Window
A window definition, named or inline.
WindowId
A window definition.
With
A WITH prefix.

Enums§

AlterAction
What an ALTER TABLE does.
BinaryOp
A binary operator.
ColumnConstraint
A column constraint, in written order.
CompoundOp
A compound operator.
ConflictAction
A conflict-resolution algorithm.
CreateTableBody
The body of a CREATE TABLE.
Expr
An expression, in the shape it was written.
ForeignKeyAction
One ON DELETE, ON UPDATE or MATCH clause.
FrameBound
One end of a window frame.
FrameExclude
A frame’s EXCLUDE clause.
FrameUnit
A window frame’s unit.
FromSource
How a FROM term names its rows.
InRhs
The right-hand side of IN.
IndexHint
An INDEXED BY hint.
InsertSource
What an INSERT inserts.
JoinConstraint
The ON or USING constraint of a join.
JoinKind
Which join was written.
Limited
Which of the two words a limited DELETE or UPDATE was written with.
Literal
A literal value, kept as the bytes it was written as.
NullOrder
Where NULLs sort, when written explicitly.
ObjectKind
Which kind of object a DROP names.
PatternOp
Which pattern operator was written.
PragmaValue
A PRAGMA argument.
RaiseAction
A RAISE() action inside a trigger body.
ReferentialAction
What a referential action does.
SelectBody
The rows of one arm of a compound SELECT.
SortOrder
Ascending or descending.
Statement
A parsed statement.
TableConstraint
A table-level constraint.
TransactionBehaviour
The behaviour of a BEGIN.
TriggerEvent
What a trigger fires on.
TriggerTime
When a trigger fires.
UnaryOp
A unary operator.