Parse an optional source location. Return an optional source location if no real location is present.
(&mut self)
| 938 | /// |
| 939 | /// Return an optional source location if no real location is present. |
| 940 | fn optional_srcloc(&mut self) -> ParseResult<ir::SourceLoc> { |
| 941 | if let Some(Token::SourceLoc(text)) = self.token() { |
| 942 | match u32::from_str_radix(text, 16) { |
| 943 | Ok(num) => { |
| 944 | self.consume(); |
| 945 | Ok(ir::SourceLoc::new(num)) |
| 946 | } |
| 947 | Err(_) => return err!(self.loc, "invalid source location: {}", text), |
| 948 | } |
| 949 | } else { |
| 950 | Ok(Default::default()) |
| 951 | } |
| 952 | } |
| 953 | |
| 954 | /// Parse an optional list of debug tags. |
| 955 | fn optional_debug_tags(&mut self) -> ParseResult<Vec<DebugTag>> { |
no test coverage detected