]> www.ginac.de Git - ginac.git/blobdiff - ginsh/ginsh_parser.yy
adapted to change symbol::getname() -> symbol::get_name()
[ginac.git] / ginsh / ginsh_parser.yy
index a83bbc32a444ecbd7ee0cede115558c16876b95f..1a4e7e0ad01736861afc3cfd74a84a5c0e3fce18 100644 (file)
@@ -125,15 +125,15 @@ line      : ';'
                try {
                        push($1);
                } catch (exception &e) {
-                       cerr << e.what() << endl;
+                       std::cerr << e.what() << endl;
                        YYERROR;
                }
        }
        | T_PRINT '(' exp ')' ';' {
                try {
-                       $3.printtree(cout);
+                       $3.print(print_tree(std::cout));
                } catch (exception &e) {
-                       cerr << e.what() << endl;
+                       std::cerr << e.what() << endl;
                        YYERROR;
                }
        }
@@ -151,7 +151,7 @@ line        : ';'
                        YYERROR;
                }
        }
-       | '?' T_SYMBOL          {print_help(ex_to_symbol($2).getname());}
+       | '?' T_SYMBOL          {print_help(ex_to_symbol($2).get_name());}
        | '?' T_TIME            {print_help("time");}
        | '?' '?'               {print_help_topics();}
        | T_QUIT                {YYACCEPT;}
@@ -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)
+{
+       return sqrfree(e[0]);
+}
+
+static ex f_sqrfree2(const exprseq &e)
 {
-       CHECK_ARG(1, symbol, sqrfree);
-       return sqrfree(e[0], ex_to_symbol(e[1]));
+       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)},
@@ -584,7 +589,7 @@ void GiNaC::ginsh_get_ginac_functions(void)
 
 static fcn_tab::const_iterator find_function(const ex &sym, int req_params)
 {
-       const string &name = ex_to_symbol(sym).getname();
+       const string &name = ex_to_symbol(sym).get_name();
        typedef fcn_tab::const_iterator I;
        pair<I, I> b = fcns.equal_range(name);
        if (b.first == b.second)