Repository navigation
Lexer: no-break space and BOM are whitespace; error text stays UTF-8 - #13
Merged
Merged
Conversation
As in OpenSCAD's lexer.l, U+00A0 (C2 A0), U+FEFF (EF BB BF) and a bare Latin-1 A0 are whitespace. Qt's editor turned no-break spaces into spaces, so a file holding one parsed in BelfrySCAD's editor and failed everywhere else; once the editor kept them exactly (BelfrySCAD#681) it failed there too (BelfrySCAD#679). The catch-all quoted the single offending byte, so a non-ASCII character produced an invalid-UTF-8 message that nanobind could not convert: the user saw a codec error instead of the parse error. It now quotes a whole UTF-8 character, and names a byte that starts none as \xNN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 5, 2026
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.
Refs BelfrySCAD/BelfrySCAD#679
lexer.l: U+00A0 NO-BREAK SPACE (C2 A0), U+FEFF (EF BB BF, anywhere in the file) and a bare Latin-1A0. OpenSCAD 2026.02 renderscube(1);<NBSP>without a warning; we failed to parse it.unexpected charactermessages are valid UTF-8. The catch-all quoted one byte, soéor a no-break space in code produced a message nanobind could not convert (nanobind::str(): conversion error, shown in BelfrySCAD as'utf-8' codec can't decode byte 0xc2). It now quotes the whole character, and shows a byte that starts no character as\xNN.Tests:
LexicalWhitespace.*(both fail without the lexer change); full suite 661/661.🤖 Generated with Claude Code