aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorRJ Catalano <rcatalano@macsales.com>2016-03-10 07:02:37 +0800
committerchriseth <c@ethdev.com>2016-03-12 00:49:32 +0800
commitb8bcb706e946ca05f55139e668fe90297a382a0a (patch)
treee260a553ead9ffb686245a2d3d02519bc337e171 /libsolidity
parent58e07151e3fd8503bc0418dba452a822f03ff260 (diff)
downloaddexon-solidity-b8bcb706e946ca05f55139e668fe90297a382a0a.tar.gz
dexon-solidity-b8bcb706e946ca05f55139e668fe90297a382a0a.tar.zst
dexon-solidity-b8bcb706e946ca05f55139e668fe90297a382a0a.zip
stylistic change, and got lexical cast to work with an iterator range
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/parsing/Token.cpp9
-rw-r--r--libsolidity/parsing/Token.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/libsolidity/parsing/Token.cpp b/libsolidity/parsing/Token.cpp
index 4f04ea7a..4634c510 100644
--- a/libsolidity/parsing/Token.cpp
+++ b/libsolidity/parsing/Token.cpp
@@ -42,6 +42,7 @@
#include <map>
#include <libsolidity/parsing/Token.h>
+#include <boost/range/iterator_range.hpp>
using namespace std;
@@ -108,11 +109,11 @@ char const Token::m_tokenType[] =
{
TOKEN_LIST(KT, KK)
};
-unsigned Token::extractUnsigned(string::const_iterator const& _begin, string::const_iterator const& _end)
+unsigned Token::extractUnsigned(string::const_iterator _begin, string::const_iterator _end)
{
try
{
- unsigned short m = boost::lexical_cast<unsigned short>(string(_begin, _end));
+ unsigned short m = boost::lexical_cast<unsigned short>(boost::make_iterator_range(_begin, _end));
return m;
}
catch(const boost::bad_lexical_cast &)
@@ -146,8 +147,8 @@ tuple<Token::Value, unsigned short, unsigned short> Token::fromIdentifierOrKeywo
}
else if (keyword == Token::UFixed || keyword == Token::Fixed)
{
- auto positionN = find_if_not(positionX + 1, _literal.end(), ::isdigit);
- unsigned short n = extractUnsigned(positionX + 1, positionN);
+ auto positionN = find_if_not(positionX++, _literal.end(), ::isdigit);
+ unsigned short n = extractUnsigned(positionX++, positionN);
if (
0 < m + n &&
m + n <= 256 &&
diff --git a/libsolidity/parsing/Token.h b/libsolidity/parsing/Token.h
index ab240b2a..64a3447a 100644
--- a/libsolidity/parsing/Token.h
+++ b/libsolidity/parsing/Token.h
@@ -308,7 +308,7 @@ public:
private:
// @returns 0 on error (invalid digit or number too large)
- static unsigned extractUnsigned(std::string::const_iterator const& _begin, std::string::const_iterator const& _end);
+ static unsigned extractUnsigned(std::string::const_iterator _begin, std::string::const_iterator _end);
// @returns the keyword with name @a _name or Token::Identifier of no such keyword exists.
static Token::Value keywordByName(std::string const& _name);
static char const* const m_name[NUM_TOKENS];