Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Parsing comma separated list
Parsing comma separated list [message #1734671] Fri, 10 June 2016 08:49 Go to next message
Mansour Al is currently offline Mansour AlFriend
Messages: 44
Registered: June 2016
Member
I am looking to be able to parse a list of values, like this:

using ( file1.xml , file2.xml , file3.properties )


The rule I have for this is:

MyFilesList:
	'using'  "(" configFiles = Files ")" ;
/*A list of comma separated files ending with xml, properties) */
Files:
	files+=ConfigFile ("," ConfigFile)*;
ConfigFile:
	file=FileName;
FileName:
	(ID | INT) "." ("xml" | "properties");


Issue is with the definition for ConfigFile. I am getting "Cannot change type twice within a rule" Error.
Any idea how to simplify this rule ?

Thank you
Re: Parsing comma separated list [message #1734674 is a reply to message #1734671] Fri, 10 June 2016 08:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13181
Registered: July 2009
Senior Member
dont forget to assign things

Files:
	files+=ConfigFile ("," files+=ConfigFile)*;


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Parsing comma separated list [message #1734676 is a reply to message #1734674] Fri, 10 June 2016 09:05 Go to previous message
Mansour Al is currently offline Mansour AlFriend
Messages: 44
Registered: June 2016
Member
This is exactly what I needed.
I didn't know that you can use the add assignment multiple times !

Thank you Christian.
Previous Topic:How to exclude some specific resource from xtext validation?
Next Topic:Specific Class type in xtext grammar
Goto Forum:
  


Current Time: Tue Nov 12 04:31:32 GMT 2019

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

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

Back to the top