Mathics3 / mathics-scanner

Tokenizer, and character tables, operator precedence, and conversion routines for the Wolfram Language.
GNU General Public License v3.0
17 stars 3 forks source link

Wrong behaviour in parsing escaped backslash #46

Closed mmatera closed 2 years ago

mmatera commented 2 years ago

Consider the input in the

In[1]:= "\\[Integral]" == "\\" <> "[Integral]"

In WMA, the result is

Out[1]= True

On the other hand, in Mathics the result is Out[1]= False

The reason is mathics-scanner parses the LHS as "\u222b", which is different to the RHS "\[Integral]"

I found it when I tried to write tests for https://github.com/Mathics3/mathics-core/pull/541

rocky commented 2 years ago

@mmatera what does StringLength["\\[Integral]"] evaluate to?

mmatera commented 2 years ago

In WMA:

In[1]:= StringLength["\\[Integral]"]

Out[1]= 11

On the other hand,

In[2]:= StringLength["\[Integral]"]

Out[2]= 1