From b4c8a33a0cbf4938b53458ded4d46efc6e8820ab Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 20 Jan 2021 15:23:57 -0800 Subject: Tweaked `..` syntax to make it more flexible (now: `.. % skip pat`) --- grammars/bp.bp | 8 ++++---- grammars/builtins.bp | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'grammars') diff --git a/grammars/bp.bp b/grammars/bp.bp index 0b222ca..725d213 100644 --- a/grammars/bp.bp +++ b/grammars/bp.bp @@ -5,14 +5,14 @@ # The grammar files provided with BP are not otherwise intended to be full # language grammars. -Grammar: __ *(Def [__`;])%__ __ ($$ / @!=(..$$%\n => "Could not parse this code")) +Grammar: __ *(Def [__`;])%__ __ ($$ / @!=(..%\n$$ => "Could not parse this code")) Def: @name=id __ `: __ ( @definition=extended-pat / $$ @!=(''=>"No definition for rule") - / @!=(..>(`;/id_`:/$)%\n => "Invalid definition: @0")) + / @!=(..%\n>(`;/id_`:/$) => "Invalid definition: @0")) # This is used for command line arguments: -String-pattern: ..$$ % (\n / Nodent / Escape / `\ pat [`;]) +String-pattern: ..%(\n / Nodent / Escape / `\ pat [`;])$$ pat: simple-pat !(__("!="/"==")) / suffixed-pat simple-pat: Upto-and / Dot / String / Chars / Nodent / Escape-range @@ -47,7 +47,7 @@ escape-sequence: ( ) No: `! (__@pat / @!=(''=>"Expected a pattern after the exclamation mark")) Nodent: `\ `N -Upto-and: ".." [__@first=simple-pat] [__`%__@second=simple-pat] +Upto-and: ".." [__`%__@second=simple-pat] [__@first=simple-pat] Repeat: ( @min=(''=>'0') (`*=>"-") @max=(''=>'∞') / @min=int __ `- __ @max=int diff --git a/grammars/builtins.bp b/grammars/builtins.bp index 937db3c..76bf4f5 100644 --- a/grammars/builtins.bp +++ b/grammars/builtins.bp @@ -11,11 +11,11 @@ utf8-codepoint: ( ) crlf: \r\n cr: \r -anglebraces: `<..`> % (\n/anglebraces/string) -brackets: `[..`] % (\n/brackets/string) -braces: `{..`} % (\n/braces/string) -parens: `(..`) % (\n/parens/string) -string: `"..`" % (`\.) / `'..`' % (`\.) +anglebraces: `< ..%(\n/anglebraces/string) `> +brackets: `[ ..%(\n/brackets/string) `] +braces: `{ ..%(\n/braces/string) `} +parens: `( ..%(\n/parens/string) `) +string: `" ..%(`\.) `" / `' ..%(`\.) `' id: !<`a-z,A-Z,_,0-9 (`a-z,A-Z,_ *`a-z,A-Z,_,0-9)!=keyword | id-char: `a-z,A-Z,_,0-9 |: !<`a-z,A-Z,_,0-9 / !`a-z,A-Z,_,0-9 -- cgit v1.2.3