aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/Token.cpp
diff options
context:
space:
mode:
authorRJ Catalano <rcatalano@macsales.com>2016-03-08 05:36:25 +0800
committerchriseth <c@ethdev.com>2016-03-12 00:49:32 +0800
commit9f5c3977fb0c1a4607a955811ea3cda6e0547b66 (patch)
tree435e0e211172dc06fa8f76018033b2f6d0e8c8e9 /libsolidity/parsing/Token.cpp
parent2738f4066a3786bea5d5c0b49709fa99547b8eff (diff)
downloaddexon-solidity-9f5c3977fb0c1a4607a955811ea3cda6e0547b66.tar
dexon-solidity-9f5c3977fb0c1a4607a955811ea3cda6e0547b66.tar.gz
dexon-solidity-9f5c3977fb0c1a4607a955811ea3cda6e0547b66.tar.bz2
dexon-solidity-9f5c3977fb0c1a4607a955811ea3cda6e0547b66.tar.lz
dexon-solidity-9f5c3977fb0c1a4607a955811ea3cda6e0547b66.tar.xz
dexon-solidity-9f5c3977fb0c1a4607a955811ea3cda6e0547b66.tar.zst
dexon-solidity-9f5c3977fb0c1a4607a955811ea3cda6e0547b66.zip
changed extractUnsigned to handle iterators rather than a string
Diffstat (limited to 'libsolidity/parsing/Token.cpp')
-rw-r--r--libsolidity/parsing/Token.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libsolidity/parsing/Token.cpp b/libsolidity/parsing/Token.cpp
index cbb46f0d..332d27f7 100644
--- a/libsolidity/parsing/Token.cpp
+++ b/libsolidity/parsing/Token.cpp
@@ -108,11 +108,11 @@ char const Token::m_tokenType[] =
{
TOKEN_LIST(KT, KK)
};
-unsigned Token::extractUnsigned(string const& _literal)
+unsigned Token::extractUnsigned(string::const_iterator const& _begin, string::const_iterator const& _end)
{
try
{
- unsigned short m = stoi(_literal);
+ unsigned short m = stoi(string(_begin, _end));
return m;
}
catch(out_of_range& e)
@@ -131,7 +131,7 @@ tuple<Token::Value, unsigned short, unsigned short> Token::fromIdentifierOrKeywo
{
string baseType(_literal.begin(), positionM);
auto positionX = find_if_not(positionM, _literal.end(), ::isdigit);
- unsigned short m = extractUnsigned(string(positionM, positionX));
+ unsigned short m = extractUnsigned(positionM, positionX);
Token::Value keyword = keywordByName(baseType);
if (keyword == Token::Bytes)
{
@@ -151,7 +151,7 @@ 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(string(positionX + 1, positionN));
+ unsigned short n = extractUnsigned(positionX + 1, positionN);
if (
0 < m + n &&
m + n <= 256 &&