diff options
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -55,6 +55,7 @@ val decline_k, next_spec_k, repeat_spec_k; val mingap_k, maxgap_k, gap_k, mintimes_k, maxtimes_k, times_k; val lines_k, chars_k; val text_s, choose_s, gather_s, do_s, mod_s, modlast_s, fuzz_s, load_s; +val require_s; val longest_k, shortest_k, greedy_k; val vars_k, resolve_k; val append_k, into_k, var_k, list_k, string_k, env_k, counter_k; @@ -3483,6 +3484,17 @@ static val v_do(match_files_ctx *c) return next_spec_k; } +static val v_require(match_files_ctx *c) +{ + spec_bind (specline, first_spec, c->spec); + val args = rest(first_spec); + uw_set_match_context(cons(c->spec, c->bindings)); + if (!eval_progn(args, make_env(c->bindings, nil, nil), specline)) + return nil; + return next_spec_k; +} + + static val v_load(match_files_ctx *c) { uses_or2; @@ -3764,6 +3776,7 @@ static void syms_init(void) gather_s = intern(lit("gather"), user_package); do_s = intern(lit("do"), user_package); load_s = intern(lit("load"), user_package); + require_s = intern(lit("require"), user_package); longest_k = intern(lit("longest"), keyword_package); shortest_k = intern(lit("shortest"), keyword_package); greedy_k = intern(lit("greedy"), keyword_package); @@ -3826,6 +3839,7 @@ static void dir_tables_init(void) sethash(v_directive_table, filter_s, cptr((mem_t *) v_filter)); sethash(v_directive_table, eof_s, cptr((mem_t *) v_eof)); sethash(v_directive_table, do_s, cptr((mem_t *) v_do)); + sethash(v_directive_table, require_s, cptr((mem_t *) v_require)); sethash(v_directive_table, load_s, cptr((mem_t *) v_load)); sethash(h_directive_table, text_s, cptr((mem_t *) h_text)); @@ -3851,6 +3865,7 @@ static void dir_tables_init(void) sethash(h_directive_table, define_s, cptr((mem_t *) h_define)); sethash(h_directive_table, eol_s, cptr((mem_t *) h_eol)); sethash(h_directive_table, do_s, cptr((mem_t *) h_do)); + sethash(h_directive_table, require_s, cptr((mem_t *) hv_trampoline)); } void match_init(void) |