Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem by reference in Xtext
Problem by reference in Xtext [message #1730853] Fri, 29 April 2016 09:42 Go to next message
Lafleur du versaille is currently offline Lafleur du versailleFriend
Messages: 35
Registered: July 2015
Member
hello
how is it possible to get all the values of the Elemet in 'result'.
because I have an error at the editor in result.
how can I have only at 'result', name of the elements that are use to 'Element'.
Thanks in advance

Quote:

Model:
'Elemet' '=' (Object += Element_1)+
'Result' '=' Elements = [Element] // ***
'finisch'
;

Element_1:
name= ID
;
Element:
name = [Element_1] '['Categories = Category ']'
;
Category:
name= ID
;

[Updated on: Fri, 29 April 2016 11:43]

Report message to a moderator

Re: Problem by reference in Xtext [message #1730856 is a reply to message #1730853] Fri, 29 April 2016 10:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi i dont get your question. you reference an Element that you never declare.

maybe you mean

Model:
'Elemet' '=' (Object += Element_1)+
'Result' '=' Elements = [Element_1] // ***
;

+ a scoping rule that restricts the visible element_1 to the ones defined in the models "object" list.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem by reference in Xtext [message #1730863 is a reply to message #1730856] Fri, 29 April 2016 11:43 Go to previous messageGo to next message
Lafleur du versaille is currently offline Lafleur du versailleFriend
Messages: 35
Registered: July 2015
Member
with 'element' I wanted receive a list from the objects

under 'member' has it possible name to enter but but all names are not categorized

and with Result with result I wanted the following receive : Object Name and the appropriate category


Editor exemple:

Element: Table, Door, Blackboard, Spoon, Cap

result: Spoon household article , Table school.// error by table and Spoon

finisch

[Updated on: Fri, 29 April 2016 11:44]

Report message to a moderator

Re: Problem by reference in Xtext [message #1730868 is a reply to message #1730863] Fri, 29 April 2016 12:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
'Result' '=' Elements +=Element (","Elements +=Element)*

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem by reference in Xtext [message #1730873 is a reply to message #1730868] Fri, 29 April 2016 12:29 Go to previous messageGo to next message
Lafleur du versaille is currently offline Lafleur du versailleFriend
Messages: 35
Registered: July 2015
Member
thank you, it works
but i have another Problem
I want this time with 'Finish' only either Spoon or table to select ie: choose only the element that are used in 'Result'
Quote:

Model:
'Elemet' '=' (Object += Element_1)+
'Result' '=' Elements +=Element (","Elements +=Element)*
'finisch' '=' finsch = [Element]
;

Element_1:
name= ID
;
Element:
name = [Element_1] '['Categories = Category ']'
;
Category:
name= ID
;

Editor exemple:

Element: Table, Door, Blackboard, Spoon, Cap

result: Spoon household article , Table school.

finisch Spoon //error

[Updated on: Fri, 29 April 2016 12:41]

Report message to a moderator

Re: Problem by reference in Xtext [message #1730875 is a reply to message #1730873] Fri, 29 April 2016 12:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi i dont get this question. you grammar and model dont match.

is this about parsing or about validation/restricting scope


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem by reference in Xtext [message #1730883 is a reply to message #1730875] Fri, 29 April 2016 13:52 Go to previous messageGo to next message
Lafleur du versaille is currently offline Lafleur du versailleFriend
Messages: 35
Registered: July 2015
Member
Grammar:

Quote:

Model:
'Element' '=' (objects += Element_1)+
'Result' '=' elements +=Element (","elements +=Element)*
'finish' '=' finsh = [Element]
;

Element_1:
name= ID
;
Element:
name = [Element_1] '['category = Category ']'
;
Category:
name= ID
;


Example:

Element = Table Door Blackboard Spoon Cap

Result = Spoon [household_article], Table [school]

finish = Spoon // Here occurs an error "Couldn't resolve reference to Element 'Spoon'."

For "Finish" i want to be able to specify elements which are used in"Result" but not in "Element". So in this example it should be possible to specify only "Spoon" and "Table" in the "Finish" part.

Thank you for your help Smile
Re: Problem by reference in Xtext [message #1730886 is a reply to message #1730883] Fri, 29 April 2016 14:02 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
crosss refs as name do not work out of the box =>

class MyDslRuntimeModule extends AbstractMyDslRuntimeModule {
	
	override bindIQualifiedNameProvider() {
		MyDslNameProvider
	}
	
}



class MyDslRuntimeModule extends AbstractMyDslRuntimeModule {
	
	override bindIQualifiedNameProvider() {
		MyDslNameProvider
	}
	
}



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext DSL to Binary conversion
Next Topic:Accessing Class annotation values from JvmDeclaredType?
Goto Forum:
  


Current Time: Fri Apr 19 01:32:06 GMT 2024

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

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

Back to the top