| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
* parser.y (o_var): fix expand wrongly being called on
a list of forms.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this change, Lisp expansion-time warnings are no longer
suppressed during the parsing of the TXR pattern language.
Embedded Lisp expressions can refer to TXR pattern variables,
which generates spurious warnings that must be suppressed.
Since TXR pattern variables are dynamically introduced in a
very flexible way, it's hard to do an exact job of this. We
take the crude approach that warnings are suppressed for all
pattern variables that appear anywhere in the TXR code. To do
that, we identify, at parse time, all directives which can
bind new variables, and register those variables as if they
were tentative global defs, purging all pending warnings for
them.
* match.c (binding_directive_table): New static hash table.
(match_reg_var, match_reg_params, match_reg_elem): New
functions.
(match_reg_var_rec): New static function.
(dir_tables_init): gc-protect binding_directive_table,
and populate its entries.
* match.h (into_k, named_k): Declared.
(match_reg_var, match_reg_params, match_reg_elem): Declared.
* parser.y (process_catch_exprs): New static function.
(elem): Call match_reg_elem for each basic directive,
to process the variables in that directive according to
its operator symbol. Do this for each compound form elem
and variable elem. Te horizontal @(define) eleme has
its own grammar production here, and we handle its
parameter list in that rule.
(define_clause): Handle the parameters of a vertical
@(define). It binds pattern variables, and so we must
suppress unbound warnings for those.
(catch_clauses_opt): Process the parameters bound by
@(catch) clauses.
(output_clause): Suppress warnings for the variables
nominated by any :into or :named argument.
(expand_repeat_rep_args): Suppress warnings for :counter
variable, and for :vars variables.
(parse_once): Remove the warning-muffling handler
frame set up around the yyparse call.
* txr.c (txr_main): Suppress warnings for TXR variables
defined using -D syntax on the command line. Dump
deferred warnings after parsing a .txr file.
|
|
|
|
|
|
|
| |
* parser.y (expand_repeat_rep_args): Correctly handle
situation when :counter or :vars appears as an argument
to another keyword. (A warning might be generated here,
since this situation is wrong.)
|
|
|
|
|
|
|
|
|
| |
* tests/008/filtenv.txr (f): Don't just copy the input
to the output but transform it by upcase-str. Otherwise
the test will pass even if the :filter syntax is not
processed at all!
* tests/08/filtenv.expected: Updated.
|
|
|
|
|
| |
* txr.c (txr_main): Reduce three repetitions of the
same call to intern to one call.
|
|
|
|
| |
* txr.1: "when they empty" -> "when they are empty".
|
|
|
|
|
| |
txr.1: the @(next) directive has a :var argument which was
added in 2011 but never documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the last round of changes on this topic, bringing
proper macro expansion to the arguments to @(skip),
@(fuzz), @(next), @(call), @(cat), @(load) and @(close).
* match.c (match_expand_keyword_args): Only process the
keyword arguments if they are followed by an argument.
Process @(next) arguments here too: :list and :string
take a Lisp expression, but :tlist and :var take an
argument which is not a Lisp expression and must be
handled properly. Also, expand any non-keyword expression.
This handles the <source> argument of @(next).
(match_expand_elem): New function.
* match.h (match_expand_elem): Declared.
* parser.h (expand_meta): Declared.
* parser.y (expand_meta): Static function becomes external.
(elem): Expand elem other than require or do using
match_expand_elem. We don't fold require and do into this
because match_expand_elem has a backward compat switch
in it that doesn't apply to these.
|
|
|
|
|
| |
* parser.y (expand_form_ver): New inline function.
(output_clause): If exprs are present, expand first one.
|
|
|
|
|
|
|
|
|
|
| |
* match.c (sem_error): Add noreturn attribute to function.
(tx_lookup_var_ubc): New static function.
(dest_set, v_next, v_flatten, v_cat, v_filter): Use new
function to for checked variable lookup.
(v_set): Pass first_spec to dest_set, since tx_lookup_var_ubc
needs to extract the directive symbol from the context
from.
|
|
|
|
|
|
| |
* parser.y (expand_forms_ver): New function.
(repeat_parts_opt, rep_parts_opt): Expand the exprs_opt that
follow MOD or MODLAST.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the argument lists of @(collect)/@(repeat), @(coll)/@(rep)
and @(gather), Lisp expressions can appear as arguments
to keywords or for supplying default values for variables.
These are not being macro-expanded.
* match.c (match_expand_vars): New static function.
(match_expand_keyword_args): New function.
* match.h (match_expand_keyword_args): Declared.
* parser.y (gather_clause, collect_clause, elem): Use new
function in match.c to expand the argument lists.
|
|
|
|
| |
* tests/012/quasi.tl: New tests added.
|
|
|
|
|
| |
* eval.c (me_op): Install handler to intercept warnings
and route them to uw_muffle_warning.
|
|
|
|
|
|
| |
* eval.c (expand_quasi): Add all-important missing
case which expands compound forms. This looks
like a txr-160 regression.
|
|
|
|
|
|
|
|
| |
* txr.1: New section Static Error Diagnosis describing error
handling and warnings. Documented functions
tentative-def-exists, register-tentative-def,
purge-deferred-warning, compile-defr-warning, compile-error
and compile-warning
|
|
|
|
|
|
| |
* struct.c (make_struct_type): Fix test of incorrect variable
which renders the supertype test useless, causing the type
to be created with no supertype.
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (defstruct): Making
nonexistent base type a deferrable warning.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (sys:bad-slot-syntax): Takes form
argument. Uses compile-error function.
(defstruct): Use modified form of sys:bad-slot-syntax
and compile-error instead of throw.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (sys:defmeth): Removing checks
from here.
(defmeth): Add checks here with new functions which provide
location info and warning deferral/supression.
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (defstruct): Register the struct
ame as a tentative definition.
|
|
|
|
|
|
| |
* eval.c (do_expand): When walking a defun or defvarl,
register them as tentative defs. Thus warnings are nicely
supressed in code like (progn (defun foo ()) (foo)).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tentative defs record the fact that some definition has been
seen at expansion time, even though that definition has not
been put into effect. They suppress warnings.
* unwind.c (tentative_defs): New static variable.
(uw_defer_warning): Throw away the warning if
it matches a tentative def.
(uw_register_tentative_def, uw_tentative_def_exists): New
functions.
(uw_dump_deferred_warnings): Purge the tag from the list of
deferred defs also.
(uw_init): gc-protect tentative_defs.
Register intrinsics register-tentative-def and
tentative-def-exists.
* unwind.h (uw_register_tentative_def,
uw_tentative_def_exists): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_intrinsic): Dump deferred warnings after
expansion, unless in the middle of a load.
* parser.c (read_eval_ret_last): Bind *load-recursive* around
all evaluations to t, then dump warnings if prior value
of *load-recursive* is nil. Thus the repl's :read feature
behaves like load.
(repl_warning): We can now unconditionally defer deferrable
warnings here now, whether or not in a load.
|
|
|
|
|
| |
* parser.c (repl): Create a new dynamic env and
rebind *stderr* variable to the repl's output stream.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register sys:ctx-form and sys:ctx-name
intrinsics.
* lisplib.c (error_set_entries, error_instantiate): New static
functions.
(lisplib_init): Register autoloading of error.tl via
new functions.
* share/txr/stdlib/error.tl: New file.
* struct.c (make_struct_type): Purge deferred warnings.
* unwind.c (uw_late_init): Register purge-deferred-warning
intrinsic.
|
|
|
|
|
|
|
| |
* eval.c (do_expand): Warn about unbound functions
or non-bindable symbols in function position
regardless whether the form is a dotted form
that was subject to the apply transformation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Warnings about undefined functions and variables are now
deferred during loading, so forward references do not generate
nuisance diagnostics.
* eval.c (load_recursive_s): New symbol variable.
(eval_defr_warn): New static function.
(op_defvarl, op_defun): Purge any deferred warning about the
given function or variable not being defined.
(load): Rebind the sys:*load-recursive* special var to true
around the load. After the load, dump deferred warnings
if the prior binding of sys:*load-recursive* is false.
Discard deferred warnings in the case of termination by
a nonlocal control transfer.
(do_expand): Treat unbound vars and functions as deferrable
warnings, specially tagged for individual purging frkm
the deferred list.
(eval_init): Intern sys:*load-recursive* and initialize
load_recursive_s variable.
* eval.h (load_recursive_s): Declared.
* parse.c (repl_warning): Accept variable arguments.
Check whether we are loading and if so, defer deferrable
(repl): Adjustment for altered signature of repl_warning.
warnings.
* txr.c (txr_main): dump deferred warnings after
evaluating Lisp stream.
* unwind.c (deferred_warnings): New static variable.
(uw_throw): When a deferrable warning is caught,
suppress the usual message and add it to the
deferred_warnings list.
(uw_defer_warning, uw_dump_deferred_warnings,
uw_dump_deferred_warnings, uw_purge_deferred_warnings): New
functions.
(uw_late_init): gc-protect deferred_warnings.
* unwind.h (uw_defer_warning, uw_dump_deferred_warnings,
uw_dump_deferred_warnings, uw_purge_deferred_warnings): New
functions declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* checkman.txr (check-func): Bugfix: neglect to scan .synb
sections for two types of headings. Include accessors, methods
and structs in the check.
(check-cblk): Use @(last) rather than @(until) so closing
.cble is consumed. Otherwise the new check for dangling
.cble will report false positives.
(check-spurious): New pattern function to detect dangling
.syne and .cble.
(main loop): Include a stand-alone .synb check for
the sake of special sections like Update expander.
Include check-spurious.
|
|
|
|
|
| |
* txr.1: Fix numerous instances of bad .cble/.cblk usage
and replace one .synb/.syne with .cblk/.cble.
|
| |
|
|
|
|
|
| |
* txr.1: Use .mets in syntax block for frame, catch-frame anf
handle-frame, as well as time.
|
|
|
|
|
| |
* txr.1: Fixed spurious comma in Methods car ...
heading and no and @ in Accessors caar ...
|
|
|
|
| |
* txr.1: Fixed under symbol-value.
|
|
|
|
| |
* txr.1: .I with run-on comma after quote becomes .IR.
|
|
|
|
| |
* txr.1: Replace silly loop with idiomatic code.
|
|
|
|
| |
* txr.1: Fix .cble that should be .cblk.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
| |
* parser.y (grammar): Remove all checks which raise a syntax
error if a clause is empty. These reject some correct
situations, getting in the programmer's way.
|
|
|
|
|
|
|
| |
* eval.c (me_whilet): insert gensym if last var is missing.
Warn if init-form looks like a variable.
* txr.1: Documented by copy and paste from iflet.
|
|
|
|
|
| |
* hash.c (hash_print_op): For hash tables that have both weak
keys and weak values, print a space between the keywords.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (pm_table): New static variable.
(expand_param_macro): New static function.
(expand_params): Expand parameter list macros via
expand_param_macro.
(eval_init): gc-protect pm_table and initialize it.
Register *param-macro* variable.
* lisplib.v (pmac_set_entries, pmac_instantiate): New static
functions.
(lisplib_init): Register autoloading of pmac.tl via new
functions.
* share/txr/stdlib/pmac.tl: New file.
* txr.1: Notes under defun, lambds, flet/labels and defmacro
about the existence of parameter macros which add to
the syntax. New Parameter List Macros section.
Documented *param-macro* and define-param-expander.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that during the expansion of something like (do
inc @1), the place expansion will generate a (sys:setq @1 ...)
form which undergoes expansion before the processing which
converts @1 to a gensym. But now that throws an error during
the expansion of the sys:setq form that @1 isn't a bindable
symbol. Since warnings are suppressed during this expansion
phase, we can make it a warning.
* eval.c (not_bindable_warning): New static function.
(do_expand): For the assignment special forms,
throw a warning if the target isn't a bindable symbol,
not an error.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It turns out we have a silly problem: catch is a special
operator, which undergoes a macro-like expansion which alters
its syntax, but uses the same operator symbol.
We turn catch into a macro which expands to a sys:catch
operator.
* eval.c (sys_catch_s): New symbol variable.
(expand_catch): Function now expands sys:catch forms
without altering any syntax.
(do_expand): Check for sys:catch rather than catch.
Call expand_catch differently: it takes the form now
instead of just the arguments, so it can return the
original form if no expansion takes place.
(eval_init): Initialize sys_catch_s variable. Change
registration of op_catch to sys:catch symbol.
* lisplib.c (except_set_entries): Add catch to the
list of autoload symbols for except.tl.
* share/txr/stdlib/except.tl (catch): New macro for
transforming catch to sys:catch.
* txr.1: Reclassify catch operator as a macro.
|
|
|
|
|
| |
* eval.c (expand_catch_clause): Check added that clause sym
must be a symbol.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that objects like `@{foo:bar} @{*xyz*}` are
printing as `@foo:bar @*xyz*` without the required braces.
This changes the meaning, as in @foo:bar which is @foo
followed by the text :bar, or creates a syntax error,
as in @*xyz*.
* lib.c (out_quasi_str): When printing a var, first convert
it to a string form by printing to a string stream. Then
if the string form consists of anything other than letters,
digits and underscores, mark it as needing braces,
in addition to the existing conditions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (lispq_setq_s, setqf_s): New symbol variables.
(op_defvarl, op_defsymacro, op_defmacro, op_setq,
op_lisp1_setq, op_setq): Drop bindability checks.
In the case of defmacro, this is already taken care
of so the check is redundant.
(do_expand): Add bindable check to defvar_s and cousins. In
the function form fallback case, check for the various
assignment operators and check their argument count and
bindability of destination symbol.
(eval_init): Initialize new symbol variables; register
corresponding special operators using variables.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix nested macro parameters not being expanded properly in all
cases. Diagnose uses of :env, :form and :whole in
function parameter lits.
* eval.c (expand_opt_params_rec, expand_params_rec): New
parametr, macro_style_p, indicating destructuring macro
parameter list is to be expanded. Restructure the cases in
expand_opt_params_rec to fix a bug: only recursively treating
a nested parameter A only when A stands alone, or without
a default form as (A), failing to do so when it is (A B ...).
Diagnose :env, :whole or :form inside a function parameter
list. Do not process recursive parameter lists for functions;
diagnose nesting as bad syntax.
(expand_params): Add macro_style_p parameter.
(expand_macrolet, expand_tree_cases): Pass t as argument to
new parameter of expand_params.
(do_expand): Pass t or nil as argument to new parameter
of expand params, based on whether expanding a macro
or function parameter list.
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the incorrect treatment of the x-p parameter in
(lambda (: (x form x-p))) when x-p is a special variable.
It is being lexically bound.
* eval.c (expand_opt_params_rec): When processing a (var
initform) pair, check for (var initform sym). Error out if
sym is not bindable. Check if it is special and if so,
push it into the list of specials.
|