From eb329bdac9fe56d67cb130fb6cdbb28743c6504b Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 12 Dec 2020 16:31:53 -0800 Subject: Bunch of changes, including some bpeg->bp renaming, and adding visualizations --- grammars/html.bp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 grammars/html.bp (limited to 'grammars/html.bp') diff --git a/grammars/html.bp b/grammars/html.bp new file mode 100644 index 0000000..cea19c1 --- /dev/null +++ b/grammars/html.bp @@ -0,0 +1,26 @@ +# HTML grammar +HTML: __ [doctype __] *html-element%__ __ + +doctype: " + +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) + +void-element: `< @tag=(id==match-tag) __attributes__ [`/] __ `> + +template-element: `< @tag=(id==match-tag) __`> __ >match-body @body=*(!`<$. / comment / html-element / !(")$.) (") + +raw-element: `< @tag=(id==match-tag) __attributes__ `> >match-body @body=.. (") + +normal-element: `< @tag=(id==match-tag) __attributes__ `> >match-body @body=*(!`<$. / comment / html-element / !(")$.) " + +comment: "" + +attributes: *attribute%__ +attribute: (+id%`:)__`=__ (id / `" ..`" / `' ..`') +attribute: (+id%`:)__`=__ (id / `" ..`" / `' ..`') +match-tag: id +match-body: '' -- cgit v1.2.3