danvim / ProcalParsing

0 stars 2 forks source link

Hidden multiplication does not have a fixed binding power #1

Closed danvim closed 7 years ago

danvim commented 7 years ago

What happened

Precedence of hidden multiplication is unexpected and not consistent.

1/1$A is parsed as (1/(1*$A))


What should have happened

Hidden multiplication should have the same left binding power

1/1$A should be parsed as ((1/1)*$A)


What might be the problem

Hidden multiplication is implemented as .led()s in some tokens with different binding powers, e.g. constant, variable, function, lparen.

danvim commented 7 years ago

Fixed in commit 41b4aefe89679121a2e43761a80df065e02588a8 by changing left binding powers.

danvim commented 7 years ago

Permanent fix was implementing a regex sanitizing procedure before actual parsing. So that the hidden multiplication is found and replaced with a ` token for a fixed binding power, and same as normal multiplication.