From 763034a4062436190fde62ca9a7800830dc33307 Mon Sep 17 00:00:00 2001 From: rhaas Date: Fri, 16 May 2014 18:21:34 +0000 Subject: 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 --- lib/sbin/parameter_parser.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 -- cgit v1.2.3