ADD: comments.

main
bog 2023-09-11 01:10:00 +02:00
parent f001a50d38
commit 583c1351ba
3 changed files with 25 additions and 1 deletions

View File

@ -27,6 +27,18 @@ namespace grino
skip_spaces();
while (has_more(m_cursor)
&& at(m_cursor) == ';')
{
while (has_more(m_cursor)
&& at(m_cursor) != '\n')
{
m_cursor++;
}
skip_spaces();
}
for (auto const& scanner: m_scanners)
{
auto my_info = scanner();
@ -84,6 +96,7 @@ namespace grino
char c = m_source[index];
if (std::isspace(c)) { return true; }
if (c == ';') { return true; }
auto itr = std::find(std::begin(m_separators),
std::end(m_separators),

View File

@ -6,7 +6,7 @@
#define NODE_TYPE(G) \
G(NODE_MODULE), \
G(NODE_BOOL)
G(NODE_BOOL),
namespace grino
{

View File

@ -51,3 +51,14 @@ TEST_CASE_METHOD(LexerTest, "Lexer_booleans")
test_end(lexer);
}
}
TEST_CASE_METHOD(LexerTest, "Lexer_comments")
{
grino::Lexer lexer {m_logger, "tests/lexer"};
lexer.scan(" true ; false \n\n true ");
test_next(lexer, "BOOL[true]");
test_next(lexer, "BOOL[true]");
test_end(lexer);
}