]> 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 7a7867a0a1069c5a02b57d2829ab0a3922bac2e3..2230d614913fe56fe9a7feb82d5a1070d363092a 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(