Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Reference scope
Reference scope [message #1403310] Tue, 22 July 2014 20:16 Go to next message
De Gumis is currently offline De GumisFriend
Messages: 1
Registered: July 2014
Junior Member
I've just started mu journey with Xtext. I've created a simple grammar:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "h_t_t_p://"

	'services' id=MYID name=ID '{'

	'point' id=MYID name=ID '{'

	'defaultPoints' defaultPoints+=PointId (',' defaultPoints+=PointId)*


	Basic | Advanced

	'basic' id=MYID name=ID '{'

	'advanced' id=MYID name=ID '{'
		'group' '{'
			defaultPoints+=PointId (',' defaultPoints+=PointId)*

terminal MYID:
	'A'..'Z' '-' INT;

Below is an example of use:
services S-2 whole_config {
	point P-1 point1 {
		basic B-1 basic11 {
		basic B-2 basic12 {
		basic B-3 basic13 {
		advanced A-1 advanced11 {
			group {
				basic11 //here is ok
		defaultPoints basic11 //here is ok

	point P-2 point2 {
		basic B-3 basic21 {
		basic B-4 basic22 {
		basic B-5 basic23 {
		advanced A-2 advanced21 {
			group {
				basic11 //here I have an error
		defaultPoints basic11 //here I have an error

In this grammar I use reference (in 'group' and DefaultPoints) a reference to "Basic".
Why I can not point 'basic' elements from P-1 in P-2? I can point only 'basic' elements int this same 'point'

Thank you in advance for any help
Re: Reference scope [message #1403443 is a reply to message #1403310] Wed, 23 July 2014 17:07 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13612
Registered: July 2009
Senior Member
the reason for that is the default behaviour of defaultdeclarativequalifiednameprovider.
you could customize this one to return only the names of the elements and not to concatenate them with their parents name
which makes them insivible by their simple name.

you could alternatively change the grammar to


FQN: ID ("." ID)*;

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Xtend editor does not see methods generated from IncQuery patterns until restart
Next Topic:errors while exporting to Repository
Goto Forum:

Current Time: Mon Sep 28 04:54:01 GMT 2020

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

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

Back to the top