chkn / AluminumLua

NOTE: THIS WAS A TOY PROJECT AND IS NOT MAINTAINED
100 stars 13 forks source link

unexpected 'a' #4

Open michalmicpaw opened 11 years ago

michalmicpaw commented 11 years ago

I've noticed, that in your lib there is a bug/error.

When I paste such code:

//--- local aaa = 1 aaa = aaa + 1

print(aaa) //---

or other variable name, that begins from 'a' letter, it throws me an error Exception:

A first chance exception of type 'AluminumLua.LuaException' occurred in WindowsPhoneGame3.DLL Error in main.lua(2,3): unexpected 'a'

Do you have idea why?

PS.

I've noticed, that this error is caused by 'and' operator. You are trying to read operator, and when you find 'a' you want next letter to be 'n' and next 'd'. I think this could be done in other way, because now i cant use variable, that begins from 'a' letter.

Maybe you shuld use buffer for whole key-or-not-word, and when you will read whole word, you should compare it with key-word-table and variable-table. What do you think?

nyashes commented 11 years ago

My fault, I'm sorry, yes you're right it's the and operator that cause the problem, I think than the best things to do is to replace the "throw exection" with goto default; or something like that