MCPcopy Index your code
hub / github.com/endbasic/endbasic / parse_required_expr

Method parse_required_expr

core/src/parser.rs:1013–1019  ·  view source on GitHub ↗

Wrapper over `parse_expr` that requires an expression to be present and returns an error with `msg` otherwise.

(&mut self, msg: &'static str)

Source from the content-addressed store, hash-verified

1011 /// Wrapper over `parse_expr` that requires an expression to be present and returns an error
1012 /// with `msg` otherwise.
1013 fn parse_required_expr(&mut self, msg: &'static str) -> Result<Expr> {
1014 let next_pos = self.lexer.peek()?.pos;
1015 match self.parse_expr(None)? {
1016 Some(expr) => Ok(expr),
1017 None => Err(Error::Bad(next_pos, msg.to_owned())),
1018 }
1019 }
1020
1021 /// Parses a `GOSUB` statement.
1022 fn parse_gosub(&mut self) -> Result<Statement> {

Callers 9

parse_assignmentMethod · 0.80
parse_do_guardMethod · 0.80
parse_if_multilineMethod · 0.80
parse_ifMethod · 0.80
parse_forMethod · 0.80
parse_case_guardsMethod · 0.80
parse_selectMethod · 0.80
parse_whileMethod · 0.80

Calls 2

parse_exprMethod · 0.80
peekMethod · 0.45

Tested by

no test coverage detected