Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext noobie doubt
xtext noobie doubt [message #1263551] Tue, 04 March 2014 15:33 Go to next message
Junior A is currently offline Junior AFriend
Messages: 2
Registered: March 2014
Junior Member
i have this xtext grammar

Program:
'program' name=ID '{'
type=Type
'}'
;

Type:
{Type}
'type' '{'
list+=ListType*
'}'
;

ListType:
name=ID '{'
funcs+=SubType*
'}'
;

SubType:
name=ID '()'
;

Verify:
subsys=[ListType] '.' cname=[SubType] '()'
;

now lets say i do:

program test{

subsystems {
A{
B()
}
}

}

and I want to use Verify rule with something like
A.B()

how can i make it recognize that B is from A ?
Re: xtext noobie doubt [message #1263643 is a reply to message #1263551] Tue, 04 March 2014 17:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13641
Registered: July 2009
Senior Member
Hi,

the keyword for that is called "scoping"

something like (pseudo code)

IScope scope_Verify_cname(Verify ctx, EReference r) {
return Scopes.scopeFor(ctx.getSubsys().getfuncs());
}


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtext noobie doubt [message #1263689 is a reply to message #1263643] Tue, 04 March 2014 17:47 Go to previous message
Junior A is currently offline Junior AFriend
Messages: 2
Registered: March 2014
Junior Member
that did the job Smile
thanks
Previous Topic:Unwanted comments in generated Java Code
Next Topic:How to complete code using ctrl-space
Goto Forum:
  


Current Time: Wed Oct 28 06:45:40 GMT 2020

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

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

Back to the top