lua-users home
lua-l archive

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


Am 02.06.2011 18:05, schrieb Luiz Henrique de Figueiredo:
syntax error: [string "return 42"]:1: malformed number near '42ÿ'

Ah, ÿ is 0xFF. So, somehow -1 is getting mapped into 0xFF.
It seems to be a faulty isdigit, which is mapping -1 to 0xFF *and*
thinking 0xFF is a digit! Try using your own isdigit...

Where does that -1 come from? I replaced isdigit() in read_numeral by the following, no change:

static int
isadigit(char c)
{
	if (c >= '0' && c <= '9')
		return 1;
	return 0;
}




If you want to trace this, the place to start is read_numeral in llex.c.