Parse Gerber command streams without dropping errors - #26
Open
mfiumara wants to merge 2 commits into
Open
Conversation
Commands are delimited by `*`, not newlines (spec 4.1). The old line-based tokenizer merged single-line files into one block, causing a spurious CoordinateDataWithoutOperationCode error. Now splits on `*`, treats `%...%` spans (incl. macros) as one block, and ends a block at a newline outside such spans.
Contributor
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.


Summary
*-terminated Gerber commands even when a file does not put each command on its own lineGerber line endings are formatting only;
*terminates commands. The released parser can therefore lose valid commands in compact streams. The first commit is the focused tokenizer change from #25. The follow-up keeps every outerparse_lineerror in the returned document rather than losing it through iterator flattening.This intentionally excludes #25's later breaking
ErrorContextAPI change and single-digit G-code expansion.Verification
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warnings -A clippy::blocks_in_conditions(the allowed test lint predates this change)cargo test --all-features— 57 passed