|
Re: Check if a feature matches one among more terminals [message #988645 is a reply to message #988498] |
Fri, 30 November 2012 15:32  |
Eclipse User |
|
|
|
Hi Marco,
please try to use NodeModelUtils.findNodeForFeature, ask the node for
the grammar element and check that against the grammar access of your
language.
Best regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 30.11.12 14:35, schrieb Marco Naddeo:
> Hi :)
>
> in a declarative validator for a type of my own language, how can I
> check if a feature of this grammar element matches one among more
> terminals?
>
> Suppose that the rule defining this type is:
>
> ANonTerminal:
> myFeature=TERMINAL1 anotherFeature=AnotherNonTerminal |
> myFeature=TERMINAL2 anotherFeature=AnotherNonTerminal |
> myFeature=TERMINAL3 anotherFeature=AnotherNonTerminal
> ;
>
> and I want to write something like this:
>
>
> public class AbstractMyLanguageJavaValidator extends
> AbstractDomainmodelJavaValidator {
>
> ...
>
> @Check
> public void myOwnCheck(ANonTerminal elem) {
> if (elem.getMyFeature == TERMINAL2) {
> warning(...);
> }
> }
>
> }
>
> Could you help me please? Thanks in advance! :)
|
|
|
Powered by
FUDForum. Page generated in 0.03250 seconds