Remove timestamp again and some fixes for ufixed parsing.

This commit is contained in:
chriseth 2016-03-11 17:42:55 +01:00
parent 299fef0c79
commit 9b00290d74
2 changed files with 18 additions and 15 deletions

View File

@ -147,23 +147,27 @@ tuple<Token::Value, unsigned int, unsigned int> Token::fromIdentifierOrKeyword(s
} }
else if (keyword == Token::UFixed || keyword == Token::Fixed) else if (keyword == Token::UFixed || keyword == Token::Fixed)
{ {
auto positionN = find_if_not(++positionX, _literal.end(), ::isdigit);
int n = parseSize(++positionX, positionN);
if ( if (
0 < m + n && positionM < positionX &&
positionX < _literal.end() &&
*positionX == 'x' &&
all_of(positionX + 1, _literal.end(), ::isdigit)
) {
int n = parseSize(positionX + 1, _literal.end());
if (
0 < m && m < 256 &&
0 < n && n < 256 &&
m + n <= 256 && m + n <= 256 &&
m % 8 == 0 && m % 8 == 0 &&
n % 8 == 0 && n % 8 == 0
positionN == _literal.end() && ) {
*positionX == 'x'
)
{
if (keyword == Token::UFixed) if (keyword == Token::UFixed)
return make_tuple(Token::UFixed, m, n); return make_tuple(Token::UFixed, m, n);
else else
return make_tuple(Token::Fixed, m, n); return make_tuple(Token::Fixed, m, n);
} }
} }
}
return make_tuple(Token::Identifier, 0, 0); return make_tuple(Token::Identifier, 0, 0);
} }
return make_tuple(keywordByName(_literal), 0, 0); return make_tuple(keywordByName(_literal), 0, 0);

View File

@ -231,7 +231,6 @@ namespace solidity
K(Type, "type", 0) \ K(Type, "type", 0) \
K(TypeOf, "typeof", 0) \ K(TypeOf, "typeof", 0) \
K(Using, "using", 0) \ K(Using, "using", 0) \
T(Timestamp, "timestamp", 0) \
/* Illegal token - not able to scan. */ \ /* Illegal token - not able to scan. */ \
T(Illegal, "ILLEGAL", 0) \ T(Illegal, "ILLEGAL", 0) \
\ \