Skip to main content

Module expr

Module expr 

Source
Expand description

IR for PL/SQL expressions and name references.

Sibling of stmt: where statements carry raw rhs_text / cond_text slices, the expression IR shipped here lets downstream passes (lineage, bindgen, SAST) reason about expression structure without re-tokenising.

The expression grammar is intentionally conservative — every shape recognised here is one we’ve found in the lab corpus and the synthetic L1 / L2 fixtures. Anything outside this set lowers to Expr::Raw with the original text, mirroring the Statement::Unrecognized posture from.

§/oracle evidence

  • DATABASE-REFERENCE.md PL/SQL Language Reference — the recognised reference shapes (<ident>, <schema>.<obj>, <schema>.<obj>.<member>, <table>(<args>) for function calls and array access) and the operator precedence table for binary ops come from the PL/SQL Language Reference chapter on expressions.
  • LOW-LEVEL-CATALOGS.md Data Dictionary View Families — ALL_IDENTIFIERS is the PL/Scope-side view that later passes cross-check our reference resolution against.

Structs§

NameRef

Enums§

Expr
One PL/SQL expression node.
UnknownExprReason

Constants§

MAX_EXPR_DEPTH
Maximum expression-lowering recursion depth. Real well-formed PL/SQL expressions nest far below this; the cap exists only so a crafted flat binary chain or pathologically-nested paren / call / unary spine cannot drive lower_expression (and the secondary tree-walk consumers that re-walk the produced Box<Expr> chain to identical depth — collect_calls, collect_expr_flow, canonicalize_expr) into a stack-overflow / SIGABRT. Chosen high enough that it never clips genuine expressions and low enough that 256 frames of the walk cannot overflow even a 2 MiB tokio worker stack. Mirrors the honest-degradation posture of crate::MAX_RELOWER_DEPTH.

Functions§

lower_expression
Lower a raw expression-source slice into an Expr. Errors surface as Expr::Raw with a typed reason — never panic.