X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginsh%2Fginsh_parser.yy;h=c81ea4a8255f92f30c3e02856215c5c189ac8a12;hb=7c9917b84e0124ad8ee7215659327e77dbfedc1f;hp=c479434e174b087ae8b914daf4497aed58e928ac;hpb=383d5eb3b0f0506810d9105a268f939125bfc347;p=ginac.git diff --git a/ginsh/ginsh_parser.yy b/ginsh/ginsh_parser.yy index c479434e..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; @@ -700,11 +701,13 @@ static char **fcn_completion(char *text, int start, int end) // For shell commands, revert back to filename completion rl_completion_append_character = orig_completion_append_character; rl_basic_word_break_characters = orig_basic_word_break_characters; + rl_completer_word_break_characters = rl_basic_word_break_characters; return completion_matches(text, (CPFunction *)filename_completion_function); } else { // Otherwise, complete function names rl_completion_append_character = '('; rl_basic_word_break_characters = " \t\n\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~"; + rl_completer_word_break_characters = rl_basic_word_break_characters; return completion_matches(text, (CPFunction *)fcn_generator); } }