aboutsummaryrefslogtreecommitdiff
path: root/grammars/html.bpeg
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-09-16 22:36:38 -0700
committerBruce Hill <bruce@bruce-hill.com>2020-09-16 22:36:38 -0700
commit82952fa5e955885baa1632b0b0ba2ab040a30f14 (patch)
treeaa02b3dbac36e7a6fb3050f9ae55dbc7e8a637da /grammars/html.bpeg
parent9ee7102f51c60469659de752f119b1ecbd3c0ba7 (diff)
Removed the requirement for semicolons, changed '=' -> ':' for
definitions, added better error reporting for failed BPEG grammars
Diffstat (limited to 'grammars/html.bpeg')
-rw-r--r--grammars/html.bpeg28
1 files changed, 14 insertions, 14 deletions
diff --git a/grammars/html.bpeg b/grammars/html.bpeg
index 3a2d9f2..908fa69 100644
--- a/grammars/html.bpeg
+++ b/grammars/html.bpeg
@@ -1,26 +1,26 @@
# HTML grammar
-HTML = __ 0-1(doctype __) 0+html-element%__ __;
+HTML: __ 0-1(doctype __) 0+html-element%__ __
-doctype = "<!DOCTYPE" ..`>;
+doctype: "<!DOCTYPE" ..`>
-html-element = (
+html-element: (
>(`<("area"/"base"/"br"/"col"/"embed"/"hr"/"img"/"input"/"link"/"meta"/"param"/"source"/"track"/"wbr")) void-element
/ >(`<("script"/"style"/"textarea"/"title")) raw-element
/ >(`<("template")) template-element
- / normal-element);
+ / normal-element)
-void-element = `< @[tag](id==match-tag) __attributes__ 0-1`/ __ `>;
+void-element: `< @[tag](id==match-tag) __attributes__ 0-1`/ __ `>
-template-element = `< @[tag](id==match-tag) __`> __ >match-body @[body]0+(!`<$. / comment / html-element / !("</"tag__`>)$.) ("</"tag__`>);
+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__`>);
+raw-element: `< @[tag](id==match-tag) __attributes__ `> >match-body @[body].. ("</"tag__`>)
-normal-element = `< @[tag](id==match-tag) __attributes__ `> >match-body @[body]0+(!`<$. / comment / html-element / !("</"tag__`>)$.) "</"tag__`>;
+normal-element: `< @[tag](id==match-tag) __attributes__ `> >match-body @[body]0+(!`<$. / comment / html-element / !("</"tag__`>)$.) "</"tag__`>
-comment = "<!--" ..."-->";
+comment: "<!--" ..."-->"
-attributes = 0+attribute%__;
-attribute = (1+id%`:)__`=__ (id / `" ..`" / `' ..`');
-attribute = (1+id%`:)__`=__ (id / `" ..`" / `' ..`');
-match-tag = id;
-match-body = '';
+attributes: 0+attribute%__
+attribute: (1+id%`:)__`=__ (id / `" ..`" / `' ..`')
+attribute: (1+id%`:)__`=__ (id / `" ..`" / `' ..`')
+match-tag: id
+match-body: ''