Skip to content

Commit bca64f1

Browse files
committed
Initial commit
0 parents  commit bca64f1

File tree

3 files changed

+390
-0
lines changed

3 files changed

+390
-0
lines changed

README.rst

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
================================================
2+
Sublime Text Java Bytecode (Syntax highlighting)
3+
================================================
4+
5+
6+
This is a package for introducing Java bytecode syntax highlighting to the `SublimeText <http://www.sublimetext.com/>`_
7+
editor (*ST2/ST3*).
8+
9+
Currently supported:
10+
11+
- Javap output
12+
- JBE class editor output
13+
14+
15+
Javap (Java class file disassembler)
16+
**************************************
17+
18+
.. image:: http://i.imgur.com/QbtbKpg.png
19+
20+
21+
JBE(Java class file editor)
22+
*****************************************
23+
.. image:: http://i.imgur.com/uAXOxfy.png
24+
25+
26+
Version
27+
=======
28+
1.0.1
29+
30+
31+
Installation
32+
=============
33+
34+
35+
#. Having installed `Package Control <https://packagecontrol.io/installation>`_ access the ``Command Pallete`` (`Ctrl+Shift+P`), select ``Install package`` and then select ``Java Bytecode``.
36+
37+
#. In the bottom right corner click and select **Java Bytecode > Default** (or `Custom` if you've set up a custom color scheme)
38+
39+
40+
*Alternatively* if you have not installed Package control (which I highly recommend):
41+
42+
#. Go to **Preferences | Browse packages...**
43+
#. While inside the **Packages** directory, clone the theme repository using the command below:
44+
45+
``git clone https://github.com/xdrop/Java-Bytecode.git "Java Bytecode"``
46+
47+
48+
49+
50+
Custom syntax highlighting
51+
===========================
52+
The package comes with support for custom syntax highlighting by including the following custom scopes:
53+
54+
* ``return`` and similar keywords
55+
* ``new`` keyword
56+
* ``getfield/putfield`` and similar field accessors
57+
* ``astore`` and similar local field storing
58+
* ``aload`` and similar local field loaders
59+
* calls to ``invoke...``
60+
* ``nop``
61+
* java keywords used by javap
62+
* list of all bytecode instructions
63+
64+
**(!)** To use custom syntax coloring you need to edit the theme you use to provide support for these custom scopes.
65+
66+
Instructions
67+
************
68+
#. Obtain the ``.tmTheme`` file of the color scheme you are using and wish to edit
69+
#. Open it in a text editor
70+
#. Get the ``addedscopes.xml`` file from this package directory
71+
#. Locate the ``</array>`` closing tag and copy the contents of ``addedscopes.xml`` **before** it.
72+
#. Load your new ``.tmTheme`` file into `tmTheme Editor <https://github.com/aziz/tmTheme-Editor>`_ and customize it to your needs.
73+
#. Download it and add it to your packages directory.
74+
#. Go to **Preferences | Color Scheme** and select it.
75+
#. Set **Java Bytecode | Custom highlighting** as your language.
76+
77+
78+
License:
79+
*********
80+
81+
Copyright (c) 2015 xdrop
82+
83+
84+
Permission is hereby granted, free of charge, to any person obtaining a copy
85+
of this software and associated documentation files (the "Software"), to deal
86+
in the Software without restriction, including without limitation the rights
87+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
88+
copies of the Software, and to permit persons to whom the Software is
89+
furnished to do so, subject to the following conditions:
90+
91+
92+
The above copyright notice and this permission notice shall be included in
93+
all copies or substantial portions of the Software.
94+
95+
96+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
97+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
98+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
99+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
100+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
101+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
102+
THE SOFTWARE.

