Home » Modeling » OCL » Parsing failed: ") unexpected token(s)" in helper.defineOperation(..) although number of p
| |
Re: Parsing failed: ") unexpected token(s)" in helper.defineOperation(..) although number [message #59565 is a reply to message #59491] |
Tue, 22 July 2008 13:03 |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
--=-5XBnevqiIQmoj8i2ZQXz
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi, Anne,
That does look like some kind of bug: the location of the offending
parenthesis suggests that it has nothing to do with the body of the
operation definition. AFAICT, your OCL is well formed.
If you can reproduce this problem with a subset of your metamodel that
you feel you can share as an attachment on a bug, I'd appreciate it.
I'm afraid that I would have to debug this to provide any help :-(
This exception is coming from the concrete-syntax parsing phase, not the
abstract-syntax parsing, so it must be something simple that I'm not
seeing ...
Thanks,
Christian
On Tue, 2008-07-22 at 11:40 +0200, Anne Martens wrote:
> Dear newsgroup,
>
> I'm trying to define the operation below, but get a ParserException for
> wrong parenthesis. Is that really a problem of my OCL or rather a bug
> (maybe giving the correct error message if my OCL is really invalid
> because of other reasons)?
>
> You find my code below. It is supposed to retrieve the set of all
> Interfaces of a BasicComponent "self" via the ProvidedRole class (see
> meta model excerpt below) and check whether all Interfaces of a
> BasicComponent "o" are included.
>
> helper.setContext(aBasicComponent.eClass());
>
> helper.defineOperation(
> "isAlternativeTo(o: BasicComponent): Boolean = " +
> "self.providedRoles_InterfaceProvidingEntity" +
> "->collect(t | t.providedInterface__ProvidedRole)" +
> "->includesAll(o.providedRoles_InterfaceProvidingEntity" +
> "->collect(t | t.providedInterface__ProvidedRole))");
>
> The exception:
>
> ParserException: 1:49:1:49 ") unexpected token(s)"
> at OCLParser.parseConcreteSyntax(OCLParser.java:747)
> at OCLParser.parseInvOrDefCS(OCLParser.java:836)
> ...
>
> My meta model:
>
> BasicComponent ---- * ProvidedRole ---- 1 Interface
>
> where the associations are named:
> BasicComponent to ProvidedRole (1 to n) is named:
> providedRoles_InterfaceProvidingEntity
>
> ProvidedRole to Interface (n to 1) is named: providedInterface__ProvidedRole
>
> I am using OCL 2.0 version 1.1.2.v200711262212. Unfortunately, I don't
> manage to upgrade to 1.2 due to conflicts with other plugins, but that
> is another story.
--=-5XBnevqiIQmoj8i2ZQXz
Content-Type: text/html; charset=utf-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.0">
</HEAD>
<BODY>
Hi, Anne,<BR>
<BR>
That does look like some kind of bug: the location of the offending parenthesis suggests that it has nothing to do with the body of the operation definition. AFAICT, your OCL is well formed.<BR>
<BR>
If you can reproduce this problem with a subset of your metamodel that you feel you can share as an attachment on a bug, I'd appreciate it. I'm afraid that I would have to debug this to provide any help :-(<BR>
<BR>
This exception is coming from the concrete-syntax parsing phase, not the abstract-syntax parsing, so it must be something simple that I'm not seeing ...<BR>
<BR>
Thanks,<BR>
<BR>
Christian<BR>
<BR>
On Tue, 2008-07-22 at 11:40 +0200, Anne Martens wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Dear newsgroup,</FONT>
<FONT COLOR="#000000">I'm trying to define the operation below, but get a ParserException for </FONT>
<FONT COLOR="#000000">wrong parenthesis. Is that really a problem of my OCL or rather a bug </FONT>
<FONT COLOR="#000000">(maybe giving the correct error message if my OCL is really invalid </FONT>
<FONT COLOR="#000000">because of other reasons)?</FONT>
<FONT COLOR="#000000">You find my code below. It is supposed to retrieve the set of all </FONT>
<FONT COLOR="#000000">Interfaces of a BasicComponent "self" via the ProvidedRole class (see </FONT>
<FONT COLOR="#000000">meta model excerpt below) and check whether all Interfaces of a </FONT>
<FONT COLOR="#000000">BasicComponent "o" are included.</FONT>
<FONT COLOR="#000000">helper.setContext(aBasicComponent.eClass()); </FONT>
<FONT COLOR="#000000"> </FONT>
<FONT COLOR="#000000">helper.defineOperation(</FONT>
<FONT COLOR="#000000"> "isAlternativeTo(o: BasicComponent): Boolean = " +</FONT>
<FONT COLOR="#000000"> "self.providedRoles_InterfaceProvidingEntity&qu ot; +</FONT>
<FONT COLOR="#000000"> "->collect(t | t.providedInterface__ProvidedRole)" +</FONT>
<FONT COLOR="#000000"> "->includesAll(o.providedRoles_InterfaceProv idingEntity" +</FONT>
<FONT COLOR="#000000"> "->collect(t | t.providedInterface__ProvidedRole))");</FONT>
<FONT COLOR="#000000">The exception:</FONT>
<FONT COLOR="#000000">ParserException: 1:49:1:49 ") unexpected token(s)"</FONT>
<FONT COLOR="#000000"> at OCLParser.parseConcreteSyntax(OCLParser.java:747)</FONT>
<FONT COLOR="#000000"> at OCLParser.parseInvOrDefCS(OCLParser.java:836)</FONT>
<FONT COLOR="#000000"> ...</FONT>
<FONT COLOR="#000000">My meta model:</FONT>
<FONT COLOR="#000000">BasicComponent ---- * ProvidedRole ---- 1 Interface</FONT>
<FONT COLOR="#000000">where the associations are named:</FONT>
<FONT COLOR="#000000">BasicComponent to ProvidedRole (1 to n) is named: </FONT>
<FONT COLOR="#000000">providedRoles_InterfaceProvidingEntity</FONT >
<FONT COLOR="#000000">ProvidedRole to Interface (n to 1) is named: providedInterface__ProvidedRole</FONT>
<FONT COLOR="#000000">I am using OCL 2.0 version 1.1.2.v200711262212. Unfortunately, I don't </FONT>
<FONT COLOR="#000000">manage to upgrade to 1.2 due to conflicts with other plugins, but that </FONT>
<FONT COLOR="#000000">is another story.</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>
--=-5XBnevqiIQmoj8i2ZQXz--
|
|
|
Re: Parsing failed: ") unexpected token(s)" in helper.defineOperation(..) although number [message #59689 is a reply to message #59565] |
Wed, 23 July 2008 07:30 |
Anne Martens Messages: 2 Registered: July 2009 |
Junior Member |
|
|
Dear Christian,
I wanted to provide you with the meta model, but before doing so, tried
to reproduce the bug (in the meantime I had reorganised my plugin code
to do the query without OCL directly traversing the object graph).
And funnily, I cannot reproduce it. Everything works fine. I have no
clue why.
If you still want to have a look, the meta model is included in the
plugin/feature de.uka.ipd.sdq.pcm, available at the update site
http://sdqweb.ipd.uka.de/eclipse/PCM_unstable/ . Unfortunately, I am not
sure which other plugins are required.
Thank you anyway for your help! Lesson learned: Try to do things anew
before giving it up.
If I encounter the bug(?) again, I will make sure to document it better
to be able to report it with the example code.
Kind regards,
Anne Martens
On 22.07.2008 15:03 Christian W. Damus wrote:
> Hi, Anne,
>
> That does look like some kind of bug: the location of the offending
> parenthesis suggests that it has nothing to do with the body of the
> operation definition. AFAICT, your OCL is well formed.
>
> If you can reproduce this problem with a subset of your metamodel that
> you feel you can share as an attachment on a bug, I'd appreciate it.
> I'm afraid that I would have to debug this to provide any help :-(
>
> This exception is coming from the concrete-syntax parsing phase, not the
> abstract-syntax parsing, so it must be something simple that I'm not
> seeing ...
>
> Thanks,
>
> Christian
>
> On Tue, 2008-07-22 at 11:40 +0200, Anne Martens wrote:
>> Dear newsgroup,
>>
>> I'm trying to define the operation below, but get a ParserException for
>> wrong parenthesis. Is that really a problem of my OCL or rather a bug
>> (maybe giving the correct error message if my OCL is really invalid
>> because of other reasons)?
>>
>> You find my code below. It is supposed to retrieve the set of all
>> Interfaces of a BasicComponent "self" via the ProvidedRole class (see
>> meta model excerpt below) and check whether all Interfaces of a
>> BasicComponent "o" are included.
>>
>> helper.setContext(aBasicComponent.eClass());
>>
>> helper.defineOperation(
>> "isAlternativeTo(o: BasicComponent): Boolean = " +
>> "self.providedRoles_InterfaceProvidingEntity" +
>> "->collect(t | t.providedInterface__ProvidedRole)" +
>> "->includesAll(o.providedRoles_InterfaceProvidingEntity" +
>> "->collect(t | t.providedInterface__ProvidedRole))");
>>
>> The exception:
>>
>> ParserException: 1:49:1:49 ") unexpected token(s)"
>> at OCLParser.parseConcreteSyntax(OCLParser.java:747)
>> at OCLParser.parseInvOrDefCS(OCLParser.java:836)
>> ...
>>
>> My meta model:
>>
>> BasicComponent ---- * ProvidedRole ---- 1 Interface
>>
>> where the associations are named:
>> BasicComponent to ProvidedRole (1 to n) is named:
>> providedRoles_InterfaceProvidingEntity
>>
>> ProvidedRole to Interface (n to 1) is named: providedInterface__ProvidedRole
>>
>> I am using OCL 2.0 version 1.1.2.v200711262212. Unfortunately, I don't
>> manage to upgrade to 1.2 due to conflicts with other plugins, but that
>> is another story.
|
|
|
Goto Forum:
Current Time: Sat Apr 27 03:15:56 GMT 2024
Powered by FUDForum. Page generated in 0.03369 seconds
|