Commit 483dce2
committed
Correctly end tokens in mathtext parsing.
This avoids parsing `\sinx` as `\sin x` (it now raises an error
instead), and removes the need for `accentprefixed` (because `\doteq`
is treated as a single token now, instead of `\dot{eq}`). This also
means that `\doteq` (and friends) are now correctly treated as relations
(per `_relation_symbols`, thus changing the spacing around them); hence
then change in baseline images. Only keep the `x \doteq y` baseline
(and adjust the test string to undo the spacing), to avoid regen'ing
baselines.
Also shaves ~2% off drawing all the current mathtext tests, i.e.
```
MPLBACKEND=agg python -c 'import time; from pylab import *; from matplotlib.tests.test_mathtext import math_tests; fig = figure(figsize=(3, 10)); fig.text(0, 0, "\n".join(filter(None, math_tests)), size=6); start = time.perf_counter(); [fig.canvas.draw() for _ in range(10)]; print((time.perf_counter() - start) / 10)'
```
(including adjustment for the two removed test cases), probably because
accentprefixed was previously extremely commonly checked, being at the
top of the placeable list; however, performance wasn't really the main
goal here.1 parent 60e1ce5 commit 483dce2
2 files changed
+38
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1708 | 1708 | | |
1709 | 1709 | | |
1710 | 1710 | | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
1711 | 1726 | | |
1712 | 1727 | | |
1713 | 1728 | | |
1714 | | - | |
1715 | 1729 | | |
1716 | 1730 | | |
1717 | 1731 | | |
| |||
1720 | 1734 | | |
1721 | 1735 | | |
1722 | 1736 | | |
1723 | | - | |
| 1737 | + | |
1724 | 1738 | | |
1725 | 1739 | | |
1726 | 1740 | | |
| |||
1761 | 1775 | | |
1762 | 1776 | | |
1763 | 1777 | | |
1764 | | - | |
1765 | | - | |
| 1778 | + | |
1766 | 1779 | | |
1767 | 1780 | | |
1768 | | - | |
| 1781 | + | |
1769 | 1782 | | |
1770 | 1783 | | |
1771 | 1784 | | |
| |||
1813 | 1826 | | |
1814 | 1827 | | |
1815 | 1828 | | |
1816 | | - | |
1817 | | - | |
1818 | | - | |
1819 | | - | |
| 1829 | + | |
| 1830 | + | |
1820 | 1831 | | |
1821 | 1832 | | |
1822 | 1833 | | |
| |||
2004 | 2015 | | |
2005 | 2016 | | |
2006 | 2017 | | |
2007 | | - | |
2008 | | - | |
2009 | 2018 | | |
2010 | 2019 | | |
2011 | 2020 | | |
| |||
2034 | 2043 | | |
2035 | 2044 | | |
2036 | 2045 | | |
2037 | | - | |
2038 | | - | |
2039 | | - | |
2040 | | - | |
2041 | | - | |
2042 | | - | |
2043 | 2046 | | |
2044 | 2047 | | |
2045 | 2048 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
226 | 239 | | |
227 | 240 | | |
228 | 241 | | |
| |||
235 | 248 | | |
236 | 249 | | |
237 | 250 | | |
| 251 | + | |
238 | 252 | | |
239 | 253 | | |
240 | 254 | | |
| |||
265 | 279 | | |
266 | 280 | | |
267 | 281 | | |
| 282 | + | |
268 | 283 | | |
269 | 284 | | |
270 | 285 | | |
| |||
0 commit comments