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

Method parse_unary_arithmetic_operation

parser/src/parser/parser.rs:2198–2211  ·  view source on GitHub ↗

https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations

(&mut self)

Source from the content-addressed store, hash-verified

2196
2197 // https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations
2198 fn parse_unary_arithmetic_operation(&mut self) -> Result<Expression, ParsingError> {
2199 let node = self.start_node();
2200 if self.cur_kind().is_unary_op() {
2201 let op = map_unary_operator(&self.cur_kind());
2202 self.bump_any();
2203 let operand = self.parse_unary_arithmetic_operation()?;
2204 return Ok(Expression::UnaryOp(Box::new(UnaryOperation {
2205 node: self.finish_node(node),
2206 op,
2207 operand,
2208 })));
2209 }
2210 self.parse_power_expression()
2211 }
2212
2213 // https://docs.python.org/3/reference/expressions.html#the-power-operator
2214 fn parse_power_expression(&mut self) -> Result<Expression, ParsingError> {

Callers 2

Calls 7

map_unary_operatorFunction · 0.85
start_nodeMethod · 0.80
is_unary_opMethod · 0.80
cur_kindMethod · 0.80
bump_anyMethod · 0.80
finish_nodeMethod · 0.80

Tested by

no test coverage detected