diff options
author | Jo-Philipp Wich <jo@mein.io> | 2023-07-11 12:10:53 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2023-07-12 00:38:49 +0200 |
commit | 9df91602e3aba0edc4771b220663f442f836f986 (patch) | |
tree | f1c2ff50c3fbc5ce4e236c09044da85565974532 /lexer.c | |
parent | 62775f4a4492ec2d6f19f2bc0af882de041b0bb7 (diff) |
lexer: don't count EOF token as newline
Avoid reporting a nonexisting final line by not counting the EOF character
as physical newline.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lexer.c')
-rw-r--r-- | lexer.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -94,9 +94,9 @@ fill_buf(uc_lexer_t *lex) { static int update_line(uc_lexer_t *lex, int ch) { - if (ch == '\n' || ch == EOF) + if (ch == '\n') uc_source_line_next(lex->source); - else + else if (ch != EOF) uc_source_line_update(lex->source, 1); lex->source->off++; |