[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Re: Token filter for erlang-style numbers.
- From: Karel Tuma <ktuma@...>
- Date: Tue, 24 Oct 2006 23:36:15 +0200
hi,
On Tue, Oct 24, 2006 at 05:13:28PM +0200, Joseph Stewart wrote:
> Yeah, I like it... next comes the php-style variable expansion in
> string constant ..
.. is trivial to implement.
doing ${} with sub-expressions is another story however (probably
out of TF reach altogether)
//kt
-- str = "foo $variable bar", flawed in many ways
local function F(get,put)
while true do
local l,t,v=get()
if t=="<string>" then
for pref,var in string.gmatch(v.."$","(.-)$([a-zA-Z0-9]*)") do
put(l,t,pref) put(l,"..")
if (var and var ~= "") then put(l,"<name>", var) put(l,"..") end
end
v=""
end
put(l,t,v)
end
end
function FILTER(get,source)
FILTER=coroutine.wrap(F)
FILTER(get,coroutine.yield)
end