-
Notifications
You must be signed in to change notification settings - Fork 0
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
Integrate Xtext editor with EAXML serialization #7
Comments
My suggestion here is (without much background knowledge, so no warranty that this is the right way):
|
Something related in this link: https://jevopisdeveloperblog.blogspot.com/2011/03/implement-tostring-with-xtexts.html |
I am not a fan of the |
There has been some progress and some riddles. Here's a summary: Originally, deserialisation to EAXML failed since EMF did not recognise the URIs used by EAST-ADL with the protocol However, now serialisation to EAtxt fails with the following error:
After updating the
This contains When Xtext then looks for the right
The elements in the scope look like this:
The first one is probably the one we want. The comparison is based on the URI. But instead of using the URI So we need to get Xtext to use the URI provided by |
Creating an EAXML file from an eatxt file works right now. However, the EAXML file contains tags such as this:
The EAXML files we received as examples would instead use this format:
We need to check if this is a problem or if we can safely ignore this. So far, EATOP seems to accept files that contain tags of this form without issue. |
I have come a little further now. Using the same approach as EAST-ADL uses, I have now created a new |
More progress. In 8d3cca3, I added custom scope to accommodate different URI schemes. When serialising an EMF model that was loaded from an EAXML file to an EAtxt file, Xtext uses This is not the end of the story, though. Several issues are left:
|
Even after introducing line breaks and whitespace manually (see below), the eatxt file is not valid. There are two problems:
Here's the sanitized generated eatxt file:
|
It's indeed the formatter that needs to be extended. I have added the code below (took me lots of debugging to figure out) and now have at least some linebreaks in the the generated code. What I do not know yet is how to deal with the attributes. The code I am currently using fails for most of them. Maybe because they are empty? In any case, the Itemis has an example for their whitespace-aware language but it's not documented and I find it hard to map to our much more complicated (and nested) language. def dispatch void format(EAElement obj, extension IFormattableDocument doc) {
if (obj === null) {
return;
} else {
obj.append[newLine]
obj.regionFor.feature(Eastadl22Package.eINSTANCE.getEAElement_Name()).surround[indent].append[newLine]
if (obj instanceof Identifiable) {
obj.regionFor.feature(Eastadl22Package.eINSTANCE.getIdentifiable_Category()).surround[indent].append[newLine]
obj.regionFor.feature(Eastadl22Package.eINSTANCE.getIdentifiable_Uuid()).surround[indent].append[newLine]
}
}
obj.eContents.forEach[format]
}
def dispatch void format(EAPackageableElement obj, extension IFormattableDocument doc) {
if (obj === null) {
return;
} else {
obj.surround[indent].append[newLine]
}
obj.eContents.forEach[format]
} |
The current version is able to convert correct EAXML to EAtxt and vice versa. There are some remaining issues:
|
The EATOP plugin for the EAXML serialization has to be integrated, so that either
A flow-chart of serialization:
The text was updated successfully, but these errors were encountered: