mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +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:
parent
ff11753df1
commit
25504ba216
5 changed files with 73 additions and 4 deletions
|
@ -147,6 +147,14 @@ Parses any character falling between @var{a} and @var{z}.
|
|||
@code{(range #\a #\z)}
|
||||
@end deftp
|
||||
|
||||
@deftp {PEG Pattern} {inverse range of characters} a z
|
||||
Parses any character not falling between @var{a} and @var{z}.
|
||||
|
||||
@code{"[^a-z]"}
|
||||
|
||||
@code{(not-in-range #\a #\z)}
|
||||
@end deftp
|
||||
|
||||
Example:
|
||||
|
||||
@example
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue