lua-users home
lua-l archive

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

On Thu, 25 Apr 2019 at 06:54, Dirk Laurie <> wrote:
> Op Do. 25 Apr. 2019 om 03:33 het Philippe Verdy <> geskryf:
> > I also agree that the "*xxx" or "*(xxx, params...)" syntax is very fuzzy and will not work with the future evolution of annotations
> >
> > Le jeu. 25 avr. 2019 à 00:22, Dibyendu Majumdar <> a écrit :
> >> I am writing about this again in the hope that it is not too late to
> >> change the syntax of the *toclose attribute. I think there is an
> >> opportunity to allow a general way of introducing annotations in Lua,
> >> which can be exploited by extensions. It would be sad if that
> >> opportunity is lost.
> Therefore I would suggest that an annotation starts with ! and
> continues until but not including the first termination character.
> Sensible termination characters might be comma, semicolon and end-of
> line, allowing annotations for every item in a parameter/return list,
> table constructor etc, but not encumbering the parser with a difficult
> decision whether the annotation is done. In the contex of "local", an
> empty annotation could default to 'toclose', so that "local a!, b, c!`
> is all that one needs to supply "toclose" directives.

I would suggest that the syntax should be:

<special character><optional name><optional table with only literal
keys and values>

So assuming your choice of !, we could have:

local a!
local b !go_to_space { when=true }
local c !array { 20 }

By allowing an optional table after the name would enable a whole host
of possibilities without breaking the lexer / parser I hope.

Thanks and Regards