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

3
src/util/json/parser.h

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

Loading…
Cancel
Save