From 56da250d69615d70774dbc361fa2693cca1e3df4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 12 May 2022 12:11:28 -0400 Subject: Split backref/named captures into separate concepts for performance reasons. --- grammars/bp.bp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'grammars/bp.bp') diff --git a/grammars/bp.bp b/grammars/bp.bp index 2782934..a77881b 100644 --- a/grammars/bp.bp +++ b/grammars/bp.bp @@ -6,7 +6,7 @@ # language grammars. Grammar: __ *(Def [__`;])%__ __ [@error=(+(./\n) => "Could not parse this code: @0")] -Def: @name=id __ `: __ ( +Def: @name=id __ 1-2`: __ ( @definition=extended-pat / $$ @error=(=>"No definition for rule") / @error=(..%\n>(`;/id_`:/$) => "Invalid definition: @0")) @@ -62,7 +62,7 @@ Repeat: ( Optional: `[ __ extended-pat (__`] / @error=(=>"Expected closing square bracket here")) After: `< __ pat Before: `> __ pat -Capture: `@ [__ @capture-name=(id/`!) __ !"=>" `=] __ (@capture=pat / @error=(=>"Expected pattern to capture")) +Capture: `@ [__ @capture-name=(id/`!) __ !"=>" `=,:] __ (@capture=pat / @error=(=>"Expected pattern to capture")) Replace: ( @replace-pat=[Chain-noreplace / pat] __ "=>" (__ @replacement=String / @error=(=>"Expected replacement string")) ) -- cgit v1.2.3