lua-users home
lua-l archive

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

On Mon, 07 Dec 2009 10:10:27 +0200, steve donovan <> wrote:

This is the best way to accommodate everybody and their 'special
needs'.  I'd suggest looking into a new API for the token-filter patch
so (a) it has minimal impact on programs that don't need it (b) that
it cannot be accidently invoked by defining a global FILTER and (c)
that different token filters can co-exist.

Token filter patch is rather invasive, does not really provide C interface,
and bulks up code. What would be good to see is something similar to the
lua_Reader callback interface, and have the standard Lua lexer
implemented using this interface. Something similar to:

int mylex(lua_State *L, void *data, void *dst) {
  struct MyLexData *d = (struct MyLexData *) data;
    return TK_LE;
    return luaX_string(L, dst, TK_GLOBAL, s, len);
    return luaX_num(L, dst, n);
  return TK_EOS;

  MyLexData d;
  lua_xload(L, &mylex, &d);