aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorLeonardo Alt <leo@ethereum.org>2018-05-22 23:37:21 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-05-30 22:14:53 +0800
commitac6871078940f0ae4a47380091fc46ed46a63d0a (patch)
tree92795e519aeb424245c68420dad1e9bd97bd473b /libsolidity
parent41965ca2626e1e09de7fb1eb40ae4751b5e289fa (diff)
downloaddexon-solidity-ac6871078940f0ae4a47380091fc46ed46a63d0a.tar.gz
dexon-solidity-ac6871078940f0ae4a47380091fc46ed46a63d0a.tar.zst
dexon-solidity-ac6871078940f0ae4a47380091fc46ed46a63d0a.zip
Disallow trailing dots that are not followed by a number
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/parsing/Scanner.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/libsolidity/parsing/Scanner.cpp b/libsolidity/parsing/Scanner.cpp
index 6541f6c2..801d2cc4 100644
--- a/libsolidity/parsing/Scanner.cpp
+++ b/libsolidity/parsing/Scanner.cpp
@@ -768,8 +768,14 @@ Token::Value Scanner::scanNumber(char _charSeen)
scanDecimalDigits(); // optional
if (m_char == '.')
{
+ // A '.' has to be followed by a number.
+ if (m_source.isPastEndOfInput() || !isDecimalDigit(m_source.get(1)))
+ {
+ literal.complete();
+ return Token::Number;
+ }
addLiteralCharAndAdvance();
- scanDecimalDigits(); // optional
+ scanDecimalDigits();
}
}
}