[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lpeg-list and nested substitutions
- From: Wesley Smith <wesley.hoke@...>
- Date: Sun, 28 Mar 2010 11:30:29 +0100
To partially answer my own question, here's a solution I came up with:
local p = P{
"patt",
one = Cmt(L(L"one"), function(s, i)
s[i] = "two"
return i
end),
patt = (V"one" + L(V"patt") + P(1))^0
}
My guess is this is the best way to go. Here's what happens:
{
[1] = something
2 = {
[1] = something
2 = {
[1] = one
}
}
3 = {
[1] = one
}
}
Becomes:
{
[1] = something
2 = {
[1] = something
[2] = two
}
[3] = two
}
wes