Conversation
maybeLexSchemeChar checked the followup delimiter at byte offset 1, which falls inside a multi-byte UTF-8 glyph, so printed forms like #\λ failed to lex back as a character (and drove parseQuote/parseValue into unbounded recursion). Advance the followup offset by the glyph's UTF-8 byte length. Also extend the reader's character-name table with the print names nul/vtab/page/rubout so decoded control characters round-trip.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #75 +/- ##
==========================================
+ Coverage 73.19% 73.71% +0.52%
==========================================
Files 24 24
Lines 2108 2108
Branches 290 290
==========================================
+ Hits 1543 1554 +11
+ Misses 565 554 -11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
The existing glyph test puts a delimiter right after #\λ, so the
whitespace branch of maybeLexSchemeChar's followup check was never
exercised. A glyph char in a list ('(#\λ #\a)) covers it.
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 two character print → re-read round-trip gaps tracked in #73, where a printed character did not read back as the same character.
maybeLexSchemeCharchecked the followup delimiter at byte offset1, which lands inside a multi-byte UTF-8 glyph. Printed forms like#\λtherefore failed to lex back as a character — and, worse, droveparseQuote/parseValueinto unbounded recursion (stack overflow) rather than the symbol fallback the issue predicted. The followup offset now advances by the glyph's UTF-8 byte length.charReprFromCodePointemits Racket's print names (nul,vtab,page,rubout), but the reader'sisCharacterNametable only knewnull/deleteand lackedvtab/page, so#\nul/#\vtab/#\page/#\ruboutread back as symbols. The table now accepts these print names, withnullordered beforenulso#\nullis not truncated.Test plan
ctest --preset debug— 13/13 passing (includes thelitintegration suite)nora-lit test/integration -v— 54/54 passing, including 6 new round-trip testsclang-format --dry-run --Werror src/Lex.cpp— clean#\λ,#\nul,#\vtab,#\page,#\ruboutnow round-trip;#\nullstill lexestest/integration/char-*-read.rkt)Fixes #73