From 956b50a00167ed073375e0213e022ea0fb177309 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Wed, 22 Apr 2026 15:49:57 +0300 Subject: Remove storage from lex.c There's no point in holding curtok somewhere as the maximum supported amount of ungettok() calls is 1 --- lex.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lex.c') diff --git a/lex.c b/lex.c index 29b56f0..7c17b33 100644 --- a/lex.c +++ b/lex.c @@ -23,7 +23,6 @@ #include -static struct tok storage; struct tok curtok; static int isunget; ulong curline; @@ -220,16 +219,14 @@ gettok(void) { int ch; - curtok.info = (struct tinfo){NULL, 0, 0}; - if (isunget) { isunget = 0; - curtok = storage; - /*say("reread %s(`%s')", tokname(curtok.type), curtok.info.p)*/; return curtok.type; } + curtok.info = (struct tinfo){NULL, 0, 0}; + for (; (ch = get()) != EOF; curtok.info.len = 0) if (!isspace(ch)) goto found; @@ -242,14 +239,12 @@ found: else oper(); - /*say("read %s(`%s')", tokname(curtok.type), curtok.info.p)*/; return curtok.type; } void ungettok() { - storage = curtok; isunget = 1; } -- cgit 1.4.1