]> www.ginac.de Git - ginac.git/blobdiff - ginac/parser/parse_context.cpp
Added get_builtin_reader() that parses only the builtin GiNaC functions
[ginac.git] / ginac / parser / parse_context.cpp
index 5c442023afa0bbaa3f59edcd456f0a9075cb0950..2230d614913fe56fe9a7feb82d5a1070d363092a 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of the parser context. */
 
 /*
- *  GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2010 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 
 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(