aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2024-04-09 06:30:32 +0200
committerlemon <lsof@mailbox.org>2024-04-09 06:30:32 +0200
commit274935a984141f623a364737766e0eae26954c82 (patch)
treeb9b90385308ca3bb7b5df01a25c43c9158c1fbc1
parent56884db7dc67dab8dc8754438c813bf274008eb8 (diff)
lexer: fix scanning of pp directives in some circumstances
-rw-r--r--lex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lex.c b/lex.c
index 86df308..924cfe4 100644
--- a/lex.c
+++ b/lex.c
@@ -1043,7 +1043,7 @@ lex(struct lexer *lx, struct token *tk_)
}
skip = nppcnd ? ppcndstk[nppcnd-1].cnd != PPCNDTRUE : 0;
- for (linebegin = 0;;) {
+ for (linebegin = 1;;) {
while ((t = lex0(lx, tk)) == '\n') linebegin = 1;
if (t == '#' && linebegin) {
if (lex0(lx, tk) == '\n') { }
@@ -1080,6 +1080,7 @@ lex(struct lexer *lx, struct token *tk_)
}
ppskipline(lx);
}
+ linebegin = 1;
} else {
linebegin = 0;
if (skip && tk->t != TKEOF) continue;