lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



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