fix(parser): preserve quoted-key text in redefinition error messages#302
Conversation
The parse_string lookahead advanced two code points to detect multi-line strings, but only the input stream was rewound via go_back(2u) when the string turned out to be single-line. The diagnostic recording_buffer kept those code points, so parse_basic_string then re-recorded them and duplicated the first two characters of every quoted key, producing messages like 'cannot redefine existing table "fofoo"' for a key named "foo". Snapshot the recording_buffer length before the lookahead and restore it alongside the input rewind so the buffer mirrors the stream state. Fixes marzer#300.
There was a problem hiding this comment.
This fix looks very LLM-coded. The way the comments are written, and the fact that my PR template was annihilated wholesale, yet it's requirements were still referenced.
... Am I right? If so, please remove the LLM junk comments, restore the PR description, and complete the template by hand.
|
Acknowledged, closing. Sorry for the noise. |
|
@SAY-5 to be clear, I don't have a problem with you using an LLM to arrive at a fix or whatever, just don't blindly go "cursor go brrrrr" in submitting it. If you want to contribute your fix while also observing project norms I'll happily accept it. |
|
@marzer apologies for the noise earlier. Reopened with three things addressed:
The fix itself is unchanged. The PR currently lacks (a) updating README.md contributors and (b) verifying on Clang/MSVC. Happy to add the README entry on request, and to add those compiler check-marks once I can verify on those toolchains. |
|
Thanks, I appreciate it.
I'll look at the rest now. |
|
Looks good, happy to merge pending any last-second editorial changes. |
What does this change do?
Fixes the corrupted quoted-key string that appears in redefinition error messages. A key written as
["foo"]previously produced an error of the formcannot redefine existing table '"fofoo"'. With this change the diagnostic shows"foo", as written in the source.Is it related to an exisiting bug report or feature request?
Fixes #300.
Pre-merge checklist
origin/master(if necessary)