mirror of
https://github.com/cheat/cheat.git
synced 2024-11-27 00:11:36 +01:00
159 lines
4.4 KiB
XML
159 lines
4.4 KiB
XML
|
<lexer>
|
||
|
<config>
|
||
|
<name>HTML</name>
|
||
|
<alias>html</alias>
|
||
|
<filename>*.html</filename>
|
||
|
<filename>*.htm</filename>
|
||
|
<filename>*.xhtml</filename>
|
||
|
<filename>*.xslt</filename>
|
||
|
<mime_type>text/html</mime_type>
|
||
|
<mime_type>application/xhtml+xml</mime_type>
|
||
|
<case_insensitive>true</case_insensitive>
|
||
|
<dot_all>true</dot_all>
|
||
|
<not_multiline>true</not_multiline>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="script-content">
|
||
|
<rule pattern="(<)(\s*)(/)(\s*)(script)(\s*)(>)">
|
||
|
<bygroups>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="NameTag"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Punctuation"/>
|
||
|
</bygroups>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern=".+?(?=<\s*/\s*script\s*>)">
|
||
|
<using lexer="Javascript"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="style-content">
|
||
|
<rule pattern="(<)(\s*)(/)(\s*)(style)(\s*)(>)">
|
||
|
<bygroups>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="NameTag"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Punctuation"/>
|
||
|
</bygroups>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern=".+?(?=<\s*/\s*style\s*>)">
|
||
|
<using lexer="CSS"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="attr">
|
||
|
<rule pattern="".*?"">
|
||
|
<token type="LiteralString"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="'.*?'">
|
||
|
<token type="LiteralString"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="[^\s>]+">
|
||
|
<token type="LiteralString"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="root">
|
||
|
<rule pattern="[^<&]+">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="&\S*?;">
|
||
|
<token type="NameEntity"/>
|
||
|
</rule>
|
||
|
<rule pattern="\<\!\[CDATA\[.*?\]\]\>">
|
||
|
<token type="CommentPreproc"/>
|
||
|
</rule>
|
||
|
<rule pattern="<!--">
|
||
|
<token type="Comment"/>
|
||
|
<push state="comment"/>
|
||
|
</rule>
|
||
|
<rule pattern="<\?.*?\?>">
|
||
|
<token type="CommentPreproc"/>
|
||
|
</rule>
|
||
|
<rule pattern="<![^>]*>">
|
||
|
<token type="CommentPreproc"/>
|
||
|
</rule>
|
||
|
<rule pattern="(<)(\s*)(script)(\s*)">
|
||
|
<bygroups>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="NameTag"/>
|
||
|
<token type="Text"/>
|
||
|
</bygroups>
|
||
|
<push state="script-content" state="tag"/>
|
||
|
</rule>
|
||
|
<rule pattern="(<)(\s*)(style)(\s*)">
|
||
|
<bygroups>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="NameTag"/>
|
||
|
<token type="Text"/>
|
||
|
</bygroups>
|
||
|
<push state="style-content" state="tag"/>
|
||
|
</rule>
|
||
|
<rule pattern="(<)(\s*)([\w:.-]+)">
|
||
|
<bygroups>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="NameTag"/>
|
||
|
</bygroups>
|
||
|
<push state="tag"/>
|
||
|
</rule>
|
||
|
<rule pattern="(<)(\s*)(/)(\s*)([\w:.-]+)(\s*)(>)">
|
||
|
<bygroups>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="NameTag"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Punctuation"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="comment">
|
||
|
<rule pattern="[^-]+">
|
||
|
<token type="Comment"/>
|
||
|
</rule>
|
||
|
<rule pattern="-->">
|
||
|
<token type="Comment"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
<rule pattern="-">
|
||
|
<token type="Comment"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="tag">
|
||
|
<rule pattern="\s+">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="([\w:-]+\s*)(=)(\s*)">
|
||
|
<bygroups>
|
||
|
<token type="NameAttribute"/>
|
||
|
<token type="Operator"/>
|
||
|
<token type="Text"/>
|
||
|
</bygroups>
|
||
|
<push state="attr"/>
|
||
|
</rule>
|
||
|
<rule pattern="[\w:-]+">
|
||
|
<token type="NameAttribute"/>
|
||
|
</rule>
|
||
|
<rule pattern="(/?)(\s*)(>)">
|
||
|
<bygroups>
|
||
|
<token type="Punctuation"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Punctuation"/>
|
||
|
</bygroups>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|