Lex underscore in unicode escapes
diff --git a/src/stable.rs b/src/stable.rs
index 8277d4c..116635c 100644
--- a/src/stable.rs
+++ b/src/stable.rs
@@ -722,28 +722,12 @@
{
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<()> {
diff --git a/tests/test.rs b/tests/test.rs
index 4d6831b..831c0cb 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -47,6 +47,8 @@
");
roundtrip("'a");
roundtrip("'static");
+ roundtrip("'\\u{10__FFFF}'");
+ roundtrip("\"\\u{10_F0FF__}foo\\u{1_0_0_0__}\"");
}
#[test]