summaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-06-03 17:12:21 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-06-03 17:12:21 -0300
commitc398a02110d72422f2c2e1168376d751ec1269db (patch)
tree10224e1ed29d89bfe2c6392e88d0684eea07fab6 /llex.c
parentad7103ea3aed7f40a5cf7055af253b34320134bc (diff)
downloadlua-github-c398a02110d72422f2c2e1168376d751ec1269db.tar.gz
uses `isspace' to recognize space characters
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/llex.c b/llex.c
index 3e308753..14dc2902 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
/*
-** $Id: llex.c,v 1.102 2002/05/16 18:39:46 roberto Exp roberto $
+** $Id: llex.c,v 1.103 2002/06/03 14:09:57 roberto Exp roberto $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@@ -306,15 +306,11 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) {
for (;;) {
switch (LS->current) {
- case ' ': case '\t': case '\r': /* `\r' to avoid problems with DOS */
- next(LS);
- continue;
-
- case '\n':
+ case '\n': {
inclinenumber(LS);
continue;
-
- case '-':
+ }
+ case '-': {
next(LS);
if (LS->current != '-') return '-';
/* else is a comment */
@@ -325,41 +321,41 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) {
while (LS->current != '\n' && LS->current != EOZ)
next(LS);
continue;
-
- case '[':
+ }
+ case '[': {
next(LS);
if (LS->current != '[') return '[';
else {
read_long_string(LS, seminfo);
return TK_STRING;
}
-
- case '=':
+ }
+ case '=': {
next(LS);
if (LS->current != '=') return '=';
else { next(LS); return TK_EQ; }
-
- case '<':
+ }
+ case '<': {
next(LS);
if (LS->current != '=') return '<';
else { next(LS); return TK_LE; }
-
- case '>':
+ }
+ case '>': {
next(LS);
if (LS->current != '=') return '>';
else { next(LS); return TK_GE; }
-
- case '~':
+ }
+ case '~': {
next(LS);
if (LS->current != '=') return '~';
else { next(LS); return TK_NE; }
-
+ }
case '"':
- case '\'':
+ case '\'': {
read_string(LS, LS->current, seminfo);
return TK_STRING;
-
- case '.':
+ }
+ case '.': {
next(LS);
if (LS->current == '.') {
next(LS);
@@ -374,12 +370,16 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) {
read_number(LS, 1, seminfo);
return TK_NUMBER;
}
-
- case EOZ:
+ }
+ case EOZ: {
return TK_EOS;
-
+ }
default: {
- if (isdigit(LS->current)) {
+ if (isspace(LS->current)) {
+ next(LS);
+ continue;
+ }
+ else if (isdigit(LS->current)) {
read_number(LS, 0, seminfo);
return TK_NUMBER;
}