1
0
Fork 0

Merging upstream version 25.16.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:52:32 +01:00
parent 7688e2bdf8
commit bad79d1f7c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
110 changed files with 75353 additions and 68092 deletions

2
sqlglotrs/Cargo.lock generated
View file

@ -188,7 +188,7 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
[[package]]
name = "sqlglotrs"
version = "0.2.8"
version = "0.2.9"
dependencies = [
"pyo3",
]

View file

@ -1,6 +1,6 @@
[package]
name = "sqlglotrs"
version = "0.2.8"
version = "0.2.9"
edition = "2021"
[lib]

View file

@ -77,6 +77,7 @@ pub struct TokenizerSettings {
pub command_prefix_tokens: HashSet<TokenType>,
pub heredoc_tag_is_identifier: bool,
pub string_escapes_allowed_in_raw_strings: bool,
pub nested_comments: bool,
}
#[pymethods]
@ -100,6 +101,7 @@ impl TokenizerSettings {
command_prefix_tokens: HashSet<TokenType>,
heredoc_tag_is_identifier: bool,
string_escapes_allowed_in_raw_strings: bool,
nested_comments: bool,
) -> Self {
let to_char = |v: &String| {
if v.len() == 1 {
@ -150,6 +152,7 @@ impl TokenizerSettings {
command_prefix_tokens,
heredoc_tag_is_identifier,
string_escapes_allowed_in_raw_strings,
nested_comments,
}
}
}

View file

@ -375,7 +375,7 @@ impl<'a> TokenizerState<'a> {
self.advance(1)?;
// Nested comments are allowed by some dialects, e.g. databricks, duckdb, postgres
if !self.is_end && self.chars(comment_start_size) == *comment_start {
if self.settings.nested_comments && !self.is_end && self.chars(comment_start_size) == *comment_start {
self.advance(comment_start_size as isize)?;
comment_count += 1
}