diff options
Diffstat (limited to 'lib/parse_plural.h')
-rw-r--r-- | lib/parse_plural.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/parse_plural.h b/lib/parse_plural.h index 2b78de89..7af6809e 100644 --- a/lib/parse_plural.h +++ b/lib/parse_plural.h @@ -152,6 +152,7 @@ private: }; Token(Type t) : type(t), number(0) {} + Token(int num) : type(TK_CONST_NUMBER), number(num) {} Type type; int number; //if type == TK_CONST_NUMBER @@ -195,13 +196,12 @@ private: } auto digitEnd = std::find_if(pos, stream.end(), [](char c) { return !zen::isDigit(c); }); - ptrdiff_t digitCount = digitEnd - pos; - if (digitCount != 0) + + if (digitEnd != pos) { - Token out(Token::TK_CONST_NUMBER); - out.number = zen::stringTo<int>(std::string(&*pos, digitCount)); - pos += digitCount; - return out; + int number = zen::stringTo<int>(std::string(&*pos, digitEnd - pos)); + pos = digitEnd; + return number; } throw ParsingError(); //unknown token |