summaryrefslogtreecommitdiffstats
path: root/ChangeLog
Commit message (Collapse)AuthorAgeFilesLines
...
* * parser.y (expr): Set source location info on elements.Kaz Kylheku2011-11-261-0/+5
| | | | (strlit): Set location info.
* * match.c (subst_vars): Handle expr_s, so thatKaz Kylheku2011-11-261-0/+12
| | | | | | | | | | | Lisp expressions can be interpolated into quasiliterals. (extract_vars): Avoid recursing into expressions marked with expr_s. (do_output_line): Handle expr_s so that Lisp expressions can be interpolated into output. * parser.y (o_elem, quasi_items): Handle list expressions, annotated with expr_s.
* Task #11436Kaz Kylheku2011-11-261-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lisp interpreter added. * gc.c (finalize, mark_obj): Handle ENV objects. * hash.c (struct hash): acons_new_l_fun function pointer order of arguments change. (equal_hash): Handle ENV. (make_hash, gethash_l): Use cobj_handle for type safety. Follow change in acons_new_l. (gethash, gethash_f, remhash, hash_count, hash_get_userdata, hash_set_userdata, hash_next): Use cobj_handle. (gethash_n): New function. * hash.h (gethash_n): Declared. * lib.c (env_s): New symbol variable. (code2type, equal): Handle ENV. (plusv, minusv, mul, mulv, trunc, mod, gtv, ltv, gev, lev, maxv, minv, int_str): New functions. (rehome_sym): New static function. (func_f0, func_f1, func_f2, func_f3, func_f4, func_n0, func_n1, func_n2, func_n3, func_n4): Initialize new fields of struct func. (func_f0v, func_f1v, func_f2v, func_f3v, func_f4v, func_n0v, func_n1v, func_n2v, func_n3v, func_n4v, func_interp): New functions. (apply): Function removed: sanely re-implemented in new eval.c file. (funcall, funcall1, funcall2, funcall3, funcall4): Handle variadic and interpreted functions. (acons, acons_new, acons_new_l, aconsq_new, aconsq_new_l): Reordered arguments for compatibility with Common Lisp acons. (obj_init): Special hack to prepare hash_s symbol, which is needed for type checking inside the hash table funtions invoked by make_package, at a time when the symbol is not yet interned. Initialize new env_s variable. (obj_print, obj_pprint): Handle ENV. Fix confusing rendering of of function type. (init): Call new function eval_init. * lib.h (enum type): New enumeration member ENV. (struct func): functype member changed to bitfield. New bitfied members minparam and variadic. New members in f union: f0v, f1v, f2v, f3v, f4v, n0v, n1v, n2v, n3v, n4v. (struct env): New type. (union obj): New member e of type struct env. (env_s): Variable declared. (plusv, minusv, mul, mulv, trunc, mod, gtv, ltv, gev, lev, maxv, minv,
* * lib.c (getplist_f): New function.Kaz Kylheku2011-11-241-0/+15
| | | | | | | | | | | | | * lib.h (getplist_f): Declared. * match.c (v_collect, h_coll): Use getplist_f to distinguish the case that :vars is explicitly specified as (). In this case, no bindings escape from the collect. * tests/008/soundex.txr: This test case broke due to using :vars () and yet counting on the variable to exist. * RELNOTES: Updated.
* * match.c (match_funcall): Set source location info forKaz Kylheku2011-11-241-0/+5
| | | | generated function call.
* * parser.y (texts, elem): Fixed incorrect use of rl ratherKaz Kylheku2011-11-241-0/+7
| | | | | | than rlcp. Added forgotten rlcp on result of optimize_text. * RELNOTES: Updated.
* Version 043txr-043Kaz Kylheku2011-11-231-0/+12
| | | | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped. * RELNOES: Updated.
* * txr.c (remove_hash_bang_line): Recognize multipleKaz Kylheku2011-11-231-0/+7
| | | | | | syntax possibilities. A hash bang could be buried in a (text ...) compound, or it could just be a string (thanks to the text form optimization).
* Optimization: if all the elements of (text ...) areKaz Kylheku2011-11-231-0/+9
| | | | | | | | strings, then replace the (text ...) by the catenation of those strings. * parser.y (optimize_text): New function. (elem): Use optimize_text.
* * lib.c (plus, minus): Fixed wrong assertion which would incorrectlyKaz Kylheku2011-11-231-0/+10
| | | | | | | | | fire for inputs that do not overflow. * match.c (search_form): Fixed incorrect loop test which could lead to nonterminating behavior. * RELNOTES: Updated.
* Semantics change. If a variable is followed by a mixtureKaz Kylheku2011-11-231-0/+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.
* * configure: Fix environ test case for C++.Kaz Kylheku2011-11-221-0/+4
|
* * match.c (search_form): Bugfix: we must search to one characterKaz Kylheku2011-11-221-0/+11
| | | | | | | | | | 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-0/+10
| | | | | | | | * txr.c (version): Bumped. * txr.1: Bumped version and set date. * configure (txr_ver): Bumped.
* * parser.y (char_from_name): const on wchar_t *.Kaz Kylheku2011-11-201-0/+4
|
* * RELNOTES: Updated.txr-93txr-60Kaz Kylheku2011-11-201-0/+2
|
* Bug #34630Kaz Kylheku2011-11-201-0/+7
| | | | | * parser.y (repeat_clause, rep_elem): Allow empty body. (yybadtoken): Handle unexpected newline with different message.
* Relaxing :vars in collect/coll a little bit.Kaz Kylheku2011-11-201-0/+15
| | | | | | | | | | | | | * 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.
* * Makefile (tests/008/soundex.ok): New test case.Kaz Kylheku2011-11-191-0/+9
| | | | | | | | (TXR_ARGS): Specified for new test case. * tests/008/soundex.expected: New file. * tests/008/soundex.txr: New file.
* * RELNOTES: New file.Kaz Kylheku2011-11-191-0/+4
|
* Bug #34866Kaz Kylheku2011-11-191-0/+9
| | | | | | | * 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-0/+9
| | | | | | | | 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-0/+18
| | | | | | | | | | | | | | | | * 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.
* * parser.y (yybadtoken): Use ~a to print bad character rather than #\Kaz Kylheku2011-11-191-0/+5
| | | | notation.
* * parser.y: Regression IDENT, '{' and '}'Kaz Kylheku2011-11-181-0/+7
| | | | | | must be on the same precedence level and right associative. Without this consective braced variables don't work, etc.
* * gc.c (mark_mem_region): Use the Valgrind API only to markKaz Kylheku2011-11-181-0/+13
| | | | | | | | | | | | the type field as accessible, not the whole object that we are checking. Marking the whole object accessible hides uninitialized field bugs! * lib.c: And found a bug already: lazy_str was not completely initializing all of the object fields (ls.prefix, ls.list) before invoking memory allocating operations, making it possible for the garbage collector to encounter uninitialized object areas.
* Added a JSON parsing test case. This flushed out a bug which crashedKaz Kylheku2011-11-181-0/+19
| | | | | | | | | | | | | | | | | | the garbage collector (uninitialized fields in function objects). * Makefile: Defined TXR_ARGS and TXR_OPTS for new test case. * hash.c (hash_begin): Construction of cobj modified to obey the correct procedure described in HACKING. * lib.c (func_n3, func_n4): These functions neglected to initialize the env member of the function structure. * tests/009/json.expected: New file. * tests/009/json.txr: New file. * tests/009/webapp.json: New file.
* Task #11598.Kaz Kylheku2011-11-171-0/+15
| | | | | | | | | | | | | * 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).
* Adding quote and unquote read syntax to list forms, resemblingKaz Kylheku2011-11-171-0/+17
| | | | | | | | | | | | | | | | Lisp. The difference is that splice is spelled ,* because @ already means something, and that there is only one quote operator. None of this does anything; it is only syntax. * lib.c (quote_s, qquote_s, unquote_s, splice_s): New variables. (obj_init): New variables initialized. * lib.h (quote_s, qquote_s, unquote_s, splice_s): Declared. * parser.l: Added recognition rules. * parser.y (SPLICE): New symbolic token. (list): Added new syntax for quote and splicing.
* * match.c (h_fun, v_fun): Bugfix! copy_list should be used for copyingKaz Kylheku2011-11-171-0/+15
| | | | | | | | | | | | | | 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.
* * parser.y: Bugfix: precedence of { } must be low, close to that ofKaz Kylheku2011-11-171-0/+5
| | | | IDENT, otherwise @{var}@(foo) doesn't parse.
* Allow directives after variable to be a kind of negative match.Kaz Kylheku2011-11-161-0/+17
| | | | | | | | | | | | | | | * 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-0/+13
| | | | | | | | | | | | 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.
* * txr.vim: Update for new character constant syntax.Kaz Kylheku2011-11-151-0/+4
|
* * match.c (h_var): when manipulating specline, propagate theKaz Kylheku2011-11-151-0/+18
| | | | | | | | | | | | | | | | | source locatio info. (v_skip): Don't use specline for trace messages, because it may be nil. Use the skip spec. * parser.h (rl): Declared. (rlcp): New inline function. * parser.y (rl): Static declaration removed. Function becomes extern. (clause): Propagate location info from clause to clause list backbone. (collect_clause, COLL): Bugfix: car/cdr mixup in location info. (elem): Use rlcp function to abbreviate code. (o_elems_opt, o_elems_opt2, o_elem): Set location info.
* Changing read syntax for character literals, because we are going toKaz Kylheku2011-11-151-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Bugfix: horizontal directives were being treated as vertical,Kaz Kylheku2011-11-141-0/+22
| | | | | | | | | | | | | | | | | | | | | and the trailing material silently ignored. For instance @(bind a 1)@(bind b 2). This was going to v_bind, v_bind does not check for the trailing material and doe snot call decline_s. The result was that b was not bound. Correct behavior is to process these binds in match_line. * match.c (match_line): Check if a directive IS found in the vertical table, and if so report a different error message. The fallback case is that there is no such function or directive. (v_next): Do not check for obsolete syntax any more. This case will not occur any more due to the following changes. (match_files): Do not defer opening the file if the data starts with an incorrectly written next directive. Do not look up and process a vertical directive or function call if it is followed by more material in the same line. Thus vertical directives can longer receive trailing material. This fixes the bug of horizontal directives being treated as vertical
* * debug.c (debug): Eliminated duplicate code.Kaz Kylheku2011-11-131-0/+5
| | | | Implemented better way of printing character context.
* Adding a debugger. This is an experimental prototype.Kaz Kylheku2011-11-131-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile (OBJS): New object file debug.o. * dep.mk: Updated. * match.c (h_fun): Use debug_begin and debug_end macros to set up a debug frame for backtracing. (match_line, match_files): Call debug_check to give debugger a chance to instrument call. (v_fun): Use debug_begin and debug_end macros to set up a debug frame for backtracing. Call debug_check to give debugger a chance to instrument call. * stream.c (struct strm_ops): New function pointer, flush. (stdio_maybe_write_error): Wrong word in error message corrected. (stdio_flush): New static function. (stdio_ops, pipe_ops): New function entered into tables. (flush_stream): New function. * stream.h (flush_stream): Declared. * txr.c (help): New options documented. (main): call to debug_init added. New debug options parsed and opt_debugger set accordingly. * unwind.c (uw_push_debug, uw_current_frame): New function. * unwind.h (uw_frtype): New enumeration member UW_DBG. (struct uw_debug): New frame variant. (union uw_frame): New member, db. (uw_push_debug, uw_current_frame): Declared, * debug.c: New file. * debug.h: New file.
* Fix regression in earlier commit:Kaz Kylheku2011-11-131-0/+11
| | | | | | | | | "Eliminate line numbers from the abstract syntax tree representation of the TXR query." * match.c (match_funcall): Remove spurious object being added to the front of a form where a line number used to be.
* * match.c: Removed <assert.h>Kaz Kylheku2011-11-131-0/+6
| | | | * txr.c: Likewise.
* Bug #34813Kaz Kylheku2011-11-131-0/+8
| | | | | | * match.c (v_freeform): Fail if the data is null, to avoid a false positive match as an empty line, followed by the type error of incrementing a nonexistent data line number.
* * parser.y: Correctly record line number info for regex.Kaz Kylheku2011-11-121-0/+4
|
* Improved line number reporting in errors and debug traces.Kaz Kylheku2011-11-121-0/+10
| | | | | | | | * match.c (debugf): Function removed. (dest_bind, v_output, v_eof): Use debuglf instead of debugf, and sem_error instead of uw_throwf. (match_files): Likewise, and file_err is called with form.
* Eliminate line numbers from the abstract syntaxKaz Kylheku2011-11-121-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tree representation of the TXR query. * match.c (debuglf, sem_error, file_err, eval_form): Line number argument replaced with the form to which the situation pertains. Location information is pulled from the hash table entry associated with the form. (dest_set, dest_bind, eval_form, vars_to_bindings): Context argument renamed since it isn't a line number. (struct match_line_ctx): spec_lineno member removed. (ml_all, ml_bindings_specline): lineno parameter removed. (LOG_MISMATCH, LOG_MATCH, h_var, h_skip, h_coll, h_parallel, match_line): Pass elem to debuglf instead of line number. as context. (h_trailer, h_eol): define elem for LOG_MISMATCH and LOG_MATCH macros. (h_fun): Pass elem variable to debuglf instead of line number. Body stored as a simple cons cell once again (no line number). (do_output_line): Line number parameter removed. Pass specline to sem_error instead of line number. (do_output): Adjusted for one less parameter in do_output_line. (mf_from_ml): Pass one less parameter to ml_all. Conversion of specline to spec is just a wrapping into a nested list, with no line number. (spec_bind): Linenumber variable parameter removed from macro. Definition simplified. (v_skip): Pass specline to debuglf instead of spec_linenum, which is no longer computed. (v_trailer): Use new definition of specline. Pass first_spec to sem_error instead of spec_linenum. Computation of ff_specline no longer has to skip line number. (v_freeform, v_block, v_accept_fail, v_next, v_parallel, v_gather, v_collect, v_merge, v_bind, hv_trampoline, v_cat, v_output, v_try, v_defex, v_throw, v_deffilter, v_filter, match_funcall): Use new definition of specline. Pass first_spec to sem_error instead of spec_linenum. (v_forget_local): Specline computed differently since there is no linenumber to skip. (h_define): Back to implified representation of function with no extra cell for line number. (v_define, v_fun): Pass first_spec to sem_error instead of spec_linenum. Back to implified representation of function with no extra cell for line number. (match_files): first_spec_item computed differently. Pass first_spec to sem_error instead of spec_linenum. * parser.h (source_loc): Declared. * parser.l (source_loc): New function. * parser.y:x (grammar): Removed line numbers from abstract sytnax tree. A few more places needed the annotation of forms with location info, and a couple of cases of the need to propagate the info was
* Infrastructure for storing line number informationKaz Kylheku2011-11-121-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | outside of the code, in hash tables. * filter.c (make_trie, trie_add): Update to three-argument make_hash. * hash.c (struct hash): New members, hash_fun, assoc_fun acons_new_l_fun. (ll_hash): Renamed to equal_hash. (eql_hash): New static function. (cobj_hash_op): Follows ll_hash rename. (hash_grow): Use new function indirection to call hashing function. (make_hash): New argument to specify type of hashing. Initialize new members of struct hash. (gethash_l, gethash, remhash): Use function indirection for hashing and chain search and update. (pushhash): New function. * hash.h (make_hash): Declaration updated with new parameter. (pushhash): Declared. * lib.c (eql_f): New global variable. (eql, assq, aconsq_new, aconsq_new_l): New functions. (make_package): Updated to new three-argument make_hash. (obj_init): gc-protect and initialize new variable eql_f. * lib.h (eql, assq, aconsq_new, aconsq_new_l): Declared. * match.c (dir_tables_init): Updated to there-argument make_hash. * parser.h (form_to_ln_hash, ln_to_forms_hash): Global variables declared. * parser.l (form_to_ln_hash, ln_to_forms_hash): New global variables. (grammar): Set yylval.lineno for tokens that are classified to that type in parser.y. (parse_init): Initialize and gc-protect new global variables. * parser.y (rl): New static helper function. (%union): New member, lineno. (ALL, SOME, NONE, MAYBE, CASES, CHOOSE, GATHER, AND, OR, END, COLLECT, UNTIL, COLL, OUTPUT, REPEAT, REP, SINGLE, FIRST, LAST, EMPTY, DEFINE, TRY, CATCH, FINALLY, ERRTOK, '('): Reclassified as lineno type. In the grammar, these keywords can thus provide a stable line number from the lexer. (grammar): Numerous rules updated to add constructs to the line number hash tables via the rl helper. * dep.mk: Updated. * Makefile (depend): Use the installed, stable txr in the system path to update dependencies rather than locally built ./txr, to prevent the problem that txr is broken because out out-of-date dependencies, and thus cannot regenerate dependencies.
* Bug #34799: errors in horizontal functionsKaz Kylheku2011-11-101-0/+12
| | | | | | | | | | | reported to caller line number. * match.c (ml_bindings_specline): Extended with extra argument (h_coll): Pass nil for new argument of ml_bindings_specline. (h_fun): Extract line number from stored function. Pass line number to ml_bindings_specline. (h_define, v_define): Store function as a cons cell containing the line number and body.
* * txr.1: Document -l/--lisp-bindings.Kaz Kylheku2011-11-101-0/+4
|
* * match.c (opt_nobindings, opt_arraydims): GlobalKaz Kylheku2011-11-101-0/+18
| | | | | | | | | | | | | | | | | variables moved from parser.l. (opt_lisp_bindings): New variable. (dump_bindings): Dump Lisp syntax bindings on standard output if opt_lisp_bindings is set. (v_cat): Do not complain about trailing material; this is not compatible with horizontal cat. * parser.l (opt_nobindings, opt_arraydims): Moved to match.c. * txr.c (txr_main): New options, --lisp-bindings and the equivalent -l. * txr.h: opt_lisp_bindings declared.
* Task #11583Kaz Kylheku2011-11-101-0/+9
| | | | | | | * match.c (dir_tables_init): Mapping flatten_s, forget_s, local_s, merge_s, set_s, cat_s and filter_s to hv_trampoline function, thereby making all these directives work in horizontal contexts in one fell swoop.