Updated docs

This commit is contained in:
Bruce Hill 2022-05-02 18:01:45 -04:00
parent af668004e8
commit 3944a36f14
3 changed files with 21 additions and 6 deletions

13
bp.1
View File

@ -203,9 +203,16 @@ Any one of the given escape sequences or ranges \f[I]esc1\f[R] or
\f[I]esc2\f[R] (e.g.\ \f[B]\[rs]r,n,x01-x04\f[R])
.TP
\f[B]\[rs]N\f[R]
A special case escape that matches a \[lq]nodent\[rq]: one or more
newlines followed by the same indentation that occurs on the current
line.
A special escape that matches a \[lq]nodent\[rq]: one or more newlines
followed by the same indentation that occurs on the current line.
.TP
\f[B]\[rs]C\f[R]
A special escape that always matches the empty string and replaces it
with the indentation of the line on which it matched.
For example, this pattern would match Bash-style heredocs that start
with \[lq]<<-FOO\[rq] and end with a line containing only the starting
indentation and the string \[lq]FOO\[rq]: \f[B]\[dq]<<-\[dq]
\[at]end=(\[rs]C id) ..%\[rs]n (\[ha]end$)\f[R]
.TP
\f[B]\[rs]i\f[R]
An identifier character (e.g.\ alphanumeric characters or underscores).

11
bp.1.md
View File

@ -169,8 +169,15 @@ can be combined with a comma (e.g. `` `a-z,A-Z ``).
: Any one of the given escape sequences or ranges *esc1* or *esc2* (e.g. `\r,n,x01-x04`)
`\N`
: A special case escape that matches a "nodent": one or more newlines followed
by the same indentation that occurs on the current line.
: A special escape that matches a "nodent": one or more newlines followed by
the same indentation that occurs on the current line.
`\C`
: A special escape that always matches the empty string and replaces it with
the indentation of the line on which it matched. For example, this pattern
would match Bash-style heredocs that start with "<<-FOO" and end with a line
containing only the starting indentation and the string "FOO":
`"<<-" @end=(\C id) ..%\n (^end$)`
`\i`
: An identifier character (e.g. alphanumeric characters or underscores).

View File

@ -15,7 +15,7 @@ Def: @name=id __ `: __ (
String-pattern: ..%(\n / Nodent / Identifier-char / Identifier-start / Escape / `\ pat [`;])$$
pat: simple-pat !(__("!~"/"~")) / suffixed-pat
simple-pat: (Upto-and / Dot / Word-boundary/ String / Chars / Nodent
simple-pat: (Upto-and / Dot / Word-boundary/ String / Chars / Nodent / Curdent
/ Identifier-char / Identifier-start / Escape-range
/ Escape / Repeat / Optional / No / After / Before / Capture
/ Start-of-File / Start-of-Line / End-of-File / End-of-Line / Ref / parens)
@ -48,6 +48,7 @@ escape-sequence: (
)
No: `! (__@pat / @error=(=>"Expected a pattern after the exclamation mark"))
Nodent: "\N"
Curdent: "\C"
Word-boundary: `| / "\b"
Identifier-char: "\i"
Identifier-start: "\I"