|Re: Reserved keywords? [message #53110 is a reply to message #52976]
||Mon, 24 March 2008 15:14
Originally posted by: cdamus.ca.ibm.com|
Yes, attr is defined by the OCL specification as a reserved word. I think
it is an anachronism, but the MDT implementation respects it.
You can escape this by enclosing the word in double-quotes:
Note, however, that this is a non-standard capability.
The OCL Specification lists reserved words in Section 7.4.9 "Keywords."
You can also find them listed in the OCLKWLexer.g file in the MDT OCL CVS,
in the org.eclipse.ocl.parser package.
Stefan Schulze wrote:
> In a testcase I defined an EClass "SomeClass" with the integer-attribute
> "attr" and an according EObject with attr=1. I tried to evaluate the query
> "SomeClass.allInstances()->select(o|o.attr=1)", but it fails with the
> message "token 'attr' is invalid". If I change the attributes name to
> "someattr" and the query to
> "SomeClass.allInstances()->select(o|o.someattr=1)", everything works fine.
> The same issue occures with a variable named "attr".
> I guess, "attr" is somehow reserved. Can I find a list with all reserved
> keywords anywhere?
Powered by FUDForum
. Page generated in 0.05426 seconds