aboutsummaryrefslogtreecommitdiff
path: root/grammars
diff options
context:
space:
mode:
Diffstat (limited to 'grammars')
-rw-r--r--grammars/bp.bp10
-rw-r--r--grammars/builtins.bp10
-rw-r--r--grammars/html.bp6
3 files changed, 13 insertions, 13 deletions
diff --git a/grammars/bp.bp b/grammars/bp.bp
index ed7eb80..7240729 100644
--- a/grammars/bp.bp
+++ b/grammars/bp.bp
@@ -14,18 +14,18 @@ Def: @name=id __ `: __ (
# This is used for command line arguments:
String-pattern: ..%(\n / Nodent / Escape / `\ pat [`;])$$
-pat: simple-pat !(__("!="/"==")) / suffixed-pat
+pat: simple-pat !(__("!~"/"~")) / suffixed-pat
simple-pat: Upto-and / Dot / String / Chars / Nodent / Escape-range
/ Escape / Repeat / Optional / No / After / Before / Capture
/ Start-of-File / Start-of-Line / End-of-File / End-of-Line / Ref / parens
suffixed-pat: (
- Eq-pat
- / Not-eq-pat
+ Match-pat
+ / Not-match-pat
)
-Eq-pat: @first=(suffixed-pat / simple-pat)__"=="__@second=pat
-Not-eq-pat: @first=(suffixed-pat / simple-pat)__"!="__@second=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 '!~'"))
Dot: `. !`.
String: (
diff --git a/grammars/builtins.bp b/grammars/builtins.bp
index 6c0fc75..42a41ac 100644
--- a/grammars/builtins.bp
+++ b/grammars/builtins.bp
@@ -17,15 +17,15 @@ braces: `{ ..%(\n/braces/string) `}
parens: `( ..%(\n/parens/string) `)
string: `" ..%string-escape `" / `' ..%string-escape `'
string-escape: `\ (`x 2 Hex / 1-3 `0-7 / `u 1-4 Hex / .)
-left-id-edge: ^ / <(\x00-x7f!=id-char) / <((\xc0-xdf \x80-xbf)!=id-char)
- / <((\xe0-xef 2\x80-xbf)!=id-char) / <((\xf0-xf7 3\x80-xbf)!=id-char)
+left-id-edge: ^ / <(\x00-x7f!~(^^id-char)) / <((\xc0-xdf \x80-xbf)!~(^^id-char))
+ / <((\xe0-xef 2\x80-xbf)!~(^^id-char)) / <((\xf0-xf7 3\x80-xbf)!~(^^id-char))
right-id-edge: !id-char
-id: left-id-edge !`0-9 (+id-char)!=keyword
+id: left-id-edge !`0-9 !(keyword left-id-edge) +id-char
id-char: `a-z,A-Z,_,0-9
var: id
keyword: !"" # No keywords defined by default
-left-word-edge: ^ / <(\x00-x7f!=word-char) / <((\xc0-xdf \x80-xbf)!=word-char)
- / <((\xe0-xef 2\x80-xbf)!=word-char) / <((\xf0-xf7 3\x80-xbf)!=word-char)
+left-word-edge: ^ / <(\x00-x7f!~(^^word-char)) / <((\xc0-xdf \x80-xbf)!~(^^word-char))
+ / <((\xe0-xef 2\x80-xbf)!~(^^word-char)) / <((\xf0-xf7 3\x80-xbf)!~(^^word-char))
right-word-edge: !word-char
word-char: `a-z,A-Z,_,0-9,-,'
word: left-word-edge +word-char
diff --git a/grammars/html.bp b/grammars/html.bp
index 483db6a..457a183 100644
--- a/grammars/html.bp
+++ b/grammars/html.bp
@@ -8,15 +8,15 @@
doctype: "<!DOCTYPE" ..%\n `>
-html-element: void-element / raw-element / template-element / normal-element
+element: void-element / raw-element / template-element / normal-element
void-element: `< ("area"/"base"/"br"/"col"/"embed"/"hr"/"img"/"input"/"link"/"meta"/"param"/"source"/"track"/"wbr") __attributes__ [`/] __ `>
-template-element: "<template>" ..%(\n / comment / html-element) "</template>"
+template-element: "<template>" ..%(\n / comment / element) "</template>"
raw-element: `< @tag=("script"/"style"/"textarea"/"title") __attributes__ `> ..%\n ("</"tag__`>)
-normal-element: `< @tag=id __attributes__ `> ..%(\n / comment / html-element) ("</"tag`>)
+normal-element: `< @tag=id __attributes__ `> ..%(\n / comment / element) ("</"tag`>)
comment: "<!--" ..%\n "-->"