[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is it worth making a patch?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 23 Jan 2008 15:45:06 -0200
'@' 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 <lhf@tecgraf.puc-rio.br>
* 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=='@') {
t=TK_NAME;
seminfo->ts = luaS_new(ls->L,"self");
ls->lookahead.token='.';
}
return t;
}
#define llex nexttoken