Implement CLI enhancements, grammar fixes, and performance refactor - #8
Merged
Conversation
…on, NuGet attribution - Add validate CLI command with inline self-test model (lint + SVG + PNG) - Add --depth N flag to render command with ellipsis truncation beyond limit - Add view name enumeration to multiple-view error diagnostic - Add NuGet attribution for Noto Sans (SIL OFL 1.1) and SkiaSharp (MIT) - Include OFL.txt in NuGet package content - 600 tests passing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add view def GeneralView to general-view-test.sysml to enable rendering tests - Add DiagramRenderer_RenderWorkspace_GeneralViewModel_SvgContainsElementNames: proves the full pipeline produces SVG containing ComponentA and ComponentB text - Add DiagramRenderer_RenderWorkspace_GeneralViewModel_PngProducesValidOutput: proves PNG output is non-trivially sized with valid PNG header signature bytes - Add DiagramRenderer_RenderWorkspace_GeneralViewModel_NoUnresolvedWarnings: confirms no false unresolved-reference warnings on same-package specialization - Use inline SysML constant + temp file pattern (consistent with WorkspaceLoaderTests) to avoid dependency on test output directory layout Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…AstBuilder visitors
The daltskin/sysml-v2-grammar source omitted KerML classifier types
(datatype, class, struct, assoc, assoc struct) from the definitionElement
rule, causing the SysML v2 grammar to fail parsing the OMG standard
library .kerml files. These constructs are valid SysML v2 / KerML
textual notation and the grammar rules for them already existed -- they
were simply unreachable as package-level members.
Changes:
- SysMLv2Parser.g4: add dataType, class, structure, association,
associationStructure to definitionElement
- Regenerated Parser/Antlr/ from updated grammar using JDK 25 + ANTLR 4.13.1
- AstBuilder: add VisitDataType, VisitClass, VisitStructure,
VisitAssociation, VisitAssociationStructure visitors with shared
BuildClassifierNode helper and GetSuperclassingSupertypes
- WorkspaceLoader: parallelize stdlib parsing across thread pool
- Grammar/README.md: document local patch and correct regeneration
instructions (must run from Grammar/ directory)
- Parser/Antlr/README.md: reference local patches section
Result: stdlib warnings reduced from 10,000+ to ~111 (10 unique types),
all of which are downstream of remaining KerML expression-syntax gaps
(->reduce, ??, inv{}, return keywords in feature bodies).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Patch 2: Add function and predicate to definitionElement
- These KerML behavioral classifiers appear at the top level of KerML
function libraries (BaseFunctions.kerml, DataFunctions.kerml, etc.)
but were missing from definitionElement, causing parse failures on
every function declaration in the KerML stdlib
Patch 3: Allow bare qualifiedName as arrow expression argument
- KerML reduce/collect operations pass a function reference inline
without parentheses: dimensions->reduce '*' ?? 1
- The upstream grammar required bodyExpression ({...}) or argumentList
((...)) after ->, leaving bare name arguments unrecognized
- Made the suffix optional and added qualifiedName as a third option
Both rule changes are documented in Grammar/README.md Local Patches.
AstBuilder updated with VisitFunction and VisitPredicate visitors.
206/206 tests passing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…p speedup - Extract Language project: ANTLR parser, AstBuilder, SymbolTable, ReferenceResolver, WorkspaceParser, WorkspaceLoader, AstSerializer/AstDeserializer - Add Stdlib project: embeds pre-compiled stdlib.bin as managed resource via StdlibProvider - Add StdlibGen tool: build-time codegen that parses all 94 stdlib files, resolves cross-references, and serializes the symbol table to stdlib.bin - Rename DemaConsulting.SysML2Tools -> DemaConsulting.SysML2Tools.Core (workspace, rendering, layout, diagram model) - Fix SkiaSharp native asset PrivateAssets='All' suppressing libSkiaSharp.dll from publish - Add stdlib.json to .gitignore (StdlibGen debug output artifact) - Add view def to software-structure.sysml for rendering tests - Cold startup time: 25s -> 0.35s (70x speedup) - Tests: 645 passing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- .editorconfig: broaden ANTLR generated_code glob to src/**/Parser/Antlr/*.cs (was hardcoded to old project path, dotnet format now correctly skips generated files) - fix.ps1: add dotnet restore before dotnet format (mirrors lint.ps1 behavior; fixes 'Required references did not load' warnings on Core/Png projects) - .cspell.yaml: add Superclassing/superclassing (KerML technical term from grammar) and NETSDK (MSBuild error code referenced in design doc) - StdlibProviderTests.cs: behaviour -> behavior (US English) - docs/verification/sysml2-tools-core/parser.md: wrap long line to stay under 120 chars Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t10.0) - Stdlib.csproj: run GenerateStdlibBin in outer (cross-targeting) build via BeforeTargets=DispatchToInnerBuilds to prevent parallel TFM builds racing to write StdlibGen.dll (CS2012 file-locked error in CI) - Stdlib.csproj: write stdlib.bin to BaseIntermediateOutputPath (shared obj/Release/) instead of per-TFM IntermediateOutputPath - StdlibGen: switch from net9.0 (STS) to net10.0 (LTS) - StdlibGen/Program.cs: extract ParseArguments() to reduce cognitive complexity (S3776) - PngRenderer.cs: introduce parameter object to reduce method parameter count (S107) - SvgRenderer.cs: extract constants for repeated string literals (S1192) - SvgRenderer.cs: extract helper method to reduce cognitive complexity (S3776) - Validation.cs: add timeout to Regex construction (S6444) - Build: 0 warnings, 0 errors across all three TFMs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Two root causes were causing the CI build to fail: 1. StdlibGen in .slnx: solution built StdlibGen in parallel with the GenerateStdlibBin target's <MSBuild> task, causing file-lock (CS2012) and node-pool deadlocks (10+ min hang). Fixed by removing StdlibGen from .slnx — it is a private build tool, not a deliverable. 2. <MSBuild> task re-entrancy: calling <MSBuild> from inside a solution build requests a worker node that may already be fully occupied, deadlocking. Fixed by replacing with <Exec Command='dotnet build ...'> which spawns an independent child process outside the node pool. Also switch StdlibGen from net9.0 (STS) to net10.0 (LTS). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Removed --no-restore from the dotnet build <Exec> call for StdlibGen. Because StdlibGen is no longer in the .slnx, the solution-level dotnet restore does not restore it. The child process dotnet build must restore it itself. This is safe because the child process is independent and does not interfere with the parent build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Parse_StdlibOnly_NoErrors was removed during the Language/Stdlib refactor (stdlib is now pre-compiled; not parsed at test time). The three remaining ParseSource_* tests still fully exercise the ANTLR4 runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jul 27, 2026
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.
This pull request introduces a major reorganization and clarification of the project structure, documentation, and review configuration to better separate concerns between the Language, Stdlib, and Core libraries. The changes update the
.reviewmark.yamlreview definitions, solution/project structure, and design documentation to reflect the new modular architecture.Key changes include:
Review configuration and architecture alignment
.reviewmark.yamlforDemaConsulting.SysML2Tools.LanguageandDemaConsulting.SysML2Tools.Stdlib, covering architecture, design, verification, and implementation, and updated existing reviews to reference the correct projects, paths, and documentation. [1] [2] [3]Solution and project structure
DemaConsulting.SysML2Tools.slnxto include separate projects forDemaConsulting.SysML2Tools.Language,DemaConsulting.SysML2Tools.Stdlib,DemaConsulting.SysML2Tools.Core, and the newTools/StdlibGentool, reflecting the new modular structure.Design documentation updates
docs/design/introduction.mdto document the new breakdown of system, subsystem, and unit levels, clearly distinguishing the roles of the Language, Stdlib, and Core libraries, and describing new units such asAstSerializer,AstDeserializer, andStdlibProvider. [1] [2]sysml2-tools-language.mdandsysml2-tools-stdlib.mddesign docs. [1] [2]Core library documentation
docs/design/sysml2-tools-core.mdto clarify that the Core library now focuses on layout and rendering, and depends on the Language and Stdlib libraries for parsing and semantic analysis, with an updated architecture diagram.