- removed rule about RCS from makefile
- comments and nitpicking in 'llex.c'
This commit is contained in:
Roberto Ierusalimschy 2019-08-01 14:11:33 -03:00
parent 223bb04090
commit 35a28a58b3
2 changed files with 13 additions and 8 deletions

20
llex.c
View File

@ -211,8 +211,16 @@ static int check_next2 (LexState *ls, const char *set) {
/* LUA_NUMBER */ /* LUA_NUMBER */
/* /*
** this function is quite liberal in what it accepts, as 'luaO_str2num' ** This function is quite liberal in what it accepts, as 'luaO_str2num'
** will reject ill-formed numerals. ** 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) { static int read_numeral (LexState *ls, SemInfo *seminfo) {
TValue obj; TValue obj;
@ -223,15 +231,13 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) {
if (first == '0' && check_next2(ls, "xX")) /* hexadecimal? */ if (first == '0' && check_next2(ls, "xX")) /* hexadecimal? */
expo = "Pp"; expo = "Pp";
for (;;) { for (;;) {
if (check_next2(ls, expo)) /* exponent part? */ if (check_next2(ls, expo)) /* exponent mark? */
check_next2(ls, "-+"); /* optional exponent sign */ check_next2(ls, "-+"); /* optional exponent sign */
if (lisxdigit(ls->current)) else if (lisxdigit(ls->current) || ls->current == '.') /* '%x|%.' */
save_and_next(ls);
else if (ls->current == '.')
save_and_next(ls); save_and_next(ls);
else break; 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_and_next(ls); /* force an error */
save(ls, '\0'); save(ls, '\0');
if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */ if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */

View File

@ -107,7 +107,6 @@ $(LUAC_T): $(LUAC_O) $(CORE_T)
$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(CORE_T) $(LIBS) $(MYLIBS) $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(CORE_T) $(LIBS) $(MYLIBS)
clean: clean:
rcsclean -u
$(RM) $(ALL_T) $(ALL_O) $(RM) $(ALL_T) $(ALL_O)
depend: depend: