(&mut self, terminator: &str)
| 346 | } |
| 347 | |
| 348 | fn parse_rust_until(&mut self, terminator: &str) -> syn::Result<ExpressionWithoutId> { |
| 349 | let mut t = vec![]; |
| 350 | |
| 351 | while !self.peek_operator("|=") && |
| 352 | !self.peek_operator("&&") && |
| 353 | !self.peek_operator("==>") && |
| 354 | !self.peek_operator(terminator) && |
| 355 | !self.tokens.is_empty() { |
| 356 | t.push(self.pop().unwrap()); |
| 357 | } |
| 358 | let mut stream = TokenStream::new(); |
| 359 | stream.extend(t.into_iter()); |
| 360 | |
| 361 | let cloned: VecDeque<TokenTree> = stream.clone().into_iter().collect(); |
| 362 | if let Some(span) = self.contains_operator_recursive(&cloned, "==>") { |
| 363 | Err(self.error_no_implies(span)) |
| 364 | } else if cloned.is_empty() { |
| 365 | Err(self.error_expected("expression")) |
| 366 | } else { |
| 367 | Ok(ExpressionWithoutId { |
| 368 | spec_id: common::SpecificationId::dummy(), |
| 369 | id: (), |
| 370 | expr: syn::parse2(stream)?, |
| 371 | }) |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | /// is there any non-prusti operator following the first thing? |
| 376 | fn is_part_of_rust_expr(&mut self) -> bool { |
no test coverage detected