java-bytecode-custom.tmLanguage

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>fileTypes</key>
6+
<array>
7+
<string></string>
8+
</array>
9+
<key>name</key>
10+
<string>Custom highlighting</string>
11+
<key>patterns</key>
12+
<array>
13+
<dict>
14+
<key>match</key>
15+
<string>\b(new|newarray)\b</string>
16+
<key>name</key>
17+
<string>bytecode.new</string>
18+
</dict>
19+
<dict>
20+
<key>match</key>
21+
<string>\b(anewarray|arraylength|athrow|bipush|breakpoint|checkcast|d2f|d2i|d2l|dadd|dcmpg|dcmpl|ddiv|dmul|dneg|drem|dsub|dup|dup2|dup2_x1|dup2_x2|dup_x1|dup_x2|f2d|f2i|f2l|fadd|fcmpg|fcmpl|fdiv|fmul|fneg|frem|fsub|goto|goto_w|i2b|i2c|i2d|i2f|i2l|i2s|iadd|iand|idiv|if_acmpeq|if_acmpne|if_icmpeq|if_icmpge|if_icmpgt|if_icmple|if_icmplt|if_icmpne|ifeq|ifge|ifgt|ifle|iflt|ifne|ifnonnull|ifnull|iinc|impdep1|impdep2|imul|ineg|instanceof|ior|irem|ishl|ishr|isub|iushr|ixor|jsr|jsr_w|l2d|l2f|l2i|ladd|land|lcmp|ldc|ldc_w|ldc2_w|ldiv|lmul|lneg|lookupswitch|lor|lrem|lshl|lshr|lsub|lushr|lxor|monitorenter|monitorexit|multianewarray|pop|pop2|sipush|swap|tableswitch|wide)\b</string>
22+
<key>name</key>
23+
<string>keyword</string>
24+
</dict>
25+
<dict>
26+
<key>match</key>
27+
<string>\b(class|private|public|protected|static|void|int|double|float|byte|char|abstract|interface|short)\b</string>
28+
<key>name</key>
29+
<string>bytecode.javakeyword</string>
30+
</dict>
31+
<dict>
32+
<key>match</key>
33+
<string>\b(areturn|return|dreturn|freturn|ireturn|lreturn|ret)\b</string>
34+
<key>name</key>
35+
<string>bytecode.return</string>
36+
</dict>
37+
<dict>
38+
<key>match</key>
39+
<string>\b(getfield|getstatic|putfield|putstatic)\b</string>
40+
<key>name</key>
41+
<string>bytecode.fieldaccessor</string>
42+
</dict>
43+
<dict>
44+
<key>match</key>
45+
<string>\b(aastore|bastore|castore|dastore|fastore|iastore|lastore|sastore|astore(?:_\d)?|dstore(?:_\d)?|istore(?:_\d)?|lstore(?:_\d)?|fstore(?:_\d)?)\b</string>
46+
<key>name</key>
47+
<string>bytecode.fieldstore</string>
48+
</dict>
49+
<dict>
50+
<key>match</key>
51+
<string>\b(iconst_m1|aconst_null|iconst_\d|lconst_\d|fconst_\d|dconst_\d)\b</string>
52+
<key>name</key>
53+
<string>bytecode.constant</string>
54+
</dict>
55+
<dict>
56+
<key>match</key>
57+
<string>\b(aaload|baload|caload|daload|faload|fload(?:_\d)?|iaload|laload|saload|lload(?:_\d)?|iload(?:_\d)?|dload(?:_\d)?|aload(?:_\d)?)\b</string>
58+
<key>name</key>
59+
<string>bytecode.load</string>
60+
</dict>
61+
<dict>
62+
<key>match</key>
63+
<string>\b(invokeinterface|invokespecial|invokestatic|invokevirtual)\b</string>
64+
<key>name</key>
65+
<string>bytecode.invoke</string>
66+
</dict>
67+
<dict>
68+
<key>match</key>
69+
<string>Code(?::)</string>
70+
<key>name</key>
71+
<string>comment.code</string>
72+
</dict>
73+
<dict>
74+
<key>match</key>
75+
<string>nop</string>
76+
<key>name</key>
77+
<string>bytecode.nop</string>
78+
</dict>
79+
<dict>
80+
<key>match</key>
81+
<string>\d+(:)</string>
82+
<key>name</key>
83+
<string>bytecode.linenumber</string>
84+
</dict>
85+
<dict>
86+
<key>match</key>
87+
<string>//.*$</string>
88+
<key>name</key>
89+
<string>comment.ordinary</string>
90+
</dict>
91+
<dict>
92+
<key>match</key>
93+
<string>\b(\d+|#\d+)\b</string>
94+
<key>name</key>
95+
<string>bytecode.opcodearg</string>
96+
</dict>
97+
<dict>
98+
<key>captures</key>
99+
<dict>
100+
<key>1</key>
101+
<dict>
102+
<key>name</key>
103+
<string>bytecode.functionname</string>
104+
</dict>
105+
<key>2</key>
106+
<dict>
107+
<key>name</key>
108+
<string>bytecode.parameter</string>
109+
</dict>
110+
<key>3</key>
111+
<dict>
112+
<key>name</key>
113+
<string>bytecode.returntype</string>
114+
</dict>
115+
</dict>
116+
<key>match</key>
117+
<string>\b(\w+(?:\/\w+)+)(?:\(([\w\/]*);?\))?([^;]*)</string>
118+
<key>name</key>
119+
<string>classmatcher</string>
120+
</dict>
121+
<dict>
122+
<key>begin</key>
123+
<string>\"</string>
124+
<key>end</key>
125+
<string>\"</string>
126+
<key>name</key>
127+
<string>string.quoted.double</string>
128+
<key>patterns</key>
129+
<array>
130+
<dict>
131+
<key>match</key>
132+
<string>\\.</string>
133+
<key>name</key>
134+
<string>constant.character.escape.untitled</string>
135+
</dict>
136+
</array>
137+
</dict>
138+
</array>
139+
<key>scopeName</key>
140+
<string>source.java.bytecode</string>
141+
<key>uuid</key>
142+
<string>63357d86-fa78-4c49-867c-819f38185648</string>
143+
</dict>
144+
</plist>

java-bytecode.tmLanguage

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>fileTypes</key>
6+
<array>
7+
<string>javap</string>
8+
</array>
9+
<key>name</key>
10+
<string>Default</string>
11+
<key>patterns</key>
12+
<array>
13+
<dict>
14+
<key>match</key>
15+
<string>\b(new|newarray)\b</string>
16+
<key>name</key>
17+
<string>support.function</string>
18+
</dict>
19+
<dict>
20+
<key>match</key>
21+
<string>\b(anewarray|arraylength|athrow|bipush|breakpoint|checkcast|d2f|d2i|d2l|dadd|dcmpg|dcmpl|ddiv|dmul|dneg|drem|dsub|dup|dup2|dup2_x1|dup2_x2|dup_x1|dup_x2|f2d|f2i|f2l|fadd|fcmpg|fcmpl|fdiv|fmul|fneg|frem|fsub|goto|goto_w|i2b|i2c|i2d|i2f|i2l|i2s|iadd|iand|idiv|if_acmpeq|if_acmpne|if_icmpeq|if_icmpge|if_icmpgt|if_icmple|if_icmplt|if_icmpne|ifeq|ifge|ifgt|ifle|iflt|ifne|ifnonnull|ifnull|iinc|impdep1|impdep2|imul|ineg|instanceof|ior|irem|ishl|ishr|isub|iushr|ixor|jsr|jsr_w|l2d|l2f|l2i|ladd|land|lcmp|ldc|ldc_w|ldc2_w|ldiv|lmul|lneg|lookupswitch|lor|lrem|lshl|lshr|lsub|lushr|lxor|monitorenter|monitorexit|multianewarray|pop|pop2|sipush|swap|tableswitch|wide)\b</string>
22+
<key>name</key>
23+
<string>keyword</string>
24+
</dict>
25+
<dict>
26+
<key>match</key>
27+
<string>\b(class|private|public|protected|static|void|int|double|float|byte|char|abstract|interface|short)\b</string>
28+
<key>name</key>
29+
<string>keyword.java</string>
30+
</dict>
31+
<dict>
32+
<key>match</key>
33+
<string>\b(areturn|return|dreturn|freturn|ireturn|lreturn|ret)\b</string>
34+
<key>name</key>
35+
<string>storage.type</string>
36+
</dict>
37+
<dict>
38+
<key>match</key>
39+
<string>\b(getfield|getstatic|putfield|putstatic)\b</string>
40+
<key>name</key>
41+
<string>storage.type</string>
42+
</dict>
43+
<dict>
44+
<key>match</key>
45+
<string>\b(aastore|bastore|castore|dastore|fastore|iastore|lastore|sastore|astore(?:_\d)?|dstore(?:_\d)?|istore(?:_\d)?|lstore(?:_\d)?|fstore(?:_\d)?)\b</string>
46+
<key>name</key>
47+
<string>variable.parameter</string>
48+
</dict>
49+
<dict>
50+
<key>match</key>
51+
<string>\b(iconst_m1|aconst_null|iconst_\d|lconst_\d|fconst_\d|dconst_\d)\b</string>
52+
<key>name</key>
53+
<string>constant.language</string>
54+
</dict>
55+
<dict>
56+
<key>match</key>
57+
<string>\b(aaload|baload|caload|daload|faload|fload(?:_\d)?|iaload|laload|saload|lload(?:_\d)?|iload(?:_\d)?|dload(?:_\d)?|aload(?:_\d)?)\b</string>
58+
<key>name</key>
59+
<string>variable.parameter</string>
60+
</dict>
61+
<dict>
62+
<key>match</key>
63+
<string>\b(invokeinterface|invokespecial|invokestatic|invokevirtual)\b</string>
64+
<key>name</key>
65+
<string>entity.name.function</string>
66+
</dict>
67+
<dict>
68+
<key>match</key>
69+
<string>Code(?::)</string>
70+
<key>name</key>
71+
<string>comment.code</string>
72+
</dict>
73+
<dict>
74+
<key>match</key>
75+
<string>nop</string>
76+
<key>name</key>
77+
<string>comment.nop</string>
78+
</dict>
79+
<dict>
80+
<key>match</key>
81+
<string>\d+(:)</string>
82+
<key>name</key>
83+
<string>comment.line</string>
84+
</dict>
85+
<dict>
86+
<key>match</key>
87+
<string>//.*$</string>
88+
<key>name</key>
89+
<string>comment.ordinary</string>
90+
</dict>
91+
<dict>
92+
<key>match</key>
93+
<string>\b(\d+|#\d+)\b</string>
94+
<key>name</key>
95+
<string>argument</string>
96+
</dict>
97+
<dict>
98+
<key>captures</key>
99+
<dict>
100+
<key>1</key>
101+
<dict>
102+
<key>name</key>
103+
<string>support.function</string>
104+
</dict>
105+
<key>2</key>
106+
<dict>
107+
<key>name</key>
108+
<string>variable.parameter</string>
109+
</dict>
110+
<key>3</key>
111+
<dict>
112+
<key>name</key>
113+
<string>entity.other.inherited-class</string>
114+
</dict>
115+
</dict>
116+
<key>match</key>
117+
<string>\b(\w+(?:\/\w+)+)(?:\(([\w\/]*);?\))?([^;]*)</string>
118+
<key>name</key>
119+
<string>classmatcher</string>
120+
</dict>
121+
<dict>
122+
<key>begin</key>
123+
<string>\"</string>
124+
<key>end</key>
125+
<string>\"</string>
126+
<key>name</key>
127+
<string>string.quoted.double</string>
128+
<key>patterns</key>
129+
<array>
130+
<dict>
131+
<key>match</key>
132+
<string>\\.</string>
133+
<key>name</key>
134+
<string>constant.character.escape.untitled</string>
135+
</dict>
136+
</array>
137+
</dict>
138+
</array>
139+
<key>scopeName</key>
140+
<string>source.java.bytecode</string>
141+
<key>uuid</key>
142+
<string>63357d86-fa78-4c49-867c-819f38185648</string>
143+
</dict>
144+
</plist>

0 commit comments

Comments
 (0)