fix(parsing): collect typed SysML v2 view usages (view x : Def { } and view x : Def;)#1
Open
Ben-Williams-Founder wants to merge 1 commit into
Conversation
…: Def;)
VIEW_START_RE previously only matched untyped view usages (`view x { }`).
SysML v2 also allows typed usages where the view references a view def:
view structuralView : StructuralViewDef { ... }
view summaryView : 'StructuralViewDef';
The colon-plus-def-name broke the `\s*\{` body-opener before the brace,
so typed usages were silently skipped in windseeker output.
Fix: replace the `\s*\{` tail with an alternation that accepts either an
untyped block opener (`{`) or a typed declaration (`: DefName` followed
by `{` or `;`). `view def` declarations remain unmatched because the `def`
keyword occupies the position where the body-opener alternation applies.
Adds a test covering: typed usage with block, typed usage with semicolon,
and confirming `view def` is not collected.
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.
Problem
VIEW_START_REonly matches untyped view usages (view x { }). SysML v2 also allows typed usages where a view references a view definition:The colon-plus-definition-name broke the
\s*\{body-opener before the brace, so typed usages were silently skipped in windseeker output. Models using typed usages get zero views rendered.Fix
Replace the
\s*\{tail of the regex with an alternation that accepts either:{): DefNamefollowed by{or;)view defdeclarations are correctly excluded — thedefkeyword occupies the position where the body-opener alternation applies, so defs remain unmatched.Tests
Added
test_collect_views_typed_usage_and_def_not_collectedcovering:view x : Def { }) → collected ✓view x : 'Def';) → collected ✓view defdeclaration → not collected ✓All 4 existing tests continue to pass.