Only flush the currentToken when encountering a semi-colon IF the currentToken is non-empty

expression_parsing.sync-conflict-20210316-090018-O3W7KWN
Tristan B. V. Kildaire 2021-03-02 22:33:38 +02:00
parent b178528ece
commit ce7ea36b0b
1 changed files with 7 additions and 4 deletions

View File

@ -40,9 +40,12 @@ public final class Lexer
} }
else if(currentChar == ';' && !stringMode) else if(currentChar == ';' && !stringMode)
{ {
/* Flush the current token */ /* Flush the current token (if one exists) */
if(currentToken.length)
{
currentTokens ~= currentToken; currentTokens ~= currentToken;
currentToken = ""; currentToken = "";
}
/* Add the ; token */ /* Add the ; token */
currentTokens ~= ";"; currentTokens ~= ";";