ADD: comments.
parent
f001a50d38
commit
583c1351ba
|
@ -27,6 +27,18 @@ namespace grino
|
||||||
|
|
||||||
skip_spaces();
|
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)
|
for (auto const& scanner: m_scanners)
|
||||||
{
|
{
|
||||||
auto my_info = scanner();
|
auto my_info = scanner();
|
||||||
|
@ -84,6 +96,7 @@ namespace grino
|
||||||
|
|
||||||
char c = m_source[index];
|
char c = m_source[index];
|
||||||
if (std::isspace(c)) { return true; }
|
if (std::isspace(c)) { return true; }
|
||||||
|
if (c == ';') { return true; }
|
||||||
|
|
||||||
auto itr = std::find(std::begin(m_separators),
|
auto itr = std::find(std::begin(m_separators),
|
||||||
std::end(m_separators),
|
std::end(m_separators),
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#define NODE_TYPE(G) \
|
#define NODE_TYPE(G) \
|
||||||
G(NODE_MODULE), \
|
G(NODE_MODULE), \
|
||||||
G(NODE_BOOL)
|
G(NODE_BOOL),
|
||||||
|
|
||||||
namespace grino
|
namespace grino
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,3 +51,14 @@ TEST_CASE_METHOD(LexerTest, "Lexer_booleans")
|
||||||
test_end(lexer);
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue