lua-users home
lua-l archive

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

On 5-Oct-05, at 10:34 AM, Rici Lake wrote:

Here's the patch (against lua-5.1-alpha); comments are welcome.

For the benefit of the two or three people who might have downloaded that, I just put up a new version which fixes a (blush!) bug in the codegen for 'if' statements which create upvals. I also ported over my Lua implementation of SRFI-61 (which allows local bindings in 'if' conditions).

The revised diff actually has a couple of examples in the test/ directory; specifically command.lua which shows how the loop constructs work in practice. etc/lua.vim and etc/luaindent.vim will let you get syntax highlighting and indenting to work (more or less) in vim.

If you don't want to go to all that trouble, you can just look at the example program at <>; the syntax highlighting was generated by vim (I used :highlight link Repeat Special to get the loops coloured differently.)

Despite the fact that it looks like I spent a lot of time on this, I'm not seriously proposing any of it; it was an interesting experiment with the Lua parser, mostly, and also I always feel that you actually have to *try* syntax to see if it works or not, rather than just reacting according to prior prejudice. In any event, it was just a few hours' work... the changes are only to the parser, which means that it could exist side-by-side with ordinary Lua if there were some way of plugging different parsers in.