aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing/Scanner.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-09-06 17:05:35 +0800
committerchriseth <chris@ethereum.org>2018-09-10 18:28:34 +0800
commitc0d9b492a23537e99495ff84a4a24f55ebd9ebc7 (patch)
tree613eff0771b707d4f1847310eef28adb1d05c3e3 /libsolidity/parsing/Scanner.h
parent65a439b0fbbd3723f9b6a456cbb9927b3ab5d121 (diff)
downloaddexon-solidity-c0d9b492a23537e99495ff84a4a24f55ebd9ebc7.tar
dexon-solidity-c0d9b492a23537e99495ff84a4a24f55ebd9ebc7.tar.gz
dexon-solidity-c0d9b492a23537e99495ff84a4a24f55ebd9ebc7.tar.bz2
dexon-solidity-c0d9b492a23537e99495ff84a4a24f55ebd9ebc7.tar.lz
dexon-solidity-c0d9b492a23537e99495ff84a4a24f55ebd9ebc7.tar.xz
dexon-solidity-c0d9b492a23537e99495ff84a4a24f55ebd9ebc7.tar.zst
dexon-solidity-c0d9b492a23537e99495ff84a4a24f55ebd9ebc7.zip
This fixes several bugs with regards to line breaks and comments:
- any unicode line break (line feed, vertical tab, form feed, carriage return, NEL, LS and PS) is considered to terminate a single-line comment. The line break itself is considered to be the next token after the comment, leading to a parser error if it is not an ascii character (i.e. for NEL, LS and PS). - unterminated multiline comments are considered illegal tokens - '/** /' is considered an unterminated multiline comment (previously, whitespace was allowed before the last '/'
Diffstat (limited to 'libsolidity/parsing/Scanner.h')
-rw-r--r--libsolidity/parsing/Scanner.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/libsolidity/parsing/Scanner.h b/libsolidity/parsing/Scanner.h
index 0adaa6fd..602532e4 100644
--- a/libsolidity/parsing/Scanner.h
+++ b/libsolidity/parsing/Scanner.h
@@ -197,8 +197,8 @@ private:
/// Skips all whitespace and @returns true if something was skipped.
bool skipWhitespace();
- /// Skips all whitespace except Line feeds and returns true if something was skipped
- bool skipWhitespaceExceptLF();
+ /// Skips all whitespace that are neither '\r' nor '\n'.
+ void skipWhitespaceExceptUnicodeLinebreak();
Token::Value skipSingleLineComment();
Token::Value skipMultiLineComment();
@@ -218,6 +218,9 @@ private:
/// is scanned.
bool scanEscape();
+ /// @returns true iff we are currently positioned at a unicode line break.
+ bool isUnicodeLinebreak();
+
/// Return the current source position.
int sourcePos() const { return m_source.position(); }
bool isSourcePastEndOfInput() const { return m_source.isPastEndOfInput(); }