Skip to content
Snippets Groups Projects
Commit 6736546f authored by Vasileios Karakasis's avatar Vasileios Karakasis
Browse files

Addresses PR #21 review.

parent 7e8801fa
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ bool is_keyword(Token const& t);
// takes a range of characters as input parameters
class Lexer {
public:
Lexer(const char * begin, const char* end)
Lexer(const char* begin, const char* end)
: begin_(begin),
end_(end),
current_(begin),
......@@ -114,4 +114,3 @@ protected:
Token token_;
};
......@@ -205,7 +205,9 @@ TEST(Lexer, braces) {
// test comments
TEST(Lexer, comments) {
char string[] = "foo:this is one line\nbar : another comment\n";
char string[] = "foo:this is one line\n"
"bar : another comment\n"
"foobar ? another comment\n";
PRINT_LEX_STRING
Lexer lexer(string, string+sizeof(string));
......@@ -218,7 +220,12 @@ TEST(Lexer, comments) {
EXPECT_EQ(t2.location.line, 2);
auto t3 = lexer.parse();
EXPECT_EQ(t3.type, tok::eof);
EXPECT_EQ(t3.type, tok::identifier);
EXPECT_EQ(t3.spelling, "foobar");
EXPECT_EQ(t3.location.line, 3);
auto t4 = lexer.parse();
EXPECT_EQ(t4.type, tok::eof);
}
// test numbers
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment