-
Notifications
You must be signed in to change notification settings - Fork 3
/
tree-sitter-html.ebnf
74 lines (54 loc) · 1.32 KB
/
tree-sitter-html.ebnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// From tree-sitter-html/src/grammar.json
//
//
// EBNF to generate railroad diagram at
// (IPV6) https://www.bottlecaps.de/rr/ui
// (IPV4) https://rr.red-dove.com/ui
//
fragment ::=
_node*
doctype ::=
'<!' _doctype [^>]+ '>'
_doctype ::=
[Dd][Oo][Cc][Tt][Yy][Pp][Ee]
_node ::=
doctype
| entity
| text
| element
| script_element
| style_element
| erroneous_end_tag
element ::=
start_tag _node* ( end_tag | _implicit_end_tag )
| self_closing_tag
script_element ::=
script_start_tag raw_text? end_tag
style_element ::=
style_start_tag raw_text? end_tag
start_tag ::=
'<' _start_tag_name attribute* '>'
script_start_tag ::=
'<' _script_start_tag_name attribute* '>'
style_start_tag ::=
'<' _style_start_tag_name attribute* '>'
self_closing_tag ::=
'<' _start_tag_name attribute* '/>'
end_tag ::=
'</' _end_tag_name '>'
erroneous_end_tag ::=
'</' erroneous_end_tag_name '>'
attribute ::=
attribute_name ( '=' ( attribute_value | quoted_attribute_value ) )?
attribute_name ::=
[^<>"'/= #x09#x0A#x0B#x0C#x0D]+
attribute_value ::=
[^<>"'= #x09#x0A#x0B#x0C#x0D]+
entity ::=
'&'('#'([xX][0-9a-fA-F]'{1,6}'|[0-9]'{1,5}')|[A-Za-z]'{1,30}')';'
quoted_attribute_value ::=
"'" [^']+? "'"
| '"' [^"]+? '"'
text ::=
[^<>& #x09#x0A#x0B#x0C#x0D]([^<>&]*[^<>& #x09#x0A#x0B#x0C#x0D])?