ImportUri and scoping [message #1008374] |
Tue, 12 February 2013 03:29  |
Eclipse User |
|
|
|
Hi All,
I got some problems with using importuri.
As per the documentation , i understand the scoping.
Anyway let me explain my problem.
1. MyDsl looks somewhat like this.
SI:
include+=Include*
types+=Type*
enums+=Enum*
consts+=Constant*
Include : 'include' importuri=STRING;
Type : 'type' name=ID '{'
'}';
Enum : 'enum' name=ID '{'
'}';
Constant: 'const' name=ID type=[TypeOrEnum] defaultValue=STRING;
TypeOrEnum : Type | Enum;
2. Now I have
test1.dsl
type type1 {
}
type type2 {
}
enum enum1 {
}
test2.dsl
include "test1.dsl"
const PI type1 "3.14"
The above line is not resolved as type1 is not visible.
3. After reading some posts, I came to know about ImportUriScoping.
So i changed the workflow as shown
before:
// scoping and exporting API
// fragment = scoping.ImportURIScopingFragment {}
// fragment = exporting.SimpleNamesFragment {}
// scoping and exporting API
fragment = scoping.ImportNamespacesScopingFragment {}
fragment = exporting.QualifiedNamesFragment {}
fragment = builder.BuilderIntegrationFragment {}
Now:
I changed to
// scoping and exporting API
fragment = scoping.ImportURIScopingFragment {}
fragment = exporting.SimpleNamesFragment {}
// scoping and exporting API
//fragment = scoping.ImportNamespacesScopingFragment {}
//fragment = exporting.QualifiedNamesFragment {}
//fragment = builder.BuilderIntegrationFragment {}
After doing the above change , now i am able to see type1 in the content assist.
But the problem is i am able to see all the types/ enums which are present in the files
i.e test3.dsl can also access type1 but it is not being imported at all.
why this behaviour.
In this case it is so weird, i also get some errors telling type1 is not resolved, not in red indicator, instead in grey color
So what should i do inorder to get only the types of imported files available??
Thanks in advance
|
|
|
|
|
Re: ImportUri and scoping [message #1010762 is a reply to message #1008374] |
Mon, 18 February 2013 02:43  |
Eclipse User |
|
|
|
1) 'importURI' is case sensitive. Naming a the property 'importuri' will
not have any effect.
2) What does test3 import?
Am 12.02.13 09:29, schrieb Girish Kumar:
> Hi All,
>
> I got some problems with using importuri.
>
> As per the documentation , i understand the scoping.
>
> Anyway let me explain my problem.
>
> 1. MyDsl looks somewhat like this.
>
> SI:
> include+=Include*
> types+=Type*
> enums+=Enum*
> consts+=Constant*
>
> Include : 'include' importuri=STRING;
>
> Type : 'type' name=ID '{'
> '}';
>
> Enum : 'enum' name=ID '{'
> '}';
>
> Constant: 'const' name=ID type=[TypeOrEnum] defaultValue=STRING;
>
> TypeOrEnum : Type | Enum;
>
> 2. Now I have test1.dsl
> type type1 {
> }
>
> type type2 {
> }
>
> enum enum1 {
> }
>
> test2.dsl
> include "test1.dsl"
> const PI type1 "3.14"
> The above line is not resolved as type1 is not visible.
>
> 3. After reading some posts, I came to know about ImportUriScoping.
> So i changed the workflow as shown
> before:
> // scoping and exporting API
> // fragment = scoping.ImportURIScopingFragment {}
> // fragment = exporting.SimpleNamesFragment {}
> // scoping and exporting API fragment =
> scoping.ImportNamespacesScopingFragment {}
> fragment = exporting.QualifiedNamesFragment {}
> fragment = builder.BuilderIntegrationFragment {}
> Now:
> I changed to // scoping and exporting API
> fragment = scoping.ImportURIScopingFragment {}
> fragment = exporting.SimpleNamesFragment {}
> // scoping and exporting API //fragment =
> scoping.ImportNamespacesScopingFragment {}
> //fragment = exporting.QualifiedNamesFragment {}
> //fragment = builder.BuilderIntegrationFragment {}
> After doing the above change , now i am able to see type1 in the content
> assist.
>
> But the problem is i am able to see all the types/ enums which are
> present in the files
> i.e test3.dsl can also access type1 but it is not being imported at all.
> why this behaviour.
>
> In this case it is so weird, i also get some errors telling type1 is not
> resolved, not in red indicator, instead in grey color
>
> So what should i do inorder to get only the types of imported files
> available??
>
> Thanks in advance
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
|
|
|
Powered by
FUDForum. Page generated in 0.04716 seconds