diff --git a/src/fh_builtins_meta.c b/src/fh_builtins_meta.c index e7bc0ad..d6b2664 100644 --- a/src/fh_builtins_meta.c +++ b/src/fh_builtins_meta.c @@ -31,6 +31,23 @@ static enum fh_error w_colon(struct fh_thread_s *fh, const struct fh_word_s *w) return FH_OK; } +static enum fh_error w_does(struct fh_thread_s *fh, const struct fh_word_s *w) +{ + (void) w; + enum fh_error rv; + ENSURE_STATE(FH_STATE_INTERPRET); + + fh_setstate(fh, FH_STATE_COMPILE, 0); + + struct fh_word_s *last_word = fh_word_at(fh, fh->dict_last); + if (!last_word) return FH_ERR_INTERNAL; + + last_word->handler = w_user_word; + last_word->param = fh->here; + last_word->flags = WORDFLAG_WORD; + return FH_OK; +} + static enum fh_error w_forget(struct fh_thread_s *fh, const struct fh_word_s *w) { (void) w; @@ -551,6 +568,7 @@ const struct name_and_handler fh_builtins_meta[] = { {"unused", w_unused, 0, 0}, {">in", w_to_in, 0, 0}, {":", w_colon, 0, 0}, + {"does>", w_does, 1, 0}, {";", w_semicolon, 1, 0}, {"forget", w_forget, 1, 0}, {"\\", w_backslash, 1, 0}, // line comment