| uncertain reference to entity [message #808269] |
Mon, 27 February 2012 10:49  |
Michal S Messages: 73 Registered: July 2011 |
Member |
|
|
Hello,
I am wondering, how would be possible to solve following issue:
Lets have grammar:
Variable: name=MYID '=' value=INT;
MYID: ID;
RefToDefinedOrUndefinedVariable: name=ID '=' value=[Variable]|MYID;
I understand, that this is not valid as "Decision can match input such as "RULE_ID" using multiple alternatives".
My task is, whether it is somehow possible to "reference if available"?
UseCase: there are some variables not defined in model (they are defined in runtime environment, where generated code will be used).
Temporarily, I solved it as "... value=MYID" and completion is done using Dynamic Template Proposals. Unfortunately, this is very dirty solution (i.e. there is no real reference).
Thank you
Michal
|
|
|
|
|
|
| Re: uncertain reference to entity [message #809922 is a reply to message #809902] |
Wed, 29 February 2012 07:47   |
Michal S Messages: 73 Registered: July 2011 |
Member |
|
|
Hello Meinte,
I haven't seen the dot behind, sorry about it.
Anyway, I think, hyperlinking is more appropriate concept for this purpose. I have googled for some example of using it ( http://www.eclipse.org/Xtext/documentation/2_1_0/180-hyperlinking.php ), but I was not successful.
Could anybody provide some simple example, how to creat hyperlink e.g. in this simple case:
MyDsl: contents+= Entity*;
Entity: Entity1|Entity2;
Entity1: 'Entity1' name=MYID;
Entity2: 'Entity2' name=MYID refToEntity1=MYID;
MYID: ID;
I guess, it can be done somehow using createHyperlinksByOffset or createHyperlinksTo methods, but I have no clue how.
Thank you & Best regards,
Michal
|
|
|
| Re: uncertain reference to entity [message #810053 is a reply to message #809922] |
Wed, 29 February 2012 11:11  |
Henrik Lindberg Messages: 2427 Registered: July 2009 |
Senior Member |
|
|
I do my special linked "after model linked" and associate information in
adapters (for various purposes). At the other end, simply override the
default implementation (of whatever it is you are after) and make it
also look in the special adapter.
You can look at such an implementation in cloudsmith/geppetto at github.
I use this for "Show Declaration" (among other things).
- henrik
On 2012-29-02 13:48, Michal S wrote:
> Hello Meinte,
> I haven't seen the dot behind, sorry about it.
> Anyway, I think, hyperlinking is more appropriate concept for this
> purpose. I have googled for some example of using it (
> http://www.eclipse.org/Xtext/documentation/2_1_0/180-hyperlinking.php ),
> but I was not successful.
> Could anybody provide some simple example, how to creat hyperlink e.g.
> in this simple case:
>
> MyDsl: contents+= Entity*;
> Entity: Entity1|Entity2;
> Entity1: 'Entity1' name=MYID;
> Entity2: 'Entity2' name=MYID refToEntity1=MYID;
> MYID: ID;
>
> I guess, it can be done somehow using createHyperlinksByOffset or
> createHyperlinksTo methods, but I have no clue how.
> Thank you & Best regards,
> Michal
|
|
|
Powered by
FUDForum. Page generated in 0.01788 seconds