MCPcopy Create free account
hub / github.com/Glyphack/enderpy / parse_subscript

Method parse_subscript

parser/src/parser/parser.rs:2423–2439  ·  view source on GitHub ↗
(
        &mut self,
        node: Node,
        value: Expression,
    )

Source from the content-addressed store, hash-verified

2421 }
2422
2423 fn parse_subscript(
2424 &mut self,
2425 node: Node,
2426 value: Expression,
2427 ) -> Result<Expression, ParsingError> {
2428 let mut expr = Ok(value);
2429 // To handle cases like a[1][2]...
2430 while self.eat(Kind::LeftBrace) {
2431 let slice = self.parse_slices()?;
2432 expr = Ok(Expression::Subscript(Box::new(Subscript {
2433 node: self.finish_node(node),
2434 value: expr?,
2435 slice,
2436 })));
2437 }
2438 expr
2439 }
2440
2441 // https://docs.python.org/3/reference/expressions.html#atoms
2442 fn parse_atom(&mut self) -> Result<Expression, ParsingError> {

Callers 2

parse_targetMethod · 0.80
parse_primaryMethod · 0.80

Calls 4

SubscriptClass · 0.85
eatMethod · 0.80
parse_slicesMethod · 0.80
finish_nodeMethod · 0.80

Tested by

no test coverage detected