Skip to content

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
Westfall-io:mainfrom
Ben-Williams-Founder:fix/view-typed-usage-parsing
Open

fix(parsing): collect typed SysML v2 view usages (view x : Def { } and view x : Def;)#1
Ben-Williams-Founder wants to merge 1 commit into
Westfall-io:mainfrom
Ben-Williams-Founder:fix/view-typed-usage-parsing

Conversation

@Ben-Williams-Founder

Copy link
Copy Markdown

Problem

VIEW_START_RE only matches untyped view usages (view x { }). SysML v2 also allows typed usages where a view references a view definition:

view structuralView : StructuralViewDef {
  // typed usage with block
}

view summaryView : 'StructuralViewDef';
// typed usage with semicolon terminator

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:

  • an untyped block opener ({)
  • a typed declaration (: DefName followed by { or ;)

view def declarations are correctly excluded — the def keyword occupies the position where the body-opener alternation applies, so defs remain unmatched.

Tests

Added test_collect_views_typed_usage_and_def_not_collected covering:

  • typed usage with block (view x : Def { }) → collected ✓
  • typed usage with semicolon (view x : 'Def';) → collected ✓
  • view def declaration → not collected ✓

All 4 existing tests continue to pass.

…: 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant