From 99b5a839652d850b5d40c78d3cf26ddb815c29a9 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 1 Aug 2026 13:41:06 +0300 Subject: add eol token --- src/fwdscript.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/fwdscript.c') diff --git a/src/fwdscript.c b/src/fwdscript.c index 3ee7449..c524810 100644 --- a/src/fwdscript.c +++ b/src/fwdscript.c @@ -240,7 +240,8 @@ struct fwdtoken { FWDTOKEN_OPEN, FWDTOKEN_CLOSE, FWDTOKEN_TO, - FWDTOKEN_END + FWDTOKEN_END, + FWDTOKEN_EOL } kind; size_t line; @@ -265,6 +266,17 @@ static int fwdscript_tokenize(struct fwdtokens *tokens, const char *buf) break; if (*tok == '\n') { + struct fwdtoken eol = { + .kind = FWDTOKEN_EOL, + .line = line, + .s = NULL + }; + + if (!fwdtokens_append(tokens, eol)) { + fprintf(stderr, "failed appending eol token\n"); + return -1; + } + line += 1; start = tok + 1; continue; -- cgit v1.3