Merge pull request #38 from alexcrichton/underscore

Lex underscore in unicode escapes
This commit is contained in:
Alex Crichton 2017-12-25 17:32:53 -06:00 committed by GitHub
commit 21d2d11153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 21 deletions

View File

@ -722,28 +722,12 @@ fn backslash_u<I>(chars: &mut I) -> bool
{
next_ch!(chars @ '{');
next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F');
let b = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '}');
if b == '}' {
return true
loop {
let c = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '_' | '}');
if c == '}' {
return true;
}
}
let c = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '}');
if c == '}' {
return true
}
let d = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '}');
if d == '}' {
return true
}
let e = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '}');
if e == '}' {
return true
}
let f = next_ch!(chars @ '0'...'9' | 'a'...'f' | 'A'...'F' | '}');
if f == '}' {
return true
}
next_ch!(chars @ '}');
true
}
fn float(input: &str) -> PResult<()> {

View File

@ -47,6 +47,8 @@ fn roundtrip() {
");
roundtrip("'a");
roundtrip("'static");
roundtrip("'\\u{10__FFFF}'");
roundtrip("\"\\u{10_F0FF__}foo\\u{1_0_0_0__}\"");
}
#[test]