Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Check nature of XExpression
Check nature of XExpression [message #992407] Fri, 21 December 2012 15:06 Go to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
Registered: March 2012
Location: Italy
Senior Member

Goodevening guys.

I have to check if a generic XExpression is a boolean condition.
I'll try to check type of expression, but it is insufficient: in fact something like this have boolean type but isn't a boolean condition

if (true) true


Very thank you!
Re: Check nature of XExpression [message #992418 is a reply to message #992407] Fri, 21 December 2012 15:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi if this is your own IF you have to implement the type provider
yourself

--
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
Re: Check nature of XExpression [message #993875 is a reply to message #992407] Tue, 25 December 2012 19:45 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 12/21/2012 04:06 PM, Tommaso De Sica wrote:
> Goodevening guys.
>
> I have to check if a generic XExpression is a boolean condition.
> I'll try to check type of expression, but it is insufficient: in fact
> something like this have boolean type but isn't a boolean condition
>
> if (true) true
>
> Very thank you!

Hi Tommaso

if it has boolean type it is a boolean condition actually :)

if you need to accept only XExpressions with boolean type but with a
specific "shape" you'll have to perform the additional check yourself;
in Xsemantics I do something similar (see
http://sourceforge.net/p/xsemantics/code/ci/759c09eb49b1d8ec11bc386805e88762431174b9/tree/plugins/it.xsemantics.dsl/src/it/xsemantics/dsl/typing/XsemanticsTypeSystem.xtend
in particular the method isBooleanPremise)

hope this helps
cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: Check nature of XExpression [message #994459 is a reply to message #992407] Thu, 27 December 2012 11:17 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
Registered: March 2012
Location: Italy
Senior Member

I've implemented check myself, thank you.

A curiosity: why a char expression in XExpression has always String type?
Re: Check nature of XExpression [message #994466 is a reply to message #994459] Thu, 27 December 2012 11:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Xbase has not char literals but string literals only. Have a look at
the xbasetypeprovider for further details on the type system

--
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
Re: Check nature of XExpression [message #994506 is a reply to message #994466] Thu, 27 December 2012 14:12 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
Registered: March 2012
Location: Italy
Senior Member

Christian Dietrich wrote on Thu, 27 December 2012 12:33
Xbase has not char literals but string literals only. Have a look at
the xbasetypeprovider for further details on the type system


Yes, I know it.
But my curiosity was about the reason of it.
Re: Check nature of XExpression [message #996481 is a reply to message #994506] Wed, 02 January 2013 07:23 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Am 27.12.12 15:12, schrieb Tommaso De Sica:
> Christian Dietrich wrote on Thu, 27 December 2012 12:33
>> Xbase has not char literals but string literals only. Have a look at
>> the xbasetypeprovider for further details on the type system
>
>
> Yes, I know it.
> But my curiosity was about the reason of it.

This is a current limitation that we want to get rid of, e.g. by means
of target typing. Both expression will be valid in future versions of Xbase:

val char c = 'c'
val String s = 's'

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Check nature of XExpression [message #996501 is a reply to message #996481] Wed, 02 January 2013 08:30 Go to previous message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
Registered: March 2012
Location: Italy
Senior Member

Good,
thank you!
Previous Topic:Using xText with existing model and Resource
Next Topic:imports do not work anymore in Xtext 2.4
Goto Forum:
  


Current Time: Tue Apr 16 21:47:44 GMT 2024

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

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

Back to the top