X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginsh%2Fginsh_parser.yy;h=c81ea4a8255f92f30c3e02856215c5c189ac8a12;hp=62418496f28e10f3728dfa28f37e0ea4d470f0dd;hb=336c03561cdacb388041cf9345c51a28465ee653;hpb=9e027882daaed818363bb4dc0e23d104b25ff5dc diff --git a/ginsh/ginsh_parser.yy b/ginsh/ginsh_parser.yy index 62418496..c81ea4a8 100644 --- a/ginsh/ginsh_parser.yy +++ b/ginsh/ginsh_parser.yy @@ -215,14 +215,13 @@ exp : T_NUMBER {$$ = $1;} | exp '-' exp {$$ = $1 - $3;} | exp '*' exp {$$ = $1 * $3;} | exp '/' exp {$$ = $1 / $3;} - | exp '%' exp {$$ = $1 % $3;} | '-' exp %prec NEG {$$ = -$2;} | '+' exp %prec NEG {$$ = $2;} | exp '^' exp {$$ = power($1, $3);} | exp '!' {$$ = factorial($1);} | '(' exp ')' {$$ = $2;} | '[' list_or_empty ']' {$$ = $2;} - | T_MATRIX_BEGIN matrix T_MATRIX_END {$$ = lst_to_matrix($2);} + | T_MATRIX_BEGIN matrix T_MATRIX_END {$$ = lst_to_matrix(ex_to_lst($2));} ; exprseq : exp {$$ = exprseq($1);} @@ -442,10 +441,15 @@ static ex f_series(const exprseq &e) return e[0].series(e[1], ex_to_numeric(e[2]).to_int()); } -static ex f_sqrfree(const exprseq &e) +static ex f_sqrfree1(const exprseq &e) { - CHECK_ARG(1, symbol, sqrfree); - return sqrfree(e[0], ex_to_symbol(e[1])); + return sqrfree(e[0]); +} + +static ex f_sqrfree2(const exprseq &e) +{ + CHECK_ARG(1, lst, sqrfree); + return sqrfree(e[0], ex_to_lst(e[1])); } static ex f_subs3(const exprseq &e) @@ -533,7 +537,8 @@ static const fcn_init builtin_fcns[] = { {"quo", fcn_desc(f_quo, 3)}, {"rem", fcn_desc(f_rem, 3)}, {"series", fcn_desc(f_series, 3)}, - {"sqrfree", fcn_desc(f_sqrfree, 2)}, + {"sqrfree", fcn_desc(f_sqrfree1, 1)}, + {"sqrfree", fcn_desc(f_sqrfree2, 2)}, {"sqrt", fcn_desc(f_sqrt, 1)}, {"subs", fcn_desc(f_subs2, 2)}, {"subs", fcn_desc(f_subs3, 3)}, @@ -566,11 +571,7 @@ static ex f_ginac_function(const exprseq &es, int serial) } // All registered GiNaC functions -#ifndef NO_NAMESPACE_GINAC void GiNaC::ginsh_get_ginac_functions(void) -#else // ndef NO_NAMESPACE_GINAC -void ginsh_get_ginac_functions(void) -#endif // ndef NO_NAMESPACE_GINAC { vector::const_iterator i = function::registered_functions().begin(), end = function::registered_functions().end(); unsigned serial = 0;