summaryrefslogtreecommitdiffstats
path: root/sqlglotrs
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglotrs')
-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()?,
+ ))
+ })
}
}