1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
Commit graph

21252 commits

Author SHA1 Message Date
Mikael Djurfeldt
8ac25f3fae README: Add dependency on autopoint 2025-01-13 22:51:35 +01:00
Tomas Volf
f6359a4715
doc: srfi-19: Use day' instead of date' for `make-date'.
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>
2024-12-22 22:46:11 +01:00
Maxim Cournoyer
98ffeacf2c
doc: Document SRFI-64.
This is an import of the 'Abstract', 'Rationale', and 'Specification'
sections from the upstream specification text, with some manual
adjustment.

* doc/ref/srfi-modules.texi (SRFI 64): New subsection.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:46:11 +01:00
Ekaitz Zarraga
c9d0a0c48c
doc: Add explanation on how to avoid escaping in SXML
* doc/ref/sxml.texi (Reading and Writing XML): Add explanation on using
  a procedure to avoid escaping.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:46:11 +01:00
Ekaitz Zarraga
d987e7e7cb
doc: Fix typo in SXML section.
* doc/ref/sxml.texi (Reading and Writing XML): Remove "."

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:45:59 +01:00
Ekaitz Zarraga
6750f6cc80
PEG: string-peg: Add HTML5 grammar test.
* test-suite/tests/peg.test (comment-grammar): Z can be anything.
("simple comment with forbidden char"): Remove.
(html-grammar, html-example): New variables.
("parsing with complex grammars"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:17:39 +01:00
Ekaitz Zarraga
38ad264979
PEG: string-peg: Better support for escaping.
* 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>
2024-12-22 22:14:12 +01:00
Ekaitz Zarraga
c86a48a92f
PEG: string-peg: Fix [^...] interpretation.
* module/ice-9/peg/string-peg.scm (NotInClass->defn): Adjust.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:14:04 +01:00
Adam Faiz
c2829e4a86 New line or field iteration procedures in (ice-9 rdelim)
* NEWS: Update
* module/ice-9/rdelim (for-rdelim-from-port, for-delimited-from-port,
  for-line-in-file): New procedures.
* doc/ref/api-io.texi: Documentation of `for-rdelim-for-port`-related
  procedures.
* test-suite/tests/rdelim.test: Tests for `for-rdelim-for-port`-related
  procedures.

Signed-off-by: Mikael Djurfeldt <mikael@djurfeldt.com>
2024-12-19 22:36:38 +01:00
Mikael Djurfeldt
a9c079b13b goops.test: Add tests for define-method* 2024-12-11 22:43:17 +01:00
Rob Browning
35f13806af scm_i_utf8_string_hash: don't overrun when len is zero
When the length is zero, the previous code would include the byte after
the end of the string in the hash.  Fix that (the wide and narrow
hashers also guard against it via "case 0"), and don't bother mutating
length for the trailing bytes.

Since we already compute the char length, use that to detect all ASCII
strings and follow the same narrow string path that we do for latin-1.

libguile/hash.c (scm_i_utf8_string_hash): avoid overrun when len == 0.
2024-12-11 11:46:40 -06:00
Rob Browning
c45e1f57ec scm_i_utf8_string_hash: switch to u8_mbtouc
libguile/hash.c (scm_i_utf8_string_hash): Switch from u8_mbtouc_unsafe
to u8_mbtouc since the unsafe variant is now the same (see the info
pages).
2024-12-11 11:21:47 -06:00
Mikael Djurfeldt
98c8a014b2 Add clarification about the less predicate passed to merge and sort 2024-12-09 23:46:20 +01:00
Ekaitz Zarraga
25504ba216
PEG: Add support for not-in-range and [^...]
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>
2024-12-09 18:15:01 +01:00
Ekaitz Zarraga
ff11753df1
PEG: Add full support for PEG + some extensions
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>
2024-12-09 18:13:08 +01:00
Mikael Djurfeldt
47807c9b11 Temporarily revert commit 7379049d3 (to make Guile bootstrap) 2024-12-06 10:26:29 +01:00
Rob Browning
76afb429ee Eight byte align statically allocated stringbufs
Previously they were unaligned, unlike their parent strings, and so
could end up with the wrong pointer tag.  Observed on i686-linux-gnu,
where they ended up tagged as immediates (SCM_IMP()), causing failures
in TYP7 related checks.

* libguile/strings.h (SCM_IMMUTABLE_STRINGBUF): align resulting buffer
  via SCM_ALIGNED(8).
2024-11-29 12:24:57 -06:00
Mikael Djurfeldt
c78abcb765 Updated GOOPS sections of reference
* doc/ref/goops.texi: Insert reference to the "definition" of
next-method the first time next-method is mentioned. Place the
definition of next-method in index. Don't use capital methods in generic
function names (corrected only in one node). In section about
next-method, say that you can provide custom arguments (which we can now
due to the optimizing compiler). New node "Inheritance and accessors"
explaining how new accessor methods are created for subclasses.
2024-11-28 21:54:30 +01:00
Mikael Djurfeldt
20405089de test-suite: Canonicalize path in test directory
* test-suite/tests/filesys.test: Canonicalize path in the chdir tests to
avoid false differences due to following links.
2024-11-27 14:59:04 +01:00
Mikael Djurfeldt
382d890026 Bugfix: Recursively use method*, not method, in method*
* module/oop/goops.scm (method*): Do not use method.
2024-11-27 13:27:46 +01:00
Mikael Djurfeldt
d2756503f1 Spell Tomas Volf's name correctly in NEWS 2024-11-27 00:00:03 +01:00
Mikael Djurfeldt
c569f98d81 Add comment about (oop goops keyword-formals) 2024-11-26 19:49:50 +01:00
Mikael Djurfeldt
fe05646f7c New module (oop goops keyword-formals)
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.
2024-11-26 19:02:07 +01:00
Mikael Djurfeldt
a3c77cb8da Update NEWS 2024-11-25 21:47:53 +01:00
Mikael Djurfeldt
5307329d1a Document method* and define-method* 2024-11-25 21:47:53 +01:00
Mikael Djurfeldt
f057e02d9a Correctly pass on keyword arguments actually present in args list
* 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.
2024-11-25 21:47:53 +01:00
Mikael Djurfeldt
2d18afe5ac Distinguish between lambda and lambda* in generated procedures
* 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.
2024-11-25 21:47:53 +01:00
Mikael Djurfeldt
05de7e3e61 Remove method slot keyword-formals? introduced in 765f1d49
* 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.
2024-11-25 21:47:53 +01:00
Mikael Djurfeldt
d619da8c35 GOOPS: Introduce new forms method* and define-method*
* 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.
2024-11-25 21:47:53 +01:00
Mikael Djurfeldt
be2f965f85 GOOPS: Add support for keyword arguments in methods
* 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.
2024-11-25 21:47:53 +01:00
Andy Wingo
c51fcfffb6 psyntax: simplify free-id=?
* module/ice-9/psyntax.scm (free-id=?): Simplify.
* module/ice-9/psyntax-pp.scm: Regenerate.
2024-11-25 11:46:58 +01:00
Andy Wingo
2f175f3453 psyntax: Cosmetic change to overriden globals
* 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.
2024-11-20 15:55:44 +01:00
Andy Wingo
2395f3b74c psyntax: Reorder global-extend
* module/ice-9/psyntax.scm (global-extend): Put at the beginning.
* module/ice-9/psyntax-pp.scm: Regenerate.
2024-11-19 14:40:25 +01:00
Andy Wingo
81645a25d3 psyntax: Typo fix
* module/ice-9/psyntax.scm: Fix comment typo.
2024-11-19 14:37:32 +01:00
Andy Wingo
6788bb4564 psyntax: Cosmetic change
* module/ice-9/psyntax.scm (build-simple-lambda): Reflow.
2024-11-19 14:36:07 +01:00
Andy Wingo
a14948be2f psyntax: Clean up sourcev/src namings
* module/ice-9/psyntax.scm: Look forward to the all-sourcev world by
just naming things "src".
* module/ice-9/psyntax-pp.scm: Regenerate.
2024-11-19 14:30:49 +01:00
Andy Wingo
2f684989e1 psyntax: Simplify output constructors.
* module/ice-9/psyntax.scm: Eta-reduce build-void, build-call, et al.
* module/ice-9/psyntax-pp.scm: Regenerate.
2024-11-19 14:23:47 +01:00
Andy Wingo
7379049d30 psyntax: Factor module-variable use to helpers
* 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.
2024-11-19 11:58:23 +01:00
Andy Wingo
5ddb366375 psyntax: Remove stale analyze-variable case
* module/ice-9/psyntax.scm (analyze-variable): Remove "bare" case, long
gone.
* module/ice-9/psyntax-pp.scm: Regenerate.
2024-11-19 09:59:15 +01:00
Andy Wingo
cdf8473b19 psyntax: Separate core expanders from their installation
* 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.
2024-11-18 16:53:41 +01:00
Andy Wingo
6c4f9a58c9 psyntax: Remove pre-3.0 hack about syntax transformer bindings.
* module/ice-9/psyntax.scm (resolve-identifier): Remove "transformer is
a pair" case.
* module/ice-9/psyntax-pp.scm: Regenerate.
2024-11-18 16:00:23 +01:00
Andy Wingo
527b4498a8 psyntax: Simplify to first-order bindings. NFC
* module/ice-9/psyntax.scm (no-source, make-empty-ribcage): Make normal
bindings, not macros.
2024-11-18 15:59:06 +01:00
Andy Wingo
522b0b4510 psyntax: Match when rebuilding macro output
* module/ice-9/psyntax.scm (expand-macro): Use match.
(eval-local-transformer): Use unless for side effect.
* module/ice-9/psyntax-pp.scm: Regenerate.
2024-11-18 15:08:18 +01:00
Andy Wingo
b4aebbd7a5 psyntax: Cleanups; ensure order of top-level expansion
* 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.
2024-11-18 11:15:15 +01:00
Andy Wingo
12afcc74fb psyntax: Simplify locally-bound-identifiers
* module/ice-9/psyntax.scm (locally-bound-identifiers): Simplify to use
match and scope.
* module/ice-9/psyntax-pp.scm: Regenerate.
2024-11-18 10:21:41 +01:00
Andy Wingo
54c8901adc psyntax: Simplify id-var-name
* 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.
2024-11-18 10:11:53 +01:00
Andy Wingo
14414655d3 psyntax: Fix bug introduced in 0295409483
* module/ice-9/psyntax.scm (analyze-variable): Fix erroneous pattern
matching.
* module/ice-9/psyntax-pp.scm: Regenerate.
2024-11-18 10:07:50 +01:00
Andy Wingo
2daea40200 psyntax: Use new `match' instead of cdadring
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm: Use `match' more.  Also use more first-order
definitions.  NFC.
2024-11-15 15:35:10 +01:00
Andy Wingo
0295409483 psyntax: Use new `match' instead of cdadring
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm: Use `match' more.  NFC.
2024-11-15 14:27:27 +01:00
Andy Wingo
d94292724b psyntax: Add simple pattern matcher
* module/ice-9/psyntax.scm (simple-match1, simple-match-pat,
simple-match-patv, match): Add simple pattern matcher.
* module/ice-9/psyntax-pp.scm: Regenerate.  Just different renumbering
of temps.
2024-11-15 14:16:20 +01:00