From 0d2908f824ab573e9ad13f14919ae4d07984dc89 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 22 Jun 2017 12:22:16 -0600 Subject: [PATCH] regexp docs: minor corrections Fixes inaccuracies discovered when reimplementing regexp matching in Racket. --- pkgs/racket-doc/scribblings/reference/regexps.scrbl | 4 ++++ pkgs/racket-doc/scribblings/reference/rx.rkt | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/racket-doc/scribblings/reference/regexps.scrbl b/pkgs/racket-doc/scribblings/reference/regexps.scrbl index 17632df90c..c8d1377fe3 100644 --- a/pkgs/racket-doc/scribblings/reference/regexps.scrbl +++ b/pkgs/racket-doc/scribblings/reference/regexps.scrbl @@ -95,6 +95,10 @@ The following completes the grammar for @racket[pregexp], which uses @px-table +In case-insensitive mode, a backreference of the form +@litchar{\}@nonterm{n} matches case-insensitively only with respect to +ASCII characters. + The Unicode categories follow. @category-table diff --git a/pkgs/racket-doc/scribblings/reference/rx.rkt b/pkgs/racket-doc/scribblings/reference/rx.rkt index 6d49304819..455c83be2b 100644 --- a/pkgs/racket-doc/scribblings/reference/rx.rkt +++ b/pkgs/racket-doc/scribblings/reference/rx.rkt @@ -9,7 +9,7 @@ (define grammar @string-append{ Regexp ::= Pces Match Pces #co | Regexp|Regexp Match either Regexp, try left first #co 1 - Pces ::= Pce Match Pce #co + Pces ::= Match empty #co | PcePces Match Pce followed by Pces #co Pce ::= Repeat Match Repeat, longest possible #co 3 | Repeat? Match Repeat, shortest possible #co 6 @@ -22,6 +22,7 @@ | Atom{N,} Match Atom N or more times #px 8 | Atom{,M} Match Atom between 0 and M times #px 9 | Atom{N,M} Match Atom between N and M times #px 10 + | Atom{} Match Atom 0 or more times #px Atom ::= (Regexp) Match sub-expression Regexp and report #co 11 | [Rng] Match any character in Rng #co 2 | [^Rng] Match any character not in Rng #co 12 @@ -34,6 +35,7 @@ | Look Match empty if Look matches #co | (?TstPces|Pces) Match 1st Pces if Tst, else 2nd Pces #co 36 | (?TstPces) Match Pces if Tst, empty if not Tst #co + | \`at`end`of`pattern` Match the nul character (ASCII 0) #co Atom ::= ... ... #px | \N Match latest reported match for N##th _(_ #px 16 | Class Match any character in Class #px @@ -64,7 +66,7 @@ | (?!Regexp) Match if Regexp doesn't match #mode 32 | (?<=Regexp) Match if Regexp matches preceding #mode 33 | (?