]> www.ginac.de Git - ginac.git/blobdiff - ginac/parser/parser.cpp
Fixed dirty hack in parser to distinguish between serial numbers and pointers.
[ginac.git] / ginac / parser / parser.cpp
index 42edf5b0834eceac42f5bf52606935726c8a62ed..8f663d1879fada9154ac9612ec4020fd5879f424 100644 (file)
@@ -25,6 +25,7 @@
 #include "debug.h"
 #include "mul.h"
 #include "constant.h"
+#include "function.h"
 
 #include <sstream>
 #include <stdexcept>
@@ -65,8 +66,16 @@ ex parser::parse_identifier_expr()
                Parse_error_("no function \"" << name << "\" with " <<
                             args.size() << " arguments");
        }
-       ex ret = reader->second(args);
-       return ret;
+       // dirty hack to distinguish between serial numbers of functions and real
+       // pointers.
+       try {
+               GiNaC::function f(reinterpret_cast<unsigned>(reader->second), args);
+               return f;
+       }
+       catch ( std::runtime_error ) {
+               ex ret = reader->second(args);
+               return ret;
+       }
 }
 
 /// paren_expr:  '(' expression ')'