Repository navigation
fix(parser): preserve comma lists and multi-dataset bar groups verbatim - #27
Merged
Merged
Conversation
Two round-trip corruptions found by GLEstudio's Phase-3 gate review against the GLE manual corpus (appendix/fig/single.gle): - bar/fill passthrough rejoined tokens with spaces, turning 'fill x1,d1 color gray10' into 'fill x1 , d1 color gray10', which GLE rejects as an illegal data set identifier. Passthrough now falls back to the statement's verbatim source text instead. - 'bar d1,d2 fill green,blue' groups multiple datasets in one GLE command (side-by-side bars); gleplot has no model for a shared group, so it silently modeled only the last dataset and dropped the rest with no warning. It's now kept verbatim in the axes passthrough with a structure: warning, and the 'data' statement that declares its now-unmodeled datasets is restored too so the regenerated file still defines what the passthrough text references. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Fixes two parser round-trip corruptions found by GLEstudio's Phase-3 gate review against the GLE manual corpus (reproducer:
appendix/fig/single.gle).bar/fillstatements rejoined tokens with" ".join(...), turningfill x1,d1 color gray10intofill x1 , d1 color gray10— which GLE rejects withillegal data set identifier. Passthrough now falls back to the statement's verbatim source text instead of a token rejoin.bar d1,d2 fill green,bluegroups multiple datasets into one GLE command (side-by-side grouped bars). gleplot has noBarSeriesmodel for a shared group, so it silently modeled only the last dataset (bar d1 fill green) and droppedd2/bluewith no warning. It's now kept verbatim in the axes passthrough with astructure:warning, satisfying the recognizer's no-silent-drops contract.While verifying the fix against the real
glebinary, I found a follow-on gap the multi-dataset fix introduced: once abar/fillstatement becomes unmodeled passthrough, nothing carries itsdata_fileanymore, so the writer was silently omitting thedata single.datstatement those datasets depend on — producing GLE that references undefined datasets. Added reconciliation logic that restores the originaldatastatement verbatim when all its datasets end up orphaned this way (and warns instead of guessing when adatastatement's datasets are a mix of modeled and orphaned).Test plan
tests/parser/test_recognizer_adversarial.py, including an end-to-end test that compiles the regenerated GLE with the realglebinaryappendix/fig/single.gle) round-trips and compiles cleanly withgle 4.3.10, and that a second parse→save cycle is a byte-exact fixed pointPYTHONPATH=$PWD/src .venv/bin/python -m pytest tests/ -q→ 2090 passed, 2 skippedtests/gui/→ 432 passedblack --checkclean on touched files🤖 Generated with Claude Code