Repository navigation
Record spans in the event API; recovery keeps the record after a missing ; (0.11.4) - #21
Merged
Merged
Conversation
A consumer of the event API could not say where a record it rejects sits in the file: a record the IFC model cannot represent was reported without a position (openbimrs/ifc#614, #616). The parser already computes the span for the reference check. A provided method hands it over without changing any sink that only implements `event`. Closes #18.
Recovery resynchronized at the next `;`, so a record missing its `;` took the following record with it, and no diagnostic named that record. A consumer that reserves skipped ids could reuse the id, and a conflicting duplicate went unreported (openbimrs/ifc#668). The scan now also stops before a `#id =` outside a literal, so the next record is parsed and kept, which recovers more than listing the swallowed ids would. It reads comments the way the scan does rather than through the lexer: the two disagree on a comment opener split by a control, and that made every `#` look ahead to the end of the file. Closes #20.
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.
Closes #18. Closes #20.
#18. Adds a provided method,
EventSink::data_record(record, span). The parser calls it for each data record with the span from#through;. The default forwards toevent(Event::DataRecord(record)), so existing sinks and closures keep working.#20. Recovery now also stops before the next
#id =outside a literal, so a record missing its;no longer swallows the next record. That record is parsed and kept, which recovers more than listing the swallowed ids would. It takes the issue's first option, with one difference: no whitespace is needed before the#, because#1=A(1)#2=B();loses#2in the same way.a_skip_over_several_records_names_only_the_firstis replaced accordingly.Lenient output changes for such files: more records, the same or more diagnostics, and shorter spans. With the reference check on, a duplicate after the skip is now reported, which is the first repro in openbimrs/ifc#668. The second repro also names the swallowed
#1now, because that record is kept.Remaining limits, documented on
Diagnostic::instanceand pinned by a test. Both stay inside the skip's span:=is missing;record_head_atreads comments asresync_fromdoes rather than calling the lexer. The two disagree on a comment opener split by a control, and with the lexer a crafted input made every#scan to the end of the file. A time-bounded test covers this: with the lexer-based check it was still running at 150 s.Verification
scripts/gate.shpasses;cargo semver-checksagainst 0.11.3 reports no semver update required.;(three separators), and with each;removed in turn from the trap file.mainon 626 local files, 5 of which have skips.examples/recovery_property: 0 fabricated records, 0 span faults.