clean up use of modules

This commit is contained in:
Andy Grove 2018-10-06 10:04:22 -06:00
parent 661ada0664
commit beb1a7a735
3 changed files with 23 additions and 40 deletions

View file

@ -1,34 +0,0 @@
// Copyright 2018 Grove Enterprises LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Support for custom dialects
pub use self::ansi_sql::AnsiSqlDialect;
pub use self::generic_sql::GenericSqlDialect;
pub use self::postgresql::PostgreSqlDialect;
mod ansi_sql;
mod generic_sql;
mod postgresql;
pub mod keywords;
pub trait Dialect {
/// Get a list of keywords for this dialect
fn keywords(&self) -> Vec<&'static str>;
/// Determine if a character is a valid identifier start character
fn is_identifier_start(&self, ch: char) -> bool;
/// Determine if a character is a valid identifier character
fn is_identifier_part(&self, ch: char) -> bool;
}

18
src/dialect/mod.rs Normal file
View file

@ -0,0 +1,18 @@
mod ansi_sql;
mod generic_sql;
pub mod keywords;
mod postgresql;
pub use self::ansi_sql::AnsiSqlDialect;
pub use self::generic_sql::GenericSqlDialect;
pub use self::postgresql::PostgreSqlDialect;
pub trait Dialect {
/// Get a list of keywords for this dialect
fn keywords(&self) -> Vec<&'static str>;
/// Determine if a character is a valid identifier start character
fn is_identifier_start(&self, ch: char) -> bool;
/// Determine if a character is a valid identifier character
fn is_identifier_part(&self, ch: char) -> bool;
}

View file

@ -13,7 +13,11 @@
// limitations under the License.
//! SQL Abstract Syntax Tree (AST) types
//!
mod sql_operator;
mod sqltype;
mod table_key;
mod value;
pub use self::sqltype::SQLType;
pub use self::table_key::{AlterOperation, Key, TableKey};
@ -21,11 +25,6 @@ pub use self::value::Value;
pub use self::sql_operator::SQLOperator;
mod sql_operator;
mod sqltype;
mod table_key;
mod value;
/// SQL Abstract Syntax Tree (AST)
#[derive(Debug, Clone, PartialEq)]
pub enum ASTNode {