summaryrefslogtreecommitdiffstats
path: root/sqlglotrs/src/lib.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-24 07:49:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-24 07:49:56 +0000
commit97144fb2271b9bd749deac2eb3537103d9513182 (patch)
treeebd8aa8769becb97f7477cf9c14889146e6b8614 /sqlglotrs/src/lib.rs
parentAdding upstream version 20.3.0. (diff)
downloadsqlglot-97144fb2271b9bd749deac2eb3537103d9513182.tar.xz
sqlglot-97144fb2271b9bd749deac2eb3537103d9513182.zip
Adding upstream version 20.4.0.upstream/20.4.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglotrs/src/lib.rs')
-rw-r--r--sqlglotrs/src/lib.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/sqlglotrs/src/lib.rs b/sqlglotrs/src/lib.rs
index c962887..43e90dc 100644
--- a/sqlglotrs/src/lib.rs
+++ b/sqlglotrs/src/lib.rs
@@ -71,7 +71,18 @@ impl Token {
impl Token {
#[pyo3(name = "__repr__")]
fn python_repr(&self) -> PyResult<String> {
- Ok(format!("{:?}", self))
+ Python::with_gil(|py| {
+ Ok(format!(
+ "<Token token_type: {}, text: {}, line: {}, col: {}, start: {}, end: {}, comments: {}>",
+ self.token_type_py.as_ref(py).repr()?,
+ self.text.as_ref(py).repr()?,
+ self.line,
+ self.col,
+ self.start,
+ self.end,
+ self.comments.as_ref(py).repr()?,
+ ))
+ })
}
}