Add scanner helpers to ParserBase

This commit is contained in:
Alex Beregszaszi 2017-05-24 23:03:15 +01:00
parent 2fefe3b549
commit 3459052ae8

View File

@ -24,6 +24,7 @@
#include <memory>
#include <libsolidity/interface/Exceptions.h>
#include <libsolidity/parsing/Scanner.h>
#include <libsolidity/parsing/Token.h>
namespace dev
@ -46,11 +47,14 @@ protected:
/// End position of the current token
int endPosition() const;
///@{
///@name Helper functions
/// If current token value is not _value, throw exception otherwise advance token.
void expectToken(Token::Value _value);
Token::Value currentToken() const { return m_scanner->currentToken(); }
Token::Value peekNextToken() const { return m_scanner->peekNextToken(); }
std::string currentLiteral() const { return m_scanner->currentLiteral(); }
Token::Value advance() { return m_scanner->next(); }
///@}
/// Creates a @ref ParserError and annotates it with the current position and the