start top { element* } element { comment | doctype | tag | entity | text } comment="comment" { "" _)* "-->" } doctype="meta" { ("" _)* ">" } context tag { openTag (asTag("/>") | &selfClosing asTag(">") | asTag(">") element* (~"") } asTag(value)="tag" { value } attribute { attributeName spaceChar* ("=" spaceChar* attributeValue)? spaceChar* } attributeValue="string" { "\"" (!"\"" _)* "\"" | "'" (!"'" _)* "'" | (!(spaceChar | ">") .)* } entity="atom" { "&" (!(";" | spaceChar) .)* ";" } text { "\n" | (!("&" | "<") .)+ } tagName="tag" { wordChar+ } attributeName="attribute" { wordChar+ } wordChar { "a"-"z" | "A"-"Z" | "-" | "." | "0"-"9" | "_" } spaceChar { "\n" | "\t" | " " }