provide error message when using more than 65535 hash symbols for raw strings

This commit is contained in:
David Cao 2018-05-28 20:19:44 -07:00
parent c40275b34f
commit 313d6c53df

View File

@ -1452,6 +1452,13 @@ impl<'a> StringReader<'a> {
self.bump();
let mut hash_count: u16 = 0;
while self.ch_is('#') {
if hash_count == 65535 {
let bpos = self.next_pos;
self.fatal_span_(start_bpos,
bpos,
"too many `#` symbols: raw strings may be \
delimited by up to 65535 `#` symbols").raise();
}
self.bump();
hash_count += 1;
}
@ -1682,6 +1689,13 @@ impl<'a> StringReader<'a> {
self.bump();
let mut hash_count = 0;
while self.ch_is('#') {
if hash_count == 65535 {
let bpos = self.next_pos;
self.fatal_span_(start_bpos,
bpos,
"too many `#` symbols: raw byte strings may be \
delimited by up to 65535 `#` symbols").raise();
}
self.bump();
hash_count += 1;
}