Skip to content

Mark EmptySmallCircle, EmptySet and eight other shapes as letter-like - #182

Merged
rocky merged 1 commit into
Mathics3:masterfrom
tombouctou:fix-letterlike-geometric-shapes
Oct 16, 2026
Merged

rocky merged 1 commit into
Mathics3:masterfrom
tombouctou:fix-letterlike-geometric-shapes

Conversation

@tombouctou

Copy link
Copy Markdown
Contributor

WMA documents these named characters as "Letter-like form":

character WMA reference
\[EmptyCircle] https://reference.wolfram.com/language/ref/character/EmptyCircle.html
\[EmptyDiamond] https://reference.wolfram.com/language/ref/character/EmptyDiamond.html
\[EmptyDownTriangle] https://reference.wolfram.com/language/ref/character/EmptyDownTriangle.html
\[EmptyRectangle] https://reference.wolfram.com/language/ref/character/EmptyRectangle.html
\[EmptySet] https://reference.wolfram.com/language/ref/character/EmptySet.html
\[EmptySmallCircle] https://reference.wolfram.com/language/ref/character/EmptySmallCircle.html ("Not the same as the infix operator \[SmallCircle]")
\[EmptySmallSquare] https://reference.wolfram.com/language/ref/character/EmptySmallSquare.html
\[EmptySquare] https://reference.wolfram.com/language/ref/character/EmptySquare.html
\[EmptyUpTriangle] https://reference.wolfram.com/language/ref/character/EmptyUpTriangle.html
\[FilledDiamond] https://reference.wolfram.com/language/ref/character/FilledDiamond.html

In named-characters.yml they had is-letter-like: false and are not operators either, so the tokeniser rejected them wherever they appeared. For example, in Mathics3:

In[1]:= Hold[Infix[t, \[EmptySmallCircle]]]
Syntax::sntxf: "Hold[Infix[t, \[EmptySmallCircle]" cannot be followed by "]]".

This PR sets is-letter-like: true for these ten characters.

A wider note: about 215 named characters are currently neither letter-like nor operators, so they can't be used in an expression. Many of them are legitimately so (spaces, Raw* characters, brackets), but some others may also be letter-like in WMA (e.g. Euro, Cent, the chess pieces). I only changed the ten above, which I checked one by one against the WMA reference pages.

Tests: test_letterlike_geometric_shapes in test/test_tokeniser.py.

🤖 Generated with Claude Code

WMA documents EmptyCircle, EmptyDiamond, EmptyDownTriangle,
EmptyRectangle, EmptySet, EmptySmallCircle, EmptySmallSquare,
EmptySquare, EmptyUpTriangle and FilledDiamond as "Letter-like form"
(e.g. EmptySmallCircle: "Not the same as the infix operator
\[SmallCircle]"). Here they were neither letter-like nor operators, so
the tokeniser rejected them: Infix[t, \[EmptySmallCircle]] was a syntax
error.

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

rocky commented Oct 16, 2026

Copy link
Copy Markdown
Member

LGTM - thanks for finding this.

@rocky
rocky merged commit ce48dc7 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