roulette/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/java.xml

194 lines
6.1 KiB
XML
Raw Normal View History

2023-09-14 22:37:22 +00:00
<lexer>
<config>
<name>Java</name>
<alias>java</alias>
<filename>*.java</filename>
<mime_type>text/x-java</mime_type>
<dot_all>true</dot_all>
</config>
<rules>
<state name="root">
2023-10-30 02:49:49 +00:00
<rule pattern="(^\s*)((?:(?:public|private|protected|static|strictfp)(?:\s+))*)(record)\b">
<bygroups>
<token type="TextWhitespace" />
<usingself state="root" />
<token type="KeywordDeclaration" />
</bygroups>
<push state="class" />
</rule>
2023-09-14 22:37:22 +00:00
<rule pattern="[^\S\n]+">
2023-10-30 02:49:49 +00:00
<token type="TextWhitespace" />
2023-09-14 22:37:22 +00:00
</rule>
2023-10-30 02:49:49 +00:00
<rule pattern="(//.*?)(\n)">
<bygroups>
<token type="CommentSingle" />
<token type="TextWhitespace" />
</bygroups>
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="/\*.*?\*/">
2023-10-30 02:49:49 +00:00
<token type="CommentMultiline" />
2023-09-14 22:37:22 +00:00
</rule>
2023-10-30 02:49:49 +00:00
<rule
pattern="(assert|break|case|catch|continue|default|do|else|finally|for|if|goto|instanceof|new|return|switch|this|throw|try|while)\b">
<token type="Keyword" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="((?:(?:[^\W\d]|\$)[\w.\[\]$&lt;&gt;]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()">
<bygroups>
2023-10-30 02:49:49 +00:00
<usingself state="root" />
<token type="NameFunction" />
<token type="TextWhitespace" />
<token type="Punctuation" />
2023-09-14 22:37:22 +00:00
</bygroups>
</rule>
<rule pattern="@[^\W\d][\w.]*">
2023-10-30 02:49:49 +00:00
<token type="NameDecorator" />
2023-09-14 22:37:22 +00:00
</rule>
2023-10-30 02:49:49 +00:00
<rule
pattern="(abstract|const|enum|extends|final|implements|native|private|protected|public|sealed|static|strictfp|super|synchronized|throws|transient|volatile|yield)\b">
<token type="KeywordDeclaration" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="(boolean|byte|char|double|float|int|long|short|void)\b">
2023-10-30 02:49:49 +00:00
<token type="KeywordType" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="(package)(\s+)">
<bygroups>
2023-10-30 02:49:49 +00:00
<token type="KeywordNamespace" />
<token type="TextWhitespace" />
2023-09-14 22:37:22 +00:00
</bygroups>
2023-10-30 02:49:49 +00:00
<push state="import" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="(true|false|null)\b">
2023-10-30 02:49:49 +00:00
<token type="KeywordConstant" />
</rule>
<rule pattern="(class|interface)\b">
<token type="KeywordDeclaration" />
<push state="class" />
2023-09-14 22:37:22 +00:00
</rule>
2023-10-30 02:49:49 +00:00
<rule pattern="(var)(\s+)">
2023-09-14 22:37:22 +00:00
<bygroups>
2023-10-30 02:49:49 +00:00
<token type="KeywordDeclaration" />
<token type="TextWhitespace" />
2023-09-14 22:37:22 +00:00
</bygroups>
2023-10-30 02:49:49 +00:00
<push state="var" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="(import(?:\s+static)?)(\s+)">
<bygroups>
2023-10-30 02:49:49 +00:00
<token type="KeywordNamespace" />
<token type="TextWhitespace" />
2023-09-14 22:37:22 +00:00
</bygroups>
2023-10-30 02:49:49 +00:00
<push state="import" />
2023-09-14 22:37:22 +00:00
</rule>
2023-10-30 02:49:49 +00:00
<rule pattern="&quot;&quot;&quot;\n">
<token type="LiteralString" />
<push state="multiline_string" />
2023-09-14 22:37:22 +00:00
</rule>
2023-10-30 02:49:49 +00:00
<rule pattern="&quot;">
<token type="LiteralString" />
<push state="string" />
2023-09-14 22:37:22 +00:00
</rule>
2023-10-30 02:49:49 +00:00
<rule pattern="&#x27;\\.&#x27;|&#x27;[^\\]&#x27;|&#x27;\\u[0-9a-fA-F]{4}&#x27;">
<token type="LiteralStringChar" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="(\.)((?:[^\W\d]|\$)[\w$]*)">
<bygroups>
2023-10-30 02:49:49 +00:00
<token type="Punctuation" />
<token type="NameAttribute" />
</bygroups>
</rule>
<rule pattern="^(\s*)(default)(:)">
<bygroups>
<token type="TextWhitespace" />
<token type="Keyword" />
<token type="Punctuation" />
2023-09-14 22:37:22 +00:00
</bygroups>
</rule>
2023-10-30 02:49:49 +00:00
<rule pattern="^(\s*)((?:[^\W\d]|\$)[\w$]*)(:)">
<bygroups>
<token type="TextWhitespace" />
<token type="NameLabel" />
<token type="Punctuation" />
</bygroups>
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="([^\W\d]|\$)[\w$]*">
2023-10-30 02:49:49 +00:00
<token type="Name" />
2023-09-14 22:37:22 +00:00
</rule>
2023-10-30 02:49:49 +00:00
<rule
pattern="([0-9][0-9_]*\.([0-9][0-9_]*)?|\.[0-9][0-9_]*)([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)[pP][+\-]?[0-9][0-9_]*[fFdD]?">
<token type="LiteralNumberFloat" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?">
2023-10-30 02:49:49 +00:00
<token type="LiteralNumberHex" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="0[bB][01][01_]*[lL]?">
2023-10-30 02:49:49 +00:00
<token type="LiteralNumberBin" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="0[0-7_]+[lL]?">
2023-10-30 02:49:49 +00:00
<token type="LiteralNumberOct" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="0|[1-9][0-9_]*[lL]?">
2023-10-30 02:49:49 +00:00
<token type="LiteralNumberInteger" />
2023-09-14 22:37:22 +00:00
</rule>
2023-10-30 02:49:49 +00:00
<rule pattern="[~^*!%&amp;\[\]&lt;&gt;|+=/?-]">
<token type="Operator" />
</rule>
<rule pattern="[{}();:.,]">
<token type="Punctuation" />
2023-09-14 22:37:22 +00:00
</rule>
<rule pattern="\n">
2023-10-30 02:49:49 +00:00
<token type="TextWhitespace" />
</rule>
</state>
<state name="class">
<rule pattern="\s+">
<token type="Text" />
</rule>
<rule pattern="([^\W\d]|\$)[\w$]*">
<token type="NameClass" />
<pop depth="1" />
</rule>
</state>
<state name="var">
<rule pattern="([^\W\d]|\$)[\w$]*">
<token type="Name" />
<pop depth="1" />
</rule>
</state>
<state name="import">
<rule pattern="[\w.]+\*?">
<token type="NameNamespace" />
<pop depth="1" />
</rule>
</state>
<state name="multiline_string">
<rule pattern="&quot;&quot;&quot;">
<token type="LiteralString" />
<pop depth="1" />
</rule>
<rule pattern="&quot;">
<token type="LiteralString" />
</rule>
<rule>
<include state="string" />
</rule>
</state>
<state name="string">
<rule pattern="[^\\&quot;]+">
<token type="LiteralString" />
</rule>
<rule pattern="\\\\">
<token type="LiteralString" />
</rule>
<rule pattern="\\&quot;">
<token type="LiteralString" />
</rule>
<rule pattern="\\">
<token type="LiteralString" />
</rule>
<rule pattern="&quot;">
<token type="LiteralString" />
<pop depth="1" />
2023-09-14 22:37:22 +00:00
</rule>
</state>
</rules>
</lexer>