summaryrefslogtreecommitdiffstats
path: root/match.c
Commit message (Collapse)AuthorAgeFilesLines
* * arith.c: Revised error messages to refer to Lisp names insteadKaz Kylheku2014-01-151-3/+5
| | | | | | | | | | of C names of functions, or otherwise clarified them. * filter.c: Likewise. * lib.c: Likewise. * match.c: Likewise.
* * match.c (do_txeval): Lift an annoying restriction in the patternKaz Kylheku2014-01-101-2/+4
| | | | | | | | | | language's expression evaluator. Whereas TXR Lisp expressions can be used int the pattern language, preceded by @, it was not possible to evaluate TXR Lisp variables this way. So instead of @var, some clumsy trick had to be used like @(identity var). This is not necessary any more. Code like @(next @*stdin*) will now work. * txr.1: Updated.
* * match.c (v_load): Call yylex_destroy after yyparse, so we don'tKaz Kylheku2014-01-071-0/+1
| | | | | have stray scanner state possibly interfering with a subsquent parse job.
* First cut at signal handling support.Kaz Kylheku2013-12-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile (OBJS-y): Include signal.o if have_posix_sigs is "y". * configure (have_posix_sigs): New variable, set by detecting POSIX signal stuff. * dep.mk: Regenerated. * arith.c, debug.c, eval.c, filter.c, hash.c, match.c, parser.y, parser.l, rand.c, regex.c, syslog.c, txr.c, utf8.c: Include new signal.h header, now required by unwind, and the <signal.h> system header. * eval.c (exit_wrap): New function. (eval_init): New functions registered as intrinsics: exit_wrap, set_sig_handler, get_sig_handler, sig_check. * gc.c (release): Unused functions removed. * gc.h (release): Declaration removed. * lib.c (init): Call sig_init. * stream.c (set_putc, se_getc, se_fflush): New static functions. (stdio_put_char_callback, stdio_get_char_callback, stdio_put_byte, stdio_flush, stdio_get_byte): Use new functions to enable signals when blocked on I/O. (tail_strategy): Allow signals across sleep. (pipev_close): Allow signals across waitpid. (se_pclose): New static function. (pipe_close): Use new function to enable signals across pclose. * unwind.c (uw_unwind_to_exit_point): use extended_longjmp instead of longjmp. * unwind.h (struct uw_block, struct uw_catch): jb member changes from jmp_buf to extended_jmp_buf. (uw_block_begin, uw_simple_catch_begin, uw_catch_begin): Use extended_setjmp instead of setjmp. * signal.c: New file. * signal.h: New file.
* Bumping copyrights to 2014 and expressing them as year ranges.Kaz Kylheku2013-12-101-1/+1
| | | | Fixing some errors in copyright comments.
* debug_check calls are the culprit triggering lookaheadKaz Kylheku2013-12-021-4/+2
| | | | | | | | | | | | | in lazy lists. Changing the semantics of the data argument so that it can just be the list. * debug.c (debug): If data is a cons, then replace it with the first item. * match.c (match_files): Pass c.data to debug_check, rather than the value of if2(consp(c.data), car(c.data)) which accesses car(c.data) whether or not we are debugging. (match_fun): Likewise.
* Steps toward fixing an issue: lazy list readahead.Kaz Kylheku2013-12-011-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is that accurate lazy lists are not suitable for real time use, where we want the TXR program to respond immediately to matching some datum. I'm implementing a simple, naive variant of lazy stream lists which simply populates the lazy cons by reading from the stream when the car or cdr fields are accessed. This type of stream can never be nil (empty list) even if the file is empty; in that case it will be (nil) and in general, it will have a spurious nil item at the end instead of ending in a string. (An adjustment was made in match.c to detect this; more will be needed.) I'm adding attributes to streams so streams can now have a "real-time" attribute. When a lazy string list is constructed over a real-time stream, the simple implementation is used. File streams are automatically real-time if (on Unix) they are tied to tty streams. Tail streams are also real-time. More work is needed to achieve the goal of this change, but this is a big step in the right direction. * configure: Detect isatty function. * lib.c (simple_lazy_stream_func): New static function. (lazy_stream_cons): Use simple implementation for real-time streams. * match.c (match_files): Do not call match_line_completely with a data line that is nil (as a result of simple lazy list over a real-time stream). A nil item in a lazy list of strings is treated as eof. * stream.c (real_time_k): New symbol variable. (struct strm_ops): New members: get_prop, set_prop. (struct stdio_handle): New member: is_real_time. (stdio_get_prop, stdio_set_prop): New static function. (stdio_ops, tail_ops, pipe_ops): stdio_get_prop and stdio_set_prop funtions wired in. (make_stdio_stream_common): Attribute streams as real-time if they are tty devices. (make_tail_stream): Tail streams are real-time attributed. (stream_set_prop, real_time_stream_p): New functions. (stream_init): Initialize real_time_k. * stream.h (real_time_k): Declared. (real_time_stream_p, stream_set_prop): Likewise.
* * configure: Added check to detect POSIX sleep function.Kaz Kylheku2013-11-271-26/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (eval_init): Register new open_tail function as intrinsic. * match.c (complex_snarf, complex_stream): Update calls to make_stdio_stream and make_pipe_stream to take fewer arguments. (match_files): Support a stream object as a data source specification in place of a string. * parser.l (parse_reset): Update call to make_stdio_stream to take fewer arguments. * stream.c: Inclusion of <unistd.h> made properly conditional. (struct stdio_handle): pid member defined as pid_t only if we have fork functionality, otherwise defined as int. (tail_get_line, tail_get_char, tail_get_byte): New static functions. (tail_ops): New static structure. (make_stdio_stream_common): New static structure. (make_stdio_stream, make_pipe_stream): These functions lose the input and output parameters, which ended up never used. Reimplemented in terms of new common function. (make_tail_stream): New function. (make_pipevp_stream): Reimplemented in terms of new common function. (open_file, open_command): Simplified by removal of useless local variables and their computation, which used to be extra arguments to make_stdio_stream and make_pipe_stream. (open_tail): New function. (stream_init): Calls to make_stdio_stream updated. * stream.h (make_stdio_stream, make_pipe_stream): Declarations updated. (make_tail_stream, open_tail): Declared. * txr.c (txr_main): Calls to make_stdio_stream updated.
* * match.c (v_load): Bugfix: bindings were propagated in only one of twoKaz Kylheku2013-11-241-1/+2
| | | | | | subcases of a successful load. This bug means that a loaded TXR sub-query was not reliably able to bind variables that are then visible to subsquent directives in the parent.
* Fix for uninitialized struct member curfiles in the match context.Kaz Kylheku2013-11-241-7/+10
| | | | | | | | | This is used for reporting the current match location in debug traces. * match.c (mf_all): Takes new argument curfiles and initializes the match_files_ctx member of the same name. (do_match_line, mf_from_ml, match_filter, match_fun, extract): Pass curfile to ml_all.
* Nasty bug fixed: @(accept) from inside a @(collect) was found not toKaz Kylheku2013-11-211-6/+6
| | | | | | | | | | | | | propagate bindings. The culprit? The bindings_coll variable in the v_collect function being indeterminate by the well-documented and understood action of setjmp. Marking the bindings_coll variable volatile instantly fixed it. I reviewed this code to find any other instance of this oversight. * match.c (v_skip, v_collect): Mark some local variable volatile: precisely those which are used after possibly returning via an unwind, and which might have been modified since setting up the unwind block.
* Remove junk character from error message.Kaz Kylheku2013-10-281-1/+1
|
* Ouch! Turns out the code base has numerous unintendedKaz Kylheku2013-10-241-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | deviations from C90, like mixed declations and statements. GCC doesn't diagnose these without the --pedantic flag. * configure: GCC's --ansi flag should be spelled -ansi. * lib.c (split_str, obj_print): Reorder declaration before statements. (make_sym): Fix similar problem by eliminating a statement. (funcall1, funcall2, funcall3, funcall4): Use assignment to initialize local array with non-constant elements. This is actually good for performance because we only initialize those parts of the array that we use. * lib.h (struct func): Change functype member to unsigned, since enum-typed bitfields are a GCC extension. * match.c (ml_all, mf_all): Use assignments to initialize local struct with non-constants. (do_txeval, v_collect): Slightly revise unwinding macrology with help of new macros to avoid mixing declarations and statements. (spec_bind): Removed spurious semicolon from macro expansion. (v_gather): Reorder two lines to avoid mixed decls and statements. (match_filter): Move declaration of ret a few lines up, ahead of statements. * unwind.c (uw_pop_until): New function. * unwind.h (uw_pop_until): Declared. (uw_mark_frame, uw_fast_return): New macros.
* Task #11433. Implement continuation of multipleKaz Kylheku2013-10-111-2/+67
| | | | | | | | | | | | | | | | output blocks across the same stream. * match.c (close_s, named_k, continue_k, finish_k): New symbol variables. (v_output): Implement :named, :finish and :continue. (v_close): New static function. (syms_init): New symbols interned. (dir_tables_init): New entry associating v_close function with symbol stored in close_s. * match.h (close_s): Declared. * txr.1: New features documented.
* New feature: :vars argument in repeat and rep directives in an outputKaz Kylheku2013-10-061-4/+6
| | | | | | | | | | | | block, for specifying variables to include in iteration whose presence repeat is not able to deduce. * match.c (extract_bindings): New argument, vars, specifies additional variables to consider. (do_output_line, do_output): Process :vars argument of repeat and rep directive. * txr.1: Updated.
* * match.c (require_s): New variable.Kaz Kylheku2013-06-111-0/+15
| | | | | | | | | | | | | | (v_require): New static function. (syms_init): Initialize require_s. (dir_tables_init): Add new entries into v_directive_table and h_directive_table for new require directive. * match.h (require_s): Declared. * txr.1: Added do and require directives to the directive summary section. Documented new require directive. Fixed int-str documentation to clarify that the radix is optional.
* * match.c (match_fun): Support debug stop on the functionKaz Kylheku2013-05-151-4/+15
| | | | | | | prior to the call. The first data line number is 1, not zero, if there is data. * txr.1: Added usage example for match-fun.
* * match.c (v_collect): Bug in processing of @(last) directive.Kaz Kylheku2012-09-101-1/+2
| | | | | | When a match for the @(last) material occured at the end of data, c->data was being mistakenly set to nil rather than t before breaking out of the loop, wreaking havoc.
* * match.c (complex_open): Likewise.Kaz Kylheku2012-05-181-1/+1
| | | | * stream.c (w_opendir): Likewise.
* * match.c (v_collect): Implemented semantics for repeat symbol.Kaz Kylheku2012-05-171-1/+11
| | | | | | | | | | | | | | | | (dir_tables_init): Register dispatch for repeat to v_collect function. * parser.y (collect_repeat): New nonterminal symbol. (clause): Removed repeat_clause error case because that now clashes with the syntax in collect_clause. (collect_clause): Repeat syntax implemented, with help of collect_repeat. (out_clause): Error case for collect_clause removed due to syntactic clash. * txr.1: Added mention of @(collect :vars nil) and documented @(repeat) as the shorthand.
* Bugfix: multiple uses of @(next :args) seeing junk "args" stringKaz Kylheku2012-04-131-18/+19
| | | | | | | | | | | | | | in argument list. Fix is not to rely on the hack of using the first element of the list of files to hold the name of the current file. * match.c (match_files_ctx): New member, curfile. (mf_all): Initialize curfile. (mf_args): Set curfile to "args". (mf_file_data): Initialize curfile. (v_skip, v_fuzz, v_gather, v_collect): Use c->curfile rater than first(c->files) in debug calls. (freeform_prepare, match_files): Pass c->curfile to ml_all constructor of match_line_ctx rather than rather than first(c->files).
* * configure: Support a gen-gc configuration variable whichKaz Kylheku2012-04-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | causes CONFIG_GEN_GC to be defined as 1 in config.h. * eval.c (op_defvar, dwim_loc, op_modplace, transform_op): Handle mutating assignments via set macro. (op_dohash): Inform gc about mutated variables. TODO here. * filter.c (trie_add, trie_compress): Handle mutating assignments via set macro. * gc.c (BACKPTR_VEC_SIZE, FULL_GC_INTERVAL): New preprocessor symbols. (backptr, backptr_idx, partial_gc_count, full): New static variables. (make_obj): Initialize generation to zero. (gc): Added logic for deciding between full and partial gc. (gc_set, gc_mutated): New functions. * gc.h (gc_set, gc_mutated): Declared. * hash.c (hash_mark): Changed useless use of vecref_l to vecref. (gethash_f): Use set when assigning through *found since it is a possible mutation. * lib.c (car_l, cdr_l, vecref_l): Got rid of loc macro uses. Using the value properly is going to be the caller's responsibility. (push): push may be a mutation, so use set. (intern): Uset set to mutate a hash entry. (acons_new_l, aconsq_new_l): Use set when replacing *list. * lib.h (PTR_BIT): New preprocessor symbol. (obj_common): New macro for defining common object fields. type_t is split into two bitfields, half a pointer wide, allowing for generation to be represented. (struct any, struct cons, struct string, struct sym, struct package, struct func, struct vec, struct lazy_cons, struct cobj, struct env, struct bignum, struct flonum): Use obj_common macro to defined common fields. (loc): Macro removed. (set, mut): Macros conditionally defined for real functionality. (list_collect, list_collect_nconc, list_collect_append): Replace mutating operations with set. * match.c (dest_set, v_cat, v_output, v_filter): Replace mutating operations with set. * stream.c (string_in_get_line, string_in_get_char, strlist_out_put_string, strlist_out_put_char): Replace mutating operations with set. * unwind.c (uw_register_subtype): Replace mutating operation with set.
* If one of the blocks which are subordinate to a @(trailer)Kaz Kylheku2012-03-311-9/+34
| | | | | | | | | | | | | | | | | | | | | happen to request a successful termination by invoking @(accept) the position must not advance into the trailer material. * match.c (v_trailer): Added an unwind protect which detects that an accept is taking place and adjusts the return value to restrict the input position at the point given to trailer. (accept_fail): Use uw_block_return_proto instead of uw_block_return and pass the symbol as the protocol identifier. * unwind.c (uw_current_exit_point): New function. (uw_block_return): Function renamed to uw_block_return_proto; takes new parameter which is stored in the block structure. * unwind.h (struct uw_block): New member, protocol. (uw_block_return): Becomes an inline wrapper for uw_block_return_proto. (uw_block_return_proto, uw_current_exit_point): Declared. * txr.1: Interaction between @(trailer) and @(accept) documented.
* * match.c (h_var): Disallow the variable named by the symbol tKaz Kylheku2012-03-301-10/+24
| | | | | | | | by throwing an exception. Allow nil, but wherever nil occurs, do not produce a binding. * txr.1: State the restrictions against using t in the section on Variables and also describe the nil ignore feature.
* Filtering on lists and nested lists is hereby made to work.Kaz Kylheku2012-03-261-3/+3
| | | | | | | | | | | | | | | | | | For instance given @(bind a ("a" "b" "c")) it is now possible to do @(filter :upcase a) whereby a promptly takes on the value ("A" "B" "C"). * filter.c (string_filter): Function renamed to string_tree_filter. (compound_filter): Follows rename. (filter_string): Function renamed to filter string tree. Can filter tree of strings, or possibly other objects, if the filter function allows. (filter_equal): No special case test for objects that are strings. Just put them through the filter. * filter.h (filter_string): Declaration updated. * match.c (format_field, subst_vars, v_filter): Follow rename.
* * match.c (v_output): Bugfix: we should flush the streamKaz Kylheku2012-03-261-0/+2
| | | | | | | after each @(output) block. Otherwise if output blocks that go to standard output are interleaved with output blocks which pipe to some command which then goes to standard out, the output won't be in the proper order.
* * lib.c (rebind_s): New symbol variable.Kaz Kylheku2012-03-241-0/+17
| | | | | | | | | | * lib.h (rebind_s): Declared. * match.c (v_rebind): New static function. (dir_tables_init): Registered rebind_s to v_rebind, and also to hv_trampoline in the horizontal directive table. * txr.1: Documented it.
* Bug #35989Kaz Kylheku2012-03-241-1/+1
| | | | | * match.c (syms_init): text_s must be in the system package because it's not a user-visible operator.
* Bugfix: code like @(skip)@{var /partial/} whereKaz Kylheku2012-03-241-11/+17
| | | | | | | | | | | | | | | | the regular expression does not match all the way to the end of the line was getting by the check for a complete match. * match.c (do_match_line): Loses the second parameter named completely. The check whether the line was matched completely is done higher up, in match_line_completely. This is needed because do_match_line has some early successful return cases which bypass the check. (match_line): Remove second paramter in call to do_match_line. (match_line_completely): Do the check here that the line was matched completely. Nothing can get by this. (v_freeform): Do notpass second nil argument to do_match_line.
* Changing type function to not blow up on nil, which makes a lot of codeKaz Kylheku2012-03-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | simpler. A pseudo type code is introduced called NIL with value 0. * lib.h (enum type): New enumeration value, NIL. (type): Function accepts object nil and maps it to code NIL. * eval.c (dwim_loc, op_dwim): test for nil obj and goto hack is gone, just handle NIL in the switch. * gc.c (make_obj, mark): Handle new NIL type code in switch. * hash.c (equal_hash): Handle NIL in the switch instead of nil test. * lib.c (code2type): Map new NIL type code to null. (typeof, typecheck): Code simplified. (class_check, car): Move nil test into switch. (eql, equal, consp, bignump, stringp, lazy_stringp, symbolp, functionp, vectorp, cobjp): Simplified. (length, sub, ref, refset, replace, obj_print, obj_pprint): Handle NIL in switch instead of nil test. goto hack removed from refset. * match.c (do_match_line, do_output_line): switch condition simplified. * regex.c (regexp): Simplified. (regex_nfa): Assert condition simplified.
* Version 61txr-61Kaz Kylheku2012-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * eval.c (op_modplace): Fix warning about uninitialized variable. No bug. * filter.c: gcc compilation regresion: missing <stdio.h> breaks inclusion of "stream.h" header. Strangely, didn't show up when configured for compiling with g++ on Ubuntu. * match.c (match_filter): Fixed ununsed variable warning. * txr.vim: Bunch of missing keywords added. * dep.mk: Regenerated.
* Change: @(block) requires @(end) from now on.Kaz Kylheku2012-03-131-6/+21
| | | | | | | | | | | | | | | | | | | Blocks no longer extend to the end of the surrounding scope. * match.c (v_block): Rewrite for new syntax. * parser.l (BLOCK): New token type handled. * parser.y (BLOCK): New token. (block_clause): New nonterminal grammar symbol. (clause): Collateral fix: replaced a bunch of list(X, nao) forms with cons(X, nil). Introduced block_clause as a constituent of clause. * txr.1: Revamped documentation of block, and wrote about using blocks for reducing nested skips and reducing backtracking in general.
* * lib.c (sub_str): Removed second check for lazy string thatKaz Kylheku2012-03-031-11/+19
| | | | | | | | | | | | | | | | can't ever come out true. * match.c (search_form, h_var, h_coll, h_parallel, h_fun): Handle position t emanating from match_line, indicating match to end of line. (h_skip): When skipping to the end of line (empty spec), just return t as the position rather than the end of the line. This avoids calculating the length of the line, which forces a lazy string. (do_match_line): Near the beginning of the loop, if the position is t, then substitute the length of the line. (freeform_prepare): Return the freeform line limit value. (v_freeform): Check for t coming out of match line and do the conversion back to the trailing list in that case, but only if the freeform was limited by number of lines.
* * match.c (search_form): search_form works with relative positions now,Kaz Kylheku2012-03-011-2/+3
| | | | | | | but match_line returns absolute, and so needs to be offset by -c->base. (h_trailer, h_fun): Bugfix: return the absolute position, rather than relative c->pos. The return value of these functions becomes the return value of do_match_line, so the semantics has to agree.
* * match.c (sem_error, file_err): Bugfix: pull text formatted sourceKaz Kylheku2012-03-011-2/+2
| | | | location using source_loc_str rather than raw object using source_loc.
* * match.c (v_load): Check for errors during the parse and throw an exception.Kaz Kylheku2012-03-011-0/+4
|
* * match.c (v_load): Fixed broken functionality. Failing to evaluateKaz Kylheku2012-03-011-1/+24
| | | | directives following the load and consume input properly.
* Fixing two instances of unintentional O(n*n) behavior and poor memory useKaz Kylheku2012-03-011-6/+5
| | | | | | | | | | | | | that occur in horizontal matching of basic text patterns. * lib.c (match_str, match_str_tree): New functions. * lib.h (match_str, match_str_tree): Declared. * match.c (do_match_line): Use match_str_tree and match_str when matching strings and string lists, respectively, rather than stupidly calling search functions and then asserting that the match was found at the starting position.
* * match.c (do_match_line): Function takes new argument, "completely".Kaz Kylheku2012-02-281-12/+19
| | | | | | | | | | | | | | | | The check for completely matching a line is now done within do_match_line. (match_line): Pass nil to do_match_line, specifying that a prefix match is okay. (match_line_completely): New interface to do_match_line, which requests a match to the end of the line. (v_freeform): Pass nil to do_match_line: freeform needs incomplete match semantics. (match_files): Use match_line_completely instead of match_line. By doing it this way, we do not need to compute the length of the original line and compare it to the absolute position. This saves time and memory since computing the length of a lazy string forces it.
* * match.c (consume_prefix): This memory optimization should onlyKaz Kylheku2012-02-281-6/+8
| | | | | | be done for lazy strings, otherwise it just causes unnecessary memory use by duplicating the line, and inefficiency via thanks to allocator churn.
* * lib.c (numberp): Fix bad type check: null pointer dereference whenKaz Kylheku2012-02-281-2/+2
| | | | | | | | | | object is nil. * match.c (do_match_line): Bugfix for incorrect treatment of long lines. Must return the absolute position from the start of the original line (plus(c->pos, c->base)), rather than just c->pos, which only measures from the start of a line that may have been chopped by consume_prefix.
* * match.c (extract): Check for negative value of opt_nobindings,Kaz Kylheku2012-02-271-6/+4
| | | | | | | | | | | which forces the printing. * txr.c (help): Under -b, mention that printing the word false is suppressed also. Added documentation for -B. (main): Implemented -B option. * txr.1: Documented -B option and added clarifying text under -b option explaining the conditions under which bindings are printed.
* Fixing long-time (pre-GIT) bug. The object (nil) was stupidly used toKaz Kylheku2012-02-261-1/+4
| | | | | | | | | | | | | | | | | | | | | represent empty optional output clauses, distinguishing them from missing clauses. This creates an ambiguity, so that an @(output) block which puts out a single empty line is treated as empty. Present but empty clauses are now represented by t. * match.c (do_output_line): Check for t and bail. (do_output): Check for t instead of (nil) and bail. * parser.y (o_elems_opt2): Nonterminal deleted. (out_clauses_opt): Empty case generates nil. (req_parts_opt): o_elems_opt2 replaced by o_elems_opt. (repeat_rep_helper): Function now keeps track of which clauses were specified. For those that were specified, but empty, it substitutes t. * tests/008/empty-clauses.expected: New file. * tests/008/empty-clauses.txr: New file.
* * arith.c: Updated copyright year.Kaz Kylheku2012-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * arith.h: Likewise. * debug.c: Added copyright header. * debug.h: Updated copyright year. * eval.c: Likewise. * eval.h: Likewise. * filter.c: Likewise. * filter.h: Likewise. * gc.c: Likewise. * gc.h: Likewise. * hash.c: Likewise. * hash.h: Likewise. * lib.c: Likewise. * lib.h: Likewise. * match.c: Likewise. * match.h: Likewise. * parser.h: Likewise. * regex.c: Likewise. * regex.h: Likewise. * stream.c: Likewise. * stream.h: Likewise. * txr.c: Likewise, and e-mail address. * txr.h: Updated copyright year. * unwind.c: Likewise. * unwind.h: Likewise.
* Bug #34652Kaz Kylheku2012-02-251-0/+6
| | | | | | | | * match.c (do_txeval): Establish a dynamic env frame around evaluation of quasiliteral and around embedded TXR Lisp expression (which may contain quasiliterals) and stick the bindings there via set_match_context. This way if filte functions are invoked through a quasiliteral, they can see bindings.
* * parser.y (clause): "Doh" moment. We don't need the specialKaz Kylheku2012-02-251-3/+4
| | | | | | | | transformation of the load syntax because the parent location is already associated with the syntax. * match.c (v_load): Pull out source location info from the form itself.
* * debug.c (debug): Use new way of getting line number.Kaz Kylheku2012-02-241-4/+3
| | | | | | | | | | | | | | * eval.c (eval_error): Use source_loc_str to get source location. * match.c (debuglf, sem_err, file_err): Likewise. * parser.h (source_loc_str): Declared. * parser.l (parse_init): form_to_ln_hash must be equal based now. * parser.y (rl): Store new form of read-time source location info. * txr.1: Documented load.
* * match.c (v_load): Sanity checking on target path.Kaz Kylheku2012-02-241-2/+10
| | | | | Check if it is absolute and do not substitute parent file's directory.
* * match.c (h_var): Eliminated uses of rl function, in favor ofKaz Kylheku2012-02-241-12/+4
| | | | rlcp. Only the parser should use rl to establish location info.
* First cut at @(load) directive. Incomplete: debug location infoKaz Kylheku2012-02-241-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | needs to record file name, not only line number; absolute paths not handled, etc. * match.c (load_s): New symbol variable. (v_load): New static function. (syms_init): load_s initialized. (dir_tables_init): Load directive registered. * match.h (load_s): Declared. * parser.h (parse_reset): New function declared. * parser.l (spec_file_str): Global variable moved from txr.c. (parse_reset): New function. * parser.y (clause): Special handling for @(load ...) directive. parent file path inserted into the syntax at parse time, so when the load directive executes, it can load the file from the same directory as the parent file. * txr.c (spec_file_str): Global variable moved to parser.l.