[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: in-do-end
- From: steve donovan <steve.j.donovan@...>
- Date: Sun, 17 Jan 2010 17:19:08 +0200
On Sun, Jan 17, 2010 at 1:59 PM, Eike Decker <zet23t@googlemail.com> wrote:
> That wouldn't be a problem since "function g(x)" is a statement to
> assign a function that is currently defined to the global value "g",
> whereas "function (x)...end" is no valid statement at all, unless it
> is being a part of an argument or a value to be assigned to a
> variable.
Very true! It being a rainy afternoon, I modified the parser to
accept anon functions as arguments. In the function funargs in
lparser.c, added another case:
case TK_FUNCTION: { /* funcargs -> function */
luaX_next(ls);
body(ls, f, 0, ls->linenumber);
break;
}
> print function() end
stdin:1: '=' expected near 'function'
Oops - ambiguity - it thinks this is an assignment! Not as easy as it looks.
steve d.
- References:
- in-do-end, Mark Hamburg
- Re: in-do-end, Mark Hamburg
- Re: in-do-end, Eike Decker
- Re: in-do-end, Eike Decker
- Re: in-do-end, steve donovan
- Re: in-do-end, Mark Hamburg
- Re: in-do-end, steve donovan
- Re: in-do-end, Eike Decker
- Re: in-do-end, steve donovan
- Re: in-do-end, Eike Decker