Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Problem by reference in Xtext
Problem by reference in Xtext [message #1730853] Fri, 29 April 2016 05:42 Go to next message
Eclipse UserFriend
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 07:43] by Moderator

Re: Problem by reference in Xtext [message #1730856 is a reply to message #1730853] Fri, 29 April 2016 06:28 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Problem by reference in Xtext [message #1730863 is a reply to message #1730856] Fri, 29 April 2016 07:43 Go to previous messageGo to next message
Eclipse UserFriend
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 07:44] by Moderator

Re: Problem by reference in Xtext [message #1730868 is a reply to message #1730863] Fri, 29 April 2016 08:14 Go to previous messageGo to next message
Eclipse UserFriend
'Result' '=' Elements +=Element (","Elements +=Element)*
Re: Problem by reference in Xtext [message #1730873 is a reply to message #1730868] Fri, 29 April 2016 08:29 Go to previous messageGo to next message
Eclipse UserFriend
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 08:41] by Moderator

Re: Problem by reference in Xtext [message #1730875 is a reply to message #1730873] Fri, 29 April 2016 08:32 Go to previous messageGo to next message
Eclipse UserFriend
hi i dont get this question. you grammar and model dont match.

is this about parsing or about validation/restricting scope
Re: Problem by reference in Xtext [message #1730883 is a reply to message #1730875] Fri, 29 April 2016 09:52 Go to previous messageGo to next message
Eclipse UserFriend
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 10:02 Go to previous message
Eclipse UserFriend
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
	}
	
}

Previous Topic:Xtext DSL to Binary conversion
Next Topic:Accessing Class annotation values from JvmDeclaredType?
Goto Forum:
  


Current Time: Sun Jul 27 01:56:09 EDT 2025

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

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

Back to the top