|
|
|
@ -100,7 +100,7 @@ S: error '=' {
|
|
|
|
|
|
|
|
|
|
// Can't assign to a function.
|
|
|
|
|
S: FUNC '=' {
|
|
|
|
|
TQString s(i18n("You can't assign to function %1").tqarg($1->name()));
|
|
|
|
|
TQString s(i18n("You can't assign to function %1").arg($1->name()));
|
|
|
|
|
Result::setLastResult(s);
|
|
|
|
|
|
|
|
|
|
YYABORT;
|
|
|
|
@ -116,14 +116,14 @@ ASSIGN: '(' { --gCheckIdents; } IDENT ')' '=' {
|
|
|
|
|
// since normally functions and variables with the same name can coexist, but
|
|
|
|
|
// I don't want to duplicate code all over the place.
|
|
|
|
|
S: SET DERIV {
|
|
|
|
|
TQString s(i18n("Function %1 is built-in and cannot be overridden.").tqarg("deriv"));
|
|
|
|
|
TQString s(i18n("Function %1 is built-in and cannot be overridden.").arg("deriv"));
|
|
|
|
|
Result::setLastResult(s);
|
|
|
|
|
|
|
|
|
|
YYABORT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
S: DERIV '=' {
|
|
|
|
|
TQString s(i18n("Function %1 is built-in and cannot be overridden.").tqarg("deriv"));
|
|
|
|
|
TQString s(i18n("Function %1 is built-in and cannot be overridden.").arg("deriv"));
|
|
|
|
|
Result::setLastResult(s);
|
|
|
|
|
|
|
|
|
|
YYABORT;
|
|
|
|
@ -139,7 +139,7 @@ S: SET FUNC ASSIGN EXP {
|
|
|
|
|
FunctionManager *manager = FunctionManager::instance();
|
|
|
|
|
|
|
|
|
|
if(manager->isFunction(funcName) && !manager->isFunctionUserDefined(funcName)) {
|
|
|
|
|
TQString s(i18n("Function %1 is built-in and cannot be overridden.").tqarg(funcName));
|
|
|
|
|
TQString s(i18n("Function %1 is built-in and cannot be overridden.").arg(funcName));
|
|
|
|
|
Result::setLastResult(s);
|
|
|
|
|
|
|
|
|
|
YYABORT;
|
|
|
|
@ -150,7 +150,7 @@ S: SET FUNC ASSIGN EXP {
|
|
|
|
|
|
|
|
|
|
BaseFunction *newFn = new UserDefinedFunction(funcName.ascii(), $4);
|
|
|
|
|
if(!manager->addFunction(newFn, ident)) {
|
|
|
|
|
TQString s(i18n("Unable to define function %1 because it is recursive.").tqarg(funcName));
|
|
|
|
|
TQString s(i18n("Unable to define function %1 because it is recursive.").arg(funcName));
|
|
|
|
|
Result::setLastResult(s);
|
|
|
|
|
|
|
|
|
|
YYABORT;
|
|
|
|
@ -188,14 +188,14 @@ S: REMOVE FUNC '(' ')' {
|
|
|
|
|
// Can't remove an ident using remove-func syntax.
|
|
|
|
|
S: REMOVE IDENT '(' ')' {
|
|
|
|
|
// This is an error
|
|
|
|
|
Result::setLastResult(Result(i18n("Function %1 is not defined.").tqarg($2->name())));
|
|
|
|
|
Result::setLastResult(Result(i18n("Function %1 is not defined.").arg($2->name())));
|
|
|
|
|
YYABORT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This happens when the user tries to remove a function that's not defined.
|
|
|
|
|
S: REMOVE IDENT '(' IDENT ')' {
|
|
|
|
|
// This is an error
|
|
|
|
|
Result::setLastResult(Result(i18n("Function %1 is not defined.").tqarg($2->name())));
|
|
|
|
|
Result::setLastResult(Result(i18n("Function %1 is not defined.").arg($2->name())));
|
|
|
|
|
YYABORT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -211,9 +211,9 @@ S: REMOVE IDENT {
|
|
|
|
|
else {
|
|
|
|
|
TQString s;
|
|
|
|
|
if(manager->isValueSet($2->name()))
|
|
|
|
|
s = i18n("Can't remove predefined variable %1.").tqarg($2->name());
|
|
|
|
|
s = i18n("Can't remove predefined variable %1.").arg($2->name());
|
|
|
|
|
else
|
|
|
|
|
s = i18n("Can't remove undefined variable %1.").tqarg($2->name());
|
|
|
|
|
s = i18n("Can't remove undefined variable %1.").arg($2->name());
|
|
|
|
|
|
|
|
|
|
Result::setLastResult(s);
|
|
|
|
|
|
|
|
|
@ -228,7 +228,7 @@ S: SET IDENT '=' EXP {
|
|
|
|
|
if($2->name() == "pi" && $4->value() == Abakus::number_t("3.0"))
|
|
|
|
|
Result::setLastResult(i18n("This isn't Indiana, you can't just change pi"));
|
|
|
|
|
else
|
|
|
|
|
Result::setLastResult(i18n("%1 is a constant").tqarg($2->name()));
|
|
|
|
|
Result::setLastResult(i18n("%1 is a constant").arg($2->name()));
|
|
|
|
|
|
|
|
|
|
YYABORT;
|
|
|
|
|
}
|
|
|
|
@ -247,7 +247,7 @@ S: IDENT '=' EXP {
|
|
|
|
|
if($1->name() == "pi" && $3->value() == Abakus::number_t("3.0"))
|
|
|
|
|
Result::setLastResult(i18n("This isn't Indiana, you can't just change pi"));
|
|
|
|
|
else
|
|
|
|
|
Result::setLastResult(i18n("%1 is a constant").tqarg($1->name()));
|
|
|
|
|
Result::setLastResult(i18n("%1 is a constant").arg($1->name()));
|
|
|
|
|
|
|
|
|
|
YYABORT;
|
|
|
|
|
}
|
|
|
|
@ -259,13 +259,13 @@ S: IDENT '=' EXP {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
S: NUMBER '=' {
|
|
|
|
|
Result::setLastResult(i18n("Can't assign to %1").tqarg($1->value().toString()));
|
|
|
|
|
Result::setLastResult(i18n("Can't assign to %1").arg($1->value().toString()));
|
|
|
|
|
YYABORT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Can't call this as a function.
|
|
|
|
|
TERM: IDENT '(' {
|
|
|
|
|
Result::setLastResult(i18n("%1 isn't a function (or operator expected)").tqarg($1->name()));
|
|
|
|
|
Result::setLastResult(i18n("%1 isn't a function (or operator expected)").arg($1->name()));
|
|
|
|
|
YYABORT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -351,7 +351,7 @@ TERM: NUMBER '(' EXP ')' {
|
|
|
|
|
|
|
|
|
|
TERM: NUMBER IDENT {
|
|
|
|
|
if(gCheckIdents > 0 && !ValueManager::instance()->isValueSet($2->name())) {
|
|
|
|
|
Result::setLastResult(i18n("Unknown variable %1").tqarg($2->name()));
|
|
|
|
|
Result::setLastResult(i18n("Unknown variable %1").arg($2->name()));
|
|
|
|
|
YYABORT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -362,7 +362,7 @@ VALUE: IDENT {
|
|
|
|
|
if(gCheckIdents <= 0 || ValueManager::instance()->isValueSet($1->name()))
|
|
|
|
|
$$ = $1;
|
|
|
|
|
else {
|
|
|
|
|
Result::setLastResult(i18n("Unknown variable %1").tqarg($1->name()));
|
|
|
|
|
Result::setLastResult(i18n("Unknown variable %1").arg($1->name()));
|
|
|
|
|
YYABORT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|