Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext unordered group
Xtext unordered group [message #1062350] Fri, 07 June 2013 11:01 Go to next message
junior developer is currently offline junior developer
Messages: 335
Registered: January 2013
Senior Member
Hi all,

I Wrote a grammar but I have a problem with Crossreference.When I write language in the editor.
Screen1: If I define field (lookup or boolean) in the contenttype->(ownedField+=Field (ownedField+=Field)*)?
not cames ct3 in the contenttype parent's ,onlly comes cttype3 (any defined contenttype not comes)

Screen2:if I dont write any field ,comes all defined contenttype in the contenttype's parent.

not:ct3 and cttype3 in the same scope(defined in the CustomList)



CustomList returns CustomList:
	'CustomList'
	name=QualifiedName
	'{'
	'guID' '=' guID=STRING
	'displayName' '=' displayName=STRING
	'type' '=' type=ListType
	('description' '=' description=STRING)?
	(ownedContentType+=ContentType (ownedContentType+=ContentType)*)?
	(ownedView+=View (ownedView+=View)*)?
	'}';
ContentType returns ContentType:
	'ContentType'
	name=QualifiedName
	'{'
	'guID' '=' guID=STRING
	'displayName' '=' displayName=STRING
	('description' '=' description=STRING)?
	('group' '=' group=STRING)?
	[color=red]('parent' '=' parentContentType=[ContentType|QualifiedName])?
	(ownedField+=Field (ownedField+=Field)*)?[/color]  //I have problem this line
	'}';
Field returns Field:
	LookUp | BooleanField ;




I try change ordered :
FIRSTLY :screen3 ->I defined Contenttype's parent end of the Field ,comes all contenttypes

changed grammar :
ContentType returns ContentType:
	'ContentType'
	name=ID
	'{'
	(('guID' '=' guID=STRING) 
	('displayName' '=' displayName=STRING ) 
	('description' '=' description=STRING)?
	('group' '=' group=STRING)? 
     (ownedField+=Field (ownedField+=Field)*)? 
	 (('parent' '=' parentContentType=[ContentType|ID])*)?) 
	 
	'}';





SECOND:screen4 ->if I define parent end of the defined fields,comes all contenttype,
if I defined parent before create field,comes onlly cttype3,
used unorderedgroup ,but I take warning
As a result, alternative(s) 2 were disabled for that input
Semantic predicates were present but were hidden by actions.

ContentType returns ContentType:
'ContentType'
name=ID
'{'
('guID' '=' guID=STRING)
('displayName' '=' displayName=STRING )
('description' '=' description=STRING)?
('group' '=' group=STRING)?
( (('parent' '=' parentContentType=[ContentType|ID])*)? &
(ownedField+=Field (ownedField+=Field)*)? )

'}';
I can't solved Sad please help me.How can I solved this problem in the grammar

  • Attachment: screen1.png
    (Size: 43.70KB, Downloaded 32 times)
  • Attachment: screen2.png
    (Size: 39.00KB, Downloaded 28 times)
  • Attachment: screen3.png
    (Size: 51.16KB, Downloaded 20 times)
  • Attachment: screen4.png
    (Size: 44.26KB, Downloaded 22 times)

[Updated on: Fri, 07 June 2013 11:15]

Report message to a moderator

Re: Xtext unordered group [message #1062373 is a reply to message #1062350] Fri, 07 June 2013 12:41 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander Nittka
Messages: 1156
Registered: July 2009
Senior Member
Hi,

just regarding the multiple alternatives. Why do you write

(('parent' '=' parentContentType=[ContentType|ID])*)?

* includes zero occurences. Are multiple parents really possible? If so you store only the last one in the model otherwise it would have to be

parentContentType+= ...

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: Xtext unordered group [message #1062408 is a reply to message #1062373] Fri, 07 June 2013 14:37 Go to previous message
junior developer is currently offline junior developer
Messages: 335
Registered: January 2013
Senior Member
Hi Alexander,

I solved my problem thank you very much .
ContentType returns ContentType:
'ContentType'
name=QualifiedName
'{'
'guID' '=' guID=STRING
'displayName' '=' displayName=STRING
('description' '=' description=STRING)?
('group' '=' group=STRING)?
('parent' '=' parentContentType=[ContentType|QualifiedName])?
'fields' '{'
(ownedField+=Field (ownedField+=Field)*)?
'}'
'}';

Previous Topic:Organise imports in my DSL
Next Topic:getting Value from a IWorkflow component
Goto Forum:
  


Current Time: Thu Oct 30 16:04:13 GMT 2014

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

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