Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EVL validation error
EVL validation error [message #674320] Thu, 26 May 2011 13:50 Go to next message
lalakis  is currently offline lalakis Friend
Messages: 48
Registered: October 2009
Member
I'd like to apply a regular expression to a rule by evl.i typed:
constraint A{
check : self.attribute.isDefined() and self.attribute.asString().matches('\w*:\w*')

message : 'Empty attribute is not allowed at '+self.Name + ' component'
}


but i am getting an error while i am typing the rule at the line where the chech rule is defined.How can i apply regular expressions with matches function?
Re: EVL validation error [message #674329 is a reply to message #674320] Thu, 26 May 2011 14:21 Go to previous messageGo to next message
lalakis  is currently offline lalakis Friend
Messages: 48
Registered: October 2009
Member
I realized that the problem remaines whenever a star is included at re regexp
Re: EVL validation error [message #674391 is a reply to message #674329] Thu, 26 May 2011 18:08 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi,

Backslash is the escape character in EOL strings. A backslash literal is represented with '\\'.

The following EOL code:

'abc:def'.isColonWithPrefixAndOrSuffix().println();

':'.isColonWithPrefixAndOrSuffix().println();
'abc:'.isColonWithPrefixAndOrSuffix().println();
':def'.isColonWithPrefixAndOrSuffix().println();

'abc'.isColonWithPrefixAndOrSuffix().println();

operation String isColonWithPrefixAndOrSuffix() : Boolean {
	return self.matches('\\w*:\\w*');
}


Prints true for the first four statements, and false for the fifth statement. Note that the argument to matches uses two backslashes to represent each backslash literal.

Cheers,
Louis.
Re: EVL validation error [message #674525 is a reply to message #674391] Fri, 27 May 2011 08:59 Go to previous message
lalakis  is currently offline lalakis Friend
Messages: 48
Registered: October 2009
Member
Thanks.very useful
Previous Topic:Model Transformation Round-trip
Next Topic:[Flock]
Goto Forum:
  


Current Time: Fri Apr 19 03:54:09 GMT 2024

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

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

Back to the top