Skip to content

Comments

Improve parser error messages#1425

Merged
KCarretto merged 4 commits intomainfrom
improve-parser-errors-4951876564411198904
Dec 27, 2025
Merged

Improve parser error messages#1425
KCarretto merged 4 commits intomainfrom
improve-parser-errors-4951876564411198904

Conversation

@google-labs-jules
Copy link
Contributor

Improved readability of parser error messages by implementing Display for TokenKind and updating the error formatting logic. Errors now report "unexpected token 'X'" instead of dumping the internal Token struct debug output. Verified with a regression test case covering the reported issue.


PR created automatically by Jules for task 4951876564411198904 started by @KCarretto

Updated the `eldritch-core` parser to produce user-friendly error messages when encountering unexpected tokens.
- Implemented `fmt::Display` for `TokenKind` in `src/token.rs` to provide readable string representations of tokens (e.g., `+` instead of `Plus`).
- Modified `src/parser/expr.rs` to use this display format in error messages, changing "Found Token { ... }" to "unexpected token '...'".

This resolves the issue where parser errors exposed internal debug representations to the user.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 27, 2025

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
22288    ±0 22285    ±0 3    ±0 0    ±0 0    ±0 0    ±0 1ms    ±0

Previous Results

Build 🏗️ Result 🧪 Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
#44 22288 22285 3 0 0 0 490791h 50m

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
22288 0 3 44.9s

Fail Rate

Fail Rate 0.01%    ±0
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
TestMuxHistoryOrdering 8 7 1 12.50    ↑12.50
TestMuxHistoryOrdering 8 7 1 12.50    ↑12.50
TestMuxHistoryOrdering 8 7 1 12.50    ↑12.50
TestMuxHistoryOrdering 8 7 1 12.50    ↑12.50
TestMuxHistoryOrdering 8 7 1 12.50    ↑12.50
TestMuxHistoryOrdering 8 7 1 12.50    ↑12.50
TestMuxHistoryOrdering 8 7 1 12.50    ↑12.50
TestMuxHistoryOrdering 8 7 1 12.50    ↑12.50
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: process::kill_impl::tests::test_process_kill 26 25 1 3.85    ↑3.85
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70
eldritch: file::moveto_impl::tests::test_moveto_file 27 26 1 3.70    ↑3.70

Failed Tests

Failed Tests
❌ TestMuxHistoryOrdering
=== RUN   TestMuxHistoryOrdering
=== PAUSE TestMuxHistoryOrdering
=== CONT  TestMuxHistoryOrdering
    mux_test.go:214: monitor did not receive message in time
--- FAIL: TestMuxHistoryOrdering (1.25s)

Trace:

No trace available
❌ eldritch: file::moveto_impl::tests::test_moveto_file
Error: Access is denied. (os error 5) at path "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\.tmppJ2JkY"

Trace:

Error: Access is denied. (os error 5) at path "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\.tmppJ2JkY"
❌ eldritch: process::kill_impl::tests::test_process_kill
thread 'process::kill_impl::tests::test_process_kill' (506984) panicked at lib/eldritch/src/process/kill_impl.rs:63:21

Trace:

thread 'process::kill_impl::tests::test_process_kill' (506984) panicked at lib/eldritch/src/process/kill_impl.rs:63:21:
assertion `left == right` failed
  left: false
 right: true
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
eldritch: random::string_impl::tests::test_string_uniform 25 39.5s 44.9s
eldritch: random::string_impl::tests::test_string_uniform 25 39.5s 44.9s
eldritch: random::string_impl::tests::test_string_uniform 25 39.5s 44.9s
eldritch: random::string_impl::tests::test_string_uniform 25 39.5s 44.9s
eldritch: random::string_impl::tests::test_string_uniform 25 39.5s 44.9s
eldritch: random::string_impl::tests::test_string_uniform 25 39.5s 44.9s
eldritch: random::string_impl::tests::test_string_uniform 25 39.5s 44.9s
eldritch: random::string_impl::tests::test_string_uniform 25 39.5s 44.9s
eldritch: random::string_impl::tests::test_string_uniform 25 39.5s 44.9s
eldritch: random::string_impl::tests::test_string_uniform 25 39.5s 44.9s

🍂 No flaky tests in this run.

Github Test Reporter by CTRF 💚

🔄 This comment has been updated

}

self.error(&format!("Expect expression. Found {:?}", self.peek()))
self.error(&format!("unexpected token \"{}\"", self.peek().kind))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jules uppercase this "Unexpected..."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I have uppercased the error message.

Uppercased "Unexpected" in the parser error message as requested in code review.
@KCarretto KCarretto requested a review from hulto December 27, 2025 06:06
@KCarretto KCarretto marked this pull request as ready for review December 27, 2025 06:08
@KCarretto
Copy link
Collaborator

Fixes #1296

@google-labs-jules
Copy link
Contributor Author

Fixes #1296

Acknowledged.

Uppercased "Unexpected" in the parser error message as requested in code review.
@KCarretto KCarretto merged commit 45ee849 into main Dec 27, 2025
9 of 11 checks passed
@KCarretto KCarretto deleted the improve-parser-errors-4951876564411198904 branch December 27, 2025 16:35
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