summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* * eval.c (op_defun): Transform a function body by insertingKaz Kylheku2011-12-071-1/+56
| | | | | | | | a named block around it, thereby imitating a Common Lisp feature. (op_for): Establish an anonymous block around the loop body, test form and increment forms. * txr.1: Documented named block in defun. Documented for and for *.
* * txr.1: flip operator documented. Bad syntax for pop fixed.Kaz Kylheku2011-12-071-3/+11
| | | | Blank section for list-vector function added.
* * eval.c (lookup_var, lookup_fun): Reversing assoc arguments.Kaz Kylheku2011-12-071-0/+26
| | | | | | | | | | | | | | | | | | | | | | | (eval_init): New intrinsics. * hash.c (struct_hash): assoc_fun parameters reversed. (gethash, gethash_f, gethash_n): Likewise. * lib.c (assoc, assq): Reversing parameters. (find_package, acons_new, acons_new_l, aconsq_new): Reversing arguments to assoc adn assq. * lib.h (assoc, assq): Declarations updated. * match.c (dest_set, dest_bind, h_var, h_coll, h_parallel, h_fun, subst_vars, do_txeval, v_next, v_parallel, v_gather, v_collect, v_flatten, v_cat, v_output, v_filter, f_fun, match_funcall): Reversing arguments to assoc. * unwind.c (uw_get_func, uw_exception_subtype_p, uw_register_subtype): Reversing arguments to assoc. * txr.1: Blank sections created for new functions.
* * txr.1: Blank sections created for character functions.Kaz Kylheku2011-12-071-0/+28
|
* * eval.c (progn_s): New symbol variable.Kaz Kylheku2011-12-071-0/+16
| | | | | | | (op_progn): New static function. (eval_init): Initialize new variable, register progn operator. * txr.1: progn documented.
* Version 046txr-046Kaz Kylheku2011-12-061-2/+2
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* * eval.c (op_unwind_protect): Fixed uninitialized variableKaz Kylheku2011-12-061-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | warning. (eval_init): New functions registered: typeof and vector functions, as well as length_list. * lib.c (length): Function renamed to length_list, because it is list specific. (length_vec, size_vec, vector_list): New functions. (length): New function, generic over lists, vectors and strings. * lib.h (length_list, length_vec, size_vec, vector_list): Declared. * match.c (h_var, h_fun, robust_length, v_deffilter, v_fun): Use length_list instead of length. * parser.l: Introduced # token. * parser.y (vector): New nonterminal. (expr): vector is a kind of expr. (chrlist): Bugfix: single-character syntax was not working; for instance #\x to denote the charcter x. (lit_char_helper): Use length_list instead of length. * stream.c (string_in_get_line): Bugfix: this was using the wrong length function: length was being applied to a string. The genericity of length makes that correct now, but changing to length_str anyway. * txr.1: Blank sections created for functions. Vector syntax documented.
* Whitespace.Kaz Kylheku2011-12-051-1/+1
|
* Version 045txr-045Kaz Kylheku2011-12-051-2/+2
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* * eval.c (op_cond): Fixed behavior for singleton clauses.Kaz Kylheku2011-12-051-3/+210
| | | | | | | | | | (eval_init): Use existing function objects car_f, cdr_f, eq_f, eql_f and equal_f. Added identity to function table. * lib.h (eql_f): Missing declaration added. * txr.1: Documented cond, and, if, or, defun, inc, dec, set, push and pop.
* * parser.y (force_regular_quotes): Function removed.Kaz Kylheku2011-12-041-15/+31
| | | | | | | | (list): Prior commit reversed. * txr.1: Prior commit reversed. * RELNOTES: No semantics clarification in quasiquote; bugfixes only.
* * eval.c (op_qquote_error, op_unquote_error): New static functions.Kaz Kylheku2011-12-041-31/+15
| | | | | | | | | | | | | (expand_qquote): Bugfix: missing case added to handle directly quoted quasiquote. (eval_init): Error-catching pseudo-operators registered in op_table. * parser.y (force_regular_quotes): New function. (list): Quotes within unquotes and splices are regular. * txr.1: Clarified new rules. Removed description of ,'form and ,*'form special syntax.
* Expose lazy lists in TXR Lisp.Kaz Kylheku2011-12-031-0/+6
| | | | | | | | | | | | | | | * eval.c (eval_init): New intrinsic functions. * lib.c (rplaca, rplacd, lcons_fun): New functions. (make_lazycons): Renamed to make_lazy_cons, relocated and turned into external function. (lazy_stream_func, lazy_stream_cons): Follow rename of make_lazycons. * lib.h (rplaca, rplacd, make_lazy_cons, lcons_fun): Declared. * txr.1: Stub sections created.
* * eval.c (uw_protect_s, return_s, return_from_s): New symbolKaz Kylheku2011-12-031-0/+6
| | | | | | | | | | | | | | variables. (op_unwind_protect, op_block, op_return, op_return_from): New static functions. (expand): Removed case for call, if, and, and or. These operators evaluate all their arguments, so the code walker can treat them as a function calls. Added case for block and return-from. (eval_init): New symbols interned. New operator functions registered in op_table. * txr.1: Blank sections added.
* * eval.c (eval_init): String and character functionsKaz Kylheku2011-12-031-2/+47
| | | | | | exposed as intrinsics. * txr.1: Blank sections created.
* * txr.1: Added stub sections for new functions.Kaz Kylheku2011-12-021-0/+17
|
* * parser.y (list): unquote and splice actions look inside theKaz Kylheku2011-12-021-0/+26
| | | | | | | | | | argument form. If an unquote or splice are applied to a quoted form, its quote becomes a regular quote. This behavior is necessary to make ,',form work in nested quotes, otherwise the ' is a quasiquote which captures the comma in ,form, reducing ,',form to ,form. * txr.1: Documented this special behavior.
* Version 044txr-044Kaz Kylheku2011-12-011-2/+2
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOTES: Updated.
* * txr.1: Started Lisp documentation. Updated description ofKaz Kylheku2011-12-011-11/+397
| | | | symbol syntax.
* 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.