lua-users home
lua-l archive

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


And for those who are more Pascal oriented (i.e., not equal is <> which I personally find more logical than !=), the case '<' can be changed to:

case '<': {
 next(ls);
 if (check_next1(ls, '=')) return TK_LE;
 else if (check_next1(ls, '<')) return TK_SHL;
 else if (check_next1(ls, '>')) return TK_NE;
 else return '<';
}


-----Original Message----- From: Luiz Henrique de Figueiredo
Sent: Friday, January 08, 2016 3:13 AM
To: Lua mailing list
Subject: Re: Bitwise confusion?

OK, fair enough. I may look into tweaking the parser to accept != as
well as ~= for my own use, though that depends on whether I can wrap
my brain around the parser.

It's the lexer that needs to be hacked and it's pretty easy;
just add this in function llex near to "case '~'":

     case '!': {
       next(ls);
       if (check_next1(ls, '=')) return TK_NE;
       else return '!';
     }