diff options
Diffstat (limited to '2015/rs/code/eight')
-rw-r--r-- | 2015/rs/code/eight/src/main.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/2015/rs/code/eight/src/main.rs b/2015/rs/code/eight/src/main.rs index b51f436..6917a54 100644 --- a/2015/rs/code/eight/src/main.rs +++ b/2015/rs/code/eight/src/main.rs @@ -5,7 +5,7 @@ enum ParseState { Verbatim, Esc, Hex1, - Hex2(u32) + Hex2 } fn main() { @@ -25,8 +25,8 @@ fn main() { (ParseState::Esc, 'x') => { state = ParseState::Hex1; }, (ParseState::Esc, c) => { buf.push(c); state = ParseState::Verbatim; }, - (ParseState::Hex1, c) => { state = ParseState::Hex2(c.to_digit(16).unwrap() * 16); }, - (ParseState::Hex2(n), c) => { buf.push(/*char::from_u32(n + c.to_digit(16).unwrap()).unwrap()*/'?'); state = ParseState::Verbatim; }, + (ParseState::Hex1, _) => { state = ParseState::Hex2; }, + (ParseState::Hex2, _) => { buf.push('?'); state = ParseState::Verbatim; }, } } (s, buf) |