summaryrefslogtreecommitdiff
path: root/lib/sbin
diff options
context:
space:
mode:
authorschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2008-01-25 16:03:42 +0000
committerschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2008-01-25 16:03:42 +0000
commitd5549ed595c648f84df95a8a72fe78d8e9b69484 (patch)
treecbde939bc39a880106459145ad3ebc88b3eef556 /lib/sbin
parent9512b832ef3e00b5d382ae77fd9ed00026b72985 (diff)
Ensure that the default value for REAL parameters is really a real
number. Ensure that the default values for keywords are checked as well, currently in the same way as strings. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4456 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin')
-rw-r--r--lib/sbin/parameter_parser.pl7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sbin/parameter_parser.pl b/lib/sbin/parameter_parser.pl
index cb2f2ab8..4eb0c7d1 100644
--- a/lib/sbin/parameter_parser.pl
+++ b/lib/sbin/parameter_parser.pl
@@ -438,13 +438,18 @@ sub parse_param_ccl
"'$variable' in thorn '$thorn' is not an integer",
'', __LINE__, __FILE__);
}
+ if ($type eq 'REAL' && $default !~ /^[+-]?(\d+([.]\d*)?|[.]\d+)([eEdD][+-]?\d+)?$/) {
+ &CST_error(0, "Default '$default' for real parameter " .
+ "'$variable' in thorn '$thorn' is not a real",
+ '', __LINE__, __FILE__);
+ }
if ($type =~ m:INT|REAL: && $default =~ m:":)
{
&CST_error(0, "String default given for $type $variable in " .
"$thorn",
'', __LINE__, __FILE__);
}
- elsif ($type =~ m:STRING|KEYWORD: && $default !~ m:".*":)
+ elsif ($type =~ m:STRING: && $default !~ m:".*":)
{
&CST_error(0, "Default given for $type $variable in $thorn " .
"is not a string",