Adds \v and \f as whitespace characters

This commit is contained in:
Deukhoofd 2019-05-19 15:28:45 +02:00
parent 96943bad7e
commit 608a579f19
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 3 additions and 2 deletions

View File

@ -35,7 +35,7 @@ IToken* Lexer::LexNext(char c){
switch (c) {
case '\0':
return new SimpleToken(TokenKind::EndOfFile);
case ' ': case '\t': case '\n': case '\r':
case ' ': case '\t': case '\n': case '\r': case '\v': case '\f':
return new SimpleToken(TokenKind::WhiteSpace);
case '+':
return new SimpleToken(TokenKind::PlusToken);

View File

@ -1,4 +1,3 @@
#ifdef TESTS_BUILD
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
@ -70,6 +69,8 @@ TEST_CASE( "Lex Whitespace", "[lexer]" ) {
CHECK(lexer.LexNext('\t') -> GetKind() == TokenKind::WhiteSpace);
CHECK(lexer.LexNext('\n') -> GetKind() == TokenKind::WhiteSpace);
CHECK(lexer.LexNext('\r') -> GetKind() == TokenKind::WhiteSpace);
CHECK(lexer.LexNext('\v') -> GetKind() == TokenKind::WhiteSpace);
CHECK(lexer.LexNext('\f') -> GetKind() == TokenKind::WhiteSpace);
}
TEST_CASE( "Lex Basic Integers", "[lexer]" ) {