X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Finput_parser.yy;h=b28e63a1e552b34241b9cf1d5060047f922c3fc7;hp=f9ead9e11b8a6d5d446bf96697dd2fdb7bcfab2c;hb=93eb93a10a2f29360baa4ab45d5b34b982c7fa5c;hpb=695f6ae955ec530cded8f21efd5569df39447f76 diff --git a/ginac/input_parser.yy b/ginac/input_parser.yy index f9ead9e1..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-2005 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);