Optimize default arguments (@ operator) into script rules.

The plan is to deprecate rule form completely, so instead of replace_rule(match:..) write replace_text@(match: ...)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@987 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-06-18 19:25:18 +00:00
parent 50b09c7673
commit 2662f9d4bf
9 changed files with 122 additions and 48 deletions
+10 -1
View File
@@ -611,9 +611,18 @@ ScriptValueP match_rule(Context& ctx) {
SCRIPT_FUNCTION(match_rule) {
return match_rule(ctx);
}
SCRIPT_FUNCTION(match) {
SCRIPT_FUNCTION_WITH_SIMPLIFY(match) {
return match_rule(ctx)->eval(ctx);
}
SCRIPT_FUNCTION_SIMPLIFY_CLOSURE(match) {
ScriptValueP match = closure.getBinding(SCRIPT_VAR_match);
if (match) {
intrusive_ptr<ScriptMatchRule> ret(new ScriptMatchRule);
from_script(match, ret->regex);
return ret;
}
return ScriptValueP();
}
// ----------------------------------------------------------------------------- : Rules : sort text