cheat/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/perl.xml

400 lines
14 KiB
XML
Raw Normal View History

<lexer>
<config>
<name>Perl</name>
<alias>perl</alias>
<alias>pl</alias>
<filename>*.pl</filename>
<filename>*.pm</filename>
<filename>*.t</filename>
<mime_type>text/x-perl</mime_type>
<mime_type>application/x-perl</mime_type>
<dot_all>true</dot_all>
</config>
<rules>
<state name="root">
<rule pattern="\A\#!.+?$">
<token type="CommentHashbang"/>
</rule>
<rule pattern="\#.*?$">
<token type="CommentSingle"/>
</rule>
<rule pattern="^=[a-zA-Z0-9]+\s+.*?\n=cut">
<token type="CommentMultiline"/>
</rule>
<rule pattern="(continue|foreach|unless|return|elsif|CHECK|while|BEGIN|reset|print|until|next|else|INIT|then|last|redo|case|our|new|for|END|if|do|my)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(format)(\s+)(\w+)(\s*)(=)(\s*\n)">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
<token type="Name"/>
<token type="Text"/>
<token type="Punctuation"/>
<token type="Text"/>
</bygroups>
<push state="format"/>
</rule>
<rule pattern="(eq|lt|gt|le|ge|ne|not|and|or|cmp)\b">
<token type="OperatorWord"/>
</rule>
<rule pattern="s/(\\\\|\\[^\\]|[^\\/])*/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*">
<token type="LiteralStringRegex"/>
</rule>
<rule pattern="s!(\\\\|\\!|[^!])*!(\\\\|\\!|[^!])*![egimosx]*">
<token type="LiteralStringRegex"/>
</rule>
<rule pattern="s\\(\\\\|[^\\])*\\(\\\\|[^\\])*\\[egimosx]*">
<token type="LiteralStringRegex"/>
</rule>
<rule pattern="s@(\\\\|\\[^\\]|[^\\@])*@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*">
<token type="LiteralStringRegex"/>
</rule>
<rule pattern="s%(\\\\|\\[^\\]|[^\\%])*%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*">
<token type="LiteralStringRegex"/>
</rule>
<rule pattern="s\{(\\\\|\\[^\\]|[^\\}])*\}\s*">
<token type="LiteralStringRegex"/>
<push state="balanced-regex"/>
</rule>
<rule pattern="s&lt;(\\\\|\\[^\\]|[^\\&gt;])*&gt;\s*">
<token type="LiteralStringRegex"/>
<push state="balanced-regex"/>
</rule>
<rule pattern="s\[(\\\\|\\[^\\]|[^\\\]])*\]\s*">
<token type="LiteralStringRegex"/>
<push state="balanced-regex"/>
</rule>
<rule pattern="s\((\\\\|\\[^\\]|[^\\)])*\)\s*">
<token type="LiteralStringRegex"/>
<push state="balanced-regex"/>
</rule>
<rule pattern="m?/(\\\\|\\[^\\]|[^\\/\n])*/[gcimosx]*">
<token type="LiteralStringRegex"/>
</rule>
<rule pattern="m(?=[/!\\{&lt;\[(@%$])">
<token type="LiteralStringRegex"/>
<push state="balanced-regex"/>
</rule>
<rule pattern="((?&lt;==~)|(?&lt;=\())\s*/(\\\\|\\[^\\]|[^\\/])*/[gcimosx]*">
<token type="LiteralStringRegex"/>
</rule>
<rule pattern="\s+">
<token type="Text"/>
</rule>
<rule pattern="(getprotobynumber|getprotobyname|getservbyport|getservbyname|gethostbyname|gethostbyaddr|getnetbyaddr|getnetbyname|setprotoent|setpriority|getsockname|getprotoent|getpriority|getpeername|endprotoent|setsockopt|endhostent|setservent|socketpair|getsockopt|endservent|sethostent|getservent|gethostent|getnetent|wantarray|localtime|quotemeta|setnetent|prototype|endnetent|rewinddir|endpwent|endgrent|getpwent|getpwnam|getgrgid|dbmclose|continue|closedir|shutdown|setpwent|shmwrite|syswrite|truncate|formline|setgrent|getgrent|readpipe|getgrnam|readlink|readline|getpwuid|getlogin|telldir|opendir|shmread|readdir|getpgrp|getppid|waitpid|binmode|reverse|sprintf|unshift|symlink|seekdir|sysopen|defined|dbmopen|sysread|sysseek|connect|lcfirst|ucfirst|setpgrp|syscall|import|chroot|system|gmtime|unlink|unpack|semget|semctl|select|msgrcv|length|printf|listen|scalar|caller|rindex|substr|splice|rename|msgctl|msgget|delete|msgsnd|exists|values|socket|fileno|format|accept|shmget|shmctl|ioctl|alarm|atan2|utime|untie|bless|chdir|chmod|undef|umask|chomp|times|close|crypt|srand|split|mkdir|sleep|lstat|study|rmdir|local|fcntl|flock|write|shift|index|semop|chown|tell|join|send|warn|kill|wait|grep|glob|bind|last|pack|getc|fork|link|seek|push|rand|read|exit|sort|exec|open|eval|sqrt|redo|stat|chop|next|each|dump|time|recv|tied|goto|keys|pipe|map|tie|cos|die|eof|pop|sin|pos|oct|ref|exp|int|ord|log|our|hex|abs|vec|chr|uc|tr|my|lc)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b">
<token type="NameBuiltinPseudo"/>
</rule>
<rule pattern="(&lt;&lt;)([\&#39;&#34;]?)([a-zA-Z_]\w*)(\2;?\n.*?\n)(\3)(\n)">
<bygroups>
<token type="LiteralString"/>
<token type="LiteralString"/>
<token type="LiteralStringDelimiter"/>
<token type="LiteralString"/>
<token type="LiteralStringDelimiter"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="__END__">
<token type="CommentPreproc"/>
<push state="end-part"/>
</rule>
<rule pattern="\$\^[ADEFHILMOPSTWX]">
<token type="NameVariableGlobal"/>
</rule>
<rule pattern="\$[\\\&#34;\[\]&#39;&amp;`+*.,;=%~?@$!&lt;&gt;(^|/-](?!\w)">
<token type="NameVariableGlobal"/>
</rule>
<rule pattern="[$@%#]+">
<token type="NameVariable"/>
<push state="varname"/>
</rule>
<rule pattern="0_?[0-7]+(_[0-7]+)*">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="0b[01]+(_[01]+)*">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="\d+(_\d+)*">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="&#39;(\\\\|\\[^\\]|[^&#39;\\])*&#39;">
<token type="LiteralString"/>
</rule>
<rule pattern="&#34;(\\\\|\\[^\\]|[^&#34;\\])*&#34;">
<token type="LiteralString"/>
</rule>
<rule pattern="`(\\\\|\\[^\\]|[^`\\])*`">
<token type="LiteralStringBacktick"/>
</rule>
<rule pattern="&lt;([^\s&gt;]+)&gt;">
<token type="LiteralStringRegex"/>
</rule>
<rule pattern="(q|qq|qw|qr|qx)\{">
<token type="LiteralStringOther"/>
<push state="cb-string"/>
</rule>
<rule pattern="(q|qq|qw|qr|qx)\(">
<token type="LiteralStringOther"/>
<push state="rb-string"/>
</rule>
<rule pattern="(q|qq|qw|qr|qx)\[">
<token type="LiteralStringOther"/>
<push state="sb-string"/>
</rule>
<rule pattern="(q|qq|qw|qr|qx)\&lt;">
<token type="LiteralStringOther"/>
<push state="lt-string"/>
</rule>
<rule pattern="(q|qq|qw|qr|qx)([\W_])(.|\n)*?\2">
<token type="LiteralStringOther"/>
</rule>
<rule pattern="(package)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
<token type="NameNamespace"/>
</bygroups>
</rule>
<rule pattern="(use|require|no)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
<token type="NameNamespace"/>
</bygroups>
</rule>
<rule pattern="(sub)(\s+)">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
</bygroups>
<push state="funcname"/>
</rule>
<rule pattern="(package|require|use|no)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(\[\]|\*\*|::|&lt;&lt;|&gt;&gt;|&gt;=|&lt;=&gt;|&lt;=|={3}|!=|=~|!~|&amp;&amp;?|\|\||\.{1,3})">
<token type="Operator"/>
</rule>
<rule pattern="[-+/*%=&lt;&gt;&amp;^|!\\~]=?">
<token type="Operator"/>
</rule>
<rule pattern="[()\[\]:;,&lt;&gt;/?{}]">
<token type="Punctuation"/>
</rule>
<rule pattern="(?=\w)">
<token type="Name"/>
<push state="name"/>
</rule>
</state>
<state name="cb-string">
<rule pattern="\\[{}\\]">
<token type="LiteralStringOther"/>
</rule>
<rule pattern="\\">
<token type="LiteralStringOther"/>
</rule>
<rule pattern="\{">
<token type="LiteralStringOther"/>
<push state="cb-string"/>
</rule>
<rule pattern="\}">
<token type="LiteralStringOther"/>
<pop depth="1"/>
</rule>
<rule pattern="[^{}\\]+">
<token type="LiteralStringOther"/>
</rule>
</state>
<state name="balanced-regex">
<rule pattern="/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
<rule pattern="!(\\\\|\\[^\\]|[^\\!])*![egimosx]*">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
<rule pattern="\\(\\\\|[^\\])*\\[egimosx]*">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
<rule pattern="\{(\\\\|\\[^\\]|[^\\}])*\}[egimosx]*">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
<rule pattern="&lt;(\\\\|\\[^\\]|[^\\&gt;])*&gt;[egimosx]*">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
<rule pattern="\[(\\\\|\\[^\\]|[^\\\]])*\][egimosx]*">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
<rule pattern="\((\\\\|\\[^\\]|[^\\)])*\)[egimosx]*">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
<rule pattern="@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
<rule pattern="%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
<rule pattern="\$(\\\\|\\[^\\]|[^\\$])*\$[egimosx]*">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
</rule>
</state>
<state name="lt-string">
<rule pattern="\\[&lt;&gt;\\]">
<token type="LiteralStringOther"/>
</rule>
<rule pattern="\\">
<token type="LiteralStringOther"/>
</rule>
<rule pattern="\&lt;">
<token type="LiteralStringOther"/>
<push state="lt-string"/>
</rule>
<rule pattern="\&gt;">
<token type="LiteralStringOther"/>
<pop depth="1"/>
</rule>
<rule pattern="[^&lt;&gt;]+">
<token type="LiteralStringOther"/>
</rule>
</state>
<state name="format">
<rule pattern="\.\n">
<token type="LiteralStringInterpol"/>
<pop depth="1"/>
</rule>
<rule pattern="[^\n]*\n">
<token type="LiteralStringInterpol"/>
</rule>
</state>
<state name="funcname">
<rule pattern="[a-zA-Z_]\w*[!?]?">
<token type="NameFunction"/>
</rule>
<rule pattern="\s+">
<token type="Text"/>
</rule>
<rule pattern="(\([$@%]*\))(\s*)">
<bygroups>
<token type="Punctuation"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern=";">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
<rule pattern=".*?\{">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
</state>
<state name="end-part">
<rule pattern=".+">
<token type="CommentPreproc"/>
<pop depth="1"/>
</rule>
</state>
<state name="varname">
<rule pattern="\s+">
<token type="Text"/>
</rule>
<rule pattern="\{">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
<rule pattern="\)|,">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
<rule pattern="\w+::">
<token type="NameNamespace"/>
</rule>
<rule pattern="[\w:]+">
<token type="NameVariable"/>
<pop depth="1"/>
</rule>
</state>
<state name="name">
<rule pattern="[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*(::)?(?=\s*-&gt;)">
<token type="NameNamespace"/>
<pop depth="1"/>
</rule>
<rule pattern="[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*::">
<token type="NameNamespace"/>
<pop depth="1"/>
</rule>
<rule pattern="[\w:]+">
<token type="Name"/>
<pop depth="1"/>
</rule>
<rule pattern="[A-Z_]+(?=\W)">
<token type="NameConstant"/>
<pop depth="1"/>
</rule>
<rule pattern="(?=\W)">
<token type="Text"/>
<pop depth="1"/>
</rule>
</state>
<state name="rb-string">
<rule pattern="\\[()\\]">
<token type="LiteralStringOther"/>
</rule>
<rule pattern="\\">
<token type="LiteralStringOther"/>
</rule>
<rule pattern="\(">
<token type="LiteralStringOther"/>
<push state="rb-string"/>
</rule>
<rule pattern="\)">
<token type="LiteralStringOther"/>
<pop depth="1"/>
</rule>
<rule pattern="[^()]+">
<token type="LiteralStringOther"/>
</rule>
</state>
<state name="sb-string">
<rule pattern="\\[\[\]\\]">
<token type="LiteralStringOther"/>
</rule>
<rule pattern="\\">
<token type="LiteralStringOther"/>
</rule>
<rule pattern="\[">
<token type="LiteralStringOther"/>
<push state="sb-string"/>
</rule>
<rule pattern="\]">
<token type="LiteralStringOther"/>
<pop depth="1"/>
</rule>
<rule pattern="[^\[\]]+">
<token type="LiteralStringOther"/>
</rule>
</state>
</rules>
</lexer>