Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to add Annotations to the grammar
How to add Annotations to the grammar [message #886570] Fri, 15 June 2012 07:38 Go to next message
Hans-Georg Glöckler is currently offline Hans-Georg GlöcklerFriend
Messages: 88
Registered: July 2009
Member
I wan to add Annotations to the grammar.
I have tried the following code
grammar org.lunifera.metamodel.dsl.entity.Entity with org.eclipse.xtext.xbase.Xbase

generate entity "http://www.lunifera.org/metamodel/dsl/entity/Entity"

import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase

...

Entity:
       	(annotations=Annotation) 
	'entity' name=ValidID ('extends' superType=JvmParameterizedTypeReference)? '{'
	property+=Property*
        ....
	'}';

Property:
	varType= 'var' type=JvmTypeReference name=ValidID ';';

enum Annotation:
	embeddable='@Embeddable' | cachable='@Cachable'
;



In my DSL I want to can write:
@Embeddabel
entity Person {
....
}


But I have Problems with the Annotations.
They appear not in the Content Assist of the IDE
Also entity appear not in the Content Assist of the IDE

I use Xtext 2.3

[Updated on: Fri, 15 June 2012 07:42]

Report message to a moderator

Re: How to add Annotations to the grammar [message #886637 is a reply to message #886570] Fri, 15 June 2012 10:43 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
IIRC, you do not get automatic content assist for enums the same way you
do not get content assist to write an integer value.

Think there are a couple of posts and answers on that topic in this forum.

- henrik
On 2012-15-06 9:38, hans-georg wrote:
> I wan to add Annotations to the grammar.
> I have tried the following code
>
> grammar org.lunifera.metamodel.dsl.entity.Entity with
> org.eclipse.xtext.xbase.Xbase
>
> generate entity "http://www.lunifera.org/metamodel/dsl/entity/Entity"
>
> import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase
>
> ...
>
> Entity:
> (annotations=Annotation) 'entity' name=ValidID ('extends'
> superType=JvmParameterizedTypeReference)? '{'
> property+=Property*
> ....
> '}';
>
> Property:
> varType= 'var' type=JvmTypeReference name=ValidID ';';
>
> enum Annotation:
> embeddable='@Embeddable' | cachable='@Cachable'
> ;
>
>
>
> In my DSL I want to can write:
>
> @Embeddabel
> entity Person {
> ....
> }
>
>
> But I have Problems with the Annotations.
> They appear not in the Content Assist of the IDE
> Also entity appear not in the Content Assist of the IDE
Re: How to add Annotations to the grammar [message #886683 is a reply to message #886637] Fri, 15 June 2012 12:38 Go to previous message
Hans-Georg Glöckler is currently offline Hans-Georg GlöcklerFriend
Messages: 88
Registered: July 2009
Member
Thanks.
Previous Topic:Is there a HTML DSLs I can extend?
Next Topic:Can I remove things from AST
Goto Forum:
  


Current Time: Wed Oct 28 00:55:00 GMT 2020

Powered by FUDForum. Page generated in 0.01437 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top