aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing
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
parent2738f4066a3786bea5d5c0b49709fa99547b8eff (diff)
downloaddexon-solidity-9f5c3977fb0c1a4607a955811ea3cda6e0547b66.tar.gz
dexon-solidity-9f5c3977fb0c1a4607a955811ea3cda6e0547b66.tar.zst
dexon-solidity-9f5c3977fb0c1a4607a955811ea3cda6e0547b66.zip
changed extractUnsigned to handle iterators rather than a string
Diffstat (limited to 'libsolidity/parsing')
-rw-r--r--libsolidity/parsing/Token.cpp8
-rw-r--r--libsolidity/parsing/Token.h2
2 files changed, 5 insertions, 5 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 &&
diff --git a/libsolidity/parsing/Token.h b/libsolidity/parsing/Token.h
index ce6eed18..fea80ef7 100644
--- a/libsolidity/parsing/Token.h
+++ b/libsolidity/parsing/Token.h
@@ -310,7 +310,7 @@ private:
// the variable's identity as an identifier. If an invalid conversion
// error is thrown (usually in the case of grabbing N from a fixed type)
// then a 0 is thrown to purposely ensure that it will declare itself as an identifier
- static unsigned extractUnsigned(std::string const& _literal);
+ static unsigned extractUnsigned(std::string::const_iterator const& _begin, std::string::const_iterator const& _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];