|
Re: cross-reference linking and xbase [message #1734952 is a reply to message #1734949] |
Tue, 14 June 2016 05:55 |
|
first of all your grammar gives this warning
warning(200): ../org.xtext.example.mydsl1/src-gen/org/xtext/example/mydsl1/parser/antlr/internal/InternalMyDsl.g:424:3: Decision can match input such as "RULE_ID '.' RULE_ID" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
xbase solves this by
QualifiedName:
ValidID (=>'.' ValidID)*;
and you should do that as well
then there is another problem when using xbase:
xbase does not allow relative imports.
if you have name a.b.c
and do a import a.*
then b.c is not allowed.
this is caused by
org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider.doCreateImportNormalizer(QualifiedName, boolean, boolean)
see javadoc of AbstractNestedTypeAwareImportNormalizer
so the question is: do you actually need xbase?
do you import java types and non java types as well?
and if so how shall relative imports behave?
do you want realative implicit imports at all?
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Re: cross-reference linking and xbase [message #1828901 is a reply to message #1735029] |
Sun, 21 June 2020 19:18 |
Denis Kuniß Messages: 15 Registered: March 2015 |
Junior Member |
|
|
Hi all.
I have a similar problem when using Xbase and the default Xbase scope provider.
For the following DSL source which is quite similar like a class hierarchy with fields
package p {
integration u0
in i: String
out o: String
{
.i -> u1.o ;
}
integration u1
in o: String
{}
}
I get a linker error "u1.o cannot be resolved".
When I execute the scope computation explicitly in a test (similar to a suggestion made by Lorenzo Bettini in his Xtext book) I get a list of all aliases which also contains "u1.o"
println(u1_o_ref.getScope(ref).allElements.map[name].join(", "))
// prints "i, o, u0, u0.i, u0.o, u1, u1.o, p.u0, p.u0.i, p.u0.o, p.u1, p.u1.o"
However, if I looking up the qualified name specifically, "u1.o" is not found, but the full qualified name "p.u1.o" is found:
println(u1_o_ref.getScope(ref).getSingleElement(QualifiedName.create("p","u1","o")))
// prints "p.u1.o" -- object description found
println(u1_o_ref.getScope(ref).getSingleElement(QualifiedName.create("u1","o")))
// prints "null" -- not found anything
I have read the issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=495047 but my issue here is not related to proposals.
Nevertheless, it seems somehow related to my issues and Xbase and its scope implementation. Unfortunately, I need Xbase due to Java type references (see the "String" reference).
So, I'm wondering whether there is a a workaround for this issue.
Or, am I doing something wrong?
Regards, Denis
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03377 seconds