Looking at the SRFI-19 specification, the argument is called `day', not
`date'. Even the accessor is called `date-day'. So adjust the
documentation to match.
Also adjust the (web http) module, which was using `date' as well.
* doc/ref/srfi-modules.texi (SRFI-19 Date): Use `day' instead of `date'.
* module/web/http.scm (parse-rfc-822-date, parse-rfc-850-date)
(parse-asctime-date): Same.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* module/ice-9/peg/string-peg.scm (peg-as-peg): Augment with rules for
hexadecimal digits, “\uXXX” for characters, “\t” for tabs, etc.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Modern PEG supports inversed class like `[^a-z]` that would get any
character not in the `a-z` range. This commit adds support for that and
also for a new `not-in-range` PEG pattern for scheme.
* module/ice-9/peg/codegen.scm (cg-not-in-range): New function.
* module/ice-9/peg/string-peg.scm: Add support for `[^...]`
* test-suite/tests/peg.test: Test it.
* doc/ref/api-peg.texi: Document accordingly.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit adds support for PEG as described in:
<https://bford.info/pub/lang/peg.pdf>
It adds support for the missing features (comments, underscores in
identifiers and escaping) while keeping the extensions (dashes in
identifiers, < and <--).
The naming system tries to be as close as possible to the one proposed
in the paper.
* module/ice-9/peg/string-peg.scm: Rewrite PEG parser.
* test-suite/tests/peg.test: Fix import
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This module replaces the method and define-method bindings with their
method* and define-method* counterparts, for use by users who prefer not
to use both kinds of syntactic forms.
* module/oop/goops/keyword-formals.scm: New module.
* am/bootstrap.am: Added
* doc/ref/goops.texi: Document this change.
* module/oop/goops.scm (compute-keyword-formal-ids): Renamed from
->keyword-formal-ids; modified to do work both on the list of formals
and the list of formal ids in the next-method call.
(compute-make-procedure): Use compute-keyword-formal-ids.
* module/oop/goops (compute-procedure, compute-make-procedure): Emit
lambda or lambda* as appropriate. This doesn't matter now since all
will boil down to lambda-case, but to be future-proof...
Also add some clarifying comments.
* module/oop/goops.scm (method-keyword-formals?): Remov method slot
keyword-formals? as well as exported procedure method-keyword-formals?
introduced in 765f1d49 by partially reverting that commit.
* module/oop/goops.scm: Export method* and define-method*.
(define-method): Extract definitions of helper procedures and place
them in an eval-when at top level.
(define-method*): Renamed from last commits define-method and modified
to invoke method*.
(define-method): New syntax.
(parse-keyword-formals): Renamed from parse-formals and modified to
give keyword methods a specialzers list with tail <top>.
(parse-formals): Re-introduce the code of previous parse-args.
(%compute-applicable-methods): Revert change of previous
commit. Giving keyword methods a specializer tail <top> naturally
makes original %compute-applicable-methods work also with keyword
methods (which kind of shows that we have made the correct choices).
(method*): Renamed from last commit's "method".
(method): New syntax.
* module/oop/goops.scm (keyword-formals?): New slot in <method>.
(method-keyword-formals?): New exported <method> getter.
(%compute-applicable-methods): Treat method as applicable if having
matched all specializers, still have further arguments and have
keyword-formals.
(%compute-applicable-methods): Remove unused local variable n.
(define-syntax method): Rename parse-args to parse-formals.
(parse-formals): Return formals, specializers and keyword-formals.
(compute-procedure): Make a lambda* with possibly keyword formals.
(->formal-ids): Renamed from ->proper and now returns formal-ids.
(->keyword-formal-ids): New procedure. Filter out formal ids from
a keyword formal specification.
(compute-make-procedure): Adapted for keyword formals. Needs
->formal-ids and ->keyword-formal-ids to compute the
real-next-method call.
(compute-procedures): Pass on keyword-formals.
(syntax method): Adapted for keyword formals.
* module/ice-9/psyntax.scm (define/override, define*/override): Use
instead of set! on globals.
($sc-dispatch): Renest. Will compile to the same thing as before.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (resolve-module*, resolve-variable): New
helpers.
(free-id=?, resolve-identifier): Use new helpers.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (expand-let, expand-letrec, ...): Name these
expanders, then install them. Allows for better code evolution and
decreases the indent.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (build-lexical-reference): No "type"
parameter. Adapt callers.
(valid-bound-ids?, distinct-bound-ids?, bound-id-member?): Use match.
(expand-sequence, expand-top-sequence): Use match. For
expand-top-sequence, ensure that both phases of expansion are run in
order; was the case before, but by accident. Don't accumulate results
in reverse.
(parse-when-list): Use match.
* module/ice-9/psyntax.scm (id-var-name): No need for `search` to return
the marks. Simplify to use scope instead of repeating, and use match.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (maybe-name-value): Return a fresh lambda
instead of mutating the given lambda.
(define-expansion-accessors): No need to define setters.
* module/ice-9/psyntax.scm (gen-unique): Instead of making a string with
an embedded hex counter, make a vector. A little less work than making
a string, and slightly smaller binaries.
(gen-label, gen-mark): Use gen-unique.
(resolve-identifier): Adapt case that recognizes labels denoting
lexicals to be less strict.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (expand-top-sequence): Remove needless
gen-label uses, and replace one use with gen-lexical (which is what is
needed).
* module/ice-9/psyntax-pp.scm: Regenerate.
The specification mandates a string, but with rationale suggesting symbols
would be a more natural fit.
> In some ways using symbols would be preferable. However, we want
> human-readable names, and standard Scheme does not provide a way to include
> spaces or mixed-case text in literal symbols.
Add support for symbols as an implementation extension and for backwards
compatibility with the reference implementation.
* module/srfi/srfi-64.scm (%cmp-group-name): New procedure.
(test-end): Use it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Reported-by: Daniel Llorens <lloda@sarc.name>
Fixes <https://bugs.gnu.org/30600>.
* module/system/repl/command.scm (define-meta-command): Flush all
remaining input after handling a read error.
* module/system/repl/common.scm (flush-all-input): New public procedure.
* module/system/repl/repl.scm: Remove local flush-all-input definition.
The bundled (reference) implementation was of somewhat mixed quality and
it failed to follow standard in multiple places. This commit replaces
it with a new one, written from scratch to follow the standard as close
as possible.
* module/srfi/srfi-64/testing.scm: Delete file.
* module/srfi/srfi-64.scm: Replace with new implementation.
* am/bootstrap.am (srfi/srfi-64.go): Remove extra dependencies.
(NOCOMP_SOURCES): Remove srfi/srfi-64/testing.scm.
* test-suite/tests/srfi-64-test.scm
("8.6.1. Simple (form 1) test-apply")
("8.6.2. Simple (form 2) test-apply"): Adjust tests to follow the
specification.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>