commit 21455162b5da29e5850bee1e16b85e226ae391b2
parent 99cc4b20f2c9e33600948fb0489c6d1d1c160518
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Fri, 20 Mar 1998 11:17:57 -0300
details (and new escape sequences: \a, \b, ...)
Diffstat:
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/llex.c b/llex.c
@@ -1,5 +1,5 @@
/*
-** $Id: llex.c,v 1.16 1998/03/06 16:54:42 roberto Exp roberto $
+** $Id: llex.c,v 1.17 1998/03/09 17:22:49 roberto Exp roberto $
** Lexical Analizer
** See Copyright Notice in lua.h
*/
@@ -323,11 +323,15 @@ int luaY_lex (YYSTYPE *l)
case '\\':
next(LS); /* do not save the '\' */
switch (LS->current) {
+ case 'a': save('\a'); next(LS); break;
+ case 'b': save('\b'); next(LS); break;
+ case 'f': save('\f'); next(LS); break;
case 'n': save('\n'); next(LS); break;
- case 't': save('\t'); next(LS); break;
case 'r': save('\r'); next(LS); break;
+ case 't': save('\t'); next(LS); break;
+ case 'v': save('\v'); next(LS); break;
case '\n': save('\n'); inclinenumber(LS); break;
- case '\\': case '"': case '\'': {
+ case '\\': case '"': case '\'': case '?': {
save(LS->current);
next(LS);
break;
@@ -338,9 +342,10 @@ int luaY_lex (YYSTYPE *l)
int i = 0;
do {
c = 10*c + (LS->current-'0');
- i++;
next(LS);
- } while (i<3 && isdigit(LS->current));
+ } while (++i<3 && isdigit(LS->current));
+ if (c >= 256)
+ luaY_error("escape sequence too large");
save(c);
}
else {