| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to account for new parameter.
* lib.c (syntax_error_s): New symbol_variable.
(obj_init): New symbol variable initialized.
* lib.h (syntax_error_s): Declared.
* parser.h (lisp_parse): Declaration updated.
* parser.l (lisp_parse): Takes third parameter.
* txr.1: Third parameter of read described.
* txr.c (txr_main): Pass colon_k to third parameter of lisp_parse
to obtain exception throwing behavior.
* unwind.c (uw_init): Register syntax-error as subtype of error.
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.y (yybadtok): New macro.
(yybadtoken): Function must take parser argument.
(grammar): Replace uses of yybadtoken with yybadtok.
* parser.h (yybadtoken): Declaration updated.
* parser.l (grammar): Fix incorrect yyprepf calls
that are missing the yyscanner parameter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.l (YY_INPUT): Stop relying on removed yyin_stream;
refer to stream via yyextra.
(yyin_stream, lineno, errors, spec_file_str,
prepared_error_message): Global variables removed.
(yyget_column, yyset_column): Missing prototypes not generated by flex
in bison bridge mode have to be added by us to avoid
warning.
(yyerror): Takes parser and scanner as parameters. Prepared error
message is now in the parser context. Calls to other error handling
functions receive scanner context.
(yyerr): New function.
(yyerrorf, yyerrprepf): Takes scanner argument, chases extra data to
get to parser, and refers to parser variables instead of globals.
(num_esc): Scanner argument added.
(%option reentrant, %option bison-bridge, %option extra-type): New
flex options.
(grammar): yyscanner added everywhere.
(end_of_char): Takes scanner argument.
(parse_init): Removed references to yyin_stream and
prepared_error_message.
(parse_reset): Function renamed to open_txr_file. Returns
results via pointers instead of setting global variables.
(regex_parse, lisp_parse): Use reentrant parser interface.
* parser.y (yyerror): Prototype removed.
(yylex): Prototype moved after grammar, with new arguments.
(sym_helper, define_transform): Take scanner argument.
(make_expr): Takes parser argument.
(rlrec): New static function.
(rl): Function turned into macro.
(mkexp, symhlpr): New macros.
(%purse-parser, %parse-param, %lex-param): New Yacc options.
(grammar): Actions re-worked for reentrance. Parser and scanner
contexts are passed down to helper functions, in some cases
via the three new macros. The result of the parse is stored
in the syntax_tree member of the parser_t structure instead
of a global. The yylex function receives the scanner instance.
(get_spec): Function removed.
(parse): New function.
* parser.h (lineno, errors, yyin_stream, spec_file_str):
Declarations removed.
(parser_t): New struct.
(yyerr): New function declared.
(yyparse, yyerror, yyerrorf, end_of_regex, end_of_char,
yylex, yylex_destroy): Declarations updated.
|
|
|
|
|
|
|
|
| |
debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, hash.c,
hash.h, lib.c, lib.h, match.c, match.h, parser.h, parser.l, parser.y,
rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, stream.c,
stream.h, syslog.c, syslog.h, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h: Synchronize license header with LICENSE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
back-fills some missing source code location info. We apply this to
macro expansions. If some error occurs in expanded code, this way it
is referenced to the line where the macro *call* occurs.
Not only is this better than nothing, it may be better than tracing
it to the macro definition. Ideally, we would have both places:
("the error is in the code expanded from this macro, at this site").
* eval.c (expand): Use rlcp_tree to back-fill source info in
macro expansion by taking it from the unexpanded form.
* parser.h (rlcp_tree): Declared.
* parser.y (rlcp_tree): New function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New catenated streams make the Yacc hack possible.
* eval.c (eval_init): Register lisp_parse as intrinsic.
* parser.h (lisp_parse): Declared.
* parser.l: New lexical hack to produce SECRET_ESCAPE_E token.
(regex_parse): Move declaration before statements.
(lisp_parse): New function.
* parser.y (SECRET_ESCAPE_E): New token type.
(spec): New production rule for single expression.
* stream.c (cat_stream_print, cat_get_line, cat_get_char,
cat_get_byte, cat_get_prop): New static functions.
(cat_stream_ops): New static function.
(make_catenated_stream): New function.
* stream.h (make_catenated_stream): Declared.
|
|
|
|
| |
Fixing some errors in copyright comments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
intrinsic function and std_null as new variable.
* parser.h (yylex_destroy): Existing function declared.
* parser.l (regex_parse): New function.
New lexical syntax added which returns SECRET_ESCAPE_R.
* parser.y (SECRET_ESCAPE_R): New token.
(spec): Added syntactic variant which lets us
smuggle a regex into the parser easily.
* stream.c:x (std_null): New global variable.
(null_stream_print): New static function.
(null_ops): New static structure.
(make_null_stream): New function.
(stream_init): Protect and initialize std_null.
* stream.h (std_null, make_null_stream): Declared.
* txr.1: New features documented: regex-parse, *stdnull*.
* txr.c (txr_main): Call yylex_destroy after parsing the program now
that I know about this function; this can free up some memory.
|
|
|
|
|
|
|
|
|
| |
line number info.
* parser.h (rlset): Declared.
(rlcp): Use rlset.
* parser.y (rlset): New function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.h: Likewise.
* debug.c: Added copyright header.
* debug.h: Updated copyright year.
* eval.c: Likewise.
* eval.h: Likewise.
* filter.c: Likewise.
* filter.h: Likewise.
* gc.c: Likewise.
* gc.h: Likewise.
* hash.c: Likewise.
* hash.h: Likewise.
* lib.c: Likewise.
* lib.h: Likewise.
* match.c: Likewise.
* match.h: Likewise.
* parser.h: Likewise.
* regex.c: Likewise.
* regex.h: Likewise.
* stream.c: Likewise.
* stream.h: Likewise.
* txr.c: Likewise, and e-mail address.
* txr.h: Updated copyright year.
* unwind.c: Likewise.
* unwind.h: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_error): Use source_loc_str to get source location.
* match.c (debuglf, sem_err, file_err): Likewise.
* parser.h (source_loc_str): Declared.
* parser.l (parse_init): form_to_ln_hash must be equal based now.
* parser.y (rl): Store new form of read-time source location info.
* txr.1: Documented load.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.h (ln_to_forms_hash): Declaration removed.
* parser.l (ln_to_forms_hash): Variable removed.
(parse_init): Initialization and protection of ln_to_forms_hash
removed.
* parser.y (rl): Update of ln_to_forms_hash removed.
* txr.1:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
* parser.h: Do not include <stdio.h>
* regex.c: Include <limits.h>
* regex.h: Do not include <limits.h>
|
|
|
|
|
|
|
|
|
| |
* parser.h (parse_init): Declared.
* parser.l (parse_init): New function.
* txr.c (main): Call parse_init.
(txr_main): No need to gc-protect yyin_stream since parse_init does it.
|
|
|
|
|
|
| |
hash.h, lib.c, lib.h, match.c, match.h, parser.h, parser.l, parser.y,
regex.c, regex.h, stream.c, stream.h, txr.1, txr.c, txr.h, unwind.c,
unwind.h, utf8.c, utf8.h: Updated e-mail address.
|
|
|
|
|
|
| |
lib.h, match.c, match.h, parser.h, parser.l, parser.y, regex.c,
regex.h, stream.c, stream.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h: Updated copyright year.
|
| |
|
| |
|
| |
|
|
|
|
| |
in regex module not exposed in header. Etc.
|
|
|
|
|
| |
that as an object to vformat, resulting in #<garbage: ...>
output.
|
|
|
|
|
|
|
|
| |
can be converted to a type long and vice versa. The configure
script tries to detect the appropriate type to use. Also,
some run-time checking is performed in the streams module
to detect which conversions specifier strings to use for
printing numbers.
|
|
|
|
|
| |
we wouldn't have to declare object variables at all, so why
use an obtuse syntax to do so?)
|
|
|
|
|
|
| |
compiler. Idea: allocator functions return char * instead of void *,
like malloc did in classic pre-ANSI C. That way we are forced to
use a cast except when the target pointer is char * already.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
abstraction instead of directly using C standard I/O,
to eliminate most uses of C formatted I/O,
and fix numerous bugs, such variadic argument lists which
lack a terminating ``nao'' sentinel.
Bug 28033 is addressed by this patch, since streams no longer provide
printf-compatible formatting. The native formatter is extended with
some additional capabilities to take over.
The work on literal objects is expanded and they are now used
throughout the code base.
Fixed bad realloc in string output stream: reallocating by number
of wide chars rather than bytes.
|
|
|
|
|
| |
use wide character functions so that there is no illicit
mixing. (But the goal is to replace this usage with txr streams).
|
|
|
|
|
|
|
|
|
| |
This is incomplete. There are too many dependencies on
wide character support from the C stream I/O library,
and implicit use of some encoding which may not be UTF-8.
The regex code does not handle wide characters properly.
Character type is still int in some places, rather than wchar_t.
Test suite passes though.
|
|
|