franko / luajit-lang-toolkit

A Lua bytecode compiler written in Lua itself for didactic purposes or for new language implementations
Other
652 stars 91 forks source link

lang_loadstring error #25

Closed CapsAdmin closed 9 years ago

CapsAdmin commented 9 years ago

I was curious to see how things would perform and behave if I replaced loadstring in my project and stumbled upon this error:

print(require("lang.compile").string('something("foo bar"--[[]], foo, bar)')) false, luajit-lang-toolkit: stdin:1: ')' expected near ''

franko commented 9 years ago

Hi,

you stumbled on a lexer's bug. Now fixed in git HEAD.

Just an funny note. This error and some similar ones in the lexer come all from the fact that I translated the luajit's lexer which is in C and use a lot of "continue" statements. As this latter statement is missing in Lua I was forced to perform a complicate gymnastic with the control flow and I ended up introducing some bugs.