| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
* txr.1: Use let-like small indentation for the clauses of
defplace. Formatting adjusted slightly by K. K.
Remove spurious defmacro element in deffi syntax.
|
|
|
|
|
|
|
| |
* txr.1: The documentation of the semantics of sme contradicts
itself by neglecting to specify that the middle part of the
input is searched for match for the middle pattern mpat.
Let's fix this by giving detailed semantics in bulleted form.
|
|
|
|
|
| |
* lib.c (sys_rplacd): Change parameter name from new_car to
new_cdr, for obvious reasons.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (rt_defvarl): More accurate self string.
(rt_defv): New static function: like rt_defvarl but ensures
that the new variable has a binding cell, and returns that
cell instead of the hash cell.
(op_defvarl): Take advantage of rt_defv to not have to cons up
the binding cell.
(eval_init): Register sys:rt-defv intrinsic.
* parser.c (read_file_common): Compiled files are now version
7, so we must recognize them. We still load version 6 files
because rt:defvarl still exists for them.
* share/txr/stdlib/compiler.tl (expand-defvarl): Improve the
generated code in two ways. Firstly, use the new sys:rt-defv,
which returns the binding cell, so that the value can be
stored into it with rplacd without having to cons up anything.
Secondly, if there is no value expression, don't emit the
code to do the assignment.
(%tlo-ver%): Bump compiled file version to (7 0).
* txr.1: Add note about TXR 260 loading version 7 and 6.
|
|
|
|
|
|
|
|
|
|
|
| |
* genman.txr: generate doc-syms as a sorted list fed to
hash-from-pairs. Now the symbols won't jump around so much
whenever we update it. Also, the names must be HTML-decoded.
For instance "str<" was being stored as "str<" causing
(doc 'str<) to fail. We use TXR @(output) to adjust the
formatting as if it were maintained by hand.
* share/txr/stdlib/doc-syms.tl: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Bumped.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
| |
* lib.c (cat_str, vscat, scat3, join_with): Pass onech
rather than wref(onech) to cat_str_init. Reason being,
cat_str_init calls wref(onech).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is fairly obscure. A repro test case is a file which
contains:
3"foo"
When the 3 is parsed, the " is also scanned as a lookahead
token, and when that happens, the lexer shifts into the
STRLIT state. At that point the parse job finishes for
that top-level form.
The next time the parser is called, it will prime the token
stream by pushing the " token into it. But, the lex state is
not put into the STRLIT. State. The result is that the parser
obtains the " token, and then foo is lexically analyzed in the
wrong state as a symbol. A syntax error occurs: symbol token
in the middle of a string literal, instead of just a sequence
of LITCHAR tokens, as expected.
What we can do is associate a lex state with pushback tokens.
If a pushback token has a nonzero lex state which is different
from the current YYSTATE, then when that pushback token is
consumed, we push that state also.
* parser.h (struct yy_token): New member, yy_lex_state.
* parser.c (parser_common_init): Initialize the new
yy_lex_state member of every token member of the parser
structure.
* parser.l (yylex): When feeding a pushed token to the parser,
if that token has a nonzero state, and the state is different
from YYSTATE, we push that state. So for instance a pushed
back " token will carry the STRLIT state, which is different
from the NESTED state that will be in effect at the start of
the parse job, and so it will be pushed, as if the " character
had been scanned. Also, when we call the real yylex_impl,
when we are storing the recenty seen token in recent_tok, we
also store the current YYSTATE along with it. That's how
tokens get associated with a state. The artificial tokens that
are used for priming parsing like SECRET_ESCAPE_E are never
associated with a nonzero state.
* tests/012/syntax.tl: Some test cases that didn't pass
before this.
* lex.yy.c.shipped: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
Problem is, there is no way to assert that txr_ign_tok
should be colored as a comment, overriding the non-transparent
item that it contains.
* genvim.txr (txr_list, txr_bracket, txr_mlist): Add new
contained item, txr_ign_tok.
(txr_ign_tok): New region.
|
|
|
|
|
| |
* txr.1: The example deployment structure shows only .tl
files. Add a .tlo in there.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_iter_init_with_info): Recognize tree_iter object,
and treat using tree iterator function.
* tests/010/tree.tl: test case for tree subrange iteration
with collect-each.
* txr.1: Updated.
|
|
|
|
| |
* txr.1: Fix typos: tree-value-at should be trie-value-at.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Getting rid of tree-begin-at and tree-reset-at. Now tree-begin
takes two optional parameters, for specifying high and low
range.
* tree.c (struct tree_diter): New members, tree and highkey.
We need tree due to requiring access to the less function.
If the iterator has no highkey, the iterator itself is stored
in that member to indicate this.
(tree_iter_mark): Mark the tree and highkey.
(tree_begin): Take optional lowkey and highkey arguments,
initializing iterator acordingly.
(tree_begin_at): Function removed.
(copy_tree_iter, replace_tree_iter): Copy tree and highkey
members. The latter require special handling due to the funny
convention for indicating highkey absence.
(tree_reset): Take optional lowkey and highkey arguments,
configuring these in the iterator being reset.
(tree_reset_at): Function removed.
(tree_next, tree_peek): Implement highkey semantics.
(sub_tree): Simplified: from and to
arguments are just passed through to tree_begin, and there is
no need for a separate loop which enforces the upper limit,
that now being handled by the iterator itself.
(tree_begin): Update registrations of tree-begin and
tree-reset; remove tree-begin-at and tree-reset-at intrinsics.
* tree.h (tree_begin_at, tree_reset_at): Declarations removed.
(tree_begin, tree_reset): Declarations updated.
* lib.c (seq_iter_rewind, seq_iter_init_with_info, where,
populate_obj_hash): Default new optional arguments in
tree_begin and tree_reset calls.
* parser.c (circ_backpatch): Likewise.
* tests/010/tree.tl: Affected cases updated.
* txr.1: Documentation updated.
* share/txr/stdlib/doc-syms.tl: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (do_generic_funcall): Support tree object invocation
with one or two arguments via sub and ref.
(sub): Implement for trees via sub_tree.
(ref): Implement for trees via tree_lookup.
* tree.c (sub_tree): New function.
(tree_init): Register sub-tree intrinsic.
* tree.h (sub_tree): Declared.
* tests/010/tree.tl: New tests.
* txr.1: Documented: DWIM bracket syntax on trees, sub and ref
support for trees, sub-tree function,
* share/txr/stdlib/doc-syms.tl: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (replace_tree_iter): New function.
(tree_init): Register replace-tree-iter intrinsic.
* tree.h (tree_init): Declared.
* share/txr/stdlib/doc-syms.tl: Updated.
* txr.1: Documented.
* tests/010/tree.tl: New test case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (copy): Handle tree_iter_s via copy_tree_iter.
* tree.c (copy_tree_iter): New function.
(tree_init): copy-tree-iter intrinsic registered.
* tree.h (copy_tree_iter): Declared.
* tests/010/tree.tl: New test case.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_iter_rewind): Use hash_reset and tree_reset
to rewind the existing iterator rather than allocating a new
one.
* tests/010/hash.tl: New file, covering uni, diff and isec for
hash tables.
* tests/010/tree.tl: New tests.
|
|
|
|
|
| |
* txr.1: Move compatibility notes 258, 257 and 231 to the
correct position, so the numbers are descending.
|
|
|
|
|
| |
* lib.c (seq_getpos): Remove spurious semicolon which adds an
unreachable null statement.
|
|
|
|
|
| |
* arith.c (poly, rpoly): fix: the poly function wrongly refers
to itself as rpoly and vice versa in diagnostics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As of this commit, binary search trees can be iterated:
mapped over with mapcar and such.
* arith.c (poly, rpoly): rpoly won't work with trees. They
work just with vectors and lists so let's make the error
message more accurate. I noticed the self names of these two
are swapped; will fix in another commit.
* eval.c (tprint): Refactor to use iterator framework for
objects other than lists. The tree case falls into this,
so trees are supported.
* lib.h (enum seq_kind): New enum constant SEQ_TREELIKE.
(seq_iter_init_with_info): Declared.
* lib.c (seq_info): Map tree object to SEQ_TREELIKE type.
(seq_iter_get_tree, seq_iter_peek_tree): New static functions.
(seq_iter_rewind): Support rewinding tree iteration.
I think we could reuse the existing iterator here, and in the
hash case as well. I made a note to look into this.
(seq_iter_init_with_info): Internal linkage changed to
external, because tprint in eval.c uses this.
Handle SEQ_TREELIKE case here, by setting up iterator with the
two new static functions.
(seq_iter_mark): Handle SEQ_TREELIKE_CASE. Change switch
statement to exhaustively list cases.
(ldiff): Add SEQ_TREELIKE to various cases. Idea is that we
handle it like SEQ_HASH.
(nsort, sort, nshuffle, take, take_while, take_until,
drop_while, drop_until, update): Add case for SEQ_TREELIKE,
routing to error message.
(lazy_where_tree_func): New static function.
(where, sel, reject): Support trees.
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tree_insert, tree_lookup_node, tree_delete_node,
tree_delete):
Switch internal linkage to external linkage.
* tree.h (tree_insert, tree_lookup_node, tree_delete_node,
tree_delete):
Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tn_peek_next): New static function.
(tree_peek): New function.
(tree_init): Register tree-peek intrinsic.
* tree.h (tree_peek): Declared.
* txr.1: Documented.
* tests/010/tree.c: Work tree-peek into existing test case.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (make_similar_tree): New function.
(tree_init): Register make-similar-tree intrinsic
* tree.h (make_similar_tree): Declared.
* tests/010/tree.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is motivated by the recent crash regression in the #;
comment out mechanism. The parser doesn't have adequate
coverage in the test suite.
* tests/012/syntax.tl: New file, for testing syntax.
A problem was found #;.expr did not work inside a list,
only at top level. It required a space before the dot.
* parser.y (listacc): A couple of productions to handle
hash-semicolon immediately followed by a dot without
any whitespace, and then by an expression.
* y.tab.c.shipped: Regenerated.
|
|
|
|
|
|
| |
* configure: Allow the conveninence of additional parameters
to be passed through reconfigure, to tweak the previous
configuration.
|
|
|
|
|
|
| |
* configure: before generating reconfigure, remove it.
Otherwise, if are executing the reconfigure script, errors
can appear in it if its length is extended.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (match_set_entries): New autoload symbols:
each-match, append-matches, keep-matches, each-match-product,
append-match-products, keep-match-products.
* share/txr/stdlib/doc-syms.tl: Updated.
* share/txr/stdlib/match.tl (each-match-expander): New
function.
(each-match, append-matches, keep-matches, each-match-product,
append-match-products, keep-match-products): New macros.
* tests/011/patmatch.tl: New tests covering each macro,
far from exhaustively.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
A crash has showed up when processing commented-out objects.
This is due to the most recent gc fix to the parser.
* parser.y (set_syntax_tree): Avoid the set macro when tree
has the special value nao (not an object).
* y.tab.c.shipped: Regenerated.
* y.tab.h.shipped: Likewise.
|
|
|
|
|
| |
* stream.c (formatv): Replace hard-coded "format:" with ~a and
self argument. Several error messages are revised.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (buf_hex): New function.
* buf.h (buf_hex): Declared.
* stream.c (formatv): Support printing of buffers in hex
via temporary buffer containing hex characters, similarly
to how bignums are handled.
* tests/018/format.tl: New file, providing some coverage over
new and affected code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's incorrect to use a borrowed buf, because a borrowed buf
assumes that the memory isn't dynamically allocated, and will
not free it when it is finalized by the garbage collector.
The buffer which holds the hash returned by sha256 and md5
does in fact own the memory.
* buf.c (make_owned_buf): Static function becomes external.
* buf.h (make_owned_buf): Declared.
* chksum.c (chksum_ensure_buf): Use make_owned_buf rather than
make_borrowed_buf.
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (int_buf, uint_buf): Refer to the buffer length b->len
rather than the underlying allocation size b->size.
Referring to b->size will not only produce the wrong value
when it is larger than len, but b->size can be null for a
borrowed buffer, producing a crash.
* tests/012/buf.tl: Tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a lexical function defined with flet or labels is
called with the wrong arguments, this is not being diagnosed
if that function is being lifted to load-time. This is because
the sys:load-time-lit that the lambda is wrapped with is not
propagating the pars attribute of the frag structure from
the lambda to its own returned frag.
* share/txr/stdlib/compiler.tl (compiler comp-load-time-lit):
After compiling the expression to obtain the exp frag, stuff
exp.pars to both the lt-frag that is generated, as well as to
the returned dummy frag carrying the dreg access that
retrieves the function. It's important for this returned frag
to carry the info, because from there it is propagated to the
function binding by comp-fbind by the (set bind.pars frag.pars)
expression.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/copy-file.tl: When removing .. components,
a dotdot must only cancel preceding non-dotdot. We must check
not only that the out stack is not empty but that the top
element isn't dotdot. Also, eliminate empty components, like
the documentation says. Lastly, we must check for the impossible
cases, when the from path uses .. components that are
impossible to navigate backwards to form a relative path.
* tests/018/rel-path.tl: Test cases added.
* txr.1: Updated with additional descriptions, fixes and
examples.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (copy_file_set_entries): Add rel-path as autoload
trigger for copy-file module.
* share/txr/stdlib/copy-file.tl (rel-path): New function.
* tests/018/rel-path.tl: New file.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/doc-syms.tl: Updated.
* stream.c (portable_abs_path_p): New function, exact copy of
old abs_path_p.
(abs_path_p): Rewritten to be specific to host platform. No
Windows-drive-like prefixes are checked on POSIX.
(stream_init): Register new function. Register abs-path-p
conditionally based on 258 compatibility.
* stream.h (portable_abs_path_p): Declared.
* txr.1: Documented, with compat notes.
|
|
|
|
|
|
|
| |
* lib.c (join_with): Pass the correct onech array down to
cat_str_init, rather than a null pointer.
* tests/015/split.tl: New tests covering join and join-with.
|
|
|
|
|
| |
* txr.1: Fix typo in recently introduced paragraph about file
compiler's treatment of symbols.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Bumped.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* parser.y (set_syntax_tree): New static function. Uses
GC-correct assignment via set macro.
(spec): Call set_syntax_tree instead of raw assignments to
parser->syntax_tree, which violate GC rules.
* y.tab.c.shipped: Regenerated.
|
|
|
|
|
| |
* configure: In maintainer mode, we specify C90. Some versions
of clang don't like -std=c90, but only the -ansi option.
|
|
|
|
|
|
| |
* txr.1: A new paragraph about how symbols are treated:
source files can refer to unqualified symbols, but compiled
files do not.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (tree_reset, tree_reset_at): New functions.
(tree_init): tree-reset and tree-reset-at intrinsics
registered.
* tree.h (tree_reset, tree_reset_at): Declared.
* tests/010/tree.tl: New tests.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
| |
* tree.c (struct tree_diter): Remove the tr member; it is not
used anywhere.
(tree_begin, tree_begin_at): Remove initialization of tdi->tr.
|
|
|
|
|
|
|
|
|
|
| |
The txr_bracevar region is not appropriate for quasiliterals,
because it contains txr_regex.
* genvim.txr (tl_bracevar): New syn region, based on copying
txr_bracevar and changing it so it contains tl_regex and not
txr_regex.
(txr_quasilit): Contain tl_bracevar rather than txr_bracevar.
|
|
|
|
|
|
| |
* genvim.txr (txr_error, txr_list, txr_ign_par, txr_ign_bkt):
Add T and N to the pattern that recognises #H, #S and #R,
so that tree and node literals are handled.
|
|
|
|
|
| |
* tests/010/tree.tl: Use rlist to express discontinuous range
instead of appending ranges.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (lazy_mapcar_func): We must capture the return value
of iter_step, since we refer to it in the next statement,
expecting it to have stepped. This bug causes a behavior as if
the original list had an extra nil.
* tests/012/lazy.tl: Tests. Poor test coverage is why this
sort of thing comes up and bites us.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tree.c (enum tree_iter_state): New iterator state
tr_find_low_prepared dedicated to the tree-begin-at traversal.
This state indicates that tree-next should visit the starting
node that it is given, and then after that, treat anything to
the left of it as having been visited. In the other states,
tree-next does not visit the node it is given but uses it as
the starting point to find the next node.
(tn_find_next): Bugfix here: when navigating the right link,
the function neglected to add the node to the path. But the
logic for backtracking up the path expects this: it checks
whether the node from the path is the parent of a right child.
Somehow this didn't cause a problem for full traversals with
tree-begin; at least the existing test cases don't expose an
issue. It caused a problem for tree-begin-at, though.
(tn_find_low): New static function. This finds the low-key
node in the tree, priming the iterator object with the correct
state and path content to continue the traversal from that
node on . We need the tr_find_low_prepared state in the
iterator in order to visit the low node itself that was found.
(tree_begin_at): New function.
(tree_init): Register tree-begin-at intrinsic.
* tree.h (tree_begin_at): Declared.
* tests/010/tree.tl: New test cases for tree-begin-at.
* txr.1: Documented.
* share/txr/stdlib/doc-syms.tl: Updated.
|