mirror of
https://github.com/cheat/cheat.git
synced 2024-12-25 14:09:44 +01:00
1790aec85d
Bump `alecthomas/chroma` to `v2`: https://github.com/cheat/cheat/issues/735
120 lines
3.9 KiB
XML
120 lines
3.9 KiB
XML
<lexer>
|
|
<config>
|
|
<name>Mako</name>
|
|
<alias>mako</alias>
|
|
<filename>*.mao</filename>
|
|
<mime_type>application/x-mako</mime_type>
|
|
</config>
|
|
<rules>
|
|
<state name="root">
|
|
<rule pattern="(\s*)(%)(\s*end(?:\w+))(\n|\Z)">
|
|
<bygroups>
|
|
<token type="Text"/>
|
|
<token type="CommentPreproc"/>
|
|
<token type="Keyword"/>
|
|
<token type="Other"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="(\s*)(%)([^\n]*)(\n|\Z)">
|
|
<bygroups>
|
|
<token type="Text"/>
|
|
<token type="CommentPreproc"/>
|
|
<using lexer="Python"/>
|
|
<token type="Other"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="(\s*)(##[^\n]*)(\n|\Z)">
|
|
<bygroups>
|
|
<token type="Text"/>
|
|
<token type="CommentPreproc"/>
|
|
<token type="Other"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="(?s)<%doc>.*?</%doc>">
|
|
<token type="CommentPreproc"/>
|
|
</rule>
|
|
<rule pattern="(<%)([\w.:]+)">
|
|
<bygroups>
|
|
<token type="CommentPreproc"/>
|
|
<token type="NameBuiltin"/>
|
|
</bygroups>
|
|
<push state="tag"/>
|
|
</rule>
|
|
<rule pattern="(</%)([\w.:]+)(>)">
|
|
<bygroups>
|
|
<token type="CommentPreproc"/>
|
|
<token type="NameBuiltin"/>
|
|
<token type="CommentPreproc"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="<%(?=([\w.:]+))">
|
|
<token type="CommentPreproc"/>
|
|
<push state="ondeftags"/>
|
|
</rule>
|
|
<rule pattern="(<%(?:!?))(.*?)(%>)(?s)">
|
|
<bygroups>
|
|
<token type="CommentPreproc"/>
|
|
<using lexer="Python"/>
|
|
<token type="CommentPreproc"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="(\$\{)(.*?)(\})">
|
|
<bygroups>
|
|
<token type="CommentPreproc"/>
|
|
<using lexer="Python"/>
|
|
<token type="CommentPreproc"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="(?sx)
 (.+?) # anything, followed by:
 (?:
 (?<=\n)(?=%|\#\#) | # an eval or comment line
 (?=\#\*) | # multiline comment
 (?=</?%) | # a python block
 # call start or end
 (?=\$\{) | # a substitution
 (?<=\n)(?=\s*%) |
 # - don't consume
 (\\\n) | # an escaped newline
 \Z # end of string
 )
 ">
|
|
<bygroups>
|
|
<token type="Other"/>
|
|
<token type="Operator"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="\s+">
|
|
<token type="Text"/>
|
|
</rule>
|
|
</state>
|
|
<state name="ondeftags">
|
|
<rule pattern="<%">
|
|
<token type="CommentPreproc"/>
|
|
</rule>
|
|
<rule pattern="(?<=<%)(include|inherit|namespace|page)">
|
|
<token type="NameBuiltin"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="tag"/>
|
|
</rule>
|
|
</state>
|
|
<state name="tag">
|
|
<rule pattern="((?:\w+)\s*=)(\s*)(".*?")">
|
|
<bygroups>
|
|
<token type="NameAttribute"/>
|
|
<token type="Text"/>
|
|
<token type="LiteralString"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="/?\s*>">
|
|
<token type="CommentPreproc"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule pattern="\s+">
|
|
<token type="Text"/>
|
|
</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>
|
|
</rules>
|
|
</lexer> |