lua-users home
lua-l archive

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


On Mon, Dec 6, 2010 at 4:30 AM, steve donovan <steve.j.donovan@gmail.com> wrote:
> On Mon, Dec 6, 2010 at 8:20 AM, starwing <weasley.wx@gmail.com> wrote:
>> local t = {1 2 3 4}
>> just read a expr() and a optional comma/semi-colon is not diffcult in
>> grammar.
>
> I bet you there are ambiguous cases, Lisp gets away with it because it
> has no syntax ;)
>
>> just change the parser to support it, maybe I can work a patch out. but I
>> just want to know anybody interest it :-)
>
> The word 'just' is one of the most terrifying words in the English
> language for programmers.
>
> But it would be an interesting patch...
>
> steve d.
>

I implemented that (see the tail of this message) while I was writing
OOBIT patch. It was never used in production, so you should see it as
alpha or beta code.

By the way, as nobody answered my request for help to benchmark OOBIT,
I decided to wait for the final release of 5.2 because Lua's 5.2 light
function requires a special approach. But if someone need it, PVT me.

---------------------------------------------------
around line 550 of lparse.c:

change

  } while (testnext(ls, ',') || testnext(ls, ';'));

by

#ifdef USE_TABLE_SEPARATORS
  } while (testnext(ls, ',') || testnext(ls, ';'));
#else
    if (testnext(ls, ',') || testnext(ls, ';'))  {
      /* consumes the separators and do nothing */
    }
  } while (1);
#endif