aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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];