Skip to main content



      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 10:01 Go to next message
Eclipse UserFriend
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 12:57 Go to previous messageGo to next message
Eclipse UserFriend
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 05:42 Go to previous message
Eclipse UserFriend
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: Mon Jul 14 04:09:46 EDT 2025

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

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

Back to the top