SAY-5 opened a new pull request, #2425:
URL: https://github.com/apache/age/pull/2425
Fixes #2418.
`ResultVisitor.visitStringValue()` and `visitPair()` in
`drivers/python/age/builder.py` use `str.strip('"')` to remove the surrounding
delimiters from agtype STRING tokens. `str.strip()` removes *all* matching
characters from both ends, so when a property value or object key starts or
ends with an escaped quote the parser drops the data character along with the
delimiter:
| Input agtype | Expected | Before this PR |
| --- | --- | --- |
| `"foo \"bar\""` | `foo \"bar\"` | `foo \"bar\` |
| `"\"leading"` | `\"leading` | `leading` |
| `"trailing\""` | `trailing\"` | `trailing\` |
The Agtype grammar (`drivers/Agtype.g4`) guarantees `STRING : '"' (ESC |
SAFECODEPOINT)* '"'`, so the token always has exactly one `"` delimiter on each
side. Slicing with `[1:-1]` removes them precisely without touching the body.
Test added: `test_string_value_preserves_inner_quotes` covers
leading/trailing/embedded escaped quotes plus the `visitPair()` path for object
keys, and exercises the empty-string `""` edge case.
--
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]