Skip to content

Conversation

ehwan
Copy link
Owner

@ehwan ehwan commented Sep 23, 2025

No description provided.

@ehwan ehwan requested a review from Copilot September 23, 2025 01:37
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a state field to ParseError structures across both deterministic and nondeterministic parsers. The change improves error reporting by providing state information where parsing errors occur, making debugging and error handling more informative.

Key Changes:

  • Refactored ParseError to be generic over Term, Location, and ReduceActionError types instead of generic over DataStack
  • Added state information to all error variants and contexts
  • Updated type aliases throughout the codebase to use the new generic parameters

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rusty_lr_core/src/parser/deterministic/error.rs Restructures deterministic ParseError to use separate error structs with state fields
rusty_lr_core/src/parser/nondeterministic/error.rs Updates nondeterministic ParseError to include states field and simplifies generics
rusty_lr_core/src/parser/deterministic/context.rs Updates context methods to use new error types and includes state information in errors
rusty_lr_core/src/parser/nondeterministic/context.rs Adds state tracking methods and updates error handling to include state information
rusty_lr_parser/src/emit.rs Updates code generation to emit new generic type aliases for ParseError
Multiple generated files Updates type aliases to use new generic parameters instead of DataStack

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

ParseError::ReduceAction(err) => {
write!(
f,
"ReduceAction: {}, State: {}\nSource: {}",
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The newline character \\n in the error message format string creates inconsistent formatting compared to other error messages. Consider using a consistent separator like '; ' instead.

Suggested change
"ReduceAction: {}, State: {}\nSource: {}",
"ReduceAction: {}, State: {}; Source: {}",

Copilot uses AI. Check for mistakes.

Comment on lines 18 to 19
/// States when the error occurred (from every diverged paths)
pub(crate) states: Vec<usize>,
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The comment has a grammatical error. It should be 'from every diverged path' (singular) or 'from all diverged paths' instead of 'from every diverged paths'.

Copilot uses AI. Check for mistakes.

ehwan and others added 2 commits September 23, 2025 10:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ehwan ehwan merged commit 2855108 into main Sep 23, 2025
1 check passed
@ehwan ehwan deleted the state_detail branch September 23, 2025 01:40
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.

1 participant