The Scanner will now check for empty lines (is the previous token and the current token a new line?) and simply not emit a NewLine Token.
This commit is contained in:
@@ -42,6 +42,16 @@ List* GenerateTokenList(const char* source) {
|
||||
AdvanceScanner();
|
||||
break; //Ignore whitespace
|
||||
case '\n':
|
||||
if (tokens->size > 0) {
|
||||
token = tokens->content[tokens->size - 1];
|
||||
|
||||
if (token->Class == PunctuationClass && token->Value.Punctuation == NewLine) {
|
||||
AdvanceScanner();
|
||||
Line++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
token = CreateToken(Line, PunctuationClass);
|
||||
token->Value.Punctuation = NewLine;
|
||||
AddListItem(token, sizeof(Token), tokens);
|
||||
|
||||
Reference in New Issue
Block a user