fix: formatter roundtrip for group qualifications, intervals, and expressions (#300)#304
Merged
Merged
Conversation
…ve send calls - Fix shorthand variable declarations (slo, shi : INTEGER) expanding correctly by unwrapping double-nested variable_id keys in constant_builder and procedure_decl_builder - Fix CASE statement building: proper case label handling and otherwise_statement assignment - Add AGGREGATE OF type builder support - Replace type_builder hash+define_method with explicit method definitions to avoid autoload ordering issues - Remove all send calls from builder_registry, use direct method calls - Remove duplicate subtype constraint registrations - Fix Model::ModelElement resolution in builder.rb Fixes #300
…REGATE, SELECT, binary literals
- Wrap interval operands in parens when inside unary expression
(NOT {interval} -> NOT ({interval})) to avoid parser ambiguity
- Use >= comparison for same-precedence binary expression parens
so (4 + 2) + 1 is explicit rather than 4 + 2 + 1
- Format AGGREGATE type with OF <base_type> when present
- Handle empty SELECT types in formatter
- Fix binary literal formatting (value already includes % prefix)
Fixes #300
…cher Function and Procedure cannot have WHERE clauses per ISO 10303-11. Removed incorrect include HasWhereRules from both models. Changed remark_attacher to use safe_get_collection for where_rules access to handle models that include the concern without the attribute.
Add formatter_roundtrip_spec.rb covering: - NOT + interval parenthesization - Shorthand variable declarations - Procedure VAR parameters - Group qualification with index qualifiers - Binary expression same-precedence parens - Binary literals - Full syntax.exp structural content stability Regenerate YAML and .exp fixtures to match improved builder output.
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 #300 —
expressir formatnow produces output that can be re-parsed and produces the same model (structural content is stable across format iterations).Root Cause
The formatter was outputting
NOT {interval}which is ambiguous in EXPRESS — the parser seesNOTfollowed by{and cannot match it as an interval expression. The original code wraps intervals in parens:NOT ({interval}).Changes
Formatter fixes
Builder fixes
Model fixes
Tests
Verification