Match and consume an optional offset32 immediate. Note that this will match an empty string as an empty offset, and that if an offset is present, it must contain a sign.
(&mut self)
| 828 | // Note that this will match an empty string as an empty offset, and that if an offset is |
| 829 | // present, it must contain a sign. |
| 830 | fn optional_offset_imm64(&mut self) -> ParseResult<Imm64> { |
| 831 | if let Some(Token::Integer(text)) = self.token() { |
| 832 | if text.starts_with('+') || text.starts_with('-') { |
| 833 | self.consume(); |
| 834 | // Lexer just gives us raw text that looks like an integer. |
| 835 | // Parse it as an `Offset32` to check for overflow and other issues. |
| 836 | return text.parse().map_err(|e| self.error(e)); |
| 837 | } |
| 838 | } |
| 839 | // If no explicit offset is present, the offset is 0. |
| 840 | Ok(Imm64::new(0)) |
| 841 | } |
| 842 | |
| 843 | // Match and consume an Ieee16 immediate. |
| 844 | fn match_ieee16(&mut self, err_msg: &str) -> ParseResult<Ieee16> { |