Module mz_sql_parser::ast::defs

source ·
Expand description

This module houses the definitions of the structs and enums that are formally part of the AST.

A few notes about the layout of this module:

  • The public interface of the sql::ast module exposes all of these types in one big namespace.

    The submodules here exist only to avoid having one massive file with every type in it. Separation into modules would be annoying for consumers of the AST, who don’t want to remember e.g. whether the Ident type is in the expr module or the name module or the value module.

  • Only types that are actually part of the AST live in this module. This module’s contents are parsed by the build script to e.g. automatically generate an AST visitor, and the build script gets confused if there are helper structs interspersed.

    Helper structs should live in a separate submodule of crate::ast, like crate::ast::display.

  • Do not import types from this module directly. I.e., use crate::ast::Ident, not crate::ast::defs::name::Ident. The former import path makes it possible to reorganize this module without changing every use statement.

Re-exports§

Modules§