aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
Diffstat (limited to 'llex.c')
-rw-r--r--llex.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/llex.c b/llex.c
index 48dbcd5b..86d9ee60 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 2.13 2005/11/08 19:45:14 roberto Exp roberto $ 2** $Id: llex.c,v 2.14 2005/12/07 15:32:52 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -319,7 +319,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) {
319} 319}
320 320
321 321
322int luaX_lex (LexState *ls, SemInfo *seminfo) { 322static int llex (LexState *ls, SemInfo *seminfo) {
323 luaZ_resetbuffer(ls->buff); 323 luaZ_resetbuffer(ls->buff);
324 for (;;) { 324 for (;;) {
325 switch (ls->current) { 325 switch (ls->current) {
@@ -432,4 +432,20 @@ int luaX_lex (LexState *ls, SemInfo *seminfo) {
432 } 432 }
433} 433}
434 434
435#undef next 435
436void luaX_next (LexState *ls) {
437 ls->lastline = ls->linenumber;
438 if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */
439 ls->t = ls->lookahead; /* use this one */
440 ls->lookahead.token = TK_EOS; /* and discharge it */
441 }
442 else
443 ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */
444}
445
446
447void luaX_lookahead (LexState *ls) {
448 lua_assert(ls->lookahead.token == TK_EOS);
449 ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
450}
451