alamb opened a new pull request, #1618:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1618

   - Follow on to https://github.com/apache/datafusion-sqlparser-rs/pull/1587
   - Part of https://github.com/apache/datafusion-sqlparser-rs/issues/1558
   
   @davisp made some great improvements to the `Parser` API to avoid copies, 
but now the API for managing tokens is a bit unwieldy. Before we release a new 
version I would like to improve the API
   
   Speicfically some of the APIs take a `&mut self` to advance `index` but 
return a read only reference to the token. This means the borrow checker is 
overly stringent and will sometimes think the parser has a mutable borrow 
outstanding when it doesnt.
   
   I think we can make the APIs easier to use (and thus more likely to use) 
with a bit of finagling and documentation
   
   See definitions of previous/current/next on 
https://github.com/apache/datafusion-sqlparser-rs/pull/1617
   
   I am hoping that we can get the API in shape a bit more and then deprecate 
some of the older style APIs. 
   
   Changes:
   1. Introduce `advance_token()` to advance to the next token and reduce 
redundancy
   2. Introduce `get_current_token()`, `get_next_token()` `get_prev_token`
   2. Introduce `current_token_index`
   3. Remove `next_token_ref_with_index`  and `next_token_ref` in favor of the 
above
   
   


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to