lua-users home
lua-l archive

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

'@' as sugar for 'self.' can be done with a simple token filter:

* proxy.c
* lexer proxy for Lua parser -- implements '@' as sugar for 'self.'.
* Luiz Henrique de Figueiredo <>
* 13 Sep 2007 18:35:51
* This code is hereby placed in the public domain.
* Add <<#include "proxy.c">> just before the definition of luaX_next in llex.c

static int nexttoken(LexState *ls, SemInfo *seminfo)
	int t=llex(ls,seminfo);
	if (t=='@') {
		seminfo->ts = luaS_new(ls->L,"self");
	return t;

#define llex nexttoken