]> 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:16:58 +0000 (09:16 +0200)
commitc84dc83799cec33b71126e624cd914125d8d2a43
tree119f9c9355f9030d8650f95035eb56b9ba85cad2
parent5fb83676210401cc08fae91831514bac44502209
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