]> www.ginac.de Git - ginac.git/commit
Parser: handle abbreviations as advertized in the manual.
authorAlexei Sheplyakov <alexei.sheplyakov@gmail.com>
Mon, 5 Jul 2010 07:15:20 +0000 (09:15 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Mon, 5 Jul 2010 07:15:20 +0000 (09:15 +0200)
commitdf823d53c56c762072f534c9f24479090162e33a
tree8e419e7c0299b77f634ae3b62b842a63660f62c9
parentff8b400eb500618644231ed9e6f199c3b0b25135
Parser: handle abbreviations as advertized in the manual.

The following example from the tutorial

GiNaC::symbol x, y;
GiNaC::symtab table;
table["x"] = x+log(y)+1;
GiNaC::parser reader(table);
GiNaC::ex e = reader("5*x3 - x2");

fails with the following exception:

terminate called after throwing an instance of 'std::invalid_argument'
what(): find_or_insert_symbol: name "x" does not correspond to a symbol

Remove silly checks from find_or_insert_symbol, and fix its return value
(should be ex, not symbol).
ginac/parser/parse_context.cpp
ginac/parser/parse_context.h