Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [xtext2]Problem with JvmArgumentTypeReference when referring to declared JvmTypeParameter
[xtext2]Problem with JvmArgumentTypeReference when referring to declared JvmTypeParameter [message #726793] Mon, 19 September 2011 15:14 Go to next message
Victor Noël is currently offline Victor NoëlFriend
Messages: 112
Registered: June 2010
Senior Member
Hi,

I have a really strange behaviour using an Xbase based grammar.

I'm porting a working grammar to xtext2 and I was used the following kind of construct:

Infrastructure:
	"infrastructure" name=ID ("[" typeParameters+=JvmTypeParameter ("," typeParameters+=JvmTypeParameter)* "]")? "{"
		(	provides+=ProvidedPort
		|	requires+=RequiredPort
		|	components+=InfrastructureInstance
		|	species+=Species
		)*
	"}";

ProvidedPort:
	"provides" name=ID ":" typeReference=JvmTypeReference


And when I am editing an instance of such a grammar, for example something like that:
infrastructure I[A] {
	provides p1: java.util.List<A>
}


It doesn't see A as a valid.

And the strange part here, is that I first overridden JvmTypeReference in my grammar in order to use my own syntax as following:
JvmParameterizedTypeReference:
	type=[types::JvmType|QualifiedName] (=> "[" arguments+=JvmArgumentTypeReference ("," arguments+=JvmArgumentTypeReference)* "]")?;


And then, it was working half of the time: completion was proposing me the A, and it was validated as ok, then if I changed some stuffs in my model it wasn't working anymore.

It seems that the declaration of A is the problem, because I have another rule to refer to a declared Infrastructure and a validation rule to check that all its parameters are set, and it always see the number of parameters as 0...

If someone has an idea, it would be helpful Smile

Victor

[Updated on: Wed, 21 September 2011 10:27]

Report message to a moderator

Re: [xtext2]Problem with JvmArgumentTypeReference when referring to declared JvmTypeParameter [message #727443 is a reply to message #726793] Wed, 21 September 2011 10:26 Go to previous message
Victor Noël is currently offline Victor NoëlFriend
Messages: 112
Registered: June 2010
Senior Member
Still no idea ?

I couldn't find a way to fix it.

I tried to declare a rule for JvmTypeParameter in order to not only rely on another language but a local rule but the same problems seem to appear...
Previous Topic:xtext validation package
Next Topic:Grammar rule for a string without quotes
Goto Forum:
  


Current Time: Fri Apr 26 04:59:54 GMT 2024

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

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

Back to the top