From ce7ea36b0b2d727a849ff4eb8964f4504fc8929a Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Tue, 2 Mar 2021 22:33:38 +0200 Subject: [PATCH] Only flush the currentToken when encountering a semi-colon IF the currentToken is non-empty --- source/tlang/commandline/lexer.d | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/tlang/commandline/lexer.d b/source/tlang/commandline/lexer.d index 5a8f824..ac38b29 100644 --- a/source/tlang/commandline/lexer.d +++ b/source/tlang/commandline/lexer.d @@ -40,10 +40,13 @@ public final class Lexer } else if(currentChar == ';' && !stringMode) { - /* Flush the current token */ - currentTokens ~= currentToken; - currentToken = ""; - + /* Flush the current token (if one exists) */ + if(currentToken.length) + { + currentTokens ~= currentToken; + currentToken = ""; + } + /* Add the ; token */ currentTokens ~= ";";