Browse Source

Util: Rearrange Parser functions

master
Riyyi 2 years ago
parent
commit
a33f35faab
  1. 10
      src/util/json/parser.cpp
  2. 3
      src/util/json/parser.h

10
src/util/json/parser.cpp

@ -86,11 +86,6 @@ bool Parser::reachedEnd()
return m_index >= m_tokens->size();
}
Token Parser::peek()
{
return m_tokens->at(m_index);
}
bool Parser::seekForward(Token::Type type)
{
for (; !reachedEnd(); ++m_index) {
@ -103,6 +98,11 @@ bool Parser::seekForward(Token::Type type)
return false;
}
Token Parser::peek()
{
return m_tokens->at(m_index);
}
Token Parser::consume()
{
Token token = peek();

3
src/util/json/parser.h

@ -26,10 +26,9 @@ public:
private:
bool reachedEnd();
Token peek();
bool seekForward(Token::Type type);
Token peek();
Token consume();
Value getLiteral();

Loading…
Cancel
Save