| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
needs to record file name, not only line number; absolute paths
not handled, etc.
* match.c (load_s): New symbol variable.
(v_load): New static function.
(syms_init): load_s initialized.
(dir_tables_init): Load directive registered.
* match.h (load_s): Declared.
* parser.h (parse_reset): New function declared.
* parser.l (spec_file_str): Global variable moved from txr.c.
(parse_reset): New function.
* parser.y (clause): Special handling for @(load ...) directive.
parent file path inserted into the syntax at parse time,
so when the load directive executes, it can load the file from
the same directory as the parent file.
* txr.c (spec_file_str): Global variable moved to parser.l.
|
|
|
|
| |
* tests/010/seq.expected: New file.
|
|
|
|
|
|
|
|
|
| |
replace_str, sub_vec, replace_vec): Implementing floating zero
behavior. This is necessary so that the important case index .. (+
index 1) for selecting one element as a subrange works even if index is
negative.
* txr.1: Floating zero behavior for ranges documented.
|
|
|
|
|
|
|
|
| |
deleted range of values. Missing del cases added for single
index cases.
* lib.c (quicksort): Fix pivot selection one more time.
(length): Fix bad argument in "not a sequence" error.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_error): nostatic added to suppress a g++ warning.
(dwim_loc): Takes new value as the original unevaluated form so
it can control evaluation. Support for del operator added.
(op_modplace): Bugfixes: new value form was being unconditionally
evaluated and out of order w.r.t. other forms. Now there is
left to right order. The form is evaluated later, since for most
operators it is on the right, with the exception of push.
dwim places can now optionally control the evaluation of newform.
del operator supported in gethash case as a special case.
error case added for del: if it's not handled in gethash or
dwim_loc, it is an error.
(eval_init): del_s initialized, and del operator added to table.
* txr.vim: syntax highlighting for del.
* txr.1: Documented del.
|
|
|
|
|
| |
Previously this function did nothing, but now it interns
some important symbols.
|
|
|
|
|
|
|
| |
It was decrementing the hash count without checking that
something was deleted from the chain. The deletion was done
incorrectly, without regard for the kind of comparison fucntion
used by the hash table.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
and replace.
* lib.c (do_sort): Static function renamed to sort_list.
(swap, quicksort, sort_vec): New static functions.
(sort): Made generic over lists, vectors and strings.
(refset): New function.
* lib.h (sort): Declaration updated (parameter name change).
(refset): Declared.
* txr.1: Mention refset.
* txr.vim: Updated with refset.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* debug.c (help, show_bindings): put_string arguments reversed.
* eval.c (bind_args): Support colon notation in interpreted
function lambda lists for optional arguments. Improved error checking.
(apply): Allow optional arguments to be left out.
(dwim_loc): Reversed arguments to replace_str, replace_vec,
replace_list.
(eval_init): Numerous intrinsics now have arguments that are optional.
New function rand introduced which reverses arguments relative to
random. New intrinsic function hash introduced for alternative
construction of hashes.
* gc.c (sweep): Reversed arguments to put_char.
* hash.c (weak_keys_k, weak_vals_k, equal_based_k): New keyword
symbol variables.
(hashv): New function.
(hash_init): Intern new symbols.
* hash.h (weak_keys_k, weak_vals_k, equal_based_k, hashv): Declared.
* lib.c (colon_k): New keyword symbol variable.
(replace_list, replace_str, replace_vec): Arguments rearranged.
(tree_find): testfun becomes optional argument.
(int_str): base becomes optional argument.
(func_f0, func_f1, func_f2, func_f3, func_f4, func_n0,
func_n1, func_n2, func_n3, func_n4, func_f0v, func_f1v,
func_f2v, func_f3v, func_f4v, func_n0v, func_n1v,
func_n2v, func_n3v, func_n4v, func_interp): Initialize optargs to zero.
(func_n0o, func_n1o, func_n2o, func_n3o, func_n4o): New functions.
(cobj_print_op): Reversed arguments to put_string.
(find): testfun and keyfun become optional arguments.
(replace): Parameters rearranged and arguments rearranged in calls to
replace_list, replace_str and replace_vec.
(obj_init): colon_k initialized.
(obj_print, obj_pprint): Arguments reversed, and stream defaults
to std_output. Arguments reversed in calls to put_char and put_string.
(dump): Arguments reversed in call to put_char.
* lib.h (struct func): sizes of minparam, fixparam bitfields
adjusted. New bitfield optargs. New unnamed bitfield added so
the previous ones add up to 16 bits.
(colon_k): Declared.
(func_n0o, func_n1o, func_n2o, func_n3o, func_n4o): Declared.
(replace_list, replace_str, replace_vec, replace): Declarations updated.
* match.c (debuglf, dump_shell_string, dump_byte_string, dump_var,
do_output_line, extract): Reversed arguments to put_char and
|
|
|
|
|
| |
variables. Lists do not have to be wrapped in @(repeat)/@(rep).
Indexing notation works on strings and vectors.
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (sub, ref, replace): Declared.
* match.c (format_field): Generic indexing using new functions.
* txr.1: Documentation stub.
* txr.vim: Highlighting for new functions.
|
|
|
|
|
|
| |
expression, then recurse into the expression to find
variables. This allows us to do things like @{`@x`} inside
a @(repeat) or @(rep).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (subst_vars): Treat the variable as an arbitrary
expression rather than just a symbol.
* match.c (subst_vars): Likewise.
* parser.y (o_var): Further simplification. The first item in
an output var is an expr and not an IDENT.
* txr.1: Updated.
* txr.vim: Likewise.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
or not. This is now done right inside the standard output stream.
* match.c (output_produced): Variable removed.
(complex_open): Assignment to output_produced removed.
* stream.c (output_produced): New global variable.
(stdio_put_string, stdio_put_char): Set output_produced
to t if the target of the output is stdout.
* stream.h (output_produced): Declared.
* txr.h (output_produced): Declaration removed.
|
|
|
|
|
| |
Here is a simpler way. We can let nil be treated as a list with a
simple goto. This solves all cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (v_do): Store match context.
(match_fun): New function.
* match.h (match_fun): Declared.
* stream.c (streamp): New function.
* stream.h (streamp): Declared.
* txr.1: Stub section for match-fun.
* txr.vim: Highlight match-fun.
|
|
|
|
|
|
| |
* match.h (match_funcall): Declaration updated.
* filter.c (get_filter): Updated.
|
|
|
|
|
|
|
|
|
| |
list, and not the atom nil.
* match.c (v_try): Do not transform an atomic exception x into
the list ((t . x)). Just to (x). This (t . x) representation is
a vestige of from the time when the exception consisted of the
old-style return values from txeval.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_catch, expand_catch_clause,
expand_catch): New static functions.
(expand): Handle catch operator.
(eval_init): Added catch operator to op_table,
and registered new functions throw, throwf and error.
* txr.1: Documented catch operator and created
stub section for throw, throwf and error.
* txr.vim: Updated.
* unwind.c (uw_throwfv, uw_errorfv): New functions.
* unwind.h (uw_throwfv, uw_errorfv): Declared.
|
| |
|
|
|
|
|
| |
range_star_v): Regression: handle the case where the range is
open-ended (to is nil).
|
|
|
|
|
|
|
|
|
|
|
| |
but the step is omitted, the step should be negative one
rather than one.
(range_star_v_func, range_star_v): New static functions.
(eval_init): New function, range*, registered.
* txr.1: Stub section for range is also for range*.
* txr.vim: Recognize range* function.
|
|
|
|
| |
not only if it achieves the endpoint, but if it crosses it.
|
|
|
|
|
|
| |
evaluates to nil, by building a form targetting the place,
and recursing into op_modplace. Also, optimization: don't use eval
on a form built from the operator; just go to op_modplace directly.
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version and set date.
* configure (txr_ver): Bumped.
* RELNOTES: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
in sys::var form) as variables. This allows interpretation of metanums
in quasiliterals, because these are replaced by variables in the
op expander.
* parser.l: Recognize METANUM in QSILIT state.
* parser.y (quasi_item): METANUM parsed in quasiliteral.
* txr.vim: Metanums highlighted properly.
|
|
|
|
| |
at least two arguments, rather than at least one.
|
|
|
|
| |
to spurious retention.
|
|
|
|
|
|
|
| |
(cols): New static variable.
(debug): Print context intelligently, fitting into the width of
the screen.
(debug_init): Try to get terminal width, from the COLUMNS variable.
|
|
|
|
|
|
| |
the input is a list, and not handling the case
atom -> (atom) like its non-lazy counterpart.
This broke @(next :list expr).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
character literals as hex escapes, followed by semicolon if
necessary. Don't use iswprint function since it is locale-specific
and concludes that non-ASCII characters are unprintable.
Changed print syntax for lazy strings.
(obj_pprint): Changed print syntax for lazy strings.
* parser.l: Bugfix in hex/octal character constant.
num_esc(yytext) was called rather than num_esc(yytext+1).
* parser.y (chrlit): Bugfix: missing case for hex and octal
constants which are given by a LITCHAR token.
* stream.c (vformat): Bugfix: strings were being printed as if using ~a
even under ~s.
|
|
|
|
| |
* match.c (h_coll): Call consume_prefix in the loop.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
in debug reporting.
* debug.c (debug): New argument, base.
* debug.h (debug_check): New argument, base.
(debug): Declaration updated.
* eval.c (do_eval): Pass new argument of debug_check as nil.
* match.c (LOG_MISMATCH, LOG_MATCH): Take into account base
when displaying character position.
(do_match_line): Pass base position to debug_check.
(match_files): Pass nil as base to debug_check.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
a large file horizontally under @(freeform) in constant memory.
Position reporting is incorrect.
* match.c (match_line_ctx): New member, base.
(ml_all): Initialize new member to zero.
(consume_prefix): New static function.
(do_match_line): New static function, contains implementation of
match_line. Calls consume_prefix.
(match_line): Becomes a wrapper for do_match_line.
(search_form, h_skip): Call consume_prefix.
(freeform_prepare): New function. External to avoid inlining.
(v_freeform): Uses do_match_line, to down context by reference,
and also refactored to avoid spurious retention of c->data.
* unwind.c (uw_push-block, uw_push_env, uw_push_debug,
uw_push_catch): Zero out the structure, otherwise the unused
fields can cause spurious retention.
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (h_match_func): Changed to one-argument form.
(LOG_MISMATCH, LOG_MATCH): References to structure members
changed from member selection . to ->.
(h_text, h_var, h_skip, h_coll, h_parallel, h_trailer,
h_fun, hv_trampoline, h_define, h_do): Changed to one-argument form
that takes a pointer to the context.
(match_line): Local pointer named c used so that the
LOG_MISMATCH and LOG_MATCH macros can be used.
|
|
|
|
|
|
|
| |
(sub_str): Bugfix: handle t values of from from and to, and negative
indices, just like sub_vec. Special handling for lazy strings
introduced. If to is the value t, then the a lazy string can be
produced.
|
|
|
|
|
|
| |
* txr.vim: Fixed mistakes in a few regex character classes,
causing upper case letters not to be recognized as part
of a variable name, and character hex constant.
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version and set date.
* configure (txr_ver): Bumped.
* RELNOTES: Updated.
|
|
|
|
|
|
|
|
|
| |
escapes in a regex. Removed o escape character from octal
constants in strings and quasiliterals: no such thing is documented.
Octal constants can be semicolon-terminated like hex ones.
* txr.1: Documented semicolons after octal constants in
string literals and after hex and octal constants in regexes.
|
|
|
|
|
|
|
| |
to a switch on the upper nybble value. This also fixes an unfortunate
bug. The test for the two byte case was written as
ch >= 0xc2 && ch <= 0xE0. That should have been ch < 0xE0.
Versions of TXR up to 55 have been incorrectly decoding some UTF-8.
|
|
|
|
|
|
|
| |
range check (less than minimum *and* U+DCxx, rather than *or*).
Also, we must check for out of range characters. UTF-8 sequences
beginning with F4 can code beyond 0x10FFFF.
(utf8_decode): Check for characters beyond 0x10FFFF.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(do_eval_args): Allow calls specified by improper lists
like (x y . z) where the z expression must evaluate to a list
that turns into addition arguments to be applied.
(transform_op, expand_op): New static functions.
(expand): Call expand_op.
(eval_init): Initialize rest_s and op_s. Use rest_s
to register rest function.
* lib.c (gensym): New function based on gensymv.
(gensymv): Now calls gensym.
* lib.h (gensym): Declared.
* parser.l: Parse @ followed by digits as a new kind of token,
METANUM.
* parser.y (METANUM): New token.
(meta_expr, exprs): Missing rlcp's added.
(expr): METANUM variant introduced.
(yybadtoken): Handle METANUM.
* txr.1: Documented one-symbol argument list of lambda.
Documented op. Closed some unbalanced parentheses.
* txr.vim: Highlight op.
|
|
|
|
|
|
|
| |
If bytes decode to U+DCxx, treat this sequence as invalid. This
way we can't be fooled by an attacker into accepting some U+DCxx which
on output we will then convert to byte xx.
(utf8_to_uc): Use upper case for hex constants.
|
|
|
|
|
|
|
| |
points (U+DC00 to U+DCFF) as multi-byte UTF8 sequences. We use
that range for invalid bytes on input, so on output the best thing
to do is to reproduce the original bytes. E.g the code U+DCA0
will produce the byte A0.
|
| |
|
|
|
|
|
|
|
| |
decoded character based on which UTF-8 case it is from. This rejects
overlong forms.
* utf8.h (struct utf8_decoder): New member, wch_min.
|