|[Solved][EVL 1.1] : lexical analysis and constraint scope [message #1112900]
||Fri, 20 September 2013 10:36
|| Didier Garcin
Registered: April 2013
I encounter two problems while developing checking of well spelled identifiers.
I wish to check thanks to an EVL constraint, UML names of packages, classes, datatypes, primitive types, interfaces, attributes and operations.
So I declare the following.
operation String isId() : Boolean
isId() succeeds if the string begins by a letter followed by letters or digits or underscores but not consecutive underscores.
So _myid, my__id, are rejected.
But, in practice, this is not the case. It seems there is a problem around the underscore character.
Which norm of regular expression does 'matches' function use ?
Finally ... I found how to solve this pb. See :
Nevertheless, what is following is still unsolved -->
guard : not self.isKindOf(Association)
check : self.name.isDefined() and self.name.isId()
var id : String;
if (self.name.isDefined() and self.name <> '')
id = self.name;
id = self.id;
return 'Err #12.001 : ' + id + ' : ' + 'This name is not a valid identifier for the target language.';
This constraint says provided a packageable element is not an association, checks its name to be an identifier.
In practice, this constraint doesn't seem checking operations and attributes. In the other hand, it checks UML entities involved in cardinality of associations. It is not what I want to get.
What is wrong ?
Thanks your answers.
I'm joining a minimal example.
- 12-packageElements.evl contains the constraint in question, well_spelled_identifier.
- operations.evl contains (among others, not used here) isId() : Boolean.
- minimal.uml, an UML model containing :
the packages named _YouMissToRejectMyName_see_the_underscore_at_the_beginning, YouMiss__ToRejectMyName_see_the_consecutive_underscores whom names should be rejected.
An association between Class1 and Class2 whom cardinalities are abusively checked. Strange... Should not be checked by the constraint, well_spelled_identifier (12-packageableElements.evl) at all.
And Class3 whom the attribute's and operation's names should be checked and rejected, but not checked at all.
[Updated on: Sun, 22 September 2013 20:43]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.13402 seconds