Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b00290

Browse files
committed
Remove timestamp again and some fixes for ufixed parsing.
1 parent 299fef0 commit 9b00290

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

libsolidity/parsing/Token.cpp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,25 @@ tuple<Token::Value, unsigned int, unsigned int> Token::fromIdentifierOrKeyword(s
147147
}
148148
else if (keyword == Token::UFixed || keyword == Token::Fixed)
149149
{
150-
auto positionN = find_if_not(++positionX, _literal.end(), ::isdigit);
151-
int n = parseSize(++positionX, positionN);
152150
if (
153-
0 < m + n &&
154-
m + n <= 256 &&
155-
m % 8 == 0 &&
156-
n % 8 == 0 &&
157-
positionN == _literal.end() &&
158-
*positionX == 'x'
159-
)
160-
{
161-
if (keyword == Token::UFixed)
162-
return make_tuple(Token::UFixed, m, n);
163-
else
164-
return make_tuple(Token::Fixed, m, n);
151+
positionM < positionX &&
152+
positionX < _literal.end() &&
153+
*positionX == 'x' &&
154+
all_of(positionX + 1, _literal.end(), ::isdigit)
155+
) {
156+
int n = parseSize(positionX + 1, _literal.end());
157+
if (
158+
0 < m && m < 256 &&
159+
0 < n && n < 256 &&
160+
m + n <= 256 &&
161+
m % 8 == 0 &&
162+
n % 8 == 0
163+
) {
164+
if (keyword == Token::UFixed)
165+
return make_tuple(Token::UFixed, m, n);
166+
else
167+
return make_tuple(Token::Fixed, m, n);
168+
}
165169
}
166170
}
167171
return make_tuple(Token::Identifier, 0, 0);

libsolidity/parsing/Token.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ namespace solidity
231231
K(Type, "type", 0) \
232232
K(TypeOf, "typeof", 0) \
233233
K(Using, "using", 0) \
234-
T(Timestamp, "timestamp", 0) \
235234
/* Illegal token - not able to scan. */ \
236235
T(Illegal, "ILLEGAL", 0) \
237236
\

0 commit comments

Comments
 (0)