diff options
author | rhaas <rhaas@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2014-05-16 18:21:34 +0000 |
---|---|---|
committer | rhaas <rhaas@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2014-05-16 18:21:34 +0000 |
commit | 763034a4062436190fde62ca9a7800830dc33307 (patch) | |
tree | 107a3b56212f765417a887fd6a97fba945d8c5e9 | |
parent | 14869ee49a4b66596c84d6245ee423ee094f0c3a (diff) |
add check for CCK_REAL parameter ranges to CST
currently only warns, will become an error in the future
git-svn-id: http://svn.cactuscode.org/flesh/trunk@5115 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | lib/sbin/parameter_parser.pl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/sbin/parameter_parser.pl b/lib/sbin/parameter_parser.pl index 9f96b420..371cefb0 100644 --- a/lib/sbin/parameter_parser.pl +++ b/lib/sbin/parameter_parser.pl @@ -390,6 +390,20 @@ sub parse_param_ccl '', __LINE__, __FILE__); } + # check real parameter ranges + # regex taken from piraha's param.peg + my $real = '[+\-]?([0-9]+\.[0-9]+|[0-9]+\.|\.[0-9]+|[0-9]+)([eEdD][+\-]?[+\-]?[0-9]+|)'; + if ($type eq 'REAL' && ! ( + $new_ranges eq '*' || + $new_ranges =~ /^$real$/ || + $new_ranges =~ /^["(]?(\*|\(?$real)?:(\*|$real\)?)?(:$real)?[)"]?$/)) { + # this will become a level 0 error in the fture + &CST_error(1, "Invalid range '$new_ranges' for real " . + "parameter '$variable' of thorn '$thorn'. ". + "This will be an error in the future.", + '', __LINE__, __FILE__); + } + $parameter_db{"\U$thorn $variable\E range $parameter_db{\"\U$thorn $variable\E ranges\"} range"} = $new_ranges; # Check description |