Skip to content

ST6RI-752 Reimplement Xtext workarounds using Xtext parse postprocessing #570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 13, 2024

Conversation

kris7t
Copy link
Contributor

@kris7t kris7t commented Jun 12, 2024

Background

There is non-generated code in the Impl classes (in package org.omg.sysml.impl), inserted to work around limitations in parsing using Xtext. In particular, there were previously a number of methods that were specifically commented as “Xtext workarounds”. Ideally, these would be better handled as actions taken when constructing the abstract syntax tree during parsing, but that is not supported in the Xtext grammar language. Instead, this PR implements a mechanism that makes the necessary changes after the construction of the syntax tree, but before other processing is done on it, so this code no longer needs to be inserted into the Impl classes.

Note, however, that it does not replace the following mechanisms:

  • The use of the Feature::isNonunique property to parse the nonunique keyword.
  • The use of the Expression::operand property to parse the KerML expression notation.

It also does not remove a number other cases of handwritten code, mostly related to property default values and additional method overrides, which may be addressed in a future PR.

Changes

  • Moves post-processing code marked as an "Xtext workaround" (from Relationship implementations) to ElementAdapter::postProcess.
  • Remove ssome special checks in clearReference that are not longer required.
  • Removes non-generated code for Relationship::source and target, since this is obsoleted by the post-processing code for Relationship subclasses.
  • Re-generates some methods incorrectly tagged as @generated NOT previously.

kris7t and others added 8 commits June 11, 2024 21:17
It is no longer necessary to prevent the clearing of the following:

- Relationship::relatedElement -- This is no longer a derived union, it
is just a regular derived property now implemented using a delegate.

- Annotation::annotatingElement and AnnotatingElement:: annotation --
Documentation is now a kind of Comment, not a relationship that needs
special handling.
- Moved special handling of ownedRelatedElements for Dependencies to
post-processing in an adapter.
- These methods had invocation delegates implemented, but the
"@generated NOT" tag had erroneously not been removed.

- Also removed handwritten code for Feature::isOrdered which was not per
spec.
@seidewitz seidewitz self-assigned this Jun 12, 2024
@seidewitz seidewitz added this to the 2024-05 milestone Jun 12, 2024
@seidewitz seidewitz merged commit fbb3f98 into master Jun 13, 2024
2 checks passed
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.

2 participants