aboutsummaryrefslogtreecommitdiff
path: root/bp.1.md
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2022-05-12 12:11:28 -0400
committerBruce Hill <bruce@bruce-hill.com>2022-05-12 12:11:28 -0400
commit56da250d69615d70774dbc361fa2693cca1e3df4 (patch)
treedbdeb2be018c5f10c13f721965b3bebff2283e88 /bp.1.md
parente484a888151460ffc25a8478d9a9c9836652a35c (diff)
Split backref/named captures into separate concepts for performance
reasons.
Diffstat (limited to 'bp.1.md')
-rw-r--r--bp.1.md12
1 files changed, 8 insertions, 4 deletions
diff --git a/bp.1.md b/bp.1.md
index 869ea42..9473d24 100644
--- a/bp.1.md
+++ b/bp.1.md
@@ -252,7 +252,7 @@ against the edges file or line.
: Matches *pat*, but does not consume any input (lookahead).
`@` *pat*
-: Capture *pat*
+: Capture *pat*. Captured patterns can be used in replacements.
`foo`
: The named pattern whose name is **"foo"**. Pattern names come from
@@ -260,10 +260,14 @@ definitions in grammar files or from named captures. Pattern names may contain
dashes (`-`), but not underscores (`_`), since the underscore is used to match
whitespace. See the **GRAMMAR FILES** section for more info.
+`@` *name* `:` *pat*
+: For the rest of the current chain, define *name* to match whatever *pat*
+matches, i.e. a backreference. For example, `` @foo:word `( foo `) `` (matches
+**"asdf(asdf)"** or **"baz(baz)"**, but not **"foo(baz)"**)
+
`@` *name* `=` *pat*
-: Let *name* equal *pat* (named capture). Named captures can be used as
-backreferences like so: `` @foo=word `( foo `) `` (matches **"asdf(asdf)"** or
-**"baz(baz)"**, but not **"foo(baz)"**)
+: Let *name* equal *pat* (named capture). Named captures can be used in
+text replacements.
*pat* `=>` `"`*replacement*`"`
: Replace *pat* with *replacement*. Note: *replacement* should be a string