Skip to content

fix: preserve punctuation in unquoted dict attribute values (#481) - #686

Merged
ddehilster merged 1 commit into
masterfrom
fix/dict-unquoted-punct-value
Jul 6, 2026
Merged

ddehilster merged 1 commit into
masterfrom
fix/dict-unquoted-punct-value

Conversation

@ddehilster

Copy link
Copy Markdown
Member

Summary

Fixes the unquoted case of #481: an unquoted dict attribute value containing a hyphen (or dot) was silently split apart.

Root cause

CG::parseDictLine tokenizes a dict line by splitting on punctuation, so

word code=A-B-C

arrived as separate tokens (A, -, B, -, C). The value branch consumed only the first token (A), then mis-read the remaining - and C as 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

Dict entry Before After
code=A-B-C ("code" "A") ("-" "B") ("code" "A-B-C") ✅
plain=hello-world split ("plain" "hello-world") ✅
ver=3.14 split ("ver" "3.14") ✅
q="x-y" (quoted) ("q" "x-y") ("q" "x-y") ✅ unchanged
num=42 ("num" 42) ("num" 42) ✅ still numeric

No regression: the emailaddress analyzer 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.

⚠️ No version bump in this PR — #685 (→3.7.2) is still in flight. Bump to 3.7.3 when merging this (after #685), or tell me and I'll add it.

Fixes #481.

🤖 Generated with Claude Code

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>
@ddehilster
ddehilster merged commit cb17821 into master Jul 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dictionary hypen in attribute string failing

1 participant