Adds \v and \f as whitespace characters
This commit is contained in:
parent
96943bad7e
commit
608a579f19
|
@ -35,7 +35,7 @@ IToken* Lexer::LexNext(char c){
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '\0':
|
case '\0':
|
||||||
return new SimpleToken(TokenKind::EndOfFile);
|
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);
|
return new SimpleToken(TokenKind::WhiteSpace);
|
||||||
case '+':
|
case '+':
|
||||||
return new SimpleToken(TokenKind::PlusToken);
|
return new SimpleToken(TokenKind::PlusToken);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#ifdef TESTS_BUILD
|
#ifdef TESTS_BUILD
|
||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
@ -70,6 +69,8 @@ TEST_CASE( "Lex Whitespace", "[lexer]" ) {
|
||||||
CHECK(lexer.LexNext('\t') -> GetKind() == TokenKind::WhiteSpace);
|
CHECK(lexer.LexNext('\t') -> GetKind() == TokenKind::WhiteSpace);
|
||||||
CHECK(lexer.LexNext('\n') -> GetKind() == TokenKind::WhiteSpace);
|
CHECK(lexer.LexNext('\n') -> GetKind() == TokenKind::WhiteSpace);
|
||||||
CHECK(lexer.LexNext('\r') -> 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]" ) {
|
TEST_CASE( "Lex Basic Integers", "[lexer]" ) {
|
||||||
|
|
Loading…
Reference in New Issue