From 0d955dd93a40b237b09503a13fa90442c1a0dd37 Mon Sep 17 00:00:00 2001 From: Fernando Carmona Varo Date: Sat, 19 Oct 2019 23:31:37 +0200 Subject: [PATCH] Fix scanner not reading token if last in input If a token is the last in the input (there's no ending newline) the token was never being read. --- src/u_scanner.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/u_scanner.c b/src/u_scanner.c index 8a2f248d..96d358b2 100644 --- a/src/u_scanner.c +++ b/src/u_scanner.c @@ -391,6 +391,9 @@ boolean U_GetNextToken(u_scanner_t* scanner, boolean expandState) else break; } + // If we reached end of input while reading, set it as the end of token + if(scanner->scanPos == scanner->length && start == end) + end = scanner->length; } if(end-start > 0 || stringFinished)