Open
Conversation
…quence parsers [error handling]: component and sequence parsers were silently dropping statement-level parse failures via `if let Ok` / `if let Some`. Both parse_file implementations now propagate errors with `?`, matching the class parser behaviour. [dispatch style]: introduced typed error enums to replace Box<dyn Error> (component) and Option (sequence): - ComponentError: Base(#[from] BaseParseError<Rule>) | InvalidStatement - SequenceError: Base(#[from] BaseParseError<Rule>) | InvalidStatement All sub-parsers in the sequence parser are converted from Option<T> to Result<T, SequenceError>. Grammar-valid but non-semantic rules (pragma, skinparam, title) return Ok(None) and are intentionally skipped; only genuine parse failures propagate as Err. DiagramParser impls updated to use the new error types. Both error types are re-exported from their respective crate roots and from puml_parser. thiserror dependency added to component_diagram and sequence_diagram BUILD targets. New rust_test unit targets added for inline acceptance tests.
…Error> All three parsers now follow the same dispatch contract: - Component: parse_statement -> Result<Vec<Statement>, ComponentError> (already done) - Sequence: parse_statement -> Result<Vec<Statement>, SequenceError> * Replace Result<Option<Statement>> with Result<Vec<Statement>> * Ok(Some(x)) -> Ok(vec![x]), Ok(None) -> Ok(vec![]) * parse_file appends via Vec::append instead of conditional push - Class: replace visitor closure walker with flat iterator pattern * Remove visit_top_level (recursive FnMut closure with visit_result mutation workaround) * Add flatten_top_level: pure fn flattening top_level/together_def wrapper nodes * Add parse_top_level_element: extracted dispatch fn with direct ? propagation * Apply flatten_top_level in parse_namespace and parse_package as well Eliminates the visit_result workaround needed to propagate errors through FnMut closures that do not support ? operator.
Move format_parse_tree to parser_core so all parsers share the same helper: - Add pub fn format_parse_tree to parser_core/src/lib.rs - Add @crates//:log dep to parser_core, sequence_diagram, and class_diagram BUILD files Component parser: - Remove local format_parse_tree method (now in parser_core) - Update call site and import to use parser_core::format_parse_tree Sequence parser: - Replace eprintln! with log::trace! for raw content at Trace level - Add #[cfg(not(coverage))] parse tree block at Debug | Trace level Class parser: - Replace eprintln! with log::trace! for raw content at Trace level - Add #[cfg(not(coverage))] parse tree block at Debug | Trace level All three parsers now: 1. Log raw source content at LogLevel::Trace via log::trace! 2. Log the structured parse tree at LogLevel::Debug | Trace via log::debug! 3. Never write directly to eprintln! 4. Preserve the #[cfg(not(coverage))] gate on the parse tree call
…ceResolver
- Rename DiagramResolver::visit_document -> resolve and drop the
visit_statement default method + type Statement associated type.
The trait now expresses a single clear contract: resolve a parsed
document into a logic model.
- ComponentResolver: DiagramResolver impl uses resolve(); visit_statement
becomes a plain private method in impl ComponentResolver.
- ClassResolver: DiagramResolver impl uses resolve(); type Statement = ()
removed; DESIGN comment added to explain the single-pass pattern.
- SequenceResolver (new): wraps build_tree() in a DiagramResolver impl.
SequenceResolverError is an uninhabited enum (build_tree is infallible)
that satisfies the std::error::Error bound required by the CLI helper.
- CLI: Sequence(SequenceTree) variant added to ResolvedDiagram;
resolve_parsed_diagram routes sequence diagrams through SequenceResolver
instead of hard-coding Err("Sequence diagrams not implemented").
- Tests: arrow detection tests added to logic_parser.rs; sequence
resolver unit tests in sequence_resolver.rs; end-to-end pipeline
test in puml_cli; puml_resolver_sequence_unit_test BUILD target added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.