X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginsh%2Fginsh_parser.yy;h=48d839a0490edc334f3b10bbcd29a18ba08e9927;hp=3f862bda0a6acfdf19a1616f7fa296f50c052204;hb=f449313a24038429447cb02a4798beb7fcf8216e;hpb=ac8fc4a3eb27b8701ad8b5f5d56aa9c7636b0db8 diff --git a/ginsh/ginsh_parser.yy b/ginsh/ginsh_parser.yy index 3f862bda..48d839a0 100644 --- a/ginsh/ginsh_parser.yy +++ b/ginsh/ginsh_parser.yy @@ -400,6 +400,15 @@ static ex f_ldegree(const exprseq &e) return e[0].ldegree(e[1]); } +static ex f_match(const exprseq &e) +{ + lst repl_lst; + if (e[0].match(e[1], repl_lst)) + return repl_lst; + else + return fail(); +} + static ex f_normal2(const exprseq &e) { CHECK_ARG(1, numeric, normal); @@ -530,6 +539,7 @@ static const fcn_init builtin_fcns[] = { {"lcoeff", fcn_desc(f_lcoeff, 2)}, {"ldegree", fcn_desc(f_ldegree, 2)}, {"lsolve", fcn_desc(f_lsolve, 2)}, + {"match", fcn_desc(f_match, 2)}, {"nops", fcn_desc(f_nops, 1)}, {"normal", fcn_desc(f_normal1, 1)}, {"normal", fcn_desc(f_normal2, 2)},