Parsing and generating annotations [message #871102] |
Thu, 10 May 2012 16:47  |
Eclipse User |
|
|
|
Hi,
I want to be able to write something similar like in Java:
/** documentation
/*
@annotation1
@annotation2
mylanguagetypeA name1 { xxx }
/** documentation
/*
@annotation2
@annotation1
mylanguagetypeB name2 { xxx }
Using "documentation = e.documentation" in the generation process allows me to access documentation without having defined this feature in the grammar at all - you i.e. xtext provide this feature to me.
When using annotations I get in conflict with the rule "one look ahead", when trying to define a grammar which is in its top rule similar like
Mylanguagetypes: MylanguagetypeA | MylanguagetypeB |MylanguagetypeC;
MylanguagetypeA: ... something for annotation ...
'mylanguagetypeA' ...
MylanguagetypeB: ... something for annotation ...
'mylanguagetypeB' ...
MylanguagetypeA resp. ..B resp. ..C are subject for code generation with the JVM inferer.
I can solve my problem easily by changing the language and integrating annotations behind the keywords 'mylanguagetypeA' etc. That way I can generate even complex annotations. But is there a better solution without changing the language?
Thanks in advance,
Jens
|
|
|
|
Re: Parsing and generating annotations [message #871190 is a reply to message #871164] |
Fri, 11 May 2012 07:25  |
Eclipse User |
|
|
|
It's probably simpler to read the reference documentation about actions.
Regards,
Sebastian
Am 11.05.12 10:21, schrieb Jan Koehnlein:
> That's a typical usecase for assigned actions.
> Have a look at the Xtend.xtext grammar to get an impression.
>
> Am 10.05.12 22:47, schrieb Jens-Uwe Moeller:
>> Hi,
>>
>> I want to be able to write something similar like in Java:
>>
>>
>> /** documentation
>> /*
>> @annotation1
>> @annotation2
>> mylanguagetypeA name1 { xxx }
>>
>> /** documentation
>> /*
>> @annotation2
>> @annotation1
>> mylanguagetypeB name2 { xxx }
>>
>>
>> Using "documentation = e.documentation" in the generation process allows
>> me to access documentation without having defined this feature in the
>> grammar at all - you i.e. xtext provide this feature to me.
>>
>> When using annotations I get in conflict with the rule "one look ahead",
>> when trying to define a grammar which is in its top rule similar like
>>
>> Mylanguagetypes: MylanguagetypeA | MylanguagetypeB |MylanguagetypeC;
>>
>> MylanguagetypeA: ... something for annotation ...
>> 'mylanguagetypeA' ...
>>
>> MylanguagetypeB: ... something for annotation ...
>> 'mylanguagetypeB' ...
>>
>>
>> MylanguagetypeA resp. ..B resp. ..C are subject for code generation with
>> the JVM inferer.
>>
>> I can solve my problem easily by changing the language and integrating
>> annotations behind the keywords 'mylanguagetypeA' etc. That way I can
>> generate even complex annotations. But is there a better solution
>> without changing the language?
>>
>> Thanks in advance,
>> Jens
>>
>>
>>
>
>
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
|
|
|
Powered by
FUDForum. Page generated in 0.22313 seconds