[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LPEG design patterns
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 2 May 2019 10:01:15 -0300
> You missed one---you could always use global variables and avoid Carg() or
> building a separate grammer entirely.
You can also use closures, avoiding global variables. The functions
in the pattern use external local variables, and some helper
functions allow you to change the values of these variables.
do
local X
function helperX (newx) X = newx end
-- your pattern goes here, using 'X'
...
end
-- Roberto