feat: configurable grammar discovery and 0.4.1 quality gates - #27
Merged
Conversation
actbit
marked this pull request as ready for review
July 17, 2026 11:55
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
NamespaceAndTypeHierarchy,TypeHierarchy, and legacyNamespacemodes[GrammarPart(typeof(Root))]for explicit cross-namespace/cross-hierarchy participation[assembly: Skip(...)]patternsBuildMode, skip patterns, token diagnostics, and discovery changes invalidate generation[Grammar(Mode = ...)]declarations generate independently and support nodes shared by multiple grammar rootsWhy
Grammar extraction previously depended on a same-namespace scan. That prevented natural project layouts and offered no way to disable namespace-based discovery. The new modes preserve compatibility while allowing hierarchy-only or explicit discovery.
The repository also lacked a full-test quality gate before package publication, and Core builder results could retain mutable builder collections.
Impact
The default remains compatible with same-namespace grammars and additionally discovers root-derived nodes across the assembly. Users who want no namespace scan can select
GrammarDiscovery.TypeHierarchy; exceptional nodes can opt in withGrammarPart.Multiple grammar modes on the same root now emit each Lexer/Parser while sharing node partial generation safely. Nodes participating in multiple grammar roots emit one partial, while grammar-specific
[OnReduce]hooks remain in the corresponding parser. Fully qualified, deterministic source hint names avoid collisions between same-named roots or nodes in different namespaces.This is a patch release and keeps the existing
Production.Rhspublic API type unchanged.Validation
dotnet test AstFirst.slnx -c Release --no-restore --nologo— 374 passedAstFirst.Core,AstFirst.Runtime, andAstFirst0.4.1 successfullygit diff --checkpassedSelf-review
The self-review caught and fixed incremental-cache omissions, an unpinned publish SDK, stale performance/error-recovery documentation, the previously ignored assembly-level
Skipattribute, source hint collisions, multiple-mode model collapsing, shared-node partial duplication, attribute-name false positives, and inaccessible token-constructor diagnostics. Invalid-signature diagnostics remain separate follow-up work.