Skip to main content



      Home
Home » Modeling » TMF (Xtext) » xtext noobie doubt
xtext noobie doubt [message #1263551] Tue, 04 March 2014 10:33 Go to next message
Eclipse UserFriend
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 12:04 Go to previous messageGo to next message
Eclipse UserFriend
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());
}
Re: xtext noobie doubt [message #1263689 is a reply to message #1263643] Tue, 04 March 2014 12:47 Go to previous message
Eclipse UserFriend
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: Tue Jul 15 14:09:44 EDT 2025

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

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

Back to the top