1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-15 13:33:12 +02:00
chroma/lexers/embedded/cheetah.xml
Alec Thomas 40542a6255 refactor: migrate a bunch more Go-based lexers to XML
Also rename some existing XML lexers to their canonical XML name.
2023-09-09 12:29:23 +10:00

55 lines
1.7 KiB
XML

<lexer>
<config>
<name>Cheetah</name>
<alias>cheetah</alias>
<alias>spitfire</alias>
<filename>*.tmpl</filename>
<filename>*.spt</filename>
<mime_type>application/x-cheetah</mime_type>
<mime_type>application/x-spitfire</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="(##[^\n]*)$">
<bygroups>
<token type="Comment"/>
</bygroups>
</rule>
<rule pattern="#[*](.|\n)*?[*]#">
<token type="Comment"/>
</rule>
<rule pattern="#end[^#\n]*(?:#|$)">
<token type="CommentPreproc"/>
</rule>
<rule pattern="#slurp$">
<token type="CommentPreproc"/>
</rule>
<rule pattern="(#[a-zA-Z]+)([^#\n]*)(#|$)">
<bygroups>
<token type="CommentPreproc"/>
<using lexer="Python"/>
<token type="CommentPreproc"/>
</bygroups>
</rule>
<rule pattern="(\$)([a-zA-Z_][\w.]*\w)">
<bygroups>
<token type="CommentPreproc"/>
<using lexer="Python"/>
</bygroups>
</rule>
<rule pattern="(\$\{!?)(.*?)(\})(?s)">
<bygroups>
<token type="CommentPreproc"/>
<using lexer="Python"/>
<token type="CommentPreproc"/>
</bygroups>
</rule>
<rule pattern="(?sx)&#xA; (.+?) # anything, followed by:&#xA; (?:&#xA; (?=\#[#a-zA-Z]*) | # an eval comment&#xA; (?=\$[a-zA-Z_{]) | # a substitution&#xA; \Z # end of string&#xA; )&#xA; ">
<token type="Other"/>
</rule>
<rule pattern="\s+">
<token type="Text"/>
</rule>
</state>
</rules>
</lexer>