moonrockz/partiql-syntax/ast does not have a README file

    ParseError

    pub(all) suberror ParseError {
    Unsupported(message~ : String, span~ : Span)
    Syntax(message~ : String, span~ : Span, expected~ : Array[String], found~ : String)
    } derive(Eq,
    Debug
    )

    Why a statement could not be parsed.

    BinaryOp

    pub(all) enum BinaryOp {
    Add
    Sub
    Mul
    Div
    Mod
    Concat
    Eq
    Ne
    Lt
    Le
    Gt
    Ge
    } derive(Eq,
    Debug
    )

    Comment

    pub(all) struct Comment {
    kind : CommentKind
    text : String
    span : Span
    } derive(Eq,
    Debug
    )

    A comment as written: -- note (without the line break) or /* note */.

    CommentKind

    pub(all) enum CommentKind {
    Line
    Block
    } derive(Eq,
    Debug
    )

    Corresponding

    pub(all) enum Corresponding {
    All
    By(Array[Identifier])
    } derive(Eq,
    Debug
    )

    CORRESPONDING [BY (names)] (RFC 0007).

    DataType

    pub(all) enum DataType {
    Null
    Missing
    Bool
    TinyInt
    SmallInt
    Int
    BigInt
    Decimal(Int?, Int?)
    Numeric(Int?, Int?)
    Real
    Double(Int?)
    Char(Int?)
    Varchar(Int?)
    String
    Symbol
    Blob
    Clob
    Date
    Time(Int?, with_tz~ : Bool)
    Timestamp(Int?, with_tz~ : Bool)
    Interval(IntervalQualifier)
    Struct
    Tuple
    List
    Bag
    Sexp
    Any
    Map(DataType, DataType)
    Array(DataType?)
    Custom(Identifier)
    } derive(Eq,
    Debug
    )

    A data type in CAST, IS and type positions.

    DatetimeField

    pub(all) enum DatetimeField {
    Year
    Month
    Day
    Hour
    Minute
    Second
    TimezoneHour
    TimezoneMinute
    } derive(Eq,
    Debug
    )

    EdgeDirection

    pub(all) enum EdgeDirection {
    Left
    Undirected
    Right
    LeftOrUndirected
    UndirectedOrRight
    LeftOrRight
    Any
    } derive(Eq,
    Debug
    )

    EdgeFiller

    pub(all) struct EdgeFiller {
    variable : Identifier?
    label : Label?
    where_ : Expr?
    span : Span
    } derive(Eq,
    Debug
    )

    [ [name] [: label] [WHERE expr] ]

    EdgePattern

    pub(all) struct EdgePattern {
    direction : EdgeDirection
    filler : EdgeFiller?
    quantifier : Quantifier?
    span : Span
    } derive(Eq,
    Debug
    )

    An edge. filler is None only for the abbreviated form (->), so -> and -[]-> stay different. The span includes the quantifier.

    Expr

    pub(all) struct Expr {
    kind : ExprKind
    span : Span
    } derive(Eq,
    Debug
    )

    Expr::strip_spans

    fn Expr::strip_spans(self : Expr) -> Expr

    The same expression with every span set to { start: 0, end: 0 }.

    ExprKind

    pub(all) enum ExprKind {
    Lit(Literal)
    VarRef(Identifier, qualified~ : Bool)
    Parameter
    Path(Expr, Array[PathStep])
    Unary(UnaryOp, Expr)
    Binary(BinaryOp, Expr, Expr)
    And(Expr, Expr)
    Or(Expr, Expr)
    Not(Expr)
    BoolTest(Expr, Bool?, negated~ : Bool)
    Like(Expr, pattern~ : Expr, escape~ : Expr?, negated~ : Bool)
    Between(Expr, low~ : Expr, high~ : Expr, negated~ : Bool)
    In(Expr, Expr, negated~ : Bool)
    IsNull(Expr, negated~ : Bool)
    IsMissing(Expr, negated~ : Bool)
    IsType(Expr, DataType, negated~ : Bool)
    Overlaps(Expr, Expr)
    Case(operand~ : Expr?, branches~ : Array[(Expr, Expr)], default~ : Expr?)
    Cast(Expr, DataType)
    Extract(DatetimeField, Expr)
    Trim(spec~ : TrimSpec?, chars~ : Expr?, Expr)
    Substring(Expr, start~ : Expr, length~ : Expr?)
    Position(Expr, Expr)
    Overlay(Expr, placing~ : Expr, from~ : Expr, for_~ : Expr?)
    Coalesce(Array[Expr])
    NullIf(Expr, Expr)
    DateAdd(DatetimeField, Expr, Expr)
    DateDiff(DatetimeField, Expr, Expr)
    Call(Identifier, Array[Expr], quantifier~ : SetQuantifier?)
    CallStar(Identifier)
    List(Array[Expr])
    Bag(Array[Expr])
    Sexp(Array[Expr])
    Struct(Array[(Expr, Expr)])
    Map(Array[(Expr, Expr)])
    Row(Array[Expr])
    Values(Array[Expr])
    Query(Query)
    GraphMatch(GraphMatch)
    Error
    } derive(Eq,
    Debug
    )

    FromItem

    pub(all) enum FromItem {
    Scan(FromSource)
    Unpivot(FromSource)
    Join(Join)
    } derive(Eq,
    Debug
    )

    FromSource

    pub(all) struct FromSource {
    lateral : Bool
    expr : Expr
    as_ : Identifier?
    at : Identifier?
    by : Identifier?
    span : Span
    } derive(Eq,
    Debug
    )

    A FROM source with its AS, AT and BY variables.

    GraphMatch

    pub(all) struct GraphMatch {
    graph : Expr
    pattern : GraphPattern
    span : Span
    } derive(Eq,
    Debug
    )

    (graph MATCH pattern), or graph MATCH pattern as a FROM item. The span includes the parentheses of the parenthesized form.

    GraphPattern

    pub(all) struct GraphPattern {
    selector : Selector?
    paths : Array[PathPattern]
    where_ : Expr?
    span : Span
    } derive(Eq,
    Debug
    )

    A selector, one or more path patterns, and an optional postfilter. paths is never empty; where_ is None in the FROM form.

    GroupBy

    pub(all) struct GroupBy {
    keys : GroupKeys
    group_as : Identifier?
    span : Span
    } derive(Eq,
    Debug
    )

    GroupDelimiter

    pub(all) enum GroupDelimiter {
    Paren
    Bracket
    } derive(Eq,
    Debug
    )

    GroupKey

    pub(all) struct GroupKey {
    expr : Expr
    as_ : Identifier?
    span : Span
    } derive(Eq,
    Debug
    )

    GroupKeys

    pub(all) enum GroupKeys {
    All
    By(Array[GroupKey], partial~ : Bool)
    } derive(Eq,
    Debug
    )

    GroupPattern

    pub(all) struct GroupPattern {
    delimiter : GroupDelimiter
    path : PathPattern
    where_ : Expr?
    quantifier : Quantifier?
    span : Span
    } derive(Eq,
    Debug
    )

    ( path [WHERE expr] ) or [ path [WHERE expr] ], with an optional quantifier. The span includes the quantifier.

    Identifier

    pub(all) struct Identifier {
    text : String
    delimited : Bool
    span : Span
    } derive(Eq,
    Debug
    )

    An identifier: a regular name (case-insensitive) or a delimited "name" (case-sensitive).

    IntervalQualifier

    pub(all) struct IntervalQualifier {
    start : DatetimeField
    start_precision : Int?
    end : DatetimeField?
    fractional_precision : Int?
    } derive(Eq,
    Debug
    )

    Join

    pub(all) struct Join {
    kind : JoinKind
    form : JoinForm
    left : FromItem
    right : FromItem
    span : Span
    } derive(Eq,
    Debug
    )

    JoinForm

    pub(all) enum JoinForm {
    Comma
    Cross
    On(Expr)
    } derive(Eq,
    Debug
    )

    JoinKind

    pub(all) enum JoinKind {
    Inner
    Left
    Right
    Full
    } derive(Eq,
    Debug
    )

    Label

    pub(all) struct Label {
    kind : LabelKind
    span : Span
    } derive(Eq,
    Debug
    )

    A label expression. The span of a parenthesized label includes the parentheses.

    LabelKind

    pub(all) enum LabelKind {
    Name(Identifier)
    Wildcard
    Not(Label)
    And(Label, Label)
    Or(Label, Label)
    } derive(Eq,
    Debug
    )

    LetBinding

    pub(all) struct LetBinding {
    expr : Expr
    name : Identifier
    span : Span
    } derive(Eq,
    Debug
    )

    Literal

    pub(all) enum Literal {
    Null
    Missing
    Bool(Bool)
    Int(String)
    Decimal(String)
    Float(String)
    String(String)
    Ion(String,
    IonValue
    )
    Date(String)
    Time(String, precision~ : Int?, with_tz~ : Bool)
    Timestamp(String, precision~ : Int?, with_tz~ : Bool)
    Interval(String, negative~ : Bool, qualifier~ : IntervalQualifier)
    } derive(
    Debug
    )

    A literal. Numbers keep their source text; an Ion literal keeps its text and its parsed value.
    impl Eq for Literal

    NodePattern

    pub(all) struct NodePattern {
    variable : Identifier?
    label : Label?
    where_ : Expr?
    span : Span
    } derive(Eq,
    Debug
    )

    ( [name] [: label] [WHERE expr] )

    NullsOrder

    pub(all) enum NullsOrder {
    First
    Last
    } derive(Eq,
    Debug
    )

    PathPart

    pub(all) enum PathPart {
    Node(NodePattern)
    Edge(EdgePattern)
    Group(GroupPattern)
    } derive(Eq,
    Debug
    )

    PathPattern

    pub(all) struct PathPattern {
    restrictor : Restrictor?
    variable : Identifier?
    parts : Array[PathPart]
    span : Span
    } derive(Eq,
    Debug
    )

    [restrictor] [name =] part+. parts is never empty.

    PathStep

    pub(all) enum PathStep {
    Field(Identifier)
    FieldString(String, span~ : Span)
    Index(Expr)
    AllElements(Span)
    AllFields(Span)
    } derive(Eq,
    Debug
    )

    Projection

    pub(all) enum Projection {
    Star(Span)
    Items(Array[SelectItem])
    Value(Expr)
    Pivot(value~ : Expr, key~ : Expr)
    } derive(Eq,
    Debug
    )

    Quantifier

    pub(all) struct Quantifier {
    kind : QuantifierKind
    span : Span
    } derive(Eq,
    Debug
    )

    QuantifierKind

    pub(all) enum QuantifierKind {
    Plus
    Star
    Range(lower~ : Int, upper~ : Int?)
    } derive(Eq,
    Debug
    )

    Bounds are not negative, and upper >= lower.

    Query

    pub(all) struct Query {
    with_ : Array[WithBinding]
    body : QueryBody
    order_by : Array[SortSpec]
    limit : Expr?
    offset : Expr?
    span : Span
    } derive(Eq,
    Debug
    )

    A query: an optional WITH, a body, and the clauses that apply to the whole body.

    Query::strip_spans

    fn Query::strip_spans(self : Query) -> Query

    The same query with every span set to { start: 0, end: 0 }.

    QueryBody

    pub(all) enum QueryBody {
    Select(Select)
    SetOp(SetOp)
    Expr(Expr)
    Table(Array[Identifier])
    } derive(Eq,
    Debug
    )

    Recovered

    pub(all) struct Recovered {
    script : Script
    errors : Array[ParseError]
    } derive(Eq,
    Debug
    )

    The result of parse_script_recovering: the partial script and every error, in source order (spec M3d ยง3).

    Restrictor

    pub(all) enum Restrictor {
    Walk
    Trail
    Acyclic
    Simple
    } derive(Eq,
    Debug
    )

    Script

    pub(all) struct Script {
    statements : Array[Statement]
    comments : Array[Comment]
    span : Span
    } derive(Eq,
    Debug
    )

    The statements of a script, and the comments of its source in source order.

    Script::strip_spans

    fn Script::strip_spans(self : Script) -> Script

    The same script with every span set to { start: 0, end: 0 }.

    Select

    pub(all) struct Select {
    quantifier : SetQuantifier?
    projection : Projection
    from : FromItem?
    let_ : Array[LetBinding]
    where_ : Expr?
    group_by : GroupBy?
    having : Expr?
    span : Span
    } derive(Eq,
    Debug
    )

    A SELECT (or PIVOT) block.

    SelectItem

    pub(all) enum SelectItem {
    Expr(Expr, as_~ : Identifier?, span~ : Span)
    AllFields(Expr, span~ : Span)
    } derive(Eq,
    Debug
    )

    Selector

    pub(all) struct Selector {
    kind : SelectorKind
    span : Span
    } derive(Eq,
    Debug
    )

    SelectorKind

    pub(all) enum SelectorKind {
    AnyShortest
    AllShortest
    Shortest
    Any(k~ : Int?)
    ShortestK(k~ : Int, group~ : Bool)
    } derive(Eq,
    Debug
    )

    Counts are not negative.

    SetOp

    pub(all) struct SetOp {
    op : SetOpKind
    quantifier : SetQuantifier?
    outer : Bool
    corresponding : Corresponding?
    left : Query
    right : Query
    span : Span
    } derive(Eq,
    Debug
    )

    SetOpKind

    pub(all) enum SetOpKind {
    Union
    Intersect
    Except
    } derive(Eq,
    Debug
    )

    SetQuantifier

    pub(all) enum SetQuantifier {
    All
    Distinct
    } derive(Eq,
    Debug
    )

    SortOrder

    pub(all) enum SortOrder {
    Asc
    Desc
    } derive(Eq,
    Debug
    )

    SortSpec

    pub(all) struct SortSpec {
    expr : Expr
    order : SortOrder?
    nulls : NullsOrder?
    span : Span
    } derive(Eq,
    Debug
    )

    Span

    pub(all) struct Span {
    start : Int
    end : Int
    } derive(Eq,
    Debug
    )

    A range of source text: UTF-16 code unit offsets, end exclusive.

    Span::line_column

    fn Span::line_column(self : Span, source : String) -> ((Int, Int), (Int, Int))

    1-based (line, column) of the start and of the end of the span. Lines end at \n (a preceding \r belongs to the line); columns count UTF-16 code units.

    Span::merge

    fn Span::merge(self : Span, other : Span) -> Span

    The smallest span that covers both spans.

    Statement

    pub(all) enum Statement {
    Query(Query)
    Error(Span)
    } derive(Eq,
    Debug
    )

    A parsed statement. M2 parses queries (DQL).

    Statement::strip_spans

    fn Statement::strip_spans(self : Statement) -> Statement

    The same statement with every span set to { start: 0, end: 0 }, so that == compares structure only.

    TrimSpec

    pub(all) enum TrimSpec {
    Both
    Leading
    Trailing
    } derive(Eq,
    Debug
    )

    UnaryOp

    pub(all) enum UnaryOp {
    Pos
    Neg
    } derive(Eq,
    Debug
    )

    WithBinding

    pub(all) struct WithBinding {
    name : Identifier
    query : Query
    span : Span
    } derive(Eq,
    Debug
    )

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    ยฉ 2026 mooncakes.io