Parse a list of expected features that Cranelift should be compiled with, or without.
(&mut self)
| 1177 | |
| 1178 | /// Parse a list of expected features that Cranelift should be compiled with, or without. |
| 1179 | pub fn parse_cranelift_features(&mut self) -> ParseResult<Vec<Feature<'a>>> { |
| 1180 | let mut list = Vec::new(); |
| 1181 | while self.token() == Some(Token::Identifier("feature")) { |
| 1182 | self.consume(); |
| 1183 | let has = !self.optional(Token::Bang); |
| 1184 | match (self.token(), has) { |
| 1185 | (Some(Token::String(flag)), true) => list.push(Feature::With(flag)), |
| 1186 | (Some(Token::String(flag)), false) => list.push(Feature::Without(flag)), |
| 1187 | (tok, _) => { |
| 1188 | return err!( |
| 1189 | self.loc, |
| 1190 | format!("Expected feature flag string, got {:?}", tok) |
| 1191 | ); |
| 1192 | } |
| 1193 | } |
| 1194 | self.consume(); |
| 1195 | } |
| 1196 | Ok(list) |
| 1197 | } |
| 1198 | |
| 1199 | /// Parse a list of function definitions. |
| 1200 | /// |