Added some more classes for ScriptErrors;

Added split_text function, which is the 'opposite' of break_text;
Script code "f\n(stuff)" now parses as "f;stuff" instead of a function call, "f(stuff)";
Fixed bug in cursor movement, which caused the closing > of a tag at end of input to be overwritten.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1175 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-27 18:44:59 +00:00
parent 9abfdd171c
commit dc9405e441
9 changed files with 104 additions and 44 deletions
+8 -8
View File
@@ -110,14 +110,14 @@ SCRIPT_FUNCTION(to_int) {
} else if (str.empty()) {
result = 0;
} else {
return delayError(_ERROR_3_("can't convert value", str, input->typeName(), _TYPE_("integer")));
return delay_error(ScriptErrorConversion(str, input->typeName(), _TYPE_("integer")));
}
} else {
result = (int)*input;
}
SCRIPT_RETURN(result);
} catch (const ScriptError& e) {
return new_intrusive1<ScriptDelayedError>(e);
return delay_error(e);
}
}
@@ -136,14 +136,14 @@ SCRIPT_FUNCTION(to_real) {
if (str.empty()) {
result = 0.0;
} else if (!str.ToDouble(&result)) {
return delayError(_ERROR_3_("can't convert value", str, input->typeName(), _TYPE_("double")));
return delay_error(ScriptErrorConversion(str, input->typeName(), _TYPE_("double")));
}
} else {
result = (double)*input;
}
SCRIPT_RETURN(result);
} catch (const ScriptError& e) {
return new_intrusive1<ScriptDelayedError>(e);
return delay_error(e);
}
}
@@ -170,11 +170,11 @@ SCRIPT_FUNCTION(to_number) {
} else if (str.empty()) {
SCRIPT_RETURN(0);
} else {
return delayError(_ERROR_3_("can't convert value", str, input->typeName(), _TYPE_("double")));
return delay_error(ScriptErrorConversion(str, input->typeName(), _TYPE_("double")));
}
}
} catch (const ScriptError& e) {
return new_intrusive1<ScriptDelayedError>(e);
return delay_error(e);
}
}
@@ -190,7 +190,7 @@ SCRIPT_FUNCTION(to_boolean) {
}
SCRIPT_RETURN(result);
} catch (const ScriptError& e) {
return new_intrusive1<ScriptDelayedError>(e);
return delay_error(e);
}
}
@@ -199,7 +199,7 @@ SCRIPT_FUNCTION(to_color) {
SCRIPT_PARAM_C(AColor, input);
SCRIPT_RETURN(input);
} catch (const ScriptError& e) {
return new_intrusive1<ScriptDelayedError>(e);
return delay_error(e);
}
}