Fix escaped quote handling in PGN tag values - #114
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #114 +/- ##
==========================================
+ Coverage 70.18% 70.29% +0.10%
==========================================
Files 27 27
Lines 4166 4181 +15
==========================================
+ Hits 2924 2939 +15
Misses 1110 1110
Partials 132 132 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for the PGN spec's \" and \\ escape sequences inside tag values. The lexer now decodes escaped quotes/backslashes when reading tag values, and Game.String() re-escapes them when emitting PGN so values round-trip correctly.
Changes:
- Lexer: replace slice-based tag value capture with a
strings.Builderthat decodes\"and\\. - Game serialization: add
escapeTagValuehelper and use it when formatting tag pairs. - Add a scanner test exercising an escaped quote in an
[Event ...]tag, including round-trip.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lexer.go | Decode \" and \\ escapes in readTagValue via a string builder. |
| game.go | Add escapeTagValue and apply it when writing tag pairs in String(). |
| scanner_test.go | New TestEscapedQuoteInTagValue verifying parse and round-trip behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.