summaryrefslogtreecommitdiffstats
path: root/match.c
Commit message (Collapse)AuthorAgeFilesLines
* Synchronize license comments with LICENSE.Kaz Kylheku2016-10-011-16/+17
| | | | | | | | | | | | | | | | | | | | * Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h, share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl, share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/termios.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl, signal.c, signal.h, socket.c, socket.h, stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Revert to verbatim 2-Clause BSD.
* Change criterion for *load-path*-relative loading.Kaz Kylheku2016-09-271-1/+1
| | | | | | | | | | * eval.c (load): Do not resolve all relative paths relative to the current *load-path*, only pure relative ones. * match.c (v_load): Likewise. * txr.1: Update doc for @(load)/@(include) and load function.
* Use *load-path* in load/include directive.Kaz Kylheku2016-09-261-1/+1
| | | | | | | | | | | | | | * match.c (v_load): Obtain parent load path from *load-path* variable, rather than from source location info associated with the directive. This changes the semantics of when a @(load ...) occurs in code included via @(include ...). That @(load ...) is processed in the *load-path* context of the parent, rather than the include. * tests/011/txr-case.txr: Load txr-case.txr from the standard library, rather than include it. Otherwise txr-case.txr looks for txr-case.tl in tests/011.
* Overhaul of self-load-path mechanism.Kaz Kylheku2016-09-261-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The self-load-path symbol macro is as of now deprecated. It simply expands to *load-path*. *load-path* is a new special variable which is dynamically bound to the path of a file being loaded. * eval.c (self_load_path_s): Global variable renamed to load_path_s. (sys_load): Bind *load-path* around processing of loaded file. (me_load): Expand (load x) simply to (sys:load x *load-path*). (set_get_symacro): Function removed. (reg_symacro): New static function. (eval_init): Initialize renamed load_path_s with interned symbol having the name *load-path*. Register the *load-path* special variable. Set up the sel-load-path symbol macro aliasing for *load-path*. * eval.h (self_load_path_s): Declaration renamed. * match.c (v_load): Bind *load-path* around loading or inclusion. * parser.c (load_rcfile): Bind *load-path* around loading of .txr_profile file. * txr.c (txr_main): Bind *load-path* instead of self-load-path symbol macro. * txr.1: Updated documentation for @(load) directive and load macro. Replaced documentation of self-load-path with *load-path*.
* Separator expression in @(cat) evaluated as Lisp.Kaz Kylheku2016-06-261-1/+1
| | | | * match.c (v_cat): Use tleval_144 instead of txeval.
* Use Lisp eval for :var inits in collect and gather.Kaz Kylheku2016-06-261-1/+1
| | | | * match.c (vars_to_bindings): Use tleval_144 instead of txeval.
* Bugfix: unsafe num_fast in repeat/rep :counter code.Kaz Kylheku2016-06-171-6/+6
| | | | | | | * match.c (do_output_line): Use num(i) rather than num_fast(i), because i is not guaranteed to be in the fixnum range. It's less than c_num(max_depth), which could be a bignum that is in the cnum range.
* Address silly uses of fixnump.Kaz Kylheku2016-06-171-26/+22
| | | | | | | | | | | | | | * match.c (h_var): Check modifier for integerp rather than fixnump. (h_skip, h_coll, v_collect): Substitute zero only for nil values of various numeric parameters, not for values that are not fixnump. (v_skip): Likewise, and check success for integerp rather than fixnump. Even if the code can't handle bignums, we need to steer into that case so it can do he right thing and throw an exception. (freeform_prepare): Use weaker integerp type test rather than fixnump on arguments, for same reason as in v_skip.
* Replace most TXR eval with Lisp eval.Kaz Kylheku2016-06-141-43/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * match.c (tlist_k): New keyword symbol variable. (tleval_144): New static function. (h_skip): evaluate min and max arguments as Lisp. (h_coll): Evaluate all numeric keyword arguments as Lisp: :min, :max, :gap, :times, :maxtimes, :mintimes, :chars. (h_call): Evaluate function expression as Lisp. (do_output_line, do_output): Evaluate n and m parameters in @(modlast) and @(mod) as Lisp. (v_skip): Evaluate min and max as Lisp. (v_fuzz): Evaluate m and n as Lisp. (v_freeform): Evaluate arguments as Lisp. (v_next): Support new argument, :tlist, which is like :list, but with TXR style evaluation. From now on :list uses Lisp evaluation, unless compatibility is set to 143 or lower. Also, evaluate the :string argument as Lisp. (v_collect): Evaluate all numeric keyword arguments as Lisp: :min, :max, :gap, :times, :maxtimes, :mintimes, :lines. (v_output): Evaluate stream in :continue or :finish expression as Lisp. (v_load): Evaluate load target as Lisp. (v_close): Evaluate stream argument as Lisp. (v_call): Evaluate function expression as Lisp. (syms_init): Initialize tlist_k variable. * tests/007/except-1.txr: Use :tlist instead of :list, since argument is a TXR list expression. * tests/010/block.txr: Likewise.
* Rename Lisp eval wrappers and change arg order.Kaz Kylheku2016-06-131-41/+32
| | | | | | | | | | | * match.c (eval_with_bindings, eval_progn_with_bindings): Change static function names to the shorter tleval and tleval_progn. The first and second arguments swapped around to match the convention used by txeval. (dest_bind, h_coll, tx_subst_vars, do_txeval, extract_bindings, do_output_line, do_output_line, do_output, v_next, v_collect, v_output, v_do, v_require, v_if, h_do): Follow rename.
* Implement :counter in collect/coll.Kaz Kylheku2016-06-091-4/+57
| | | | | | | | * match.c (h_coll, v_collect): Parse out :collect keyword specification, using code borrowed from do_output. Implement binding in collect loop. * txr.1: Documented.
* Allow @(repeat) to see variables in more places.Kaz Kylheku2016-06-041-3/+30
| | | | | | | * match.c (extract_vars): With these changes, if @{a b [c..d]} appears inside a @(repeat) or @(rep), variables in the b, c and d positions will be recognized for list iteration, not only a.
* @(output) evaluates destination as Lisp.Kaz Kylheku2016-06-031-1/+7
| | | | | | | | | * match.c (v_output): Use txeval on the destination only if compatibility is 142 or lower, or it is a meta expression (so that @var and @(expr) still work without having to use the compatibility option). * txr.1: Documented and put in compatibility notes.
* Eliminating the ! $ and - file-opening hacks.Kaz Kylheku2016-05-311-10/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Going forward, the "!command" and "$dir" are no longer recognized, except with the backward-compatibility -C option. The "-" string denoting standard input is only recognized from the command line, not in the @(next) directive; and "-" cannot be used in @(output) to denote standard output. The main problem is that these are hacks which intrude into the namespace. (What if a file is named "-", or begins with "!" or "$"?) Secondly, they are possible security holes. These prefixes are recognized even in computed strings, like "@(next var)" where var contains "!command". * Makefile (tst/tests/002/%): Run tests in this directory with the -C 142 option in TXR_OPTS, because they use the ! mechanism. * match.c (complex_open): New argument, from_cmdline, indicating whether the file name came from the command line or is internal. Function now only treats "-" as denoting standard input, if that came from the command line. The "!" and "$" prefixes are only recognized in compatibility with 142 or earlier. (v_next): Suppress old strategy of handling string sources by pushing them to the file list to let match_files open them. This is now done only under 142 compatibility. Instead, open directly, produce the list, and recurse into match_files with ready data. This is not only simpler, but also prevents "-" from being recognized in @(next), because complex_open is invoked directly, and the from_cmdline argument is specified as nil. (v_output): Don't rely on "-" denoting standard output; rather use the stream directly, which can be passed to complex_open. Pass nil to the new from_cmdline parameter of complex_open, so "-" isn't recognized. (open_data_source): Pass t for the from_cmdline parameter of complex_open, to have "-" recognized as denoting standard input. * txr.1: Removed documentation referring to !, and use of - in the @(next) and @(output) directives. Added notes to COMPATIBILITY section.
* Fix 2011-11-17 regression.Kaz Kylheku2016-05-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This addresses a regression caused by commit 68ca87bc780e25dea1418019161d99727225d1ce, affecting a hundred releases of TXR from 42 to 141. The copy_alist call to deeply clone the variable bindings was carelessly replaced with copy_list, to address the problem that functions weren't able to mutate outer bindings. However, the parameter binding code depends on the deep cloning; it destructively manipulates bindings with the understanding that they are copies that will be thrown away. Test case: @(define f0 (var)) @(end) @(define f1 (out1 out2 var)) @ (bind out1 `a:@var`) @ (maybe) @ (f0 `b:@var`) @ (end) @ (bind out2 `a:@var`) @(end) @(f1 o1 o2 "z") This program incorrectly binds o1 and o2 to different strings, "a:z" and "a:b:z" respectively, because the f0 pattern function call has the unwanted effect of mutating var. Expected behavior is that both o1 and o2 are bound to identical strings, "a:z" and "a:z". * match.c (h_fun, v_fun): When binding arguments, extend the environment with new bindings instead of trying to re-use existing ones, because we do not have a copy of the binding cells, like we used to when bindings_cp was produced by a copy_alist call.
* New feature: self-load-path symbol macro.Kaz Kylheku2016-05-181-6/+19
| | | | | | | | | | | | | | | | | | | | | * eval.c (self_load_path_s): New symbol variable. (sys_load): Save, set-up and restore self-load-path around load. (set_get_symacro): New function. (eval_init): Register load function using sys_load_s instead of redundant intern. * eval.h (set_get_symacro): Declared. * match.c (v_load): Save, set-up and restore self-load-path macro. * parser.c (load_rcfile): Likewise. * txr.c (txr_main: Set up self-load-path when opening file. * txr.1: Documented self-load-path.
* Simple indirection on pattern functions: @(call).Kaz Kylheku2016-04-271-0/+59
| | | | | | | | | | * eval.h (call_s): Declared. * match.c (h_call, v_call): New static function. (dir_tables_init): Register v_call in v_directive_table under call symbol. Likewise h_call in h_directive_table. * txr.1: Documented.
* Pretty print filename in assertion.Kaz Kylheku2016-04-251-2/+2
| | | | | * match.c (v_assert, h_assert): Use ~a rather than ~s for c->curfile in assert message.
* Don't quote path in load and @(load) diagnostics.Kaz Kylheku2016-04-221-5/+5
| | | | | | | * eval.c (sys_load): Use ~a format specifier rather than ~s for the load path (if already known to be a string). * match.c (v_load): Likewise.
* Fix inconsistency of Lisp var visibility in TXR.Kaz Kylheku2016-04-171-29/+34
| | | | | | | | | | | | | | | | | | | Numerous places in match.c are using assoc(sym, bindings) logic to access a variable, which doesn't see the Lisp globals, as we would like. For example, if foo is defined using (defvar foo), @(set foo "A") doesn't work. This is subject to the compatibility option. * match.c (tx_lookup_var): New static function. (dest_set, h_var, h_coll, h_parallel, h_fun, v_next, v_parallel, v_gather, v_collect, v_flatten, v_cat, v_output, v_filter, v_fun, match_filter): Use tx_lookup_var instead of assoc for all lookups that see the full variable scope. Only variable lists known to be locally consed up are scanned with just assoc. * txr.1: Documented new rules and added compatibility notes.
* Fix internal error: bug in data stream opening logic.Kaz Kylheku2016-04-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Test case: txr -c '@(bind x 1)A' name The problem here is that the specline has multiple elements, so when processing the bind, rest(specline) isn't nil. This means that control passes through to horizontal matching logic. No data source is open yet; just before that logic executes, open_data_source is called. However, open_data_source refuses because @(bind) is a directive that doesn't require data. So we end up in the internal error case, because we a data source, and no attempt was made to open one. The fix is for open_data_source to also check rest(specline). It cannot skip opening the data source just because the first_spec is a non-matching directive, according to the non_matching_directive_table. This criterion should only apply if it is the *only* directive, however. A spec line with multiple items must match a line of data; that's how the TXR language works. * match.c (open_data_source): Add a condition for classifying the directive as non-matching: it must be the only directive in the line (rest(specline) must be nil).
* Close source files after parsing.Kaz Kylheku2016-04-151-1/+6
| | | | | | | | | | | | | * eval.c (sys_load): close stream in all cases. * match.c (v_load): Likewise. * parser.c (load_rcfile): Close stream in unwind block, if open. * txr.c (txr_main): Close stream after parsing in all cases. If stream is std_input, or a string stream, close_stream does nothing.
* Merge some repeated code.Kaz Kylheku2016-03-221-31/+20
| | | | | | * match.c (maybe_next): New static function. (v_block, v_if): Replace block of code with call to maybe_next.
* New semantics for @(if) directive.Kaz Kylheku2016-03-221-0/+28
| | | | | | | | | | | | | | | * eval.h (if_s): Declared. * match.c (v_if): New static function. (dir_tables_init): Register v_if in v_directive_table under if symbol. * parser.y (IF): Token assigned to <lineno> type. (if_clause, elif_clauses_opt, else_clause_opt): New syntactic representation, understood by v_if. * txr.1: Documented if semantics more precisely, dropped the text about it being syntactic sugar for a cases with require, added compatibility note.
* Support binding in @(repeat)/@(rep) :vars.Kaz Kylheku2016-03-161-1/+16
| | | | | | | | | | | | | | | | * match.c (extract_bindings): Check for (var expr) syntax, evaluate and bind. * match.h (vars_k): Declared. * parser.y (expand_repeat_rep_args): New static function. (repeat_rep_helper): The :counter and :var arguments of repeat/rep must be macro-expanded, since there can be Lisp expressions there. This supports the new feature, but also fixes the bug of :counter (var form) not expanding form. * txr.1: Updated documentation about :vars in @(repeat).
* Bugfix and @(repeat) and @(rep).Kaz Kylheku2016-03-161-1/+1
| | | | | | | * match.c (extract_bindings): Do not destructively append to vars, because that's a piece of syntax. The return value of extract_vars is freshly allocated, though, so we can fix this by reversing the arguments.
* @(output)_destination can be a stream.Kaz Kylheku2016-03-141-21/+25
| | | | | | | | | | * match.c (complex_open): If name is a stream object, just return it. (v_output): Do not close the output stream if it came from a destination expression specifying an existing stream, and thus wasn't created inside complex_open. * txr.1: Document stream destination in output directive.
* Implement @(next nil).Kaz Kylheku2016-02-291-6/+10
| | | | | | | | * match.c (v_next): If argument to @(next) is nil, then evaluate remaining query in context with no list of files, and no data. * txr.1: Documented @(next nil).
* Add debug trace to @(require).Kaz Kylheku2016-01-221-1/+3
| | | | * match.c (v_require): Produce trace when require fails.
* Bugfix: @(require) eval not in proper env.Kaz Kylheku2016-01-221-2/+1
| | | | | | | | | I caught this when doing a @(require (boundp 'var)). * match.c (v_require): The correct evaluation was being done here, with the value discarded, followed by an incorrect evaluation in which the TXR bindings are not visible, whose value *is* then used.
* Header file cleanup.Kaz Kylheku2016-01-221-3/+0
| | | | | | | * arith.c, cadr.c, debug.c, eval.c, filter.c, gencadr.txr, glob.c, hash.c, linenoise/linenoise.c, lisplib.c, match.c, parser.c, rand.c, regex.c, signal.c, stream.c, struct.c, sysif.c, syslog.c, txr.c, unwind.c, utf8.c: Remove unncessary header files.
* New :mandatory keyword in until/last clauses.Kaz Kylheku2016-01-151-7/+36
| | | | | | | | | | | | | | | | | | | * match.c (mandatory_k): New keyword variable. (h_coll, v_gather, v_collect): Implement :mandatory logic. (syms_init): Initialize mandatory_k. * parser.l (grammar): The UNTIL and LAST tokens must be matched similarly to collect, without consuming the closing parenthesis, allowing a list of items to be parsed between the symbol and the closure, in the NESTED state. * parser.y (gather_clause, collect_clause, elem, repeat_parts_opt, rep_parts_opt): Adjust to new until/last syntax. In the matching productions, the abstract syntax changes to incorporate the options. In the output productions, we throw an error if options are present. * txr.1: Documented :mandatory for collect, coll and gather.
* Gather bugfix: support empty :vars.Kaz Kylheku2016-01-151-2/+5
| | | | | | | | * match.c (v_gather): Use getplist_f to distinguish the :vars nil case just like v_collect does. A :vars nil gather could be useful; it says none of the variables are strictly required. In any case, it is not correct to treat :vars nil as if :vars weren't there.
* Use last-form-evaled mechanism for pattern language.Kaz Kylheku2016-01-021-6/+12
| | | | | | | | | | | | | | We need this now, since file system errors aren't handled in the pattern language any more, after the complex_open refactoring. * eval.c (set_last_form_evaled): New function. * eval.h (set_last_form_evaled): Declared. * match.c (do_match_line, match_files): Save, set up and restore last_form_evaled via set_last_form_evaled function.
* Bugfix: premature open of data source.Kaz Kylheku2016-01-011-1/+1
| | | | | | | | | match.c (open_data_source): complex_open was being called before the check against opening the data source because the query starting with a non-matching directive. This is moved down into a more nested scope. This bug was found thanks to complex_open now throwing exceptions.
* Handle nothrow semantics down in complex_open.Kaz Kylheku2016-01-011-37/+12
| | | | | | | | | * match.c (file_err): Static function removed. (complex_open): New argument, nothrow. Catch exceptions derived from error only if nothrow is true. (v_output, open_data_source): Pass nothrow flag down to complex_open. Eliminate unnecessary error checking.
* Hacky struct fpip gone; complex_open returns stream.Kaz Kylheku2016-01-011-74/+26
| | | | | | | | | | | | | | | * match.c (enum fpip_close): Removed. (struct fpip, fpip_t): Removed. (complex_open): Use high level Lisp library function to return appropriate stream type, and return it directly. Exceptions are turned to a nil return to emulate old behavior. (complex_open_failed, complex_snarf, complex_stream): Static functions removed. (v_output, open_data_source): Use new interface of complex_open. complex_open_failed is just a nile check. complex_stream is a noop, and complex_snarf is just lazy_stream_cons.
* Copyright year bump.Kaz Kylheku2015-12-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * LICENSE, METALICENSE, Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h, share/txr/stdlib/cadr.tl, share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl, signal.c, signal.h, stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Add 2016 copyright. * linenoise/LICENSE, linenoise/linenoise.c, linenoise/linenoise.h: Bump one principal author's copyright from 2014 to 2015. The code is based on a snapshot of 2015 upstream work.
* C++ breakage: multiple definition of name_s.Kaz Kylheku2015-12-301-2/+1
| | | | | | | | | | | | | * lib.c (name_s): Defined here now. (obj_init): name_s initialized here. * lib.h (name_s): Declared. * match.c (name_s): Definition removed. (syms_init): Initialization of name_s removed. * sysif.c (name_s): Definition removed. (sysif_init): Initialization of name_s removed.
* Shocking four-year-old bug in collect/coll.Kaz Kylheku2015-12-271-2/+7
| | | | | | | | | | | | | | | | | This originates to a commit on 2011-10-21. In that commit, I attempted to make until/last clauses have visibility to the bindings in the collect body (even though those are discarded). The problem is that the until/last clause is tried whether or not the body succeeds. When the body fails, no bindings emanate from it. In that case, the until/last clause is wrongly evaluated in an environment with no bindings whatsoever, meaning that even bindings that existed before the collect are not available to it. * match.c (h_coll, v_collect): Evaluate the last/until clause using the collect body bindings only if those bindings are not nil, otherwise use the original bindings from before entry into the collect.
* Allow @(repeat) and @(rep) to see Lisp globals.Kaz Kylheku2015-12-261-0/+11
| | | | | | | * match.c (extract_bindings): Process the final list of vars. For any variable not already on the list of output bindings, check if it has a Lisp binding, and if so, add *that* binding to the output bindings.
* TXR quasiliterals and output vars treated as Lisp.Kaz Kylheku2015-12-261-147/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (format_field): Function moved here from match.c, along with the introduction of a new behavior: if a meta-expr occurs among the modifiers, its constituent expression is evaluated in its place. This allows for @{a @[expr]} which was previously not allowed in Lisp quasiliterals, but worked in TXR quasiliterals due to the treatment of @ by txeval. (subst_vars): Static function turns external, so code in match.c can call it instead of the subst_vars in that module. For that purpose, it needs to take a filter argument and process filters, like the match.c subst_vars. (op_quasi_lit): Pass nil as filter argument to subst_vars. * eval.h (format_field, subst_vars): Declared. * match.c (format_field): Function removed, moved to eval.c and slightly changed. (subst_vars): Renamed to tx_subst_vars. By default, now just a wrapper for subst_vars. In compatibility mode, invokes the old logic. (do_txeval, do_output_line): Call tx_subst_vars rather than subst_vars. * match.h (format_field): Declaration removed. * parser.y (expr): Grammar production removed: no longer referenced. (o_var): Braced variable case now parsed as n_expr, and expanded as expr by default, since this is Lisp now. In compatibility mode, expanded using expand_meta. Also SYMTOK case must be subject to expansion; an output var can now be a symbol macro. (expand_meta): Expand a quasi-literal as Lisp, except in compatibility mode. * txr.1: Bit of a documentation update. Existing doc isn't totally clear.
* Base value in :counterKaz Kylheku2015-12-231-4/+18
| | | | | | | * match.c (do_output_line, do_output): Decode (var expr) syntax as argument of :counter and implement displacement. * txr.1: Documented.
* New directives @(data) and @(name)Kaz Kylheku2015-12-221-1/+45
| | | | | | | | | | | * match.c (data_s, name_s): New symbol variables. (v_data, v_name): New static functions. (syms_init): Initialize data_s and name_s. (dir_tables_init): Register v_data and v_name as vertical directives, and enable them in horozintal context too using hv_trampoline. * txr.1: Documented.
* Allow @(line) in horizontal context.Kaz Kylheku2015-12-221-0/+1
| | | | | * match.c (dir_tables_init): Register hv_trampoline handler for line_s.
* Don't use ~d in several match debug diagnostics.Kaz Kylheku2015-12-221-2/+2
| | | | | * match.c (h_chr, v_line): Don't try to print clashing binding or object using ~d, because it might not be an integer.
* debugger: stopped at line nil of nil.Kaz Kylheku2015-12-181-4/+5
| | | | | | | | | | | | | Address some situations in which the debug_check call is given a piece of spec with no source loc information attached. * (h_var): Use rlcp when constructing new piece of spec representing a substituted variable, or a spec confined to just search for a piece of text with no trailing match. (do_match_line): Pass the whole specline to debug_check, rather than just the elem, which might just be a string with no location info attached. (match_files): Likewise.
* @(next) takes Lisp expression as source now.Kaz Kylheku2015-11-201-1/+14
| | | | | | | | | | | * match.c (v_next): Evaluate the source expression as TXR Lisp, unless it is meta-expression or meta-variable, or the compatibility option is set to 124 or lower. In those cases treat it as an expression of the TXR Pattern * txr.1: Updated documentation of @(next) and all relevant examples of @(next) everywhere. Added compatibility notes.
* @(rep) as shorthand for @(coll :vars nil).Kaz Kylheku2015-11-201-2/+11
| | | | | | | | | | | | | * match.c (h_coll): Check for rep symbol, and handle similarly to v_coll. Use symbol in error message. (dir_tables_init): Bind rep symbol to h_coll. * parser.y (elems): Don't generate rep_elem phrase structure for the sake of catching "rep outside of output"; this production now conflicts with the intent to allow this. (elem): Add various REP productions which clones of COLL. * txr.1: Documented new @(rep) usage.
* Use symbol in diagnostics in collect.Kaz Kylheku2015-11-201-9/+9
| | | | | * match.c (v_collect): Don't use hard-coded "collect" in diagnostics because the symbol can be repeat.