1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

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>
This commit is contained in:
Ekaitz Zarraga 2024-10-11 14:24:30 +02:00 committed by Ludovic Courtès
parent ff11753df1
commit 25504ba216
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
5 changed files with 73 additions and 4 deletions

3
NEWS
View file

@ -27,6 +27,9 @@ downright unusable (e.g., <https://bugs.gnu.org/72378>), non-conforming
PEG grammar parser in (ice-9 peg string-peg) has been rewritten to cover
all the functionality defined in <https://bford.info/pub/lang/peg.pdf>.
The 'not-in-range' pattern was also added to (ice-9 peg); it is
available from PEG strings via '[^...]'.
** GOOPS: Introduce new forms method* and define-method*
The module (oop goops) now exports method* and define-method* which are