alamb commented on code in PR #2098:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2098#discussion_r2645564458


##########
src/parser/mod.rs:
##########
@@ -331,9 +332,9 @@ pub struct Parser<'a> {
     /// The tokens
     tokens: Vec<TokenWithSpan>,
     /// The index of the first unprocessed token in [`Parser::tokens`].
-    index: usize,
+    index: Cell<usize>,

Review Comment:
   This is a clever way to go about reducing the need for mutable borrows. 
Thank you @eyalleshem 
   
   One thing that might be worth doing (perhaps as a follow on PR) is 
documenting how this works (notable that Parser has interior mutability so 
functions like `next_token()` actually do change state, even though they are 
immutable



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to