[Xtext] AST processing during linking question [message #51590] |
Mon, 15 June 2009 15:58  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
>>>
>>>
>>>
>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05107 seconds