]> www.ginac.de Git - ginac.git/blobdiff - ginac/parser/parse_context.h
Quick and dirty bug fix for the parser to read GiNaC::lst again.
[ginac.git] / ginac / parser / parse_context.h
index 13fc166ae46605f2a2ab62907d99eb44ed931764..60151fd37988af0538f6b000bd50285930ee8d7d 100644 (file)
@@ -3,7 +3,7 @@
  *  Interface to parser context. */
 
 /*
  *  Interface to parser context. */
 
 /*
- *  GiNaC Copyright (C) 1999-2009 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2011 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
  *
  *  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
@@ -41,12 +41,12 @@ namespace GiNaC {
 typedef std::map<std::string, ex> symtab;
 
 /**
 typedef std::map<std::string, ex> symtab;
 
 /**
- * Find the symbol with the @a name in the symbol table @a syms.
+ * Find the symbol (or abbreviation) with the @a name in the symbol table @a syms.
  *
  * If symbol is missing and @a strict = false, insert it, otherwise
  * throw an exception.
  */
  *
  * If symbol is missing and @a strict = false, insert it, otherwise
  * throw an exception.
  */
-extern symbol
+extern ex 
 find_or_insert_symbol(const std::string& name, symtab& syms,
                      const bool strict);
 
 find_or_insert_symbol(const std::string& name, symtab& syms,
                      const bool strict);
 
@@ -88,7 +88,20 @@ typedef ex (*reader_func)(const exvector& args);
  *       function pointer!! The unsigned has to correspond to the serial number of
  *       the defined GiNaC function.
  */
  *       function pointer!! The unsigned has to correspond to the serial number of
  *       the defined GiNaC function.
  */
-typedef std::map<prototype, reader_func> prototype_table;
+class PrototypeLess
+{
+public:
+       bool operator()(const prototype& p1, const prototype& p2) const
+       {
+               int s = p1.first.compare(p2.first);
+               if (s == 0) {
+                       if ((p1.second == 0) || (p2.second == 0)) return false;
+                       return p1.second < p2.second;
+               }
+               return s < 0;
+       }
+};
+typedef std::map<prototype, reader_func, PrototypeLess> prototype_table;
 
 /**
  * Default prototype table.
 
 /**
  * Default prototype table.