MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / expr

Method expr

compiler/src/modules/parser/expr.rs:14–30  ·  view source on GitHub ↗

Entry: Pratt parse, then optional ternary. Recursion is bounded inside `expr_bp`. */

(&mut self)

Source from the content-addressed store, hash-verified

12
13 /* Entry: Pratt parse, then optional ternary. Recursion is bounded inside `expr_bp`. */
14 pub(super) fn expr(&mut self) {
15 self.saw_newline = false;
16 self.expr_bp(0);
17
18 if !self.saw_newline && matches!(self.peek(), Some(TokenType::If)) {
19 self.advance();
20 self.expr_bp(0);
21 let jf = self.emit_jump(OpCode::JumpIfFalse);
22 let jmp = self.emit_jump(OpCode::Jump);
23 self.patch(jf);
24 self.chunk.emit(OpCode::PopTop, 0);
25 self.eat(TokenType::Else);
26 // Recurse so a chained conditional in the else-branch parses (right-associative).
27 self.expr();
28 self.patch(jmp);
29 }
30 }
31
32 pub(super) fn expr_tails(&mut self) {
33 self.postfix_tail();

Callers 15

stmtMethod · 0.80
name_stmtMethod · 0.80
parse_del_targetMethod · 0.80
emit_yieldMethod · 0.80
assignMethod · 0.80
brace_literalMethod · 0.80
list_literalMethod · 0.80
dict_tailMethod · 0.80
set_tailMethod · 0.80
list_tailMethod · 0.80
fstringMethod · 0.80

Calls 6

expr_bpMethod · 0.80
advanceMethod · 0.80
emit_jumpMethod · 0.80
patchMethod · 0.80
emitMethod · 0.80
eatMethod · 0.80

Tested by

no test coverage detected