[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: token filter toolset started
- From: Asko Kauppi <askok@...>
- Date: Thu, 26 Oct 2006 23:59:51 +0300
Attached is a start of a toolset for making token filters more higher
level.
As a sidenote, would it be possible to have reserved words, mainly
"until", "function" and "nil" available for everyday use. I've got a
patch doing this, and it's not many lines. I believe this would be
beneficial for the language, since it is being used also as a
configuration (non-programmer) language. There is no real reason -
imho- for banning the words from being table indices.
local function SYNTAX(get,put)
local p= init( "SYNTAX", get, put ) -- my 'p'ersonality, 'p'urse
or 'p'assport
while true do
p["until"](p,"in") -- p:until "in"
p:flush() -- pass it through, next line
local tk2,tk3= p:read(2) -- read two tokens (and cache)
if tk2=="<name>" and tk3=="do" then
p:inject( "<name>", "next" ) -- to line1 (first in
cache)
p:inject( "," )
end
p:flush()
end
end
Attachment:
ftools.lua
Description: Binary data