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

Method parse_array_assignment

core/src/parser.rs:335–349  ·  view source on GitHub ↗

Parses an assignment to the array `varref` with `subscripts`, both of which have already been read.

(
        &mut self,
        vref: VarRef,
        vref_pos: LineCol,
        subscripts: Vec<Expr>,
    )

Source from the content-addressed store, hash-verified

333 /// Parses an assignment to the array `varref` with `subscripts`, both of which have already
334 /// been read.
335 fn parse_array_assignment(
336 &mut self,
337 vref: VarRef,
338 vref_pos: LineCol,
339 subscripts: Vec<Expr>,
340 ) -> Result<Statement> {
341 let expr = self.parse_required_expr("Missing expression in array assignment")?;
342
343 let next = self.lexer.peek()?;
344 match &next.token {
345 Token::Eof | Token::Eol | Token::Else => (),
346 t => return Err(Error::Bad(next.pos, format!("Unexpected {} in array assignment", t))),
347 }
348 Ok(Statement::ArrayAssignment(ArrayAssignmentSpan { vref, vref_pos, subscripts, expr }))
349 }
350
351 /// Parses a builtin call (things of the form `INPUT a`).
352 fn parse_builtin_call(

Callers 1

Calls 2

parse_required_exprMethod · 0.80
peekMethod · 0.45

Tested by

no test coverage detected