summaryrefslogtreecommitdiffstats
path: root/sqlglotrs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 08:12:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 08:12:52 +0000
commita1f10f8d39404d9bae42a64efaf505fa12f34c1a (patch)
tree9eb894268f2a145aa9d42b1726a555ab1359810f /sqlglotrs
parentAdding upstream version 25.8.1. (diff)
downloadsqlglot-upstream/25.16.1.tar.xz
sqlglot-upstream/25.16.1.zip
Adding upstream version 25.16.1.upstream/25.16.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglotrs')
-rw-r--r--sqlglotrs/Cargo.lock2
-rw-r--r--sqlglotrs/Cargo.toml2
-rw-r--r--sqlglotrs/src/settings.rs3
-rw-r--r--sqlglotrs/src/tokenizer.rs2
4 files changed, 6 insertions, 3 deletions
diff --git a/sqlglotrs/Cargo.lock b/sqlglotrs/Cargo.lock
index de77785..e1f914f 100644
--- a/sqlglotrs/Cargo.lock
+++ b/sqlglotrs/Cargo.lock
@@ -188,7 +188,7 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
[[package]]
name = "sqlglotrs"
-version = "0.2.8"
+version = "0.2.9"
dependencies = [
"pyo3",
]
diff --git a/sqlglotrs/Cargo.toml b/sqlglotrs/Cargo.toml
index d195606..efd5eb7 100644
--- a/sqlglotrs/Cargo.toml
+++ b/sqlglotrs/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sqlglotrs"
-version = "0.2.8"
+version = "0.2.9"
edition = "2021"
[lib]
diff --git a/sqlglotrs/src/settings.rs b/sqlglotrs/src/settings.rs
index 9fb8fda..3068fd2 100644
--- a/sqlglotrs/src/settings.rs
+++ b/sqlglotrs/src/settings.rs
@@ -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,
}
}
}
diff --git a/sqlglotrs/src/tokenizer.rs b/sqlglotrs/src/tokenizer.rs
index ca5c44b..6df3bfb 100644
--- a/sqlglotrs/src/tokenizer.rs
+++ b/sqlglotrs/src/tokenizer.rs
@@ -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
}