Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » single quotes in Xtext
single quotes in Xtext [message #999292] Fri, 11 January 2013 18:36 Go to next message
Adnan AL-SOSWA is currently offline Adnan AL-SOSWAFriend
Messages: 41
Registered: May 2010
Member
Hi all
I have this rule in xtext grammer

rule: "'"name=ID"'"
Why this rule not accepted when I check it in the editor with this example
'java'
i have error that expected "'"
I do not want to use terminal String for this difinition as when I do so and try to access the name feauture from with in code,I got the result with quotes .

Thanks in advance

[Updated on: Fri, 11 January 2013 18:47]

Report message to a moderator

Re: single quotes in Xtext [message #999322 is a reply to message #999292] Fri, 11 January 2013 20:22 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

the rule will be problematic if you use the default terminals, as the STRING rule includes single quotes.

Why don't you use

Rule: name=STRING?

You could use validation that the content of the string matches an ID. Note that for referencing you then use

Reference: 'ref' to=[Rule|STRING]

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: single quotes in Xtext [message #999338 is a reply to message #999322] Fri, 11 January 2013 21:26 Go to previous messageGo to next message
Adnan AL-SOSWA is currently offline Adnan AL-SOSWAFriend
Messages: 41
Registered: May 2010
Member
Hi alex

thanks for reply .
actally when I use STRING , and try to access feature name from within xtend/xpand code
for example
<<f.name>>
the result which i get is 'java' with single quotes. I wanted single quotes to be mandatory but not part of the feature name.
Re: single quotes in Xtext [message #999523 is a reply to message #999338] Sat, 12 January 2013 10:22 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi, the quotes should be removed by the value converter. This happens
automatically with the default setup.

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Installing multiple versions of a DSL
Next Topic:Looking for XText Developer in Zuirch Switzerland
Goto Forum:
  


Current Time: Fri Apr 26 03:36:37 GMT 2024

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

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

Back to the top