code / bp

Lines4.3K C3.3K Markdown541 YAML273 make110 Shell77 Lua54
(24 lines)
1 # Syntax definitions for some HTML-specific patterns
2 #
3 # NOTE: this is *NOT* intended to be a complete definition of the language's
4 # syntax! Providing a full language grammar is overkill, because the intended
5 # use case is finding/replacing string patterns. This task does not require a
6 # full parse tree, and having one makes the task considerably more complicated.
7 # See the accompanying README.md for more info.
9 doctype: "<!DOCTYPE" ..%\n `>
11 element: void-element / raw-element / template-element / normal-element
13 void-element: `< ("area"/"base"/"br"/"col"/"embed"/"hr"/"img"/"input"/"link"/"meta"/"param"/"source"/"track"/"wbr") __attributes__ [`/] __ `>
15 template-element: "<template>" ..%(\n / comment / element) "</template>"
17 raw-element: `< @tag:("script"/"style"/"textarea"/"title") __attributes__ `> ..%\n ("</"tag__`>)
19 normal-element: `< @tag:id __attributes__ `> ..%(\n / comment / element) ("</"tag__`>)
21 comment: "<!--" ..%\n "-->"
23 attributes: *attribute%__
24 attribute: (+id%`:)__`=__ (id / string)