|
Re: Cross-referencing only if object exists [message #716366 is a reply to message #716240] |
Wed, 17 August 2011 07:51 |
Alexander Nittka Messages: 1193 Registered: July 2009 |
Senior Member |
|
|
Hi,
personally, I would consider that "sub-optimal" language design. Either I want a cross reference to an existing object or I want to define a new one. You even have a syntactic indicator that it *is* a reference, so why should it be possible to define something new there.
Anyway, your proposed grammar snippet will not work no matter what you do. The parser has to decide which feature is to be instantiated (cross reference or "simple" attribute). It cannot do so based on the input, in both cases it is a qualified name. It is not the parser's responsibility to do the linking (the linker will do that after the parser is done). Either you create new dummy objects during linking or you live with unresolved cross references.
As I said, I consider the latter alternative the clean solution, it correctly tells the user "the object you want to reference does not exist, define it if you want" (you could even implement a quickfix that would create a corresponding definition).
Alex
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03259 seconds