diff options
author | Christian Parpart <christian@parpart.family> | 2018-10-23 07:50:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-23 07:50:15 +0800 |
commit | a2f5087d13274d6832669a39694ee5a3bf68f878 (patch) | |
tree | 4b6b8b3816a0a1620e73a30de687ff3557a10098 /libsolidity/parsing/Scanner.h | |
parent | c13b5280c1b44f18a2a1fb61ef5556e91c5678e7 (diff) | |
parent | f112377dd44e8281bff092639bb546ec8a6a39ac (diff) | |
download | dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar.gz dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar.bz2 dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar.lz dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar.xz dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.tar.zst dexon-solidity-a2f5087d13274d6832669a39694ee5a3bf68f878.zip |
Merge pull request #5286 from ethereum/refactor-token-as-enum-class
refactor `libsolidity::Token` into a strongly typed enum
Diffstat (limited to 'libsolidity/parsing/Scanner.h')
-rw-r--r-- | libsolidity/parsing/Scanner.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/libsolidity/parsing/Scanner.h b/libsolidity/parsing/Scanner.h index 7564c788..02e0553f 100644 --- a/libsolidity/parsing/Scanner.h +++ b/libsolidity/parsing/Scanner.h @@ -112,13 +112,13 @@ public: void reset(); /// @returns the next token and advances input - Token::Value next(); + Token next(); ///@{ ///@name Information about the current token /// @returns the current token - Token::Value currentToken() const + Token currentToken() const { return m_currentToken.token; } @@ -149,7 +149,7 @@ public: ///@name Information about the next token /// @returns the next token without advancing input. - Token::Value peekNextToken() const { return m_nextToken.token; } + Token peekNextToken() const { return m_nextToken.token; } SourceLocation peekLocation() const { return m_nextToken.location; } std::string const& peekLiteral() const { return m_nextToken.literal; } ///@} @@ -168,7 +168,7 @@ private: /// Used for the current and look-ahead token and comments struct TokenDesc { - Token::Value token; + Token token; SourceLocation location; std::string literal; std::tuple<unsigned, unsigned> extendedTokenInfo; @@ -185,9 +185,9 @@ private: bool advance() { m_char = m_source.advanceAndGet(); return !m_source.isPastEndOfInput(); } void rollback(int _amount) { m_char = m_source.rollback(_amount); } - inline Token::Value selectToken(Token::Value _tok) { advance(); return _tok; } + inline Token selectToken(Token _tok) { advance(); return _tok; } /// If the next character is _next, advance and return _then, otherwise return _else. - inline Token::Value selectToken(char _next, Token::Value _then, Token::Value _else); + inline Token selectToken(char _next, Token _then, Token _else); bool scanHexByte(char& o_scannedByte); bool scanUnicode(unsigned& o_codepoint); @@ -199,19 +199,19 @@ private: bool skipWhitespace(); /// Skips all whitespace that are neither '\r' nor '\n'. void skipWhitespaceExceptUnicodeLinebreak(); - Token::Value skipSingleLineComment(); - Token::Value skipMultiLineComment(); + Token skipSingleLineComment(); + Token skipMultiLineComment(); void scanDecimalDigits(); - Token::Value scanNumber(char _charSeen = 0); - std::tuple<Token::Value, unsigned, unsigned> scanIdentifierOrKeyword(); + Token scanNumber(char _charSeen = 0); + std::tuple<Token, unsigned, unsigned> scanIdentifierOrKeyword(); - Token::Value scanString(); - Token::Value scanHexString(); - Token::Value scanSingleLineDocComment(); - Token::Value scanMultiLineDocComment(); + Token scanString(); + Token scanHexString(); + Token scanSingleLineDocComment(); + Token scanMultiLineDocComment(); /// Scans a slash '/' and depending on the characters returns the appropriate token - Token::Value scanSlash(); + Token scanSlash(); /// Scans an escape-sequence which is part of a string and adds the /// decoded character to the current literal. Returns true if a pattern |