lua-users home
lua-l archive

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

On Fri, Nov 17, 2017 at 4:11 AM, Hisham <> wrote:
> On 17 November 2017 at 08:46, Luiz Henrique de Figueiredo
> <> wrote:
>>> A safe table navigator symbol would be a fun thing to implement too.
>> What do you mean?
> tbl?.subtbl?.field
> --> meaning (tbl or {}).(subtbl or {}).field
> Not (easily*) doable with ltokenp because tbl can be an arbitrarily
> long expression:
> foo[bar?.baz](arg).x?.bla
> --> meaning (foo[(bar or {}).baz](arg).x or {}).bla
> To deal with expressions, you need an AST, which is what Metalua provides.
> (* technically it is doable with ltokenp because one would have to
> essentially consume an arbitrary number of the tokens and build an
> AST, but then you are just reimplementing a subset of Metalua)
> -- Hisham
Thank you, I appreciate the hint into what Metalua provides. I'll look
into Metalua when I finish satisfying my ignorance. I assume you
already understand why I can't just split and iterate over that
arbitrary list. :)