122 lines
4.0 KiB
XML
122 lines
4.0 KiB
XML
|
<lexer>
|
||
|
<config>
|
||
|
<name>Java</name>
|
||
|
<alias>java</alias>
|
||
|
<filename>*.java</filename>
|
||
|
<mime_type>text/x-java</mime_type>
|
||
|
<dot_all>true</dot_all>
|
||
|
<ensure_nl>true</ensure_nl>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="class">
|
||
|
<rule pattern="([^\W\d]|\$)[\w$]*">
|
||
|
<token type="NameClass"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="import">
|
||
|
<rule pattern="[\w.]+\*?">
|
||
|
<token type="NameNamespace"/>
|
||
|
<pop depth="1"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
<state name="root">
|
||
|
<rule pattern="[^\S\n]+">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
<rule pattern="//.*?\n">
|
||
|
<token type="CommentSingle"/>
|
||
|
</rule>
|
||
|
<rule pattern="/\*.*?\*/">
|
||
|
<token type="CommentMultiline"/>
|
||
|
</rule>
|
||
|
<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"/>
|
||
|
</rule>
|
||
|
<rule pattern="((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()">
|
||
|
<bygroups>
|
||
|
<usingself state="root"/>
|
||
|
<token type="NameFunction"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="Operator"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="@[^\W\d][\w.]*">
|
||
|
<token type="NameDecorator"/>
|
||
|
</rule>
|
||
|
<rule pattern="(abstract|const|enum|extends|final|implements|native|private|protected|public|static|strictfp|super|synchronized|throws|transient|volatile)\b">
|
||
|
<token type="KeywordDeclaration"/>
|
||
|
</rule>
|
||
|
<rule pattern="(boolean|byte|char|double|float|int|long|short|void)\b">
|
||
|
<token type="KeywordType"/>
|
||
|
</rule>
|
||
|
<rule pattern="(package)(\s+)">
|
||
|
<bygroups>
|
||
|
<token type="KeywordNamespace"/>
|
||
|
<token type="Text"/>
|
||
|
</bygroups>
|
||
|
<push state="import"/>
|
||
|
</rule>
|
||
|
<rule pattern="(true|false|null)\b">
|
||
|
<token type="KeywordConstant"/>
|
||
|
</rule>
|
||
|
<rule pattern="(class|interface)(\s+)">
|
||
|
<bygroups>
|
||
|
<token type="KeywordDeclaration"/>
|
||
|
<token type="Text"/>
|
||
|
</bygroups>
|
||
|
<push state="class"/>
|
||
|
</rule>
|
||
|
<rule pattern="(import(?:\s+static)?)(\s+)">
|
||
|
<bygroups>
|
||
|
<token type="KeywordNamespace"/>
|
||
|
<token type="Text"/>
|
||
|
</bygroups>
|
||
|
<push state="import"/>
|
||
|
</rule>
|
||
|
<rule pattern=""(\\\\|\\"|[^"])*"">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'">
|
||
|
<token type="LiteralStringChar"/>
|
||
|
</rule>
|
||
|
<rule pattern="\d+[LlUu]*">
|
||
|
<token type="LiteralNumberInteger"/>
|
||
|
</rule>
|
||
|
<rule pattern="(\.)((?:[^\W\d]|\$)[\w$]*)">
|
||
|
<bygroups>
|
||
|
<token type="Operator"/>
|
||
|
<token type="NameAttribute"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="^\s*([^\W\d]|\$)[\w$]*:">
|
||
|
<token type="NameLabel"/>
|
||
|
</rule>
|
||
|
<rule pattern="([^\W\d]|\$)[\w$]*">
|
||
|
<token type="Name"/>
|
||
|
</rule>
|
||
|
<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"/>
|
||
|
</rule>
|
||
|
<rule pattern="0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?">
|
||
|
<token type="LiteralNumberHex"/>
|
||
|
</rule>
|
||
|
<rule pattern="0[bB][01][01_]*[lL]?">
|
||
|
<token type="LiteralNumberBin"/>
|
||
|
</rule>
|
||
|
<rule pattern="0[0-7_]+[lL]?">
|
||
|
<token type="LiteralNumberOct"/>
|
||
|
</rule>
|
||
|
<rule pattern="0|[1-9][0-9_]*[lL]?">
|
||
|
<token type="LiteralNumberInteger"/>
|
||
|
</rule>
|
||
|
<rule pattern="[~^*!%&\[\](){}<>|+=:;,./?-]">
|
||
|
<token type="Operator"/>
|
||
|
</rule>
|
||
|
<rule pattern="\n">
|
||
|
<token type="Text"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|