Repository navigation
fix(project): index the names and short names of every root declaration - #29
Merged
Merged
Conversation
… misses Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…ix metadata Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
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
Without
-index,syspi bundlebuilt the.meta.jsonindex with a per-line regular expression that only sawpackage Nameat the start of a line. KerML Table 13, Note 1 asks for "all the non-null shortNames and names of all the top-level elements of the root namespaces". The scanner (topLevelNames, new fileinternal/project/scan.go) now does that for.sysmland.kermlmembers:How it works, still lexical and standard library only (no external program, no new dependency):
//notes,//* … */notes, string values and numbers, keeps/* … */as a token (it is the body that ends acomment/doc/rep), and reads quoted names with the Table 4 escapes resolved.;or at the}that returns to the root, wherever the line breaks are.#prefix::metadataare skipped and the( '<' NAME '>' )? NAME?that follows is recorded. Each notation has its own reserved-word list, sopart def class;is indexed in SysML andclass part;in KerML.::,.,,,to,then(dependency A to B,flow a.x to b.y,connector a to b),binding a = b, anddependency/featuring/metadata/@unlessfrom/of/:follows.import,aliasandfiltercontribute nothing.Output stays deterministic: names are produced in source order and the existing "path that sorts first wins" rule is unchanged.
docs/packages.mdgains a "Model index from the textual scanner" section with the behaviour and its limits.The first commit adds the table test against the old scanner; 21 of its cases failed there (short names, namespaces, definitions/usages/types/features at the root, two declarations on a line, a declaration after
}, braces andpackageinside comments, strings and quoted names).Checked against the specification
Read from the specification PDFs in the SysML v2 release repository: KerML 1.1 Beta 2 and SysML 2.1 Beta 2 (release 2026-09.1), plus the reserved-word lists of KerML 1.0 Beta 4 and SysML 2.0 Beta 4 (release 2025-04). I did not have the formal SysML 2.0 / KerML 1.1 documents.
Verified:
RootNamespace = NamespaceBodyElement*; SysML 8.2.2.5.1RootNamespace = PackageBodyElement*(definitions, usages, aliases, imports, filters).Identification = ( '<' NAME '>' )? NAME?;NAME,UNRESTRICTED_NAME, the escape table, notes,REGULAR_COMMENTandSTRING_VALUE(KerML 8.2.2.2–8.2.2.5).new; it is left unreserved so a 2.0 element of that name is still indexed.Dependency,Comment,TypeDeclaration,FeatureDeclaration, the connector, binding, succession and flow declarations,TypeFeaturing,MetadataFeature, prefix metadata, and SysMLPerformActionUsage,ExhibitStateUsage,AssertConstraintUsage,SatisfyRequirementUsage,EventOccurrenceUsage,ExtendedDefinition/ExtendedUsage..meta.jsonindex of all ten standard-library.kparfiles of release 2026-09.1 exactly.Not verified against the specification:
Identificationwas assembled from the productions listed above, not from every definition and usage production one by one (for exampleIncludeUseCaseUsage, and the view, rendering and case families, are handled by analogy).aliasor publicimportbelongs in the index. Table 13 says "an index of the global scope"; Note 1 says names of top-level elements. The scanner follows Note 1 and does not index them.Still not handled
perform,exhibit,include,assert,satisfyoreventis indexed only when its own keyword follows (perform action a); a declaration that starts with any other keyword that cannot open a root member is skipped.a–z,A–Z, digits and_..jsonand.xmimembers are not read.bundle -index index.jsonremains the route for an exporter-built index.Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/2f4eb49bc26e4531bfc2ec5f5b59edbd
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/2f4eb49bc26e4531bfc2ec5f5b59edbd?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work