mirror of
https://gitee.com/openharmony/third_party_rust_proc-macro2
synced 2024-11-27 09:31:44 +00:00
Merge pull request #38 from alexcrichton/underscore
Lex underscore in unicode escapes
This commit is contained in:
commit
21d2d11153
@ -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<()> {
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user