Merge pull request #250 from ehuss/reject-del
0.5: Reject 0x7f (DEL) in strings.
This commit is contained in:
commit
4971310a96
|
@ -331,7 +331,7 @@ impl<'a> Tokenizer<'a> {
|
||||||
|
|
||||||
fn literal_string(&mut self, start: usize) -> Result<Token<'a>, Error> {
|
fn literal_string(&mut self, start: usize) -> Result<Token<'a>, Error> {
|
||||||
self.read_string('\'', start, &mut |_me, val, _multi, i, ch| {
|
self.read_string('\'', start, &mut |_me, val, _multi, i, ch| {
|
||||||
if ch == '\u{09}' || ('\u{20}' <= ch && ch <= '\u{10ffff}') {
|
if ch == '\u{09}' || ('\u{20}' <= ch && ch <= '\u{10ffff}' && ch != '\u{7f}') {
|
||||||
val.push(ch);
|
val.push(ch);
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
|
@ -373,7 +373,7 @@ impl<'a> Tokenizer<'a> {
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
ch if '\u{20}' <= ch && ch <= '\u{10ffff}' => {
|
ch if '\u{20}' <= ch && ch <= '\u{10ffff}' && ch != '\u{7f}' => {
|
||||||
val.push(ch);
|
val.push(ch);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,6 @@ fn bad() {
|
||||||
bad("a = 1_");
|
bad("a = 1_");
|
||||||
bad("''");
|
bad("''");
|
||||||
bad("a = 9e99999");
|
bad("a = 9e99999");
|
||||||
|
bad("a = \"\u{7f}\"");
|
||||||
|
bad("a = '\u{7f}'");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue