diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-17 19:44:44 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-17 19:44:44 -0800 |
| commit | fdc91544b7c7a57243e5504c29dab68e45cc79cc (patch) | |
| tree | 4079c045e2a62657ff9983a9630a8c041e86ef34 /grammars | |
| parent | 51313c4773f0af62121b2192ff0cca9560b7ab44 (diff) | |
Improved HTML grammar
Diffstat (limited to 'grammars')
| -rw-r--r-- | grammars/html.bp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/grammars/html.bp b/grammars/html.bp index c820b4b..ab82f6f 100644 --- a/grammars/html.bp +++ b/grammars/html.bp @@ -1,7 +1,12 @@ -# HTML grammar -HTML: __ [doctype __] *html-element%__ __ +# Syntax definitions for some HTML-specific patterns +# +# NOTE: this is *NOT* intended to be a complete definition of the language's +# syntax! Providing a full language grammar is overkill, because the intended +# use case is finding/replacing string patterns. This task does not require a +# full parse tree, and having one makes the task considerably more complicated. +# See the accompanying README.md for more info. -doctype: "<!DOCTYPE" ..`> +doctype: "<!DOCTYPE" ..`> %\n html-element: void-element / raw-element / template-element / normal-element @@ -16,5 +21,4 @@ normal-element: `< @tag=id __attributes__ `>..("</"tag`>) % (\n / comment / html comment: "<!--" .."-->" % \n attributes: *attribute%__ -attribute: (+id%`:)__`=__ (id / `" ..`" / `' ..`') -attribute: (+id%`:)__`=__ (id / `" ..`" / `' ..`') +attribute: (+id%`:)__`=__ (id / string) |
