Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Reference to current list
icon5.gif  Reference to current list [message #1709596] Tue, 29 September 2015 13:19 Go to next message
Peter Obermann is currently offline Peter ObermannFriend
Messages: 17
Registered: July 2015
Junior Member
Hello there,

how can I selected list offer as autocomplete ?
Unfortunately, it is not accepted in the Scope .

Greeting

index.php/fa/23389/0/

grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"


Model:
	(list_statement+=List_Statement | list+=ListDeclaration)*
;

ListDeclaration:
	'list' name=ID '=' myList=List ';'
;

List:
	'('list=ListItem (',' lists+=ListItem)* ')'
;

ListItem:
	name=ID
;

List_Statement :
	'list' type=[ListDeclaration|ID]
			(task+=Task)*
	'end' 'list' ';'
;

Task: 
	'task' task=[ListItem|ID] ';'
;
  • Attachment: example.jpg
    (Size: 16.20KB, Downloaded 156 times)

[Updated on: Tue, 29 September 2015 13:20]

Report message to a moderator

Re: Reference to current list [message #1709598 is a reply to message #1709596] Tue, 29 September 2015 13:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
simply add something like (pseudo code)

def IScope scope_Tasl_ListItem(ListStatement ctx, EReference r) {
val elements = <ListItem>newArrayList
//TODO collect ctx.types items
Scopes.scopeFor(element)
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Reference to current list [message #1709612 is a reply to message #1709598] Tue, 29 September 2015 14:42 Go to previous message
Peter Obermann is currently offline Peter ObermannFriend
Messages: 17
Registered: July 2015
Junior Member
Hello Christian,

thank you it works . Smile )

Greeting


	def IScope scope_Task_task(List_Statement ctx, EReference r) {
		val elements = <ListItem> newArrayList		
		elements.add(ctx.type.myList.list)

		for (element : ctx.type.myList.lists) {
			elements.add(element);
		}
		Scopes.scopeFor(elements)
        }
Previous Topic:Error: Refactoring is not applicable
Next Topic:xtext from ecore bogus in mars + java 8
Goto Forum:
  


Current Time: Wed Apr 24 23:54:19 GMT 2024

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

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

Back to the top