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 TokenStream::next() {
|
||||||
token::Token got = this->peek(0);
|
token::Token got = this->peek(0);
|
||||||
m_position++;
|
m_position++;
|
||||||
|
while (m_position < static_cast<int>(m_tokens.size()) && this->peek().type == Type::Whitespace) {
|
||||||
|
m_position++;
|
||||||
|
}
|
||||||
return got;
|
return got;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,8 +190,7 @@ namespace token {
|
|||||||
if ((i + 1) >= text_length) break;
|
if ((i + 1) >= text_length) break;
|
||||||
c = text[++i];
|
c = text[++i];
|
||||||
} while (iswhitespace(c));
|
} while (iswhitespace(c));
|
||||||
// tokens.push_back(token::Token{ token::Type::Whitespace, content });
|
tokens.push_back(token::Token{ token::Type::Whitespace, content, meta + content.size() });
|
||||||
// Just skip whitespace tokens
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tokens.push_back(token::Token{ token::Type::Symbol, std::string{c}, meta });
|
tokens.push_back(token::Token{ token::Type::Symbol, std::string{c}, meta });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user