summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Expand away sys:lisp1-value based on lexical info.Kaz Kylheku2015-07-112-2/+37
| | | | | | | * eval.c (sys_lisp1_value_s): New global symbol variable. (expand_lisp1_value): New static function. (do_expand): Use expand_lisp1_value. (eval_init): Initialize sys_lisp1_value_s.
* Let's have placelet and placelet*.Kaz Kylheku2015-07-114-8/+46
| | | | | | | | * share/txr/stdlib/place.tl (placelet*): New macro. * lisplib.c (place_set_entries): Add placelet* to list of names. * txr.1: Updated to document placelet* and fix mistakes.
* * share/txr/stdlib/place.tl (defplace dwim): EliminateKaz Kylheku2015-07-112-8/+14
| | | | | | | ogetter-sym variable for caching the sequence; use the getter for the sequence place to access it. Again, this is for placelet, where the caching is visible. Another way to fix this is to clobber the cache variable when updating the sequence place.
* * eval.c (eval_init): Register bindable as intrinsic.Kaz Kylheku2015-07-103-1/+27
| | | | * txr.1: Documented.
* New placelet macro.Kaz Kylheku2015-07-104-11/+134
| | | | | | | | | | | | | | * lisplib.c (place_set_entries): Add placelet to list of names. * share/txr/stdlib/place.tl (sys:placelet1, placelet): New macros. (defplace dwim): Do not retrieve the place's value into a local variable and have the getter expand to that variable. Rather, have the getter retrieve the value. A getter that refers to a cached copy breaks the semantics of placelet, and any place operator which can evaluate the location after it is stored. * txr.1: Documented placelet.
* Handle setting of parse name through prime_parser.Kaz Kylheku2015-07-104-7/+22
| | | | | | | | | | | | * parser.c (prime_parser): Take name as argument, and install it into parser. (lisp_parser): Pass name to parse, instead of setting it in the parser object. * parser.y (parse): Take name as argument and pass down to prime_parser. * parser.h (prime_parser, parse): Declarations updated.
* Fix wrong name reported for errors in first top-level form.Kaz Kylheku2015-07-102-1/+9
| | | | | * parser.c (read_eval_stream): Get name of original stream, and pass that down to lisp_parse as the name argument.
* Fix off by one error line numbers for .tl files.Kaz Kylheku2015-07-102-3/+14
| | | | | * parser.c (read_eval_stream): Add terminating newline to the first line that was examined for hash bang.
* Remove unused "primer" member from parser_t.Kaz Kylheku2015-07-103-9/+18
| | | | | | | | | | | * parser.c (parser_mark, parser_common_init): Remove reference to primer. (parser): Don't take primer argument, remove reference to member. (ensure_parser): Don't take primer argument, don't pass to parser function. (lisp_parse): Don't pass primer string to ensure_parser. * parser.h (primer_t): Remove primer member. (parser): Declaration updated.
* Bugfix: lexer loses unmatched "hold char" between top-level forms.Kaz Kylheku2015-07-105-11/+39
| | | | | | | | | | | | | | | | | | Test case: file containing 4(prinl 3). Scanner consumes 4 and (. The ( is lost when the scanner is reset for the next call to yyparse, resulting in jut prinl being read and interpreted as a variable. * parser.c (prime_parser): If present, append hold byte to priming string. Takes parser_t * instead of parser, and returns void now. * parser.l (reset_scanner): Now returns int value, the value of the scanner's yy_hold_char variable which is nonzero when the scanner is hanging on to an unmatched byte of input. * parser.h (reset_scanner, prime_parser): Declarations updated. * parser.y (parse): Pass hold byte returned by reset_scanner to prime_parser.
* * stream.c (byte_in_unget_byte): Wrong function name in error message.Kaz Kylheku2015-07-102-1/+5
|
* Fix unget-byte and unget-char on catenated streams.Kaz Kylheku2015-07-102-2/+9
| | | | | * stream.c (cat_unget_byte, cat_unget_char): Recursive call to unget_byte and unget_char with reversed arguments.
* Parser cleanup: embed scanner in parser.Kaz Kylheku2015-07-095-28/+72
| | | | | | | | | | | | | | | | | | | | | | | * parser.c (parser_destroy): New GC finalizer static function. (parser_ops): Register parser_destroy. (parser_common_init): New function, shared by parse and parse_once. Initializes embedded scanner. (parser_cleanup): New function, shared by parse_once and parser_destroy. (parser): Use parser_common_init. * parser.h (parser_t): New member, yyscan. (reset_scanner, parser_common_init): Declared. * parser.l (reset_scanner): New function. * parser.y (parse_once): Use parser_common_init, and thus perform only a few initializations. Do not define scanner as a local variable. (parse): Call reset_scanner instead of yylex_init since the scanner is being reused, and for the same reason do not call yylex_destroy. GC will do that now.
* Bugfix: define-modify-macro not registered for auto-loading.Kaz Kylheku2015-08-082-1/+8
| | | | | * lisplib.c (place_set_entries): Add define-modify-macro to list of names.
* * genvim.txr (chesc): Include space among escaped characters.Kaz Kylheku2015-07-071-1/+1
|
* Bugfix: allow @1 in brace variables.Kaz Kylheku2015-06-072-1/+10
| | | | | | | * parser.l (grammar): Scan a METANUM token in the BRACED state also. This allows us to correctly reference op arguments in a quasiliteral, as in `foo @{@1 [1..2] ","} bar`.
* Improved printing of stream objects.Kaz Kylheku2015-07-074-26/+74
| | | | | | | | | | | | | | | | | | | | | * stream.c (null_stream_print): Static function removed. (stream_print_op): New function. Prints stream's name and address. (null_get_prop): Pull stream name from strm_ops structure rather than hard-coding to "null-stream". (null_ops, stdio_ops, tail_ops, pipe_ops, string_in_ops, byte_in_ops, string_out_ops, strlist_out_ops, dir_ops, cat_stream_ops): Use stream_print_op in place of cobj_print_op. Initialize name. (stdio_stream_print): Use name from ops structure, and include object address. (string_in_get_prop): Likewise. (cat_stream_print): Likewise. * stream.h (struct strm_ops): New member, name. (strm_ops_init): Initialize name. (stream_print_op): Declared. * syslog.c (syslog_strm_ops): Use stream_print_op. Initialize name.
* * txr.1: Replace callf example under mapf.Kaz Kylheku2015-07-061-3/+2
|
* * txr.1: three incorrect .metn/.meta usesKaz Kylheku2015-07-061-3/+3
|
* Bugfix in printed rep of stdio stream.Kaz Kylheku2015-07-062-2/+11
| | | | | | * stream.c (stdio_stream_print): Wrong way test on h->pid; if it is nonzero it must be printed. Was printed wrong: argument of integer type passed to ~s which expects a val.
* Clarify clear-error and flush return value.Kaz Kylheku2015-07-063-17/+25
| | | | | | | | | | | * stream.c (stdio_clear_error): Return the prior value of h->err. Do not inspect feof(h->f) or ferror(h->f); just clear the error status of the stream. (stdio_close): Set h->err from errno if fclose failed. (dir_clear_error): Return prior value of h->err. * txr.1: Document return value convetion for clear-error, and flush-stream.
* Tightening behavior for unimplemented stream ops.Kaz Kylheku2015-07-064-26/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In many cases, if a stream operation is not applicable to a stream, it is not appropriate to just do nothing and return nil. An error must be thrown. * stream.c (unimpl, unimpl_put_string, unimpl_put_char, unimpl_put_byte, unimpl_get_line, unimpl_get_char, unimpl_get_byte, unimpl_unget_char, unimpl_unget_byte, unimpl_seek, null_put_string, null_put_char, null_put_byte, null_get_line, null_get_char, null_get_byte, null_close, null_flush, null_seek, null_set_prop, null_get_error, null_get_error_str, null_clear_error): New static functions. (fill_stream_ops): New function. (null_ops): Use null_put_string, etc., instead of null pointers. (stdio_clear_error, dir_clear_error, cat_clear_error): Return value now indicating whether an error was cleared. (stream_set_prop, stream_get_prop, real_time_stream_p, close_stream, get_error, get_error_str, clear_error, get_line, get_char, get_byte, unget_char, unget_byte, put_string, put_char, put_byte, flush_stream): Do not test whether a function in the ops table is defined; just call it, and return its value. (stream_init): Call fill_stream_ops on all stream operation structures so any null pointers are defaulted to appropriate functions. * stream.h (struct strm_ops): clear_error gets return value. (fill_stream_ops): Declared. * syslog.c (syslog_init): Call fill_stream_ops on syslog_strm_ops.
* Reduce regex duplication in genvim.txr.Kaz Kylheku2015-07-042-30/+50
| | | | | | | | | * genvim.txr (bs, hex, at, alpha, alnum, dig, oct, chesc, glyph): New variables. *(txr_error, txr_atat, txr_comment, txr_contin, txr_char, txr_regdir, txr_variable, txr_splicevar, txr_stresc, txr_numesc, txr_regesc, txr_chr, txr_num, txr_badnum,txr_ident, txr_braced_ident): Use regex definitions.
* Syntax highlighting fixes: characters, variables, identifers.Kaz Kylheku2015-07-032-6/+15
| | | | | | | * genvim.txr (txr_variable, txr_splicevar, txr_bracevar): Weren't being generated into tl.vim. Moved to a common section. (txr_nested_error): Relocate above other matches. (txr_ident): Fixed not to match tokens starting with #.
* * txr.1: wrap* syntax fixKaz Kylheku2015-07-031-1/+1
|
* * genman.txr: Simplify double plass over BODY into single pass.Kaz Kylheku2015-07-032-30/+32
|
* Allow op arguments like @1 to be places.Kaz Kylheku2015-07-032-0/+15
| | | | | | | * share/txr/stdlib/place.tl: Introducing new defplace for (sys:var ...) which is treated as if it were a symbol, in anticipation of the op/do macro placing that syntax with a symbol.
* Support trailing semicolon after hex/octal characters.Kaz Kylheku2015-07-024-6/+47
| | | | | | | | | | | | | | | | * parser.l (%option): Remove nounput option since we need yyunput. (grammar): Rule for matching hex and octal escape in SPECIAL state recognizes optional semicolon. In 109 compatibility, this is pushed back into the stream, otherwise consumed. * txr.1: Updated documentation, including compat notes. * genvim.txr (txr_char): Include optional semicolon in match. Corrected some errors where 8 and 9 were being included as matches for octal digits. (txr_error): Default match for \x or \o not followed by digits.
* Hash-bang support for .tl files.Kaz Kylheku2015-07-026-5/+32
| | | | | | | | | | | | | | | | * parser.c (read_eval_stream): New boolean argument to request hash bang support. * parser.h (read_eval_stream): Declaration updated. * eval.c (sys_load): Pass new thid argument to read_eval_stream, to decline hash bang support. * match.c (v_load): Likewise. * txr.c (txr_main): Request hash bang support from read_eval_stream. Thus files referenced from the txr command line can have a #! line, which is ignored.
* * txr.1: Replace wrong use of .coSSKaz Kylheku2015-07-021-1/+1
|
* Handle escapes accurately in Vim syntax highlighting.Kaz Kylheku2015-07-022-5/+25
| | | | | | | | | * genvim.txr (txr_badesc, txr_stresc, txr_numesc, txr_regesc): New match categories. (txr_string, txr_quasilit, txr_regex, txl_regex): No longer use skip= argument, but rather contain escape categories. All escapes are colored as Special rather than String, and unknown or malformed escapes are colored as errors.
* * genman.txr: Take advantage of \@ escape in quasilit.Kaz Kylheku2015-07-013-2/+13
| | | | | | | * genvim.txr (txr_escat): New match category containing \@. Colorized a String. (txr_quasilit): Contains txr_escat. Thus, \@ looks like any other escape inside a quasilit.
* * genman.txr: Bugfix: reproduce the correct opening bracketKaz Kylheku2015-07-012-1/+7
| | | | before a function link.
* * txr.1: avoid term "regular macro".Kaz Kylheku2015-07-011-2/+2
|
* Fix issues in configure found by ShellCheck.Kaz Kylheku2015-06-272-8/+13
| | | | | | | | * configure (have_timegm, tm_gmtoff, tm_tmzone): Unused variables removed. (SIZEOF_LONG_LONG_T): Reference to nonexistent variable fixed. Also, fixed two instances of arithmetic expressions using unnecessary $ prefixes on variables.
* Fix TXR 97 regression in quasiliterals.Kaz Kylheku2015-06-272-1/+12
| | | | | | | | | * eval.c (expand_quasi): When the modifiers argument of a var item is expanded, the expansion incorrectly places it as the fourth item rather than third. This is effectively a continuation of the incomplete regression fix that was applied on 2014-08-29. The breakage is that `@{(expr) modifier}` ignores modifier whenever (expr) is an expression that undergoes expansion.
* Third round of quasiliteral-related fixes.Kaz Kylheku2015-06-262-5/+13
| | | | | | | | | * parser.l (char_esc): Recognize \@ escape. (grammar): Add a rule for a \@ escape in quasiliterals, and quasi word list literals. * txr.1: Document \@, and remove the lie that @@ encodes for a single @ in quasiliterals.
* Third round of quasiliteral-related fixes.Kaz Kylheku2015-06-262-0/+14
| | | | | | * parser.l (char_esc): Recognize \@ escape. (grammar): Add a rule for a \@ escape in quasiliterals, and quasi word list literals.
* Second round of quasiliteral-related fixes.Kaz Kylheku2015-06-262-1/+17
| | | | | | | | | * parser.l: Only shift to QSPECIAL state when @ is followed by a trailing context consisting of certain characters. Not every kind of Lisp object syntax can be introduced with @ in a quasiliteral. Adding a rule to produce an error when @ appears that is not followed by an allowed character.
* First round of quasiliteral-related fixes.Kaz Kylheku2015-06-263-25/+54
| | | | | | | | | | | | | | | | | | | | | * parser.l: Do not try to recognize floating-point literals in QSPECIAL state; that is not possible because @134.3 in a quasiliteral parses as a METANUM followed by ".3". On the other hand, recognize METANUM literals in QSPECIAL state, so that @@123 scans. Recognize @ as a token in QSPECIAL state, so @@abc will scan. When transitioning from QSILIT and QWLIT states to QSPECIAL upon scanning @, return a @ token, which is now parsed in the grammar. * parser.y (quasi_meta_helper): New static function. (q_var): Do not handle SYMTOK any more, only the braced variable syntax. SYMTOK is handled as a n_expr. Braced vars are handled with explicit '@' token, which is now produced by the scanner when it shifts from QSILIT to QSPECIAL. (quasi_item): No longer necessary to recognize various forms here such as quotes and splices. Just recognize a n_expr, preceded by '@'.
* * genman.txr: New filter to add hyperlinks within code inKaz Kylheku2015-06-262-0/+31
| | | | more places such as examples and summary lists.
* * genman.txr: indentation.Kaz Kylheku2015-06-261-10/+10
|
* * txr.1: Spelling, grammar.Kaz Kylheku2015-06-261-8/+8
|
* * txr.1: partition example: wrong use of where function.Kaz Kylheku2015-06-242-2/+6
|
* * txr.1: Formatting fixes.Kaz Kylheku2015-06-241-7/+16
|
* * hash.c (hash_from_pairs, hash_list): New functions.Kaz Kylheku2015-06-245-2/+68
| | | | | | | | | * hash.h (hash_from_pairs, hash_list): Declared. * eval.c (eval_init): Registered hash-from-pairs and hash-list intrinsic. * txr.1: Documented new functions.
* Refactoring n-ary functions to use a single helper.Kaz Kylheku2015-07-243-20/+23
| | | | | | | * lib.c (nary_op): New function. (plusv, mulv, logandv, logiorv): Use nary_op. * lib.h (nary_op): Declared.
* Hash subset testing.Kaz Kylheku2015-06-235-0/+86
| | | | | | | | | | | * eval.c (eval_init): Register hash-subset and hash-proper-subset intrinsics. * hash.c (hash_subset, hash_proper_subset): New functions. * hash.h (hash_subset, hash_proper_subset): Declared. * txr.1: New functions documented.
* * genman.txr: Point to hacked manutils.Kaz Kylheku2015-06-221-4/+2
|
* * genvim.txr: Add ifa.tl library file.Kaz Kylheku2015-06-224-331/+337
| | | | * tl.vim, txr.vim: Regenerated.