(&mut self)
| 404 | } |
| 405 | |
| 406 | fn bump_int(&mut self) -> Int { |
| 407 | let text = self.current_token_text(); |
| 408 | let value = if let Some(digits) = |
| 409 | text.strip_prefix("0x").or_else(|| text.strip_prefix("0X")) |
| 410 | { |
| 411 | Int::from_str_radix(&strip_underscores(digits), 16, text) |
| 412 | } else if let Some(digits) = text.strip_prefix("0o").or_else(|| text.strip_prefix("0O")) { |
| 413 | Int::from_str_radix(&strip_underscores(digits), 8, text) |
| 414 | } else if let Some(digits) = text.strip_prefix("0b").or_else(|| text.strip_prefix("0B")) { |
| 415 | Int::from_str_radix(&strip_underscores(digits), 2, text) |
| 416 | } else { |
| 417 | Int::from_str(&strip_underscores(text)) |
| 418 | } |
| 419 | .expect("lexer validated integer literal"); |
| 420 | self.bump(TokenKind::Int); |
| 421 | value |
| 422 | } |
| 423 | |
| 424 | fn bump_float(&mut self) -> f64 { |
| 425 | let value = f64::from_str(&strip_underscores(self.current_token_text())) |
no test coverage detected