whirlun commented on code in PR #2272:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2272#discussion_r2907833305
##########
src/parser/mod.rs:
##########
@@ -4223,13 +4233,26 @@ impl<'a> Parser<'a> {
loop {
match self.next_token().token {
Token::Colon if path.is_empty() => {
- path.push(self.parse_json_path_object_key()?);
+ if self.peek_token_ref().token == Token::LBracket {
+ // A bracket element directly after the colon, e.g.
`raw:['field']`.
+ // Push an empty Dot so the display re-emits the
leading `:` for syntax roundtrip.
+ path.push(JsonPathElem::Dot {
+ key: String::new(),
+ quoted: false,
+ });
+ self.next_token();
+ let key = self.parse_json_path_bracket_key()?;
+ self.expect_token(&Token::RBracket)?;
+ path.push(JsonPathElem::Bracket { key });
Review Comment:
Yep it's more clear. done.
--
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]