Repository navigation
fix: preserve punctuation in unquoted dict attribute values (#481) - #686
Merged
Merged
Conversation
CG::parseDictLine tokenizes a dict line by splitting on punctuation, so an
unquoted attribute value containing a hyphen (or dot, etc.) -- e.g.
word code=A-B-C
arrived as separate tokens (A, -, B, -, C). The value branch consumed only the
first token, then mis-read the remaining "-" and "C" as further attributes,
yielding ("code" "A") ("-" "B") ... instead of ("code" "A-B-C").
Re-join tokens that are contiguous in the source (no whitespace gap) into the
full value. Contained to parseDictLine -- the shared tokenizer is untouched --
and only affects unquoted values that contain internal punctuation.
Verified:
code=A-B-C -> ("code" "A-B-C")
plain=hello-world -> ("plain" "hello-world")
ver=3.14 -> ("ver" "3.14")
q="x-y" -> ("q" "x-y") (quoted, unchanged)
num=42 -> ("num" 42) (plain number, still numeric)
No regression: emailaddress analyzer still extracts email fields.
Note: #481's original example used a quoted value, which already worked; this
fixes the unquoted form of the same "hyphen in attribute value" problem.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the unquoted case of #481: an unquoted dict attribute value containing a hyphen (or dot) was silently split apart.
Root cause
CG::parseDictLinetokenizes a dict line by splitting on punctuation, soarrived as separate tokens (
A,-,B,-,C). The value branch consumed only the first token (A), then mis-read the remaining-andCas further attributes — producing("code" "A") ("-" "B") ...instead of("code" "A-B-C").Fix
In the value branch, re-join tokens that are contiguous in the source (no whitespace gap) into the full value. Contained to
parseDictLine— the shared tokenizer is untouched — and only affects unquoted values that contain internal punctuation.Result
code=A-B-C("code" "A") ("-" "B")("code" "A-B-C")✅plain=hello-world("plain" "hello-world")✅ver=3.14("ver" "3.14")✅q="x-y"(quoted)("q" "x-y")("q" "x-y")✅ unchangednum=42("num" 42)("num" 42)✅ still numericNo regression: the
emailaddressanalyzer still extracts email fields.Note
#481's original example used a quoted value (
completo="zigue-zague"), which already works on the current engine; this fixes the unquoted form of the same "hyphen in attribute value" problem.Fixes #481.
🤖 Generated with Claude Code