Match and a consume a possibly empty sequence of memory operation flags.
(&mut self)
| 900 | |
| 901 | // Match and a consume a possibly empty sequence of memory operation flags. |
| 902 | fn optional_memflags(&mut self) -> ParseResult<MemFlagsData> { |
| 903 | let mut flags = MemFlagsData::new(); |
| 904 | loop { |
| 905 | match self.token() { |
| 906 | Some(Token::Identifier(text)) => match flags.set_by_name(text) { |
| 907 | Ok(true) => { |
| 908 | self.consume(); |
| 909 | } |
| 910 | Ok(false) => break, |
| 911 | Err(msg) => return err!(self.loc, msg), |
| 912 | }, |
| 913 | Some(Token::AliasRegion(n)) => { |
| 914 | if flags.alias_region().is_some() { |
| 915 | return err!(self.loc, "cannot set more than one alias region"); |
| 916 | } |
| 917 | let region = ir::AliasRegion::new(n as usize); |
| 918 | flags.set_alias_region(Some(region)); |
| 919 | self.consume(); |
| 920 | } |
| 921 | _ => break, |
| 922 | } |
| 923 | } |
| 924 | Ok(flags) |
| 925 | } |
| 926 | |
| 927 | // Match and consume an identifier. |
| 928 | fn match_any_identifier(&mut self, err_msg: &str) -> ParseResult<&'a str> { |
no test coverage detected