Skip to main content

databend_common_ast/parser/
mod.rs

1// Copyright 2021 Datafuse Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15macro_rules! try_dispatch {
16    ($input:expr_2021, $return_if_ok:literal, $($pat:pat => $body:expr_2021),+ $(,)?) => {{
17        if let Some(token_0) = $input.tokens.first() {
18            use TokenKind::*;
19
20            if let Some(result) = match token_0.kind {
21                $($pat => Some($body),)+
22                _ => None,
23            } {
24                if !$return_if_ok || result.is_ok() {
25                    return result;
26                }
27            }
28        }
29    }};
30}
31
32mod comment;
33mod common;
34mod copy;
35mod data_mask;
36pub mod dynamic_table;
37mod error;
38mod error_suggestion;
39pub mod expr;
40mod input;
41#[allow(clippy::module_inception)]
42mod parser;
43pub mod query;
44pub mod script;
45mod sequence;
46mod stage;
47pub mod statement;
48pub mod stream;
49pub mod token;
50
51pub use common::IResult;
52pub use common::match_text;
53pub use common::match_token;
54pub use error::Backtrace;
55pub use error::Error;
56pub use error::ErrorKind;
57pub use error::display_parser_error;
58pub use error_suggestion::suggest_correction;
59pub use input::Dialect;
60pub use input::Input;
61pub use input::ParseMode;
62pub use parser::*;
63pub use token::all_reserved_keywords;