aboutsummaryrefslogtreecommitdiff
path: root/grammars/html.bpeg
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-09-16 17:57:56 -0700
committerBruce Hill <bruce@bruce-hill.com>2020-09-16 17:57:56 -0700
commit21807a663d0ab1fc934e1bb3ad485fe1c3e9c821 (patch)
tree618f998a8073b0adce37cb0947718945dedf775d /grammars/html.bpeg
parent79efa8bf5efed69fafc558968d51da4dbdd9cfd1 (diff)
Consolidated repetition ops (instead of '+', '*', '?', etc. now it's all
number based: '1+', '0+', '0-1') and reverted to UPTO_AND behavior instead of UPTO
Diffstat (limited to 'grammars/html.bpeg')
-rw-r--r--grammars/html.bpeg12
1 files changed, 6 insertions, 6 deletions
diff --git a/grammars/html.bpeg b/grammars/html.bpeg
index 7af1f63..451e61c 100644
--- a/grammars/html.bpeg
+++ b/grammars/html.bpeg
@@ -1,5 +1,5 @@
# HTML grammar
-HTML = __ ?(doctype __) *html-element%__ __;
+HTML = __ 0-1(doctype __) 0+html-element%__ __;
doctype = "<!DOCTYPE" ..`>;
@@ -9,19 +9,19 @@ html-element = (
/ >(`<("template")) template-element
/ normal-element);
-void-element = `< @[tag](id==match-tag) __attributes__ ?`/ __ `>;
+void-element = `< @[tag](id==match-tag) __attributes__ 0-1`/ __ `>;
template-element = `< @[tag](id==match-tag) __`> __ >match-body @[body]0+(!`<$. / comment / html-element / !("</"tag__`>)$.) ("</"tag__`>);
raw-element = `< @[tag](id==match-tag) __attributes__ `> >match-body @[body].. ("</"tag__`>);
-normal-element = `< @[tag](id==match-tag) __attributes__ `> >match-body @[body]*(!`<$. / comment / html-element / !("</"tag__`>)$.) "</"tag__`>;
+normal-element = `< @[tag](id==match-tag) __attributes__ `> >match-body @[body]0+(!`<$. / comment / html-element / !("</"tag__`>)$.) "</"tag__`>;
comment = "<!--" ..."-->";
-attributes = *(!(attribute==match-attribute))%__ __(attribute==match-attribute)__ *attribute%__;
-attribute = (+id%`:)__`=__ (id / `" ..`" / `' ..`');
-attribute = (+id%`:)__`=__ (id / `" ..`" / `' ..`');
+attributes = 0+(!(attribute==match-attribute))%__ __(attribute==match-attribute)__ 0+attribute%__;
+attribute = (1+id%`:)__`=__ (id / `" ..`" / `' ..`');
+attribute = (1+id%`:)__`=__ (id / `" ..`" / `' ..`');
match-attribute = attribute;
match-tag = id;
match-body = (/);