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: 14716
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());
}


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: Thu Sep 19 01:21:35 GMT 2024

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

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

Back to the top