summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* Version 041txr-041Kaz Kylheku2011-10-301-2/+2
|
* Bug #34657Kaz Kylheku2011-10-271-12/+56
| | | | | | * txr.1: Added explanations about the differences between empty streams and empty lines, and to watch out when passing empty strings to @(next :string ...).
* Fixed lame @(cat) directive, without obsolescence phase.Kaz Kylheku2011-10-261-5/+7
| | | | | | * match.c (v_cat): Rewritten. * txr.1: Documented.
* * filter.c (function_filter): Function removed.Kaz Kylheku2011-10-251-3/+44
| | | | | | | | | | | | | | (get_filter): Treat (:fun ...) syntax as a single function call with extra arguments, currying it up as curried function that invokes match_funcall once. * match.c (match_funcall): Extended to take a list of the additional arguments from get_filter. Adds these to the function call form generated for the v_func call. * match.h (match_funcall): Declaration updated. * txr.1: Function Filter additional arguments documented.
* * match.c (filter_s): New symbol variable.Kaz Kylheku2011-10-251-0/+18
| | | | | | | | (v_filter): New function. (syms_init): New symbol variable initialized. (dir_tables_init): New function entered into table. * txr.1: Documented new filter directive.
* Shorthand for filters which map multiple texts to a commonKaz Kylheku2011-10-251-9/+23
| | | | | | | | | | | | | | | | | replacement text. * filter.c (build_filter_from_list): Allow tuples to denote multiple keys mapping to the same value. * lib.c (do_curry_123_2, do_curry_123_1): New static functions. (curry_123_2, curry_123_1): New functions. * lib.h (curry_123_2, curry_123_1): New functions declared. * match.c (v_deffilter): Allow tuples of strings rather than just pairs. * txr.1: Updated.
* * txr.1: Updated.Kaz Kylheku2011-10-251-2/+9
|
* * filter.c (function_filter): New function.Kaz Kylheku2011-10-241-2/+44
| | | | | | | | | | | | | | | | | | | | | | (get_filter): Handle (fun ...) syntax. * match.c (v_bind): Establish dynamic environment frame around dest_bind, and stash the bindings there so filters can have access to the bindings. (v_output): Likewise, around do_output calls. (v_fun): New function. (match_files): Function handling broken out into v_fun. (match_funcall): New function. * match.h (match_funcall): Declared. * unwind.c (uw_push_env): Initialize match_context. (uw_get_match_context, uw_set_match_context): New functions. * unwind.h (struct uw_dynamic_env): New member, match_context. (uw_get_match_context, uw_set_match_context): Declared. * txr.1: Documented function filters.
* * match.c (list_k, string_k): New keyword symbol variables.Kaz Kylheku2011-10-231-7/+13
| | | | | | | | (v_next): Implement :list and :string keywords. (syms_init): New keyword variables initialized. NOTE: the :var keyword is deprecated. * txr.1: Documented :list and :string.
* Task #11474Kaz Kylheku2011-10-221-17/+36
| | | | | | | | | | | | | | | | | | | | | | | | * filter.c (filter_equal): Takes two filters instead of one. (lfilt_k, rfilt_k): New keyword variables. (filter_init): New keyword variables initialized. * filter.h (filter_equal): Declaration updated. (lfilt_k, rfilt_k): Declared. * lib.c (funcall4): New function. (do_curry_1234_34): New static function. (curry_1234_34): New function. (do_swap_12_21): New static function. (swap_12_21): New function. * lib.h (funcall4, curry_1234_34, swap_12_21): Declared. * match.c (dest_bind): Swap use the function argument swapping combinator when calling tree find such that the value being searched is on the left and pattern material is on the right. (v_bind): Implemented :lfilt and :rfilt. * txr.1: Documented :lfilt and :rfilt.
* * filter.c (get_filter_trie): Function renamed to get_filter. A filterKaz Kylheku2011-10-221-3/+25
| | | | | | | | | | | | | | is not necessarily a trie. (string_filter, compound_filter): New functions. (get_filter): Recognize a compound filters and return a function which implements it. * filter.h (get_filter_trie): Declaration renamed. * match.c (format_field, v_bind, v_output): Follow get_filter_trie rename. Error message text updated. * txr.1: Describe compound filters.
* Task #11474Kaz Kylheku2011-10-221-12/+54
| | | | | | | | | | | | | | | | | | | | | | | | * filter.c (filter_equal): New function. (upcase_k, downcase_k): New keyword variables. (filter_init): New keyword variables initialized, and new upcase and downcase filters registered. * filter.h (filter_equal): Declared. * lib.c (tree_find): Takes new argument, the equality test function. (upcase_str, downcase_str): New functions. (do_curry_123_23): New static function. (curry_123_23): New function. * lib.h (tree_find): Declaration updated. (upcase_str, downcase_str, curry_123_23): Declared. * match.c (dest_bind): Updated to take equality function. Uses it and passes it down to tree_find. (v_bind): Filter feature implemented. (h_var, v_try): Add equal_f to dest_bind argument list. * txr.1: Updated to describe new filters and bind arguments.
* * match.c (v_collect): Regression bugfix. Make it work like the commentKaz Kylheku2011-10-211-4/+25
| | | | | | | says: until/last clause has visibility to uncollated bindings from collect. * txr.1: Document behavior.
* Implementing @(set) directive for assigning to variablesKaz Kylheku2011-10-211-0/+39
| | | | | | | | | destructively. * match.c (dest_set, v_set): New static functions. (dir_tables_init): Add v_set to vertical directives hash table. * txr.1: Documented.
* * match.c (v_output): When appending output to a variable,Kaz Kylheku2011-10-211-3/+19
| | | | | | | flatten the previous contents so we can append to a single string, or to deeply nested list, etc. * txr.1: Documented these new extensions to next and output.
* * lib.c (proper_plist_to_alist, improper_plist_to_alist): NewKaz Kylheku2011-10-211-8/+21
| | | | | | | | | | | | | | functions. * lib.h (proper_plist_to_alist, improper_plist_to_alist): New functions declared. * match.c (append_k): New keyword symbol variable. (complex_open): New append argument. (v_output): Streamlined parsing of keywords. Support :append keyword. * txr.1: Output directive's keyword documentation revised.
* Version 040txr-040Kaz Kylheku2011-10-201-2/+2
|
* * parser.y (elem): Amending previous change. A single spaceKaz Kylheku2011-10-131-2/+2
| | | | | | | | | should only denote multiple spaces, not mixtures of spaces and tabs. WE have to be careful with tabs because they can be semantically different from spaces (e.g. file with tab delimited fields which can be blank, empty or have leading or trailing spaces.) * txr.1: Updated.
* * Makefile (%.ok: %.txr): Use unified diff for showingKaz Kylheku2011-10-131-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | differences between expected and actual test output. * parser.l (yybadtoken): Handle new terminal symbol, SPACE. New rule for producing SPACE token out of an extent of tabs and spaces. * parser.y (SPACE): New terminal symbol. (o_var): New nonterminal. I noticed that the var rule was being used for output elements, and the var rule refers to elem rather than o_elem. A new o_var rule is a simplified duplicate of var. (elem): Handle SPACE token. Transform to regex if it is a single space, otherwise to literal text. (o_elem): Handle SPACE token in output. * tests/001/query-2.txr: This query depends on matching single spaces and so needs to use escapes. * tests/001/query-4.txr, test/001/query-4.expected: New test case, based on query-2.txr. It produces the same output, but is simpler thanks to the new semantics of space. * txr.1: Documented.
* Version 039txr-039Kaz Kylheku2011-10-101-3/+3
|
* * txr.1: Removed references to obsolete @(next) variant.Kaz Kylheku2011-10-081-15/+2
|
* * match.c (vars_to_bindings): New function.Kaz Kylheku2011-10-081-3/+69
| | | | | | (match_line): keyword argument :vars implemented for coll. * txr.1: Documented :vars.
* * txr.1: Augment example of @/.*/ being used to skip to theKaz Kylheku2011-10-081-0/+5
| | | | | end of the line with @(skip) which is now better style, since it avoids reaching for regexes.
* * match.c (mintimes_k, maxtimes_k): New keyword variables.Kaz Kylheku2011-10-081-12/+18
| | | | | | | | | (match_line): Implemented :mintimes and :maxtimes, changing the semantics of :times. (match_files): Likewise. (match_init): New keyword variables initialized. * txr.1: Updated.
* * match.c (greedy_k): New keyword symbol variable.Kaz Kylheku2011-10-071-5/+30
| | | | | | | | (match_line): Greedy skip implemented. (match_files): Likewise. (match_init): New keyword symbol variable initialized. * txr.1: Updated.
* * lib.c (eol_s): New symbol variable.Kaz Kylheku2011-10-071-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | (obj_init): New variable initialized. * lib.h (eol_s): Declared. * match.c (match_line): Implemented horizontal skip as and new eol directive. (match_lines): Vertical skip defers to horizontal skip if there is trailing material. * txr.1: Updated. * lib.c (eol_s): New symbol variable. (obj_init): New variable initialized. * lib.h (eol_s): Declared. * match.c (match_line): Implemented horizontal skip as and new eol directive. (match_lines): Vertical skip defers to horizontal skip if there is trailing material. * txr.1: Updated.
* * txr.1: fxed wrong word.Kaz Kylheku2011-10-071-1/+1
|
* * LICENSE, Makefile, configure, filter.c, filter.h, gc.c, gc.h, hash.c,Kaz Kylheku2011-10-041-1/+1
| | | | | | hash.h, lib.c, lib.h, match.c, match.h, parser.h, parser.l, parser.y, regex.c, regex.h, stream.c, stream.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Updated e-mail address.
* * txr.1: Starte dodcumenting the forgotten merge directive.Kaz Kylheku2011-10-031-0/+24
|
* Implemented new last clause for collect and coll.Kaz Kylheku2011-10-031-11/+52
| | | | | | | | | | | | | | | | | | | | Bugfix in cases inside coll: was not collecting bindings. Bugfix for until inside coll: was not seeing bindings from main clause. * lib.c (ldiff): New function. * lib.h (ldiff): Declared. * match.c (match_line): Implemented last clause. Fixed cases handling by moving misplaced termination check. (match_files): Implemented last clause. * parser.y (until_last): New nonterminal symbol. (collect_clause): Refactored syntax to support until and last. (elem): Likewise. * txr.1: Updated.
* Version 038Kaz Kylheku2011-10-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New eof directive. Fixes in skip directive to work very well with eof. Consecutive variable matching semantics improved; concept of double variable match introduced for unbound variable followed by regex variable. Directives collect and coll have keyword arguments for more control over their behavior. Paralle directives (all, some, none, ...) are available in horizontal mode. New choose directive for selecting one of numerous alternatives GC bugfix in new filtering code. The code has an issue compling with GNU C++ instead of C, which is something that is supported by this project. Not a release-blocking issue. Not easy to fix without restructuring some code. * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped.
* * txr.1: Documented choose and horizontal mode for paralleKaz Kylheku2011-10-011-17/+56
| | | | constructs.
* * txr.1: Clarified consecutive variables and documented doubleKaz Kylheku2011-09-301-10/+24
| | | | variable match.
* * parser.l: Implemented backslash continuations in SPECIALKaz Kylheku2011-09-301-0/+32
| | | | | | state, regexes and string literals. * txr.1: Documented.
* * match.c (chars_k): New variable.Kaz Kylheku2011-09-291-0/+9
| | | | | | | | | | | | (match_line): Keyword arguments in coll implemented. (match_init): chars_k variable initialized. * parser.l (COLL): Lexical syntax changed to allow for argument material. * parser.y (elem): Coll syntax rewritten for arguments. * txr.1: Updated.
* * match.c (mingap_k, maxgap_k, gap_k, times_k, lines_k): NewKaz Kylheku2011-09-291-0/+38
| | | | | | | | | | | | | | | | | symbol variables. (match_lines): Keyword arguments in collect implemented. (match_init): New function. * match.h (match_init): Declared. * parser.l (COLLECT): Lexical syntax changed for COLLECT to allow for argument material. * parser.y (%union): obj renamed to val. (exprs_opt): New nonterminal. (collect_clause): Rewritten for arguments. * txr.c (main): Call to match_init introduced.
* * lib.c (eof_s): New symbol variable.Kaz Kylheku2011-09-271-0/+4
| | | | | | | | | | | (obj_init): New variable initialized. * lib.h (eof_s): Declared. * match.c (match_files): New @(eof) directive explicitly matches end of data. * txr.1: Updated.
* Version 037.Kaz Kylheku2011-09-261-2/+2
|
* New feature: @(deffilter)Kaz Kylheku2011-09-261-1/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | Bugfix in @(throw) when non-symbol is thrown: exception message referred to the symbol throw rather than the erroneous object. * filter.c (build_filter_from_list, register_filter): New functions. * filter.h (register_filter): New function declared. * lib.c (deffilter_s): New variable defined. (chain): Function changed from single list argument to variable argument list to reduce the complexity of use. (do_and, and): New functions. (obj_init): deffilter_s initializatio added. * lib.h (deffilter_s, and): New declarations. (chain): Declaration updated to new function signature. (eq): Changed from macro to inline function. * match.c (do_output_line): Simplified expression involving chain. (do_output): Likewise. (match_files): Bugfix in error handling of throw. Implementation of deffilter. * txr.1: Documented deffilter.
* Documented :from_html.Kaz Kylheku2011-09-251-2/+2
|
* Filtering feature for variable substitution in output.Kaz Kylheku2011-09-251-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * filter.c, filter.h: New files. * Makefile (OBJS): filter.o added. * gc.c (mark_obj): Mark new alloc field of string objets. * hash.c (struct hash): New member, userdata. (hash_mark): Mark new userdata member of hash. (make_hash): Initialize userdata. (get_hash_userdata, set_hash_userdata, hashp): New functions. * hash.h (get_hash_userdata, set_hash_userdata, hashp): New functions declared. * lib.c (getplist, string_extend, cobjp): New functions. (string_own, string, string_utf8): Initialize new alloc field to nil. (mkstring, mkustring): Initialize new alloc field to actual size. (length_str): When length is computed and cached, also compute and cache alloc. (init): Call filter_init. * lib.h (string string): New member, alloc. (num_fast): Macro converted to inline function. (getplist, string_extend, cobjp): New functions declared. * match.c (match_line): Follows change of modifier s-exp syntax. (format_field): New parameter, filter. New modifier syntax parsed. Filter retrieved, and applied. (subst_vars): New parameter, filter. Filter is either applied in this function or passed to format_field, as needed. (eval_form): Pass nil to new parameter of subst_vars. (do_output_line): New parameter, filter. Passed down to subst_vars. (do_output): New parameter, filter. Passed down to do_output_line. (match_files): Pass nil filter to subst_vars in cat directive. Output directive refactored to parse keywords, extract the filter and pass down to do_output. * parser.y (regex): Generate (sys:regex regex syntax ...) instead of (regex syntax ...). (elem, expr): Updated w.r.t. regex syntax change. (var): Cases '{' IDENT regex '}' and '{' IDENT NUMBER '}' are removed. new syntax '{' IDENT exprs '}' to handle these more generally and allow for keywords. * txr.1: Updated.
* * LICENSE, Makefile, configure, gc.c, gc.h, hash.c, hash.h, lib.c,Kaz Kylheku2011-09-231-1/+1
| | | | | | lib.h, match.c, match.h, parser.h, parser.l, parser.y, regex.c, regex.h, stream.c, stream.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Updated copyright year.
* * match.c, parser.y: Support for old output syntax removed.Kaz Kylheku2011-09-231-12/+6
| | | | | | Leading :nothrow with trailing material is an error now. * txr.1: Updated. Made note of errors in pipes being asynchronous.
* Semantics tweak: short circuiting behavior for @(all) and @(none).Kaz Kylheku2011-09-231-34/+53
| | | | | | * match.c (match_files): Added a couple of break statements. * txr.1: Updated.
* Version 036.txr-036Kaz Kylheku2011-09-221-1/+1
|
* Useful second argument in skip directive for skippingKaz Kylheku2011-09-221-0/+22
| | | | | | | | a minimum number of lines. * match.c (match_files): New behavior in skip_s case. * txr.1: Documented.
* Fix date.Kaz Kylheku2010-10-051-1/+1
|
* Version 035.Kaz Kylheku2010-10-051-1/+1
|
* Bump copyrights to 2010.Kaz Kylheku2010-10-051-1/+1
|
* * txr.1: Fix formatting problem.Kaz Kylheku2010-09-301-1/+3
|