[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ideas about colon operator syntax (and a patch in the work)
- From: "Thomas Jericke" <tjericke@...>
- Date: Thu, 01 May 2014 19:08:49 +0200
-----Original Message-----
> From: "Dirk Laurie" <dirk.laurie@gmail.com>
> To: "Lua mailing list" <lua-l@lists.lua.org>
> Date: 01-05-2014 18:09
> Subject: Re: Ideas about colon operator syntax (and a patch in the work)
>
> 2014-05-01 17:21 GMT+02:00 Thomas Jericke <tjericke@indel.ch>:
>
> > print(lower"text":lower())
> >
> > would you pefer an error (like now) or left to right order assuming that
> >
> > print("text":lower())
> >
> > is valid syntax.
>
> I prefer the error. It's the same error that you get if you write
> > print(beer"text":lower())
> There is no error if `lower` is defined.
> > local lower=string.lower; print(lower"text":lower())
>
> How do you intend making "text":lower() valid syntax?
> The present demand for parentheses comes from:
>
> prefixexp ::= var | functioncall | ‘(’ exp ‘)’
>
> Changing `prefixexp` may have other repercussions.
Well my ideal solution would be to not change prefixexp at all.
I would only change:
functioncall ::= prefixexp args | prefixexp ‘:’ Name args
into
functioncall ::= prefixexp args | prefixexp ‘:’ Name args | String ':' Name args | Number ':' Name args
But the way the Lua parser is written, this is not possible. Or I haven't found out yet how.
--
Thomas