Conversation
This commit also move the test in the interactive module
- Moved ParserAdapterTest and UsagePostProcessTest from semantics/tests to interactive/tests. - Revised UsagePostProcessTest to extend SysMLInteractiveTest. - Removed method equivalent to UsagePostProcessTest from ParserAdapterTest.
|
I made two changes myself.
|
|
@seidewitz I have a new version I hope that match all your comment because I'm not sure about what to do with "For other subtypes with multiple inheritance" |
Even though they don't have any post-processing functionality at this time.
- This was adversely interacting with the SysMLInteractiveTest Xtext setup, so that, in particular, global name resolution sometimes failed. - This set up is not necessary in the test, because all components being tested are called directly.
Yeah, I wasn't entirely clear here. What I meant was to fill in the post-processors for intermediate superclasses of any existing processing class, so the post-processor inheritance hierarchy for KerML and SysML is a subset of the abstract syntax hierarchy, with no level skipped. I went ahead and pushed a commit with the additional post-processor classes. Please review my latest update. If you agree with it, we can go ahead and merge this PR. Or, if you see problems, please comment. |
|
I also update |
OK this is what I tough but I was not sure if you expect me to do it with this PR or later. Thanks you for making it happen. I reviewed it quickly and it seems ok. You can merge this PR. (I'm not sure if I'm allowed to merge it myself) When its done I will rebase my change for ST6RI-950. Thanks for your review. |
This PR moves parsing/linking-specific
postProcess()behavior out of the model adapters and into dedicated Xtext parser adapters.Background
The textual notation grammars in the KerML and SysML specifications have several productions that parse some segment of text into an element that is synthesized into a meta-property, but then also assigned to another property. This second step is done using the
{ ... }notation in the specification BNF.For example, in the specification BNF, an owned
Specificationis parsed this way:That is, and owned
Specializationis specified with just ageneraltype (the owner is thespecifictype). Thegeneraltype is parsed as either as a named reference or an owned feature chain. In the latter case, the feature chain is also added to theownedRelatedElementsto establish ownership.Unfortunately, the Xtext grammar language doesn't support doing this sort of thing. In the Xtext grammars, the corresponding production is
That is, an
OwnedFeatureChaingets added toownedRelatedElement(because Xtext requires every element in the parse tree to have an owner), but does not get assigned togeneral.In order to make up for Xtext deficiencies such as this, after parsing a model, the implementation does post-processing on each model element. For example, the post-processing for
Specializationchecks whethergeneralis null. If so, it setsgeneralto the firstownedRelatedFeature. In the end, this achieves the parsing required by the specification production.Previously, post-processing code was included in a
postProcessmethod on theElementAdaptersfor elements that needed post-processing. However, this post-processing is specific for handling the limitations of the Xtext grammar language. Other parsers may not have such limitations, or may have different ones. Since the code inorg.omg.sysml.logic(where the adapters now are) is supposed to be parser-independent, the Xtext parser-post-processing code needed to be separated from the other adapter code.Changes
Added
omg.org.kerml.xtext.postprocessingpackage, withKerMLParserPostProcessorFactoryto instantiate various statelessParserPostProcessorclasses for KerML element post-processing. Updatedorg.omg.kerml.scoping.KerMLLinker.postProcessAll()to use the new factory, while preserving previous functionality.Added
omg.org.sysml.xtext.postprocessingpackage withSysMLParserPostProcessorFactory, extendingKerMLParserPostProcessorFactoryand adding additionalParserPostProcessorclasses for SysML. Addedorg.omg.sysml.scoping.SysMLLinkerto use the newSysMLParserPostProcessorFactory.This keeps parser-specific model completion concerns in the Xtext layer and separates them from the long-lived semantic model adapters.
Revised
postProcessmethods as necessary so they all callsuper(except for the top-levelElementParserPostProcessor).