]> www.ginac.de Git - ginac.git/blobdiff - ginac/parser/parser.hpp
parser: allow read/write access to symbol table and strictness.
[ginac.git] / ginac / parser / parser.hpp
index 81b7847694e43f1b437fbe1cdc8fef2b3503e420..dbe60ee0946bf8fd668b84d485caeefe3408d1bf 100644 (file)
@@ -1,4 +1,5 @@
 #ifndef GINAC_PARSER_HPP_
+#define GINAC_PARSER_HPP_
 
 #include "parse_context.hpp"
 #include <stdexcept>
@@ -9,6 +10,18 @@ namespace GiNaC
 
 class lexer;
 
+class parse_error : public std::invalid_argument
+{
+public:
+       const std::size_t line;
+       const std::size_t column;
+       parse_error(const std::string& what_,
+                   const std::size_t line_ = 0,
+                   const std::size_t column_ = 0) throw () :
+               std::invalid_argument(what_), line(line_), column(column_)
+       { }
+};
+
 /**
  * Recursive descent parser for GiNaC expressions.
  */
@@ -63,10 +76,15 @@ public:
        { 
                return syms; 
        }
+       /// read/write access to the symbol table
+       symtab& get_syms()
+       {
+               return syms;
+       }
 
-private:
        /// If true, throw an exception if an unknown symbol is encountered.
-       const bool strict;
+       bool strict;
+private:
        /**
         * Function/ctor table, maps a prototype (which is a name and number
         * arguments) to a C++ function. Used for parsing identifier_expr's