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 09:50 Go to next message
lalakis  is currently offline lalakis
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 10:21 Go to previous messageGo to next message
lalakis  is currently offline lalakis
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 14:08 Go to previous messageGo to next message
Louis Rose is currently offline Louis Rose
Messages: 439
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 04:59 Go to previous message
lalakis  is currently offline lalakis
Messages: 48
Registered: October 2009
Member
Thanks.very useful
Previous Topic:Model Transformation Round-trip
Next Topic:[Flock]
Goto Forum:
  


Current Time: Tue Jul 29 10:48:34 EDT 2014

Powered by FUDForum. Page generated in 0.02256 seconds