#include "numeric.h"
#include "power.h"
#include "relational.h"
+#include "input_lexer.h"
#include "debugmsg.h"
#include "utils.h"
-#ifndef NO_GINAC_NAMESPACE
+#ifndef NO_NAMESPACE_GINAC
namespace GiNaC {
-#endif // ndef NO_GINAC_NAMESPACE
+#endif // ndef NO_NAMESPACE_GINAC
// binary arithmetic operators ex with ex
return os;
}
+/** Input (parse) expression from stream. The input grammar is similar to the
+ * GiNaC output format. If 'e' contains a list of symbols upon entry, these
+ * symbols are used in the parsed expression in all places where symbols with
+ * the same names appear. All other encountered symbols will be newly created. */
istream & operator>>(istream & is, ex & e)
{
- throw(std::logic_error("input from streams not yet implemented"));
+ string s;
+ getline(is, s);
+ set_lexer_string(s);
+ set_lexer_symbols(e);
+ ginac_yyrestart(NULL);
+ if (yyparse())
+ throw (std::runtime_error(get_parser_error()));
+ else
+ e = parsed_ex;
}
-#ifndef NO_GINAC_NAMESPACE
+#ifndef NO_NAMESPACE_GINAC
} // namespace GiNaC
-#endif // ndef NO_GINAC_NAMESPACE
+#endif // ndef NO_NAMESPACE_GINAC