X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Finput_parser.yy;h=b28e63a1e552b34241b9cf1d5060047f922c3fc7;hb=85dbe3f2049dce7d43a1bd956d622f4ff5c0c156;hp=4912212364599af56d73a3bb79ee023e1a067d23;hpb=6d225ee55693c0617d254e6fa283c00c71bd2919;p=ginac.git diff --git a/ginac/input_parser.yy b/ginac/input_parser.yy index 49122123..b28e63a1 100644 --- a/ginac/input_parser.yy +++ b/ginac/input_parser.yy @@ -4,7 +4,7 @@ * This file must be processed with yacc/bison. */ /* - * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2008 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 @@ -18,7 +18,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -105,6 +105,10 @@ exp : T_NUMBER {$$ = $1;} if ($3.nops() != 1) throw (std::runtime_error("too many arguments to sqrt()")); $$ = sqrt($3.op(0)); + } else if (n == "pow" || n == "power") { + if ($3.nops() != 2) + throw std::invalid_argument("wrong number of arguments to pow()"); + $$ = power($3.op(0), $3.op(0)); } else { unsigned i = function::find_function(n, $3.nops()); $$ = function(i, ex_to($3)).eval(1);