summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* Version 043txr-043Kaz Kylheku2011-11-231-2/+2
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOES: Updated.
* Semantics change. If a variable is followed by a mixtureKaz Kylheku2011-11-231-18/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of text and regular expressions, that whole mixture is considered to follow the variable and used for matching. The earlier semantics change whereby a single unescaped space denotes the regular expression / +/ broke the simple case @a word. It caused the @a to be followed not by the text " word" but by just the regular expression element. With this change @a word means that a is followed by the regex / +/ and "word". * match.c (text_s): New symbol variable. (h_text): New function. (syms_init): Initialize new symbol variable. (dir_tables_init): Hook h_text into horizontal directives table. * match.h (text_s): Declared. * parser.y (text, texts): New nonterminals. (elem): TEXT, SPACE and regex are now handled under texts grammar production. All texts are run together and produce an item which looks like (text items ...). * txr.1, RELNOTES: Updated. * txr.c (remove_hash_bang_line): Updated to find #! buried in (text ...) syntax.
* * match.c (search_form): Bugfix: we must search to one characterKaz Kylheku2011-11-221-0/+17
| | | | | | | | | | position after the end of the line, otherwise we can never match @(eol). (h_eol): Bugfix: do not return t, but the line length. * txr.1: Warn users about @var@(bind ...) pitfall. * RELNOTES: Updated.
* Version 042Kaz Kylheku2011-11-201-2/+2
| | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped.
* Relaxing :vars in collect/coll a little bit.Kaz Kylheku2011-11-201-0/+2
| | | | | | | | | | | | | * match.c (h_coll, v_collect): Only throw an error about missing required variables if the collect iteration collected some new variables. This allows strict collects with :vars to have some cases which explicitly match and skip unwanted material, without binding variables. Also, print all missing variables in the diagnostic. * txr.1: Mention this special exception. * RELNOTES: Updated.
* Bug #34866Kaz Kylheku2011-11-191-1/+7
| | | | | | | * match.c (h_skip): Bugfix. Return the length of the line if the skip is to the end of line, not the value t. * txr.1: Clarify that @var@(skip)text is useless.
* * match.c (v_deffilter): Even better. Just evaluateKaz Kylheku2011-11-191-4/+11
| | | | | | | | the arguments individually. Now @(deffilter a b ..) is possible where these evaluate to suitable lists of strings. * txr.1: Documented.
* deffilter grows in power: it can take quasistrings.Kaz Kylheku2011-11-191-3/+6
| | | | | | | | | | | | | | | | * lib.c (cdr_f): New global variable. (funcall1, funcall2, funcall3, funcall4): Fix unterminated arguments in uw_throwf call by using uw_throw instead. (do_or): New static function. (orf): New function. (obj_init): gc_protect and initialize cdr_f. * lib.h (cdr_f, orf): Declared. * match.c (v_deffilter): Treat the table as forms to be evaluated which must reduce to strings, rather than literal strings. * txr.1: Documented.
* Task #11598.Kaz Kylheku2011-11-171-2/+36
| | | | | | | | | | | | | * match.c (resolve_k): New keyword symbol variable. (h_parallel, v_parallel): Implement :resolve keyword in @(some) directive. (syms_init): New symbol variable initialized. * parser.l: Allow (some) to have argument material. * parser.y (some_clause, elem): SOME syntax adjusted. * txr.1: Documented new :resolve keyword in @(some).
* * match.c (h_fun, v_fun): Bugfix! copy_list should be used for copyingKaz Kylheku2011-11-171-2/+7
| | | | | | | | | | | | | | the bindings, not copy_alist. Otherwise functions cannot destructively update a binding, which is useless. We want a function not to manipulate the binding list, but to be able to manipulate the contents of bindings. (match_files_ctx): Declaration moved ahead of match_line. (v_fun): Forward declaration added. (match_line): Allow vertical functions to be called from a horizontal context, in a limited way. * txr.1: Mention the possibility of a call from a horizontal context falling back on a vertical function.
* Allow directives after variable to be a kind of negative match.Kaz Kylheku2011-11-161-39/+119
| | | | | | | | | | | | | | | * match.c (search_form): bugfix: return correct match extent. * parser.y: Adjusting associativity and precedence of directives, IDENT, and grouping tokens once again. This is so that a var followed by a directive will turn into one elem, rather than the var being reduced to an elem first. * txr.1: Revised documentation to mroe clearly define the concept of a negative match, broken into subsections. Some sections belonging to syntax were moved to an appropriate location. Subsections added to description of form syntax. Explanation of directive-driven syntax.
* Variable matches can span over function calls.Kaz Kylheku2011-11-161-10/+16
| | | | | | | | | | | | Function calls following variables have searching semantics. * match.c (ml_specline_pos, search_form): New static functions. (h_var): Handle functions and regexes in a common way. * parser.y: Adjusted precedence of IDENT and ( so that @var@(func) are parsed into a single var element. * txr.1: Documented.
* Changing read syntax for character literals, because we are going toKaz Kylheku2011-11-151-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | need the single quote in the Lisp way for suppressing evaluation, eventually. I'm going with a Scheme-compatible syntax for character literals. It has a richer repertoire of standard character names than Common Lisp, and has a x convention for coding characters in hex. * lib.c (obj_print): Print characters in a Scheme-like way. * parser.h (end_of_char): New function declared. * parser.l (grammar): Implement rules for #\ syntax, with involving new HASH_BACKSLASH token. (end_of_regex): Enhancement: added check that end_of_regex is called in correct state, like the one in end_of_char. (end_of_char): New function. * parser.y (repeat_rep_helper, o_elems_transform, define_transform, lit_char_helper): Functions changed to static. (rl): Function moved down, past the grammar section. (HASH_BACKSLASH): New terminal symbol. (chrlit): Grammar redesigned. (char_from_name): New function. * txr.1: Character syntax documented.
* * txr.1: Document -l/--lisp-bindings.Kaz Kylheku2011-11-101-0/+3
|
* * match.c (v_fun): Bugfix: if there is material afterKaz Kylheku2011-11-101-19/+44
| | | | | | | the function call, decline it; it is a horizontal context. * txr.1: Discussion and examples of calls that are in a horizontal context.
* Minor.Kaz Kylheku2011-11-091-1/+1
|
* * txr.1: Documented horizontal function definitions and callsKaz Kylheku2011-11-091-37/+125
|
* Task #11581 & bugfix.Kaz Kylheku2011-11-061-2/+32
| | | | | | | | | | | | * match.c (noval_s): New symbol variable. (vars_to_bindings): Use a default value of noval_s to indicate a required variable, rather than nil, which would not allow an optional variable with a default value of nil. (h_coll, v_collect): Check default value against noval_s, rather than nil. (v_gather): Support :vars keyword. (syms_init): Initialize new symbol variable. * txr.1: Documented gather's :vars parameter.
* Task #11581Kaz Kylheku2011-11-061-0/+65
| | | | | | | | | | | | | | | | | * match.c (gather_s): New keyword variable. (v_gather): New function. (syms_init): gather_s initialized. (dir_tables_init): v_gather entered into table. * match.h (gather_s): Declared. * parser.l: GATHER token scanning added. * parser.y: GATHER token added. gather_clause nonterminal added. * txr.1: New directive documented. * txr.vim: gather keyword introduced.
* Task #11442. Access to environment variables.Kaz Kylheku2011-11-051-0/+6
| | | | | | | | | | | | | | * lib.c (env_list): New static variable. (env): New function. (match): Declaration of nonexistent function removed. (obj_init): New variable gc-protected. * lib.h (env): Declared. * match.c (env_k): New symbol variable. (v_next): Implemented :env. * txr.1: @(next :env) described.
* 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.