From 35a28a58b38fb90cbe7c9596d60af2b3c1bd52a3 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 1 Aug 2019 14:11:33 -0300 Subject: [PATCH] Details - removed rule about RCS from makefile - comments and nitpicking in 'llex.c' --- llex.c | 20 +++++++++++++------- makefile | 1 - 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/llex.c b/llex.c index d99d9015..f88057fe 100644 --- a/llex.c +++ b/llex.c @@ -211,8 +211,16 @@ static int check_next2 (LexState *ls, const char *set) { /* LUA_NUMBER */ /* -** this function is quite liberal in what it accepts, as 'luaO_str2num' -** will reject ill-formed numerals. +** This function is quite liberal in what it accepts, as 'luaO_str2num' +** will reject ill-formed numerals. Roughly, it accepts the following +** pattern: +** +** %d(%x|%.|([Ee][+-]?))* | 0[Xx](%x|%.|([Pp][+-]?))* +** +** The only tricky part is to accept [+-] only after a valid exponent +** mark, to avoid reading '3-4' or '0xe+1' as a single number. +** +** The caller might have already read an initial dot. */ static int read_numeral (LexState *ls, SemInfo *seminfo) { TValue obj; @@ -223,15 +231,13 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) { if (first == '0' && check_next2(ls, "xX")) /* hexadecimal? */ expo = "Pp"; for (;;) { - if (check_next2(ls, expo)) /* exponent part? */ + if (check_next2(ls, expo)) /* exponent mark? */ check_next2(ls, "-+"); /* optional exponent sign */ - if (lisxdigit(ls->current)) - save_and_next(ls); - else if (ls->current == '.') + else if (lisxdigit(ls->current) || ls->current == '.') /* '%x|%.' */ save_and_next(ls); else break; } - if (lislalnum(ls->current)) /* is numeral touching an alpha num? */ + if (lislalpha(ls->current)) /* is numeral touching a letter? */ save_and_next(ls); /* force an error */ save(ls, '\0'); if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */ diff --git a/makefile b/makefile index cb6cece8..cf238aeb 100644 --- a/makefile +++ b/makefile @@ -107,7 +107,6 @@ $(LUAC_T): $(LUAC_O) $(CORE_T) $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(CORE_T) $(LIBS) $(MYLIBS) clean: - rcsclean -u $(RM) $(ALL_T) $(ALL_O) depend: