mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-16 12:10:15 +00:00
Add support for DuckDB's CREATE MACRO statements (#897)
This commit is contained in:
parent
2296de2bc4
commit
75f18ecfda
5 changed files with 208 additions and 0 deletions
|
@ -114,6 +114,8 @@ pub enum Token {
|
|||
Colon,
|
||||
/// DoubleColon `::` (used for casting in postgresql)
|
||||
DoubleColon,
|
||||
/// Assignment `:=` (used for keyword argument in DuckDB macros)
|
||||
DuckAssignment,
|
||||
/// SemiColon `;` used as separator for COPY and payload
|
||||
SemiColon,
|
||||
/// Backslash `\` used in terminating the COPY payload with `\.`
|
||||
|
@ -222,6 +224,7 @@ impl fmt::Display for Token {
|
|||
Token::Period => f.write_str("."),
|
||||
Token::Colon => f.write_str(":"),
|
||||
Token::DoubleColon => f.write_str("::"),
|
||||
Token::DuckAssignment => f.write_str(":="),
|
||||
Token::SemiColon => f.write_str(";"),
|
||||
Token::Backslash => f.write_str("\\"),
|
||||
Token::LBracket => f.write_str("["),
|
||||
|
@ -847,6 +850,7 @@ impl<'a> Tokenizer<'a> {
|
|||
chars.next();
|
||||
match chars.peek() {
|
||||
Some(':') => self.consume_and_return(chars, Token::DoubleColon),
|
||||
Some('=') => self.consume_and_return(chars, Token::DuckAssignment),
|
||||
_ => Ok(Some(Token::Colon)),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue