oleobal / rockstar-interpreter

A Python interpreter for the Rockstar programming language
GNU General Public License v3.0
0 stars 0 forks source link

Expression with leading numeric literal incorrectly parsed #3

Closed zebralt closed 6 years ago

zebralt commented 6 years ago

If you put a numeric literal first in an expression, the tokenizer will raise an exception. I suppose it does not expect to find anything but numbers after it, except for an assignment operator.

Here's a simple way to reproduce it :

rk> Say 1 times 1
(Exception: Invalid numeric literal)

rk> Put 1 into my heart

rk> Say 1 times my heart
(Exception: Invalid numeric literal)

rk> Say my heart times 1
1.0
oleobal commented 6 years ago

"1 times 1" is considered as a numeric literal, obviously a problem.

Will fix ASAP.

oleobal commented 6 years ago

Fixed by 66915adc717a606507ccdedf03244a29471f7308 !

It didn't use the nextWord syntax like the others, and had redundant code, so I got to cut some fat off the meat at the same time.