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
Name resolution failures for package names with white space #2089
Comments
Actually it's a bit stranger than described above. If the package declaration contains any amount of whitespace, that is 1 or more of space, newline, tab characters, then references to the package name must also contain 1 or more whitespace characters, but the whitespace doesn't have to match. So, if the package declaration is
etc. But What is also strange, is that the closing |
Furthermore, whitespace before and after the alphanumeric segment are handled separately. Consider the cases:
Case (1) requires that there be no whitespace around |
Funny. However, for fixing the issue it's sufficient to just validate the package name. |
I think the problem is in |
That would ignore whitespace. I think it's better to have an error in the editor and have the user fix it. |
Update. While the above would work, it's not really the source of the problem. The problem is that the name strings contain spaces in to begin with. The root of that problem seems to be
It seems very strange to me that that Xtext is setup to work like this and yet doesn't handle the spaces that appear in the identifier names.
The |
Package name (parser rule QPREF in Properties.xtext) is not a terminal but a datatype rule (in Xtext terminology). Same for QCREF. |
Tried adding This works, but the parser error messages are really hard to understand. I was convinced the Xtext had a mechanism for dealing with the extra whitespace in qualified names, considering that the method In any case, one clean way to deal with this is through a We now have three ways to address this issue:
Approach (1) works, but the parser error messages suck. Approach (2) wouldn't be hard, but both (1) and (2) suffer from the problem that they would reject
And that seems wrong. This might be avoidable in (2), I'm not sure what information would be available regarding hidden nodes, but it's definitely rejected by (1). Approach (3) also seems pretty straightforward, but it means that we need special handing of "end X::Y::Z" because that is not handled in the meta model. We also need to check that the rename refactoring works correctly. Lutz has chosen to go with approach (3). |
Need to update the ValueConvertors for
|
I added value convertors that remove spaces for the above rules. This fixed the problem for the most part. As noted, the
will correctly match with
does not match with |
Need to fix |
Interestingly, The method
whereas,
Just need to update the model unit method. |
Fixed above. Added JUnit test for the issue. |
Summary
Spaces in package names are not marked as an error in the AADL text editor. In references
the spaces are treated as part of the name and must be written exactly the same.
Similarly for other white space, such as tabs and newline.
Steps to Reproduce
The following is valid:
Environment
The text was updated successfully, but these errors were encountered: