diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-07-19 19:40:43 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-07-19 19:40:43 -0700 |
| commit | 711fe47a7f651f38e090c9a20ecef11feba6f705 (patch) | |
| tree | 98a3283e7c630919a08f8bd95326ceeb1a93da9e /grammars/bp.bp | |
| parent | 62e7d654bd70db89cb38e5d9efeb9a9b0e9cf202 (diff) | |
Overhaul of word boundaries/edges. Now they use \b, which is implemented
in C, and the C code understands UTF8 id chars.
Diffstat (limited to 'grammars/bp.bp')
| -rw-r--r-- | grammars/bp.bp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/grammars/bp.bp b/grammars/bp.bp index 228f7d0..37fa83f 100644 --- a/grammars/bp.bp +++ b/grammars/bp.bp @@ -12,10 +12,11 @@ Def: @name=id __ `: __ ( / (!)(..%\n>(`;/id_`:/$) => "Invalid definition: @0")) # This is used for command line arguments: -String-pattern: ..%(\n / Nodent / Escape / `\ pat [`;])$$ + String-pattern: ..%(\n / Nodent / Identifier-char / Identifier-start / Escape / `\ pat [`;])$$ pat: simple-pat !(__("!~"/"~")) / suffixed-pat -simple-pat: Upto-and / Dot / String / Chars / Nodent / Escape-range +simple-pat: Upto-and / Dot / Word-boundary/ String / Chars / Nodent + / Identifier-char / Identifier-start / Escape-range / Escape / Repeat / Optional / No / After / Before / Capture / Error / Empty-replacement / Start-of-File / Start-of-Line / End-of-File / End-of-Line / Ref / parens @@ -31,7 +32,6 @@ Dot: `. !`. String: ( `" @s=.. (`" / $ (!)=>"Expected closing quote here") / `' @s=.. (`' / $ (!)=>"Expected closing quote here") - / `{ @s=.. (`} / $ (!)=>"Expected closing brace here") ) Chars: `` @+(Char-range/Char) % `, Char-range: @low=. `- (@high=. / (!)=>"Expected a second character to form a character range") @@ -47,7 +47,10 @@ escape-sequence: ( / `x 2 `0-9,a-f,A-F ) No: `! (__@pat / (!)=>"Expected a pattern after the exclamation mark") -Nodent: `\ `N +Nodent: "\N" +Word-boundary: "\b" +Identifier-char: "\i" +Identifier-start: "\I" Upto-and: ".." [__`%__@second=simple-pat] [__@first=simple-pat] Repeat: ( @min=(=>'0') (`*=>"-") @max=(=>'∞') |
