Skip to content

Fix escaped quote handling in PGN tag values - #114

Merged
CorentinGS merged 1 commit into
mainfrom
fix/escaped-quote-tags
Jun 1, 2026
Merged

Fix escaped quote handling in PGN tag values#114
CorentinGS merged 1 commit into
mainfrom
fix/escaped-quote-tags

Conversation

@CorentinGS

Copy link
Copy Markdown
Owner

No description provided.

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.29%. Comparing base (abc72cb) to head (fe478c1).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Builder that decodes \" and \\.
  • Game serialization: add escapeTagValue helper 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.

@CorentinGS
CorentinGS marked this pull request as ready for review June 1, 2026 20:39
@CorentinGS
CorentinGS merged commit 4d7c30a into main Jun 1, 2026
12 checks passed
@CorentinGS
CorentinGS deleted the fix/escaped-quote-tags branch June 7, 2026 15:06
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.

2 participants