diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2022-04-01 12:25:12 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2022-04-01 12:25:12 -0400 |
| commit | ee8fb64e97ad3f19e21c242dc7a55ebad6253fb8 (patch) | |
| tree | 89103c6a68876abb38748abbe2820edd4a50cf78 | |
| parent | c1c4f2109bed7076b89f8188b4b395437b330dc9 (diff) | |
Rewording
| -rw-r--r-- | bp.1 | 64 | ||||
| -rw-r--r-- | bp.1.md | 4 |
2 files changed, 41 insertions, 27 deletions
@@ -1,5 +1,19 @@ -.\" Automatically generated by Pandoc 2.14.2 +.\" Automatically generated by Pandoc 2.17.1.1 .\" +.\" Define V font for inline verbatim, using C font in formats +.\" that render this, and otherwise B font. +.ie "\f[CB]x\f[]"x" \{\ +. ftr V B +. ftr VI BI +. ftr VB B +. ftr VBI BI +.\} +.el \{\ +. ftr V CR +. ftr VI CI +. ftr VB CB +. ftr VBI CBI +.\} .TH "BP" "1" "May 17 2021" "" "" .hy .SH NAME @@ -20,8 +34,8 @@ Give a pattern in BP syntax instead of string syntax (equivalent to \f[B]bp \[aq]\[rs](pat)\[aq]\f[R] .TP \f[B]-w\f[R], \f[B]--word\f[R] \f[I]word\f[R] -Surround a string pattern with word boundaries (equivalent to -\f[B]bp \[aq]\[rs]|word\[rs]|\[aq]\f[R]) +Surround a string pattern with word boundaries (equivalent to \f[B]bp +\[aq]\[rs]|word\[rs]|\[aq]\f[R]) .TP \f[B]-e\f[R], \f[B]--explain\f[R] Print a visual explanation of the matches. @@ -213,8 +227,8 @@ Not \f[I]pat\f[R] Maybe \f[I]pat\f[R] .TP \f[I]N\f[R] \f[I]pat\f[R] -Exactly \f[I]N\f[R] repetitions of \f[I]pat\f[R] -(e.g.\ \f[B]5 \[dq]x\[dq]\f[R] matches \f[B]\[lq]xxxxx\[rq]\f[R]) +Exactly \f[I]N\f[R] repetitions of \f[I]pat\f[R] (e.g.\ \f[B]5 +\[dq]x\[dq]\f[R] matches \f[B]\[lq]xxxxx\[rq]\f[R]) .TP \f[I]N\f[R] \f[B]-\f[R] \f[I]M\f[R] \f[I]pat\f[R] Between \f[I]N\f[R] and \f[I]M\f[R] repetitions of \f[I]pat\f[R] @@ -222,17 +236,17 @@ Between \f[I]N\f[R] and \f[I]M\f[R] repetitions of \f[I]pat\f[R] \f[B]\[lq]xxx\[rq]\f[R]) .TP \f[I]N\f[R]\f[B]+\f[R] \f[I]pat\f[R] -At least \f[I]N\f[R] or more repetitions of \f[I]pat\f[R] -(e.g.\ \f[B]2+ \[dq]x\[dq]\f[R] matches \f[B]\[lq]xx\[rq]\f[R], +At least \f[I]N\f[R] or more repetitions of \f[I]pat\f[R] (e.g.\ \f[B]2+ +\[dq]x\[dq]\f[R] matches \f[B]\[lq]xx\[rq]\f[R], \f[B]\[lq]xxx\[rq]\f[R], \f[B]\[lq]xxxx\[rq]\f[R], etc.) .TP \f[B]*\f[R] \f[I]pat\f[R] -Some \f[I]pat\f[R]s (zero or more, e.g.\ \f[B]* \[dq]x\[dq]\f[R] matches +Any \f[I]pat\f[R]s (zero or more, e.g.\ \f[B]* \[dq]x\[dq]\f[R] matches \f[B]\[lq]\[lq]\f[R], \f[B]\[rq]x\[rq]\f[R], \f[B]\[lq]xx\[rq]\f[R], etc.) .TP \f[B]+\f[R] \f[I]pat\f[R] -At least one \f[I]pat\f[R]s (e.g.\ \f[B]+ \[dq]x\[dq]\f[R] matches +Some \f[I]pat\f[R]s (e.g.\ \f[B]+ \[dq]x\[dq]\f[R] matches \f[B]\[lq]x\[rq]\f[R], \f[B]\[lq]xx\[rq]\f[R], \f[B]\[lq]xxx\[rq]\f[R], etc.) .TP @@ -246,10 +260,10 @@ Any text (except newlines) up to and including \f[I]pat\f[R] .TP \f[B].. %\f[R] \f[I]skip\f[R] \f[I]pat\f[R] Any text (except newlines) up to and including \f[I]pat\f[R], skipping -over instances of \f[I]skip\f[R] -(e.g.\ \f[B]\[aq]\[dq]\[aq] ..%(\[aq]\[rs]\[aq] .) \[aq]\[dq]\[aq]\f[R] -opening quote, up to closing quote, skipping over backslash followed by -a single character) +over instances of \f[I]skip\f[R] (e.g.\ \f[B]\[aq]\[dq]\[aq] +\&..%(\[aq]\[rs]\[aq] .) +\[aq]\[dq]\[aq]\f[R] opening quote, up to closing quote, skipping over +backslash followed by a single character) .TP \f[B].. =\f[R] \f[I]only\f[R] \f[I]pat\f[R] Any number of repetitions of the pattern \f[I]only\f[R] up to and @@ -257,8 +271,9 @@ including \f[I]pat\f[R] (e.g.\ \f[B]\[dq]f\[dq] ..=abc \[dq]k\[dq]\f[R] matches the letter \[lq]f\[rq] followed by some alphabetic characters and then a \[lq]k\[rq], which would match \[lq]fork\[rq], but not \[lq]free kit\[rq]) This is essentially a \[lq]non-greedy\[rq] version -of \f[B]*\f[R], and \f[B].. pat\f[R] can be thought of as the special -case of \f[B]..=. pat\f[R] +of \f[B]*\f[R], and \f[B].. +pat\f[R] can be thought of as the special case of \f[B]..=. +pat\f[R] .TP \f[B]<\f[R] \f[I]pat\f[R] Matches at the current position if \f[I]pat\f[R] matches immediately @@ -295,10 +310,9 @@ See the \f[B]GRAMMAR FILES\f[R] section for more info. .TP \f[B]\[at]\f[R] \f[I]name\f[R] \f[B]=\f[R] \f[I]pat\f[R] Let \f[I]name\f[R] equal \f[I]pat\f[R] (named capture). -Named captures can be used as backreferences like so: -\f[B]\[at]foo=word \[ga]( foo \[ga])\f[R] (matches -\f[B]\[lq]asdf(asdf)\[rq]\f[R] or \f[B]\[lq]baz(baz)\[rq]\f[R], but not -\f[B]\[lq]foo(baz)\[rq]\f[R]) +Named captures can be used as backreferences like so: \f[B]\[at]foo=word +\[ga]( foo \[ga])\f[R] (matches \f[B]\[lq]asdf(asdf)\[rq]\f[R] or +\f[B]\[lq]baz(baz)\[rq]\f[R], but not \f[B]\[lq]foo(baz)\[rq]\f[R]) .TP \f[I]pat\f[R] \f[B]=>\f[R] \f[B]\[dq]\f[R]\f[I]replacement\f[R]\f[B]\[dq]\f[R] Replace \f[I]pat\f[R] with \f[I]replacement\f[R]. @@ -308,11 +322,10 @@ references to captured values: \f[B]\[at]0\f[R] (the whole of \f[I]pat\f[R]), \f[B]\[at]1\f[R] (the first capture in \f[I]pat\f[R]), \f[B]\[at]\f[R]\f[I]foo\f[R] (the capture named \f[I]foo\f[R] in \f[I]pat\f[R]), etc. -For example, -\f[B]\[at]word _ \[at]rest=(*word % _) => \[dq]\[at]rest:\[rs]n\[rs]t\[at]1\[dq]\f[R] -matches a word followed by whitespace, followed by a series of words and -replaces it with the series of words, a colon, a newline, a tab, and -then the first word. +For example, \f[B]\[at]word _ \[at]rest=(*word % _) => +\[dq]\[at]rest:\[rs]n\[rs]t\[at]1\[dq]\f[R] matches a word followed by +whitespace, followed by a series of words and replaces it with the +series of words, a colon, a newline, a tab, and then the first word. .TP \f[I]pat1\f[R] \f[B]\[ti]\f[R] \f[I]pat2\f[R] Matches when \f[I]pat1\f[R] matches and \f[I]pat2\f[R] can be found @@ -383,7 +396,8 @@ Using the \f[I]html\f[R] grammar, find all \f[I]element\f[R]s matching the tag \f[I]a\f[R] in the file \f[I]foo.html\f[R]: .RS .PP -\f[B]bp -g html -p \[aq]element \[ti] (\[ha]\[ha]\[dq]<a \[dq])\[aq] foo.html\f[R] +\f[B]bp -g html -p \[aq]element \[ti] (\[ha]\[ha]\[dq]<a \[dq])\[aq] +foo.html\f[R] .RE .SH AUTHORS Bruce Hill (\f[I]bruce\[at]bruce-hill.com\f[R]). @@ -202,11 +202,11 @@ by the same indentation that occurs on the current line. **"xx"**, **"xxx"**, **"xxxx"**, etc.) `*` *pat* -: Some *pat*s (zero or more, e.g. `* "x"` matches **""**, **"x"**, **"xx"**, +: Any *pat*s (zero or more, e.g. `* "x"` matches **""**, **"x"**, **"xx"**, etc.) `+` *pat* -: At least one *pat*s (e.g. `+ "x"` matches **"x"**, **"xx"**, **"xxx"**, etc.) +: Some *pat*s (e.g. `+ "x"` matches **"x"**, **"xx"**, **"xxx"**, etc.) *repeating-pat* `%` *sep* : *repeating-pat* (see the examples above) separated by *sep* (e.g. `*word % |
