Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » testing xbase language referring to another xbase resource
testing xbase language referring to another xbase resource [message #904066] Mon, 27 August 2012 17:17 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1762
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

for a DSL (based on Xbase + JvmModelInferrer) in a program I can refer
(via a JvmParameterizedTypeReference) to a Java type which is inferred
by my JvmModelInferrer and corresponds to a model defined in another file.

I'll try to simply the example

// first program
model my.model.MyModel
// for which the my.model.MyModel Java class is inferred

// second program
ref my.model.MyModel

I though I could unit test such situation with something like


@Inject extension ParseHelper<Model>
@Inject extension ValidationTestHelper
....
'''model my.model.MyModel'''.parse.assertNoErrors // this is OK
'''ref my.model.MyModel'''.parse.assertNoErrors // fails

however, the second line fails since it cannot resolve the JvmType
my.model.MyModel... since the two inputs are in the same resource set I
thought the linking and scoping would work... but they don't seem to...

am I doing something wrong?

any suggestion?

thanks in advance
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: testing xbase language referring to another xbase resource [message #904068 is a reply to message #904066] Mon, 27 August 2012 17:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13373
Registered: July 2009
Senior Member
Hi,

which version do you use still 2.3.0?
maybe one more a https://bugs.eclipse.org/bugs/show_bug.cgi?id=382555

second you have to use the parse method with three params and pass the single resourceset yourself

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: testing xbase language referring to another xbase resource [message #904308 is a reply to message #904068] Tue, 28 August 2012 07:57 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1762
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 08/27/2012 07:28 PM, Christian Dietrich wrote:
> Hi,
>
> which version do you use still 2.3.0?
> maybe one more a https://bugs.eclipse.org/bugs/show_bug.cgi?id=382555
>

2.3.1 so that bug shouldn't affect me

> second you have to use the parse method with three params and pass the
> single resourceset yourself

thanks Christian!
it works when passing the resource set... I was thinking that using the
same parser helper would use the same resource set, but I should have
looked at the sources :)

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: testing xbase language referring to another xbase resource [message #904312 is a reply to message #904308] Tue, 28 August 2012 08:12 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1762
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 08/28/2012 09:57 AM, Lorenzo Bettini wrote:
>> second you have to use the parse method with three params and pass the
>> single resourceset yourself
>
> thanks Christian!
> it works when passing the resource set... I was thinking that using the
> same parser helper would use the same resource set, but I should have
> looked at the sources :)

indeed it's even easier: you don't need a resource set provider, nor to
build the URI yourself:

val rs = '''model my.model.MyModel'''.parse.eResource.resourceSet
'''ref my.model.MyModel'''.parse(rs).assertNoErrors


--
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


Previous Topic:Decision can match input such as "RULE_ID '=' RULE_ID"
Next Topic:Implementing dynamic keywords
Goto Forum:
  


Current Time: Sat Feb 29 04:46:27 GMT 2020

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

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

Back to the top