diff options
-rw-r--r-- | match.c | 3 | ||||
-rw-r--r-- | match.h | 2 | ||||
-rw-r--r-- | parser.y | 4 | ||||
-rw-r--r-- | txr.1 | 34 |
4 files changed, 41 insertions, 2 deletions
@@ -60,7 +60,7 @@ 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, mdo_s, mod_s, modlast_s; val line_s, data_s, fuzz_s, load_s; -val include_s, close_s, require_s; +val include_s, close_s, require_s, in_package_s; val longest_k, shortest_k, greedy_k; val vars_k, resolve_k; val append_k, into_k, var_k, list_k, tlist_k, string_k, env_k, counter_k; @@ -4689,6 +4689,7 @@ static void syms_init(void) include_s = intern(lit("include"), user_package); close_s = intern(lit("close"), user_package); require_s = intern(lit("require"), user_package); + in_package_s = intern(lit("in-package"), user_package); longest_k = intern(lit("longest"), keyword_package); shortest_k = intern(lit("shortest"), keyword_package); greedy_k = intern(lit("greedy"), keyword_package); @@ -25,7 +25,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -extern val text_s, choose_s, gather_s, do_s, mdo_s, require_s; +extern val text_s, choose_s, gather_s, do_s, mdo_s, require_s, in_package_s; extern val close_s, load_s, include_s, mod_s, modlast_s, line_s; extern val counter_k, vars_k, env_k, var_k, into_k, named_k; val match_expand_keyword_args(val elem); @@ -1676,6 +1676,10 @@ static val check_parse_time_action(val spec_rev) eval_intrinsic(cons(progn_s, cdr(elem)), nil); return nil; } + if (sym == in_package_s) { + eval_intrinsic(elem, nil); + return nil; + } } } return spec_rev; @@ -3276,6 +3276,12 @@ The directive evaluates \*(TL expressions immediately, during the parsing of the \*(TX syntax in which it occurs. +.coIP @(in-package) +The +.code in-package +directive is used to switch to a different symbol package. +It mirrors the \*(TL macro of the same name. + .PP .SS* Subexpression Evaluation @@ -6580,6 +6586,34 @@ can be used as a horizontal or vertical directive, whereas .code mdo is only vertical. +.dir in-package + +The +.code in-package +directive shares the same syntax and semantics as the \*(TL macro +of the same name: + +.cblk +.mets (in-package << name ) +.cble + +The +.code in-package +directive is evaluated immediately upon being parsed, +leaving no trace in the syntax tree of the surrounding \*(TX +query. + +It causes the +.code *package* +special variable to take on the package denoted by +.metn name . + +The directive that +.meta name +is either a string or symbol. An error exception is thrown if +this isn't the case. Otherwise it searches for the package. +If the package is not found, an error exception is thrown. + .SS* Blocks .NP* Overview |