[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Tables without commas
- From: Pedro Miller Rabinovitch <pedro@...>
- Date: Tue, 13 Mar 2001 23:26:29 -0300
Hello all,
just felt like sharing something with the group. For some
reason, I wanted to specify tables like this:
myThing = {
name = "Thing"
use = "none"
owner = idPersona
}
No commas, just like {X,HT}ML attribute lists or anything like that.
I quickly patched lparser.c (see below), and it seems to be working
pretty nicely, at least for the cases I tried (I'm not in possession
of any unit tests over here). The only thing people should look out
for is stuff like:
a = { strlen "aaa" }
...which will match the expression and set a[1] to be 4, and *not* to
function `strlen'. The next does, though:
a = { (strlen) "aaa" }
Anyway. It's a toy for whoever wants it. It just ain't Lua no more. ;)
Please do warn me if you see any blatant problems with this that I
did not realize. Thanks.
Pedro.
511,512c511,513
< while (ls->t.token == ',') {
< next(ls);
---
for (;;) {
if (ls->t.token == ',')
next(ls);
530,531c531,533
< while (ls->t.token == ',') {
< next(ls);
---
for (;;) {
if (ls->t.token == ',')
next(ls);
--
Pedro Miller Rabinovitch
Gerente Geral de Tecnologia
Cipher Technology
www.cipher.com.br