Parse the invocation of a CLIF function. This is different from parsing a CLIF `call`; it is used in parsing run commands like `run: %fn(42, 4.2) == false`. invocation ::= name "(" [data-value-list] ")"
(&mut self, sig: &Signature)
| 2549 | /// |
| 2550 | /// invocation ::= name "(" [data-value-list] ")" |
| 2551 | fn parse_run_invocation(&mut self, sig: &Signature) -> ParseResult<Invocation> { |
| 2552 | if let Some(Token::Name(name)) = self.token() { |
| 2553 | self.consume(); |
| 2554 | self.match_token( |
| 2555 | Token::LPar, |
| 2556 | "expected invocation parentheses, e.g. %fn(...)", |
| 2557 | )?; |
| 2558 | |
| 2559 | let arg_types = sig |
| 2560 | .params |
| 2561 | .iter() |
| 2562 | .map(|abi| abi.value_type) |
| 2563 | .collect::<Vec<_>>(); |
| 2564 | let args = self.parse_data_value_list(&arg_types)?; |
| 2565 | |
| 2566 | self.match_token( |
| 2567 | Token::RPar, |
| 2568 | "expected invocation parentheses, e.g. %fn(...)", |
| 2569 | )?; |
| 2570 | Ok(Invocation::new(name, args)) |
| 2571 | } else { |
| 2572 | Err(self.error("expected a function name, e.g. %my_fn")) |
| 2573 | } |
| 2574 | } |
| 2575 | |
| 2576 | /// Parse a comparison operator for run commands. |
| 2577 | /// |
no test coverage detected