Skip to content

Raise unknown named character errors with the sntufn tag - #181

Merged
rocky merged 1 commit into
Mathics3:masterfrom
tombouctou:fix-sntufn-message-tag
Oct 16, 2026
Merged

rocky merged 1 commit into
Mathics3:masterfrom
tombouctou:fix-sntufn-message-tag

Conversation

@tombouctou

Copy link
Copy Markdown
Contributor

parse_escape_sequence raised NamedCharacterSyntaxError("Syntax", "sntufn", ...) in two places. SyntaxError.__init__ takes the message tag as its first argument (the message name is always "Syntax"), so the tag became "Syntax" and "sntufn" was passed as a message argument. In Mathics3 this shows up as:

Syntax::Syntax: Message Syntax::Syntax not found.

instead of

Syntax::sntufn: Unknown unicode longname "DoubleStruckCapitalZ\" (line 2 of "file.m").

The other raise site, in parse_named_character, already uses ("sntufn", name, ...).

This PR passes "sntufn" as the tag and the unknown name as the first argument, which is what the sntufn template (Unknown unicode longname 1(line4of5).) expects. Inputs that hit these two paths: \[Alpha\], \[\Sigma], \[Theta (no closing bracket).

Tests: test_invalid_named_character_message in test/test_escape_sequences.py checks the tag and the first argument.

🤖 Generated with Claude Code

parse_escape_sequence raised NamedCharacterSyntaxError("Syntax", "sntufn", ...),
but SyntaxError takes the message tag as its first argument (the name is
always "Syntax"). The message then came out as
"Syntax::Syntax: Message Syntax::Syntax not found" instead of
"Syntax::sntufn: Unknown unicode longname ...".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rocky

rocky commented Oct 16, 2026

Copy link
Copy Markdown
Member

Thanks for noticing and fixing this somewhat obvious bug.

@rocky
rocky merged commit 5a05ce9 into Mathics3:master Oct 16, 2026
12 checks passed
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