[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Re: how to make an user defined grammar?
- From: Coda Highland <chighland@...>
- Date: Fri, 13 Jan 2017 21:08:57 -0800
On Fri, Jan 13, 2017 at 8:57 PM, 常严 <email@example.com> wrote:
> What I means is that can we define a simple syntactic function as
> and it will be mapped to a function doing something:
> function test(variable)
> for i =1, #variable do
> Using the short notation is easy for user to do some specific loop
Lua does not have any mechanisms for this.
If you want to do something like that, you'll either need to modify
the parser or use a token filter of some sort. These techniques are
fairly well-known in the community (I don't know how to do it myself,
but I'm sure it's on the wiki) but they're not available using JUST
the vanilla Lua interpreter.