Skip to content

Commit

Permalink
Fix scanner not reading token if last in input
Browse files Browse the repository at this point in the history
If a token is the last in the input (there's no ending newline) the
token was never being read.
  • Loading branch information
Ferk committed Oct 19, 2019
1 parent d80b4c6 commit 0d955dd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/u_scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0d955dd

Please sign in to comment.