sql_ast/dialect/mod.rs
1// Licensed under the Apache License, Version 2.0 (the "License");
2// you may not use this file except in compliance with the License.
3// You may obtain a copy of the License at
4//
5// http://www.apache.org/licenses/LICENSE-2.0
6//
7// Unless required by applicable law or agreed to in writing, software
8// distributed under the License is distributed on an "AS IS" BASIS,
9// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10// See the License for the specific language governing permissions and
11// limitations under the License.
12
13mod generic;
14pub mod keywords;
15
16use std::fmt::Debug;
17
18pub use self::generic::GenericDialect;
19
20pub trait Dialect: Debug {
21 /// Determine if a character starts a quoted identifier. The default
22 /// implementation, accepting "double quoted" ids is both ANSI-compliant
23 /// and appropriate for most dialects (with the notable exception of
24 /// MySQL, MS SQL, and sqlite). You can accept one of characters listed
25 /// in `Word::matching_end_quote` here
26 fn is_delimited_identifier_start(&self, ch: char) -> bool {
27 ch == '"'
28 }
29 /// Determine if a character is a valid start character for an unquoted identifier
30 fn is_identifier_start(&self, ch: char) -> bool;
31 /// Determine if a character is a valid unquoted identifier character
32 fn is_identifier_part(&self, ch: char) -> bool;
33}