Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [Xtext] AST processing during linking question
[Xtext] AST processing during linking question [message #51590] Mon, 15 June 2009 15:58 Go to next message
Eclipse UserFriend
Hi,

I have a grammar which is effectively:

FullyQualifiedClassReference:
(importRef=[ImportDef] '::')? classRef=[ClassRef] '::'
memberRef=[MemberRef];

So if I write:
importedModule::SomeClass::memberOfSomeClass all the linking works fine.

However, if I write:

SomeClass::memberOfSomeClass

I get an error. In the debugger I see that Linking tries to resolve
importRef first and fails. It does not seem to move forward and try to
resolve classRef with 'SomeClass' after the first failure. I suspect the
'::' used in two contexts is the problem. So I changed the grammar to:

(importRef=[ImportDef] '::')? classRef=[ClassRef] '&' memberRef=[MemberRef]

and it matches SomeClass&memberOfSomeClass as I expect. Since I did not
expect this behavior my conceptual model of the parser is wrong. Can someone
explain why I see this behavior. And more importantly, how can I get my
original grammer intent to work with the usage of '::' as the
import/class/member separator?

Thanks for you help.
Derek
Re: [Xtext] AST processing during linking question [message #51651 is a reply to message #51590] Mon, 15 June 2009 18:44 Go to previous messageGo to next message
Eclipse UserFriend
Hi Derek,

maybe you are facing a bug in Xtext. Please file a ticket.

Thanks,
Sebastian

Am 15.06.2009 21:58 Uhr, schrieb Derek Palma:
> Hi,
>
> I have a grammar which is effectively:
>
> FullyQualifiedClassReference:
> (importRef=[ImportDef] '::')? classRef=[ClassRef] '::'
> memberRef=[MemberRef];
>
> So if I write:
> importedModule::SomeClass::memberOfSomeClass all the linking works fine.
>
> However, if I write:
>
> SomeClass::memberOfSomeClass
>
> I get an error. In the debugger I see that Linking tries to resolve
> importRef first and fails. It does not seem to move forward and try to
> resolve classRef with 'SomeClass' after the first failure. I suspect the
> '::' used in two contexts is the problem. So I changed the grammar to:
>
> (importRef=[ImportDef] '::')? classRef=[ClassRef] '&' memberRef=[MemberRef]
>
> and it matches SomeClass&memberOfSomeClass as I expect. Since I did not
> expect this behavior my conceptual model of the parser is wrong. Can
> someone explain why I see this behavior. And more importantly, how can I
> get my original grammer intent to work with the usage of '::' as the
> import/class/member separator?
>
> Thanks for you help.
> Derek
>
>
>
Re: [Xtext] AST processing during linking question [message #51669 is a reply to message #51651] Tue, 16 June 2009 01:28 Go to previous messageGo to next message
Eclipse UserFriend
Thanks.

I'll create a simple grammar and put it in a ticket.

I was curious as to whether others use this type of construct. I had
presumed it was just my misinterpretation and that it must be possible to
support this kind of matching possibly some other way. It seems like some
form of it would be needed in most non-trivial DSLs.

Derek
"Sebastian Zarnekow" <Sebastian.Zarnekow@itemis.de> wrote in message
news:h16is2$kn1$1@build.eclipse.org...
> Hi Derek,
>
> maybe you are facing a bug in Xtext. Please file a ticket.
>
> Thanks,
> Sebastian
>
> Am 15.06.2009 21:58 Uhr, schrieb Derek Palma:
>> Hi,
>>
>> I have a grammar which is effectively:
>>
>> FullyQualifiedClassReference:
>> (importRef=[ImportDef] '::')? classRef=[ClassRef] '::'
>> memberRef=[MemberRef];
>>
>> So if I write:
>> importedModule::SomeClass::memberOfSomeClass all the linking works fine.
>>
>> However, if I write:
>>
>> SomeClass::memberOfSomeClass
>>
>> I get an error. In the debugger I see that Linking tries to resolve
>> importRef first and fails. It does not seem to move forward and try to
>> resolve classRef with 'SomeClass' after the first failure. I suspect the
>> '::' used in two contexts is the problem. So I changed the grammar to:
>>
>> (importRef=[ImportDef] '::')? classRef=[ClassRef] '&'
>> memberRef=[MemberRef]
>>
>> and it matches SomeClass&memberOfSomeClass as I expect. Since I did not
>> expect this behavior my conceptual model of the parser is wrong. Can
>> someone explain why I see this behavior. And more importantly, how can I
>> get my original grammer intent to work with the usage of '::' as the
>> import/class/member separator?
>>
>> Thanks for you help.
>> Derek
>>
>>
>>
>
Re: [Xtext] AST processing during linking question [message #51768 is a reply to message #51669] Tue, 16 June 2009 03:04 Go to previous message
Eclipse UserFriend
Filed bug: 280394.


"Derek Palma" <derek.palma@gmail.com> wrote in message
news:h17aju$frt$1@build.eclipse.org...
> Thanks.
>
> I'll create a simple grammar and put it in a ticket.
>
> I was curious as to whether others use this type of construct. I had
> presumed it was just my misinterpretation and that it must be possible to
> support this kind of matching possibly some other way. It seems like some
> form of it would be needed in most non-trivial DSLs.
>
> Derek
> "Sebastian Zarnekow" <Sebastian.Zarnekow@itemis.de> wrote in message
> news:h16is2$kn1$1@build.eclipse.org...
>> Hi Derek,
>>
>> maybe you are facing a bug in Xtext. Please file a ticket.
>>
>> Thanks,
>> Sebastian
>>
>> Am 15.06.2009 21:58 Uhr, schrieb Derek Palma:
>>> Hi,
>>>
>>> I have a grammar which is effectively:
>>>
>>> FullyQualifiedClassReference:
>>> (importRef=[ImportDef] '::')? classRef=[ClassRef] '::'
>>> memberRef=[MemberRef];
>>>
>>> So if I write:
>>> importedModule::SomeClass::memberOfSomeClass all the linking works fine.
>>>
>>> However, if I write:
>>>
>>> SomeClass::memberOfSomeClass
>>>
>>> I get an error. In the debugger I see that Linking tries to resolve
>>> importRef first and fails. It does not seem to move forward and try to
>>> resolve classRef with 'SomeClass' after the first failure. I suspect the
>>> '::' used in two contexts is the problem. So I changed the grammar to:
>>>
>>> (importRef=[ImportDef] '::')? classRef=[ClassRef] '&'
>>> memberRef=[MemberRef]
>>>
>>> and it matches SomeClass&memberOfSomeClass as I expect. Since I did not
>>> expect this behavior my conceptual model of the parser is wrong. Can
>>> someone explain why I see this behavior. And more importantly, how can I
>>> get my original grammer intent to work with the usage of '::' as the
>>> import/class/member separator?
>>>
>>> Thanks for you help.
>>> Derek
>>>
>>>
>>>
>>
>
Previous Topic:Bug in codecompletion?
Next Topic:[Xtext] import scoping
Goto Forum:
  


Current Time: Tue Jul 01 06:19:19 EDT 2025

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

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

Back to the top