aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-05-31 00:51:52 +0800
committerGitHub <noreply@github.com>2018-05-31 00:51:52 +0800
commit0a1a8bfb09f996ad288baf4f195d621e143de7d9 (patch)
treec02a87fa814cad222cd138b54fc73f52251983b1 /libsolidity
parent0e3d4f773fb40c3368d968e165c24ff653860120 (diff)
parentac6871078940f0ae4a47380091fc46ed46a63d0a (diff)
downloaddexon-solidity-0a1a8bfb09f996ad288baf4f195d621e143de7d9.tar.gz
dexon-solidity-0a1a8bfb09f996ad288baf4f195d621e143de7d9.tar.zst
dexon-solidity-0a1a8bfb09f996ad288baf4f195d621e143de7d9.zip
Merge pull request #4172 from ethereum/trailing_dot
[BREAKING] Disallow trailing dot not followed by 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();
}
}
}