mz_sql_parser/ast/defs.rs
1// Copyright 2018 sqlparser-rs contributors. All rights reserved.
2// Copyright Materialize, Inc. and contributors. All rights reserved.
3//
4// This file is derived from the sqlparser-rs project, available at
5// https://github.com/andygrove/sqlparser-rs. It was incorporated
6// directly into Materialize on December 21, 2019.
7//
8// Licensed under the Apache License, Version 2.0 (the "License");
9// you may not use this file except in compliance with the License.
10// You may obtain a copy of the License in the LICENSE file at the
11// root of this repository, or online at
12//
13// http://www.apache.org/licenses/LICENSE-2.0
14//
15// Unless required by applicable law or agreed to in writing, software
16// distributed under the License is distributed on an "AS IS" BASIS,
17// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18// See the License for the specific language governing permissions and
19// limitations under the License.
20
21//! This module houses the definitions of the structs and enums that are
22//! formally part of the AST.
23//!
24//! A few notes about the layout of this module:
25//!
26//! * The public interface of the `sql::ast` module exposes all of these types
27//! in one big namespace.
28//!
29//! The submodules here exist only to avoid having one massive file with
30//! every type in it. Separation into modules would be annoying for
31//! consumers of the AST, who don't want to remember e.g. whether the
32//! `Ident` type is in the `expr` module or the `name` module or the `value`
33//! module.
34//!
35//! * Only types that are actually part of the AST live in this module. This
36//! module's contents are parsed by the build script to e.g. automatically
37//! generate an AST visitor, and the build script gets confused if there are
38//! helper structs interspersed.
39//!
40//! Helper structs should live in a separate submodule of `crate::ast`, like
41//! `crate::ast::display`.
42//!
43//! * Do *not* import types from this module directly. I.e., use
44//! `crate::ast::Ident`, not `crate::ast::defs::name::Ident`. The former
45//! import path makes it possible to reorganize this module without changing
46//! every `use` statement.
47
48mod ddl;
49mod expr;
50mod name;
51mod query;
52mod statement;
53mod value;
54
55pub use ddl::*;
56pub use expr::*;
57pub use name::*;
58pub use query::*;
59pub use statement::*;
60pub use value::*;