lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Jan 11, 2014, at 8:30 PM, Rena <hyperhacker@gmail.com> wrote:

> If you leave out an 'end', the error message isn't very helpful:
> 
> $ lua -e "if x then"
> lua: (command line):1: 'end' expected near <eof>
> 
> Some compilers I've used give you a more detailed message telling you what the 'end' would be closing, like: "'end' expected near <eof> to close 'if' at (command line):1"
> 
> This would be helpful for editing and for editors like Textadept, which highlight lines with syntax errors, so that they could highlight the line with the unclosed statement instead of just jumping to the end of the file.
> 
> -- 
> Sent from my Game Boy.


This is something I am working on for Lunia, however, I do not see any reason why I couldn't back-port those specific changes to the Lua code-base. I have a number of patches I plan to make available for vanilla-Lua from my Lunia project.

Lua only has a way of reporting syntax errors, which then halts compilation. I have also added the concept of a syntax warning as well, for situations like two constants being used in a comparison, or a variable masking an earlier variable (or global with my global declaration patch).

I am also currently working on a really nifty program for OSX called "The Explorer", which lets you execute your Lua scripts step-by-step, while showing you all the internal information available. This includes all byte-code, the stack, syntax-highlighted code (which uses hooks from Lua itself to highlight the code), the registry, active variables, etc... Check out the screenshot[1] for a sneak peek!

~pmd~

[1] http://www.fizzypopstudios.com/explorer.png