summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac>2014-01-06 17:58:05 +0000
committersbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac>2014-01-06 17:58:05 +0000
commit37ab593e984cf9361aa1beab798b5bbabbe5a234 (patch)
tree8eadbc91dd2233fbc297fec96ff78c930c6c0c59
parent852c563772bd1f6e395eb70c25f07d47ef07b244 (diff)
Ticket #1469
Fixed. git-svn-id: http://svn.cactuscode.org/flesh/trunk@5062 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r--src/piraha/Call.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/piraha/Call.cc b/src/piraha/Call.cc
index 9cccb426..2499b153 100644
--- a/src/piraha/Call.cc
+++ b/src/piraha/Call.cc
@@ -322,12 +322,19 @@ smart_ptr<Value> meval(smart_ptr<Group> gr) {
if(pn == "num") {
std::string s = gr->substring();
s = mklower(s);
+ std::replace(s.begin(),s.end(),'d','e');
ret->ddata = atof(s.c_str());
ret->idata = ret->ddata;
- if(ret->idata == ret->ddata && (s.find('.') == std::string::npos))
- ret->type = PIR_INT;
- else
- ret->type = PIR_REAL;
+ if(s.find('.') == std::string::npos) {
+ if(ret->idata != ret->ddata) {
+ std::ostringstream msg;
+ msg << "Not a valid integer value \"" << s << "\"" << std::endl;
+ std::string par = get_parfile();
+ CCTK_Error(gr->line(),par.c_str(),current_thorn.c_str(),msg.str().c_str());
+ }
+ ret->type = PIR_INT;
+ } else
+ ret->type = PIR_REAL;
} else if(pn == "paren" || pn == "parindex") {
return meval(gr->group(0));
} else if(pn == "func") {
@@ -763,7 +770,7 @@ extern "C" int cctk_PirahaParser(const char *buffer,unsigned long buffersize,int
"inquot = ({var}|\\\\.|[^\\\\\"])*\n"
"fname = \\.?/[-\\./0-9a-zA-Z_]+\n"
"quot = \"{inquot}\"|{fname}\n"
- "num = ([0-9]+(\\.[0-9]*|)|\\.[0-9]+)([ed][+-]?[0-9]+|)\n"
+ "num = ([0-9]+(\\.[0-9]*|)|\\.[0-9]+)([edDE][+-]?[0-9]+|)\n"
"env = ENV\\{{name}\\}\n"
"var = \\$({env}|{name}|\\{{name}\\})\n"