Allow changing RegExp case insensitive and basic posix properties.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6100 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2016-03-04 14:48:48 +00:00
parent 5e18aa85f8
commit beac5b2cd1
2 changed files with 22 additions and 0 deletions

View File

@ -1187,6 +1187,19 @@ bool JsRegExp::runNative(ObjList& stack, const ExpOperation& oper, GenObject* co
return true;
}
bool JsRegExp::runAssign(ObjList& stack, const ExpOperation& oper, GenObject* context)
{
XDebug(DebugAll,"JsRegExp::runAssign() '%s'='%s' (%s) in '%s' [%p]",
oper.name().c_str(),oper.c_str(),oper.typeOf(),toString().c_str(),this);
if (!JsObject::runAssign(stack,oper,context))
return false;
if (oper.name() == YSTRING("ignoreCase"))
regexp().setFlags(regexp().isExtended(),oper.toBoolean());
else if (oper.name() == YSTRING("basicPosix"))
regexp().setFlags(!oper.toBoolean(),regexp().isCaseInsensitive());
return true;
}
JsObject* JsRegExp::runConstructor(ObjList& stack, const ExpOperation& oper, GenObject* context)
{
ObjList args;

View File

@ -2430,6 +2430,15 @@ public:
inline Regexp& regexp()
{ return m_regexp; }
/**
* Try to assign a value to a single field
* @param stack Evaluation stack in use
* @param oper Field to assign to, contains the field name and new value
* @param context Pointer to arbitrary object passed from evaluation methods
* @return True if assignment succeeded
*/
virtual bool runAssign(ObjList& stack, const ExpOperation& oper, GenObject* context);
/**
* RegExp object constructor, it's run on the prototype
* @param stack Evaluation stack in use