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=ee4e4360c161eb17db53a43e8289c4e37da97506;hb=f449313a24038429447cb02a4798beb7fcf8216e;hpb=965e7b0e744625df9b99d846194ff420faa92593 diff --git a/ginsh/ginsh_parser.yy b/ginsh/ginsh_parser.yy index ee4e4360..48d839a0 100644 --- a/ginsh/ginsh_parser.yy +++ b/ginsh/ginsh_parser.yy @@ -44,7 +44,7 @@ // Original readline settings static int orig_completion_append_character; -#if (GINAC_RLVERSION_MAJOR < 4) || (GINAC_RLVERSION_MAJOR == 4 && GINAC_RLVERSION_MINOR < 2) +#if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2) static char *orig_basic_word_break_characters; #else static const char *orig_basic_word_break_characters; @@ -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)}, @@ -706,7 +716,7 @@ static char **fcn_completion(char *text, int start, int end) 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; -#if (GINAC_RLVERSION_MAJOR < 4) || (GINAC_RLVERSION_MAJOR == 4 && GINAC_RLVERSION_MINOR < 2) +#if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2) return completion_matches(text, (CPFunction *)filename_completion_function); #else return rl_completion_matches(text, (CPFunction *)rl_filename_completion_function); @@ -716,7 +726,7 @@ static char **fcn_completion(char *text, int start, int end) rl_completion_append_character = '('; rl_basic_word_break_characters = " \t\n\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~"; rl_completer_word_break_characters = rl_basic_word_break_characters; -#if (GINAC_RLVERSION_MAJOR < 4) || (GINAC_RLVERSION_MAJOR == 4 && GINAC_RLVERSION_MINOR < 2) +#if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2) return completion_matches(text, (CPFunction *)fcn_generator); #else return rl_completion_matches(text, (CPFunction *)fcn_generator);