Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Cross references Issues in Xtext(Cross references Issues in Xtext)
icon5.gif  Cross references Issues in Xtext [message #1455191] Wed, 29 October 2014 05:37 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
HI all,

An example of my DSL is:

In model1.dsl :

        myNode ABC {
	description				"---"
	type					someID
        property1                      DEF

	
}


In model2.dsl :

        myNode BCD {
	description				"---"
	type					someID
        property1                      NOT_NEEDED
}

myNode DEF {
	description				"---"
	type					someID
        property1                      NOT_NEEDED
}



Both DSLs are written using the same grammar as you can see the file extensions are also same.

Observe property1 DEF and property1 NOT_NEEDED.

The value for property1 can be either a myNode reference (DEF in this example) or an enum element (NOT_NEEDED in this example.)

All the fields are mandatory in the grammar.

Now suppose I change my model2.dsl to :

        myNode BCD {
	description				"---"
	// type					someID
        // property1                      NOT_NEEDED
}

myNode DEF {
	description				"---"
	type					someID
        property1                      NOT_NEEDED
}



So now the model2.dsl has syntax errors and parsing doesn't continue.

At this point of time, I get an error in model1.dsl at property1 DEF, which says "Couldn't resolve reference to........".

We observe this problem whenever the grammar is updated.

Is there a way to avoid this problem and cross linking still exists if the other file has problems.

Note: Suppose If I have 10 myNodes in model2.dsl and there is a problem in 6th myNode then parsing will be successfully done upto the 5th myNode and I am able to cross link it but no myNode can be referred after 6th.

Is there a way where I can only avoid 6th and still be able to refer other 9 or all 10 ?

Thanks for any help ! Smile


Regards,
Arshad


Arshad

[Updated on: Wed, 29 October 2014 05:38]

Report message to a moderator

Re: Cross references Issues in Xtext [message #1455267 is a reply to message #1455191] Wed, 29 October 2014 07:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

this depends on your grammar. so why dont you make property1 syntactically optional and enforce its existence by a check?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Cross references Issues in Xtext [message #1455316 is a reply to message #1455267] Wed, 29 October 2014 08:33 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi Christian,
Is there a way to achieve this without making property1 optional ?


Regards,
Arshad


Arshad
Re: Cross references Issues in Xtext [message #1455351 is a reply to message #1455316] Wed, 29 October 2014 09:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi it depends on your grammar and how good the error recovery of the parser is.
e.g. is myNode a keyword? is it used more than once in your grammar?
unless the parser knows to instantiate a thing with name "DEF" you wont have a chance


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
icon5.gif  Re: Cross references Issues in Xtext [message #1455366 is a reply to message #1455351] Wed, 29 October 2014 09:44 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi Christian,
Yes myNode is a keyword and say MyNode is a java class for it.
And yes, there can be many myNodes in a single DSL.


Regards,
Arshad


Arshad

[Updated on: Wed, 29 October 2014 09:45]

Report message to a moderator

Re: Cross references Issues in Xtext [message #1455433 is a reply to message #1455366] Wed, 29 October 2014 11:19 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

can you share an example grammar?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Custom xtext formatter
Next Topic:Unable to load the cross referenced Dsl elements.
Goto Forum:
  


Current Time: Thu Apr 25 07:18:30 GMT 2024

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

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

Back to the top