Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » cannot add XMemberFeatureCall to sealed type XExpression
cannot add XMemberFeatureCall to sealed type XExpression [message #910860] Mon, 10 September 2012 14:01 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I was trying to redefine in my grammar the rule for XMemberFeatureCall
as follows:

FieldAccess returns xbase::XMemberFeatureCall:
PrimaryExpression
(=>({XAssignment.assignable=current} '.'
feature=[types::JvmIdentifiableElement|ValidID]
))*
;

but I get this error from Xtext validator:

"cannot add XMemberFeatureCall to sealed type XExpression"

am I doing something wrong?
My grammar derives from Xbase and I've imported

import 'http://www.eclipse.org/xtext/xbase/Xbase' as xbase

following the example "template DSL" of "seven languages in Xtext"

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: cannot add XMemberFeatureCall to sealed type XExpression [message #910940 is a reply to message #910860] Mon, 10 September 2012 16:57 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 10.09.12 07.01, Lorenzo Bettini wrote:
>
> I was trying to redefine in my grammar the rule for XMemberFeatureCall
> as follows:
>
> FieldAccess returns xbase::XMemberFeatureCall:
> PrimaryExpression
> (=>({XAssignment.assignable=current} '.'
> feature=[types::JvmIdentifiableElement|ValidID]
> ))*
> ;
>
> but I get this error from Xtext validator:
>
> "cannot add XMemberFeatureCall to sealed type XExpression"

To redefine the grammar for XMemberFeatureCall, you'll need to use the
same rule name, and it should return the same as the original, i.e.
xbase::XExpression.

Hallvard
Re: cannot add XMemberFeatureCall to sealed type XExpression [message #911283 is a reply to message #910940] Tue, 11 September 2012 09:42 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 09/10/2012 06:57 PM, Hallvard Trætteberg wrote:
> On 10.09.12 07.01, Lorenzo Bettini wrote:
>>
>> I was trying to redefine in my grammar the rule for XMemberFeatureCall
>> as follows:
>>
>> FieldAccess returns xbase::XMemberFeatureCall:
>> PrimaryExpression
>> (=>({XAssignment.assignable=current} '.'
>> feature=[types::JvmIdentifiableElement|ValidID]
>> ))*
>> ;
>>
>> but I get this error from Xtext validator:
>>
>> "cannot add XMemberFeatureCall to sealed type XExpression"
>
> To redefine the grammar for XMemberFeatureCall, you'll need to use the
> same rule name, and it should return the same as the original, i.e.
> xbase::XExpression.
>
> Hallvard

But in the seven languages examples (the template example,
http://www.eclipse.org/Xtext/7languagesDoc.html#template ), I read
something like

RichStringIf returns xbase::XIfExpression:
{RichStringIf}
"IF" if=XExpression
then=RichString
(else=RichStringElseIf | "ELSE" else=RichString)?
"ENDIF";

which is similar to what I was implementing...

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


Previous Topic:How to generate code using values of declared variables with JvmModelInferrer in xtext?
Next Topic:How to get Output Folder? - Compiler Preferences
Goto Forum:
  


Current Time: Wed Apr 24 22:01:51 GMT 2024

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

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

Back to the top