Tokenize whitespace as well, skip it in next
This commit is contained in:
parent
cdff4cc9db
commit
85644457d0
@ -99,6 +99,9 @@ namespace token {
|
||||
Token TokenStream::next() {
|
||||
token::Token got = this->peek(0);
|
||||
m_position++;
|
||||
while (m_position < static_cast<int>(m_tokens.size()) && this->peek().type == Type::Whitespace) {
|
||||
m_position++;
|
||||
}
|
||||
return got;
|
||||
}
|
||||
|
||||
@ -187,8 +190,7 @@ namespace token {
|
||||
if ((i + 1) >= text_length) break;
|
||||
c = text[++i];
|
||||
} while (iswhitespace(c));
|
||||
// tokens.push_back(token::Token{ token::Type::Whitespace, content });
|
||||
// Just skip whitespace tokens
|
||||
tokens.push_back(token::Token{ token::Type::Whitespace, content, meta + content.size() });
|
||||
}
|
||||
else {
|
||||
tokens.push_back(token::Token{ token::Type::Symbol, std::string{c}, meta });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user