aboutsummaryrefslogtreecommitdiff
path: root/grammars
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-09-23 13:42:23 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-09-23 13:42:23 -0700
commit744a92756200052837e25f4f7758175241528536 (patch)
tree658a04ebc9aa902099febd36a9060d95094fcda3 /grammars
parent55ff8ec6637d90d50ed83c43f83e25fe4571f6bb (diff)
Deprecated (!)-errors
Diffstat (limited to 'grammars')
-rw-r--r--grammars/bp.bp37
1 files changed, 18 insertions, 19 deletions
diff --git a/grammars/bp.bp b/grammars/bp.bp
index 2b0f4f9..d0a9474 100644
--- a/grammars/bp.bp
+++ b/grammars/bp.bp
@@ -5,11 +5,11 @@
# 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 [__`;])%__ __ [@error=(+(./\n) => "Could not parse this code")]
Def: @name=id __ `: __ (
@definition=extended-pat
- / $$ (!)=>"No definition for rule"
- / (!)(..%\n>(`;/id_`:/$) => "Invalid definition: @0"))
+ / $$ @error=(=>"No definition for rule")
+ / @error=(..%\n>(`;/id_`:/$) => "Invalid definition: @0"))
# This is used for command line arguments:
String-pattern: ..%(\n / Nodent / Identifier-char / Identifier-start / Escape / `\ pat [`;])$$
@@ -17,7 +17,7 @@ String-pattern: ..%(\n / Nodent / Identifier-char / Identifier-start / Escape /
pat: simple-pat !(__("!~"/"~")) / suffixed-pat
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
+ / Escape / Repeat / Optional / No / After / Before / Capture / Empty-replacement
/ Start-of-File / Start-of-Line / End-of-File / End-of-Line / Ref / parens)
suffixed-pat: (
@@ -25,28 +25,28 @@ suffixed-pat: (
/ Not-match-pat
)
-Match-pat: @first=(suffixed-pat / simple-pat)__"~"__@second=(pat / (!)=>"Expected pattern after '~'")
-Not-match-pat: @first=(suffixed-pat / simple-pat)__"!~"__@second=(pat / (!)=>"Expected pattern after '!~'")
+Match-pat: @first=(suffixed-pat / simple-pat)__"~"__@second=(pat / @error=(=>"Expected pattern after '~'"))
+Not-match-pat: @first=(suffixed-pat / simple-pat)__"!~"__@second=(pat / @error=(=>"Expected pattern after '!~'"))
Dot: `. !`.
String: (
- `" @s=.. (`" / $ (!)=>"Expected closing quote here")
- / `' @s=.. (`' / $ (!)=>"Expected closing quote here")
+ `" @s=.. (`" / $ @error=(=>"Expected closing quote here"))
+ / `' @s=.. (`' / $ @error=(=>"Expected closing quote here"))
)
Chars: `` @+(Char-range/Char) % `,
-Char-range: @low=. `- (@high=. / (!)=>"Expected a second character to form a character range")
-Char: (@s=. / (!)=>"Expected a character following the '`'")
+Char-range: @low=. `- (@high=. / @error=(=>"Expected a second character to form a character range"))
+Char: (@s=. / @error=(=>"Expected a character following the '`'"))
Escape-range: `\ @low=escape-sequence `- @high=escape-sequence
Escape: `\ (@s=escape-sequence
- / $ (!)=>"Backslashes are used for escape sequences, not splitting lines"
- / (!)(. *(Abc/`0-9) => "Invalid escape sequence: '@0'")
+ / $ @error=(=>"Backslashes are used for escape sequences, not splitting lines")
+ / @error=(. *(Abc/`0-9) => "Invalid escape sequence: '@0'")
)
escape-sequence: (
`n,t,r,e,b,a,v
/ 1-3 `0-7
/ `x 2 `0-9,a-f,A-F
)
-No: `! (__@pat / (!)=>"Expected a pattern after the exclamation mark")
+No: `! (__@pat / @error=(=>"Expected a pattern after the exclamation mark"))
Nodent: "\N"
Word-boundary: `| / "\b"
Identifier-char: "\i"
@@ -58,16 +58,15 @@ Repeat: (
/ @min=(int / =>'1') __ (`+=>"-") @max=(=>'∞')
/ @min=@max=int
) __ @repeat-pat=pat [__`%__@sep=pat]
-Optional: `[ __ extended-pat (__`] / (!)=>"Expected closing square bracket here")
+Optional: `[ __ extended-pat (__`] / @error=(=>"Expected closing square bracket here"))
After: `< __ pat
Before: `> __ pat
-Capture: `@ [__ @capture-name=(id/`!) __ !"=>" `=] __ (@capture=pat / (!)=>"Expected pattern to capture")
-Error: "(!)" @pat=[__ (Replace / Chain / pat)]
+Capture: `@ [__ @capture-name=(id/`!) __ !"=>" `=] __ (@capture=pat / @error=(=>"Expected pattern to capture"))
Replace: (
- @replace-pat=(Replace / Chain / pat) __ "=>" (__ @replacement=String / (!)=>"Expected replacement string")
+ @replace-pat=(Replace / Chain / pat) __ "=>" (__ @replacement=String / @error=(=>"Expected replacement string"))
)
Empty-replacement: (
- @replace-pat=(=>"''") "=>" (__ @replacement=String / (!)=>"Expected replacement string")
+ @replace-pat=(=>"''") "=>" (__ @replacement=String / @error=(=>"Expected replacement string"))
)
Ref: @name=id !(__`:)
Start-of-File: "^^"
@@ -75,7 +74,7 @@ Start-of-Line: "^"
End-of-File: "$$"
End-of-Line: "$"
-parens: `( __ extended-pat (__ `) / (!)=>"Expected closing parenthesis here")
+parens: `( __ extended-pat (__ `) / @error=(=>"Expected closing parenthesis here"))
Chain: 2+@(pat !(__"=>") / Replace)%__
Otherwise: 2+@(Replace / Chain / pat)%(__`/__)