Skip to content

fix: config.zig — strip inline # comments from TOML values (#428)#433

Open
yxlyx wants to merge 1 commit intomainfrom
fix/428-config-inline-comments
Open

fix: config.zig — strip inline # comments from TOML values (#428)#433
yxlyx wants to merge 1 commit intomainfrom
fix/428-config-inline-comments

Conversation

@yxlyx
Copy link
Copy Markdown
Collaborator

@yxlyx yxlyx commented Apr 10, 2026

Summary

  • Adds stripInlineComment() to the minimal TOML parser
  • Unquoted values like primary = claude # note now correctly parse as "claude"
  • Quoted values like primary = "claude # not a comment" are preserved
  • Bare # without preceding space (e.g. color#abc) is not treated as a comment

Test plan

  • zig test src/config.zig — all 7 tests pass (4 existing + 3 new)
  • New: inline comments are stripped from unquoted values
  • New: inline comments are NOT stripped inside quoted values
  • New: hash without preceding space is not a comment
  • All existing config tests unchanged and still pass

Fixes #428

Made with Cursor

…ed strings

Adds stripInlineComment() that handles three cases:
- unquoted values: strip from first # preceded by whitespace
- quoted values: preserve # inside quotes
- bare hash (no preceding space): treated as part of the value

Fixes #428

Made-with: Cursor
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.

bug: config.zig TOML parser does not strip inline comments

1 participant