Skip to content

\pgfmathparse sandbox testing patches#1

Merged
xworld21 merged 6 commits intoxworld21:pgfmathparsefrom
dginev:pgfmathparse-sandbox-testing-patches
Dec 16, 2025
Merged

\pgfmathparse sandbox testing patches#1
xworld21 merged 6 commits intoxworld21:pgfmathparsefrom
dginev:pgfmathparse-sandbox-testing-patches

Conversation

@dginev
Copy link
Copy Markdown

@dginev dginev commented Dec 15, 2025

It turns out there were two minor buglets during sandbox testing for brucemiller#2485:

  • underscore can be part of function names
  • missing base case for the new register rule.
  • the UnTeX calls can add a %\n separator on long values, which breaks the grammar. Adding the flag to suppress those.
  • There was a slippery bug from before with trailing braces failing to parse. The skip: rule is a prefix-only rule in RecDescent. So I swapped them with spaces outside of the grammar, right before space normalization.
  • Spotted an error chain trickle into a sqrt with a negative argument leading to a Fatal, so I guarded that with an Error instead.
  • Ran our linter, which reformatted and warned not to use $a and $b unless they are declared local. Which is a good tip, they often surve a special purpose in anonymous subs.

To bookkeep some of the test articles: arXiv:1604.01057, arXiv:1405.5236

@dginev
Copy link
Copy Markdown
Author

dginev commented Dec 15, 2025

Feel free to look over this and merge it in @xworld21 .

I will continue testing tonight and make a separate PR if needed - I hope the Fatals go back to the previous levels with all of these in.

And since I ran the linter, good to remember the whitespace neutral diff ?w=1:
https://github.com/xworld21/LaTeXML/pull/1/changes?w=1

my $string = (ref $tokens ? UnTeX(Expand($tokens)->stripBraces) : $tokens);
my $string = (ref $tokens ? UnTeX(Expand($tokens)->stripBraces, 1) : $tokens);
# Normalize spaces and remove braces
$string =~ s/[}{]/ /g;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This is probably incorrect, because curly braces have a meaning in PGF. We'll have to come back to this later.

@xworld21 xworld21 merged commit 90b7151 into xworld21:pgfmathparse Dec 16, 2025
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