xitep opened a new pull request, #2281:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2281
* This exposes values in the AST as `ValueWithSpan` allowing clients to get
hold of the location/span for 1) error reporting and 2) associating metadata
with the visited values (the start location can be used to make up an
identifier)
* Tests work only because the parser in the tests sets all tokens' spans to
"empty"; ie. there is not "magic" wrt to `PartialEq/Eq` like for the
`AttachedToken`
* I'm not entirely sure it's the right approach, but it's at least
consistent with other items (e.g. `Ident`) exposing their span in the AST
* Relevant to #1548
* The `Deref<Target = Value> for ValueWithSpan` would make an upgrade to
this version less hassle:
```rust
fn pre_visit_value(&mut self, value: &ValueWithSpan) ->
ControlFlow<Self::Break> {
match **value { // <--- access `&value.value` through deref via `**`
Value::Number(_, _) => eprintln!("number"),
_ => eprintln!(".."),
}
...
```
--
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]