Skip to content

Add ability to get a Span from a PIdx, improve errors#627

Merged
ltratt merged 1 commit intosoftdevteam:masterfrom
ratmice:prod_spans
Mar 4, 2026
Merged

Add ability to get a Span from a PIdx, improve errors#627
ltratt merged 1 commit intosoftdevteam:masterfrom
ratmice:prod_spans

Conversation

@ratmice
Copy link
Collaborator

@ratmice ratmice commented Mar 4, 2026

This tries to improve an error (we discussed it at the time in) #456
Tested manually with the following example changes/output.

diff --git a/lrpar/examples/calc_actions/src/calc.y b/lrpar/examples/calc_actions/src/calc.y
index 8388ba2c..7164ad55 100644
--- a/lrpar/examples/calc_actions/src/calc.y
+++ b/lrpar/examples/calc_actions/src/calc.y
@@ -10,7 +10,7 @@ Expr -> Result<u64, Box<dyn Error>>:
         $1?.checked_add($3?)
               .ok_or_else(|| Box::<dyn Error>::from("Overflow detected."))
       }
-    | Term { $1 }
+    | Term
     ;

 Term -> Result<u64, Box<dyn Error>>:
  --- stderr

  thread 'main' (2683939) panicked at lrpar/examples/calc_actions/build.rs:17:10:
  called `Result::unwrap()` on an `Err` value:
  Error at ~/grmtools/lrpar/examples/calc_actions/src/calc.y:13:7
  13|     | Term
            ^^^^ Production is missing action code

@ltratt
Copy link
Member

ltratt commented Mar 4, 2026

Excellent!

@ltratt ltratt enabled auto-merge March 4, 2026 10:25
@ltratt ltratt added this pull request to the merge queue Mar 4, 2026
Merged via the queue into softdevteam:master with commit 487cc3f Mar 4, 2026
2 checks passed
@ratmice ratmice deleted the prod_spans branch March 4, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants