]> www.ginac.de Git - ginac.git/blobdiff - ginac/parser/parse_context.cpp
Parser: handle abbreviations as advertized in the manual.
[ginac.git] / ginac / parser / parse_context.cpp
index 1b1d38f7979cc160de030c244887c11f05a9163e..88b0b30ec9b298cce1652e03318b3bd2ad2590aa 100644 (file)
 
 namespace GiNaC {
 
-symbol
+ex
 find_or_insert_symbol(const std::string& name, symtab& syms, const bool strict)
 {
        symtab::const_iterator p = syms.find(name);
-       if (p != syms.end()) {
-               if (is_a<symbol>(p->second))
-                       return ex_to<symbol>(p->second);
-               else
-                       throw std::invalid_argument(
-                               std::string("find_or_insert_symbol: name \"")
-                               + name + "\" does not correspond to a symbol");
-       }
-
+       if (p != syms.end())
+               return p->second;
 
        if (strict)
                throw std::invalid_argument(