aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-06-28 22:12:55 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-06-28 22:12:55 +0200
commitc80417c925b70b28f78a3111baa503f9b489286d (patch)
tree982198c6385c4f93cdb4f689cd8ed5f1fbf8d378 /src
parent5911ffe467650907eb09521ca83290e4a4702d8d (diff)
Properly check for EOF
Diffstat (limited to 'src')
-rw-r--r--src/parser.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/parser.c b/src/parser.c
index d71627e..6a96154 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -378,12 +378,19 @@ isfunc(lexemes_t toks)
if (toks.kinds[toksidx + 1] == LEXRPAR)
return true;
- for (size_t i = toksidx + 1;; i++) {
+ for (size_t i = toksidx + 1, nst = 1;; i++) {
switch (toks.kinds[i]) {
+ case LEXLPAR:
+ nst++;
+ break;
case LEXRPAR:
- return false;
+ if (--nst == 0)
+ return false;
+ break;
case LEXCOLON:
return true;
+ case LEXEOF:
+ return false;
}
}
}