| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
* parser.y (json_val): Handle json_vals being a list,
indicating quasiquoting. We must nreverse it and turn it into
a sys:vector-lit form.
* y.tab.c.shipped: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Because #J<json> produces the (json ...) form that translates
into quote, ^#J<json> yields a quasiquote around a quote. This
has some disadvantages, because it requires an explicit eval
in some situtions to do what the programmer wants.
Here, we introduce an alternative: the syntax #J^<json> will
produce a quasiquote instead of a quote.
The new translation scheme is
#J X -> (json quote <X>)
#J^ X -> (json sys:qquote <X>)
where <X> denotes the Lisp object translation of JSON syntax X.
* parser.c (me_json): The quote symbol is now already in the
json form, so all that is left to do here is to take the cdr
to pop off the json symbol.
* parser.l (JPUNC, NJPUNC): Allow ^ to be a punctuator in
JSON mode.
* parser.y (json): For regular #J, generate the new (json
quote ...) syntax. Implement J# ^ which sets up the nonzero
quasi_level around the processing of the JSON syntax, so that
everything is in a quasiquote, finally producing the
(json sys:qquote ...) syntax.
* lex.yy.c.shipped, y.tab.c.shipped: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.h (end_of_json_unquote): Declared.
* parser.l (JPUNC, NJPUNC): Add ~ and * characters to set of
JSON punctuators.
(grammar): Allow closing brace character in NESTED, SPECIAL
and QSPECIAL statues to be a token. This is because it occurs
as a lookahead character in this situation #J{"foo":~expr}.
The lexer switches from the JSON to the NESTED start state
when it scans the ~ token, so that expr is treated as Lisp.
But then } is consumed as a lookahead token by the parser in
that same mode; when we pop back to JSON mode, the } token has
already been scanned in NESTED mode.
We add two new rules in JSON mode to the lexer to recognize
the ~ unquote and ~* splicing unquote. Both have to push the
NESTED start condition.
(end_of_json_unquote): New function.
* parser.y (JSPLICE): New token.
(json_val): Logic for unquoting. The array and hash rules must
now be prepared to deal with json_vals and json_pairs now
producing a list object instead of a hash or vector. That is
the signal that the data contains active quasiquotes and must
be translated to the special literal syntax for quasiquoted
vectors and hashes. Here we also add the rules for ~ and ~*
unquoting syntax, including managing the lexer's transition
back to the JSON start condition.
(json_vals, json_pairs): We add the logic here to recognize
unquotes in quasiquoting state. This is more clever than the
way it is done in the Lisp areas of the grammar. If no
quasiquotes occur, we construct a vector or hash,
respectively, and add to it. If unquotes occur and if we
are nested in a quasiquote, we switch the object to a list,
and continue it that way.
(yybadtoken): Handle JSPLICE.
* lex.yy.c.shipped, y.tab.c.shipped, y.tab.h.shipped: Updated.
|
|
|
|
|
|
|
|
|
|
| |
* parser.l (HASH_N_EQUALS, HASH_N_HASH): Recognize these
tokens in the JSON start state also.
* parser.y (json_val): Add the circular syntax, exactly like
it is done for n_expr and i_expr. And it works!
* lex.yy.c.shipped, y.tab.c.shipped, y.tab.h.shipped: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(needs buffer literal error message cleanup)
* parser.c (json_s): New symbol variable.
(is_balanced_line): Follow braces out of initial state.
This concession allows the listener to accept input
like #J{"a":"b"}.
(me_json): New static function (macro expander). The #J X
syntax produces a (json Y) form, with the JSON syntax X
translated to a Lisp object Y. If that is evaluated,
this macro translates it to (quote Y).
(parse_init): initialize json_s variable with interned symbol,
and register the json macro.
* parser.h (json_s): Declared.
(end_of_json): Declared.
* parser.l (num_esc): Treat u escape sequences in the same way
as x. This function can then be used for handling the \u
escapes in JSON string literals.
(DIG19, JNUM, JPUNC, NJPUNC): New lex named patterns.
(JSON, JLIT): New lex start conditions.
(grammar): Recognize #J syntax, mapping to HASH_J token,
which transitions into JSON start state.
In JSON start state, handle all the elements: numbers,
keywords, arrays and objects. Transition into JLIT state.
In JLIT start state, handle all the elements of JSON string
literals, including surrogate pair escapes.
JSON literals share the fallback {UANY} fallback patter with
other literals.
(end_of_jason): New function.
* parser.y (HASH_J, JSKW): New token symbols.
(json, json_val, json_vals, json_pairs): New nonterminal
symbols, and rules.
(i_expr, n_expr): Generate json nonterminal, to hook the
stuff into the grammar.
(yybadtoken): Handle JKSW and HASH_J tokens.
* lex.yy.c.shipped, y.tab.c.shipped, y.tab.h.shipped:
Updated.
|
|
|
|
|
|
|
| |
* parser.l (BUFLIT): When reporting a bad characters, do not
show it in the form of an escape sequence.
* lex.yy.c.shipped: Updated.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Bumped.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/common.tl (vtest): Only if the expected expression
is :error or (quote :error) do we wrap the expansion and
evaluation of the test expression with exception handling,
because only then do we expect an error. When the test
expression is anything else, we don't intercept any errors,
and so problems in test cases are easier to debug now.
* tests/012/struct.tl: In one case we must initialize
the *gensym-counter* to 4 to compensate for the change
in vtest to get the same gensym numbers in the output.
|
|
|
|
|
|
|
|
|
| |
* parser.c (find_matching_syms): Apply DeMorgan's on the
symbol binding tests, to use sum of positive tests instead of
product of negations. Check for struct and ffi type bindings
in the default case. The default and '[' cases are
rearranged so that the '[' case omits these, so as not to
complete on a struct or FFI typedef after a [.
|
|
|
|
|
|
|
| |
* tests/012/seq.tl: New tests.
* txr.1: Improve documentation of window-map's :wrap
and :reflect. Add examples.
|
|
|
|
|
|
|
| |
* txr.1: Fix heading repeating identity instead of listing
idenitty and identity*.
* share/txr/stdlib/doc-syms.tl: Regenerated.
|
|
|
|
|
|
| |
* txr.1: Fix numerous instances of text which uses the wording
that arguments are applied to a function. A few of the changes
repair wording that was entirely botched.
|
|
|
|
| |
* txr.1: Improve wording, eliminate superfluous comma.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (window_map_list): Rewrite :wrap and :reflect support.
The main issue with these is that they only sample items from
the front of the input list and generate both flanks of the
boundary from that prefix; :reflect is additionaly buggy due
to applying nreverse to a sub which can return the original
sequence.
* tests/012/seq.tl: Some test coverage for window-map.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The @(hash ...) operator now allows key-only patterns
like (42) or (@x), where x could be bound or unbound.
This has separate semantics from when a value is present.
* share/txr/stdlib/match.tl (compile-hash-match): Implement.
* tests/011/patmatch.tl: Test.
* txr.1: Document.
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (compile-hash-match): Fix
unquoting comma that had been strangely moved to the previous
line.
|
|
|
|
|
|
|
|
|
|
| |
* parser.y (parse): When issuing the diagostic indicating the
likely starting line of the unterminated expression, instead
of mentioning that line in the diagnostic text, let's just
issue the diagnostic against that line. The programmer's
text editor can then jump to that line.
* y.tab.c.shipped: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Because with-compilation-unit is keyed of *load-recursive*,
when compilation is happening in the context of a load (a
top-level form in a loaded file calls compile-file or
compile-update file) warnings are deferred until the end of
the load. That might never occur if the load doesn't complete,
because, say, the image quits for some reason.
If the following is the content of a file which is loaded:
(compile-file "foo")
(exit 0)
then warnings during the compilation are not issued when
compile-file terminates, and will never be issued because of
the termination due to the exit call.
* share/txr/stdlib/compiler.tl (*in-compilation-unit*): New
special variable.
(with-compilation-unit): Use *in-compilation-unit* to
determinw when a compilation unit has ended, and dump all the
deferred warnings then. We will bind *load-recursive* because
that is required for deferring warnings.
|
|
|
|
|
|
| |
* ffi.c (make_ffi_type_pointer): Set the by_value_in flag only if the in
function has been specified. Otherwise tft->in is a null pointer and
will be used if this pointer type appears as an argument.
|
|
|
|
|
|
|
| |
* eval.c (me_case): When we evaluate the keys of a caseq,
caseql* or casequal* construct, we must use expand_eval.
I ran into this problem trying to use constants defined
as symbol macros as keys.
|
|
|
|
|
|
| |
* txr.1: Round out the documentation with various missing
details, or details that benefit repeating in more than one
place int the document.
|
|
|
|
|
|
|
| |
* txr.1: The arguments after the script-file are not necessary
data files; they can have any meaning.
* txr.c (help): Also adjust the help text.
|
|
|
|
|
| |
* txr.c (help): Refer to "script-file" rather than
"query-file", just like the documentation.
|
|
|
|
| |
* share/txr/stdlib/quips.tl (%quips%): Entries added.
|
|
|
|
|
|
|
|
|
| |
* mpi/mpi.c (s_mp_in_big_range): If the value is negative,
extend the range. This is exactly the same fix as what was
applied to mp_in_range in 2019 in commit
11b5c567124a61d8e8249a0fbcce47f2688573c6. This function should
have been fixed at the same time. The corresponding
test cases now pass.
|
|
|
|
|
|
| |
* tests/016/arith.tl: Test providing coverage for the most
negative two's complement integer, #x-800...00 in various
sizes. The 64 bit cases are failing.
|
|
|
|
|
|
|
|
|
|
| |
* mpi/mpi.c (mp_get_uintptr, mp_get_double_uintptr): Fix loops
which shift and mask the bignum digits together in the wrong
way. The post-iteration shift is also wrong. We are fine in
mp_get_uintptr because the affected code is in an #if that
doesn't actually occur: bignum digits are pointer-sized.
mp_get_double_uintptr affects the conversion of bignums to
64 bits on 32 bit platforms.
|
|
|
|
|
|
|
|
|
|
|
| |
* mpi/mpi.c (mp_in_range, s_mp_in_big_range): The ptrnd
calculation here is wrong; it adds together dissimilar units:
bits and bytes. In the case of mp_in_range, we are okay by
fluke, because the calculation works out to 1 anyway. We would
not be okay of a mp_digit was half the size of a pointer.
In s_mp_in_big_range we have a problem. On 32 bit platforms,
ptrnd is wrongly calculated as 1 rather than 2, and so values
perfectly in range are rejected.
|
|
|
|
|
|
| |
* tests/016/arith.tl: Add tests covering the fixnum/bignum
knee, and ffi operations of various sizes that provide
coverage of various conversion routines.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch prevents Tab-completing on interned symbols that
have no binding.
The current behavior is, for instance:
1> 'hamsandwich
hamsandwich
2> 'ham[Tab]
2> 'hamsandwich ;; completes
The new behavior will not complete hamsandwich, because it has
no binding as a function or variable.
* parser.c (find_matching_syms): Treat the default case the
same as after '[': a function or variable binding is required,
or the symbol is not listed. Use fboundp instead of
lookup_fun. They are the same, except in TXR 127 compat mode,
which includes macros under fboundp.
|
|
|
|
|
|
| |
* txr.1: For eval and for compilation, document that
symacrolet and macrolet do not enclose multiple top-level
forms.
|
|
|
|
|
| |
* txr.1: Because we are not in indented paragraphs, we don't
need the opening .RS.
|
|
|
|
|
| |
* txr.1: Hyphenation, punctuation, spelling and formatting
throughout document.
|
|
|
|
|
|
|
|
|
| |
* txr.1: The precedence among the repeat clauses is documented
incorrectly: the @(mod) clause has a lower precedence than
modlast and last. Redocumenting this area for better clarity,
and mentioning why @(empty) isn't in the precedence list.
This issue was reported by Paul A. Patience with a patch,
which I reworked.
|
|
|
|
|
|
| |
* 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.
|