lua-users home
lua-l archive

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


> Only, making filters in C does not sound fun to me, at all.

Well, my tiny patch to the lexer to allow token filters does not require
that they be written in Lua. It's just, as you say, much easier to do it
in Lua.

Moreover, doing it in C would require exposing some of the internals of
the lexer and the parser, but this is not too bad if you're a C programmer.
The only thing is that those internals will probably change every new
version (not too much, but probably enough to break existing code).

Having said that, it seems to me that it would be not too bad to write
token filters in C if you know what you're doing. I think that many
filters would just need to maintain one (or several) token queues.
On the other hand, you do lose the ability to express filters as
coroutines, which is what makes them easy to write in Lua.

Perhaps I (or Asko or someone else) should try to write a token filter
in C to see how hard it'd be. If anyone is interested in doing so and
need tips on how to adapt proxy.c to do it, just drop me a line.
--lhf