capacitor-dex-editor 0.0.37 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/AndroidManifest.xml +8 -0
- package/android/src/main/assets/availableSyntax.json +54 -0
- package/android/src/main/assets/c.json +42 -0
- package/android/src/main/assets/colors.json +21 -0
- package/android/src/main/assets/cpp.json +79 -0
- package/android/src/main/assets/dart.json +108 -0
- package/android/src/main/assets/java.json +46 -0
- package/android/src/main/assets/js.json +54 -0
- package/android/src/main/assets/json.json +33 -0
- package/android/src/main/assets/kotlin.json +53 -0
- package/android/src/main/assets/lua.json +54 -0
- package/android/src/main/assets/php.json +69 -0
- package/android/src/main/assets/python.json +87 -0
- package/android/src/main/assets/rust.json +139 -0
- package/android/src/main/assets/smali.json +131 -0
- package/android/src/main/assets/xml.json +96 -0
- package/android/src/main/java/com/aetherlink/dexeditor/DexEditorPluginPlugin.java +67 -0
- package/android/src/main/java/com/aetherlink/dexeditor/DexManager.java +165 -0
- package/android/src/main/java/com/aetherlink/dexeditor/SmaliEditorActivity.java +205 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/EditView.java +4022 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/WordWrapLayout.java +275 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/buffer/BufferCache.java +113 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/buffer/GapBuffer.java +685 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/component/ClipboardPanel.java +1380 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/component/Magnifier.java +363 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/Candidate.java +52 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/CommentDef.java +47 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/LineResult.java +49 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/MHSyntaxHighlightEngine.java +841 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/Rule.java +53 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/highlight/Token.java +48 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/listener/OnTextChangedListener.java +6 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/Pair.java +80 -0
- package/android/src/main/java/com/aetherlink/dexeditor/editor/utils/ScreenUtils.java +63 -0
- package/android/src/main/res/drawable/abc_text_cursor_material.xml +9 -0
- package/android/src/main/res/drawable/abc_text_select_handle_left_mtrl.png +0 -0
- package/android/src/main/res/drawable/abc_text_select_handle_middle_mtrl.png +0 -0
- package/android/src/main/res/drawable/abc_text_select_handle_right_mtrl.png +0 -0
- package/android/src/main/res/drawable/ic_arrow_back.xml +12 -0
- package/android/src/main/res/drawable/ic_copy.xml +11 -0
- package/android/src/main/res/drawable/ic_cut.xml +10 -0
- package/android/src/main/res/drawable/ic_delete.xml +12 -0
- package/android/src/main/res/drawable/ic_edit_white_24dp.xml +10 -0
- package/android/src/main/res/drawable/ic_goto.xml +10 -0
- package/android/src/main/res/drawable/ic_launcher_background.xml +186 -0
- package/android/src/main/res/drawable/ic_look_white_24dp.xml +11 -0
- package/android/src/main/res/drawable/ic_more.xml +10 -0
- package/android/src/main/res/drawable/ic_open_link.xml +11 -0
- package/android/src/main/res/drawable/ic_paste.xml +11 -0
- package/android/src/main/res/drawable/ic_redo_white_24dp.xml +10 -0
- package/android/src/main/res/drawable/ic_select.xml +11 -0
- package/android/src/main/res/drawable/ic_select_all.xml +10 -0
- package/android/src/main/res/drawable/ic_share.xml +11 -0
- package/android/src/main/res/drawable/ic_toggle_comment.xml +12 -0
- package/android/src/main/res/drawable/ic_translate.xml +10 -0
- package/android/src/main/res/drawable/ic_undo_white_24dp.xml +11 -0
- package/android/src/main/res/drawable/magnifier_bg.xml +5 -0
- package/android/src/main/res/drawable/popup_background.xml +8 -0
- package/android/src/main/res/drawable/ripple_effect.xml +9 -0
- package/android/src/main/res/drawable/selection_menu_background.xml +5 -0
- package/android/src/main/res/layout/custom_selection_menu.xml +44 -0
- package/android/src/main/res/layout/expand_button.xml +23 -0
- package/android/src/main/res/layout/item_autocomplete.xml +25 -0
- package/android/src/main/res/layout/magnifier_popup.xml +17 -0
- package/android/src/main/res/layout/menu_item.xml +30 -0
- package/android/src/main/res/layout/text_selection_menu.xml +36 -0
- package/package.json +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": ["Python", ".py"],
|
|
3
|
+
"comment": [
|
|
4
|
+
{ "startsWith": "#" }
|
|
5
|
+
],
|
|
6
|
+
|
|
7
|
+
"rules": [
|
|
8
|
+
// Single-line comments
|
|
9
|
+
{ "type": "comment", "regex": "#.*" },
|
|
10
|
+
|
|
11
|
+
// Multi-line comments (triple double quotes at start of line)
|
|
12
|
+
{
|
|
13
|
+
"regex": "(?m)^\\s*\"\"\"[\\s\\S]*?\"\"\"",
|
|
14
|
+
"groupStyles": { "0": "comment" }
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
// Multi-line comments (triple single quotes at start of line)
|
|
18
|
+
{
|
|
19
|
+
"regex": "(?m)^\\s*'''[\\s\\S]*?'''",
|
|
20
|
+
"groupStyles": { "0": "comment" }
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
// Triple double quoted strings
|
|
24
|
+
{
|
|
25
|
+
"regex": "\"\"\"[\\s\\S]*?\"\"\"",
|
|
26
|
+
"groupStyles": { "0": "string" }
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
// Triple single quoted strings
|
|
30
|
+
{
|
|
31
|
+
"regex": "'''[\\s\\S]*?'''",
|
|
32
|
+
"groupStyles": { "0": "string" }
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
// Double quoted strings
|
|
36
|
+
{
|
|
37
|
+
"regex": "\"(?:\\\\.|[^\"])*\"",
|
|
38
|
+
"groupStyles": { "0": "string" }
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
// Single quoted strings
|
|
42
|
+
{
|
|
43
|
+
"regex": "'(?:\\\\.|[^'])*'",
|
|
44
|
+
"groupStyles": { "0": "string" }
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
// String escape sequences
|
|
48
|
+
{ "type": "strEscape", "regex": "\\\\u[0-9a-fA-F]{4}|\\\\x[0-9a-fA-F]{2}|\\\\[0-7]{1,3}|\\\\." },
|
|
49
|
+
|
|
50
|
+
// Numbers - binary
|
|
51
|
+
{ "type": "number", "regex": "\\b0[bB][01_]+\\b" },
|
|
52
|
+
|
|
53
|
+
// Numbers - octal
|
|
54
|
+
{ "type": "number", "regex": "\\b0[oO][0-7_]+\\b" },
|
|
55
|
+
|
|
56
|
+
// Numbers - hex
|
|
57
|
+
{ "type": "number", "regex": "\\b0[xX][0-9a-fA-F_]+\\b" },
|
|
58
|
+
|
|
59
|
+
// Numbers - decimal with scientific notation and complex
|
|
60
|
+
{ "type": "number", "regex": "\\b\\d[\\d_]*(?:\\.\\d[\\d_]*)?(?:[eE][+-]?\\d[\\d_]*)?[jJ]?\\b" },
|
|
61
|
+
{ "type": "number", "regex": "\\b\\d[\\d_]*[jJ]\\b" },
|
|
62
|
+
|
|
63
|
+
// Built-in types - only match when they are standalone words
|
|
64
|
+
{
|
|
65
|
+
"type": "type",
|
|
66
|
+
"regex": "\\b(?:int|float|long|complex|str|unicode|list|tuple|bytearray|buffer|xrange|set|frozenset|dict|bool)\\b"
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// Keywords - only match when they are standalone words
|
|
70
|
+
{
|
|
71
|
+
"type": "keyword",
|
|
72
|
+
"regex": "\\b(?:True|False|None|self|NotImplemented|Ellipsis|__debug__|__file__|and|del|from|not|while|as|elif|global|or|with|assert|else|if|pass|yield|break|except|import|print|class|exec|in|raise|continue|finally|is|return|def|for|lambda|try)\\b"
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
// Exception and error types - only match when they are standalone words
|
|
76
|
+
{
|
|
77
|
+
"type": "keyword2",
|
|
78
|
+
"regex": "\\b(?:ArithmeticError|AssertionError|AttributeError|BaseException|DeprecationWarning|EnvironmentError|EOFError|Exception|FloatingPointError|FutureWarning|GeneratorExit|IOError|ImportError|ImportWarning|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|NotImplementedError|OSError|OverflowError|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TypeError|UnboundLocalError|UserWarning|UnicodeError|UnicodeWarning|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|Warning|WindowsError|ZeroDivisionError)\\b"
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
// Operators
|
|
82
|
+
{ "type": "operator", "regex": "[+\\-*/%=&|!<>^~]+|\\.|,|;|:|@|\\(|\\)|\\{|\\}|\\[|\\]" },
|
|
83
|
+
|
|
84
|
+
// Default fallback - should be last
|
|
85
|
+
{ "type": "default", "regex": "." }
|
|
86
|
+
]
|
|
87
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": ["Rust", ".rs"],
|
|
3
|
+
"comment": [
|
|
4
|
+
{ "startsWith": "//" },
|
|
5
|
+
{ "startsWith": "//!" },
|
|
6
|
+
{ "startsWith": "/*", "endsWith": "*/" }
|
|
7
|
+
],
|
|
8
|
+
|
|
9
|
+
"rules": [
|
|
10
|
+
// Shebang
|
|
11
|
+
{ "type": "comment", "regex": "^#![^\\[\\r\\n][^\\r\\n]*" },
|
|
12
|
+
|
|
13
|
+
// Doc comments - highlight as constant (must come before regular comments)
|
|
14
|
+
{ "type": "constant", "regex": "\\/\\/\\/.*" },
|
|
15
|
+
{ "type": "constant", "regex": "\\/\\/!.*" },
|
|
16
|
+
{ "type": "constant", "regex": "\\/\\*\\*[\\s\\S]*?\\*\\/" },
|
|
17
|
+
|
|
18
|
+
// Regular comments
|
|
19
|
+
{ "type": "comment", "regex": "\\/\\/.*" },
|
|
20
|
+
{ "type": "comment", "regex": "\\/\\*[\\s\\S]*?\\*\\/" },
|
|
21
|
+
|
|
22
|
+
// TODO comments
|
|
23
|
+
{ "type": "variable", "regex": "\\b(?:TODO|FIXME|XXX|NB|NOTE|SAFETY)\\b" },
|
|
24
|
+
|
|
25
|
+
// Simple inner attributes like #![allow(unused)]
|
|
26
|
+
{ "type": "label", "regex": "#!\\[[^\\]]*\\]" },
|
|
27
|
+
|
|
28
|
+
// Attribute brackets
|
|
29
|
+
{ "type": "label", "regex": "#\\[" },
|
|
30
|
+
{ "type": "label", "regex": "\\]" },
|
|
31
|
+
|
|
32
|
+
// Attribute name (derive, inline, repr, cfg, etc.)
|
|
33
|
+
{ "type": "label", "regex": "(?<=#\\[)\\s*[a-zA-Z_][a-zA-Z0-9_]*" },
|
|
34
|
+
|
|
35
|
+
// Macro variables - $identifier (but not $()
|
|
36
|
+
{ "type": "label", "regex": "\\$[a-zA-Z_][a-zA-Z0-9_]*" },
|
|
37
|
+
|
|
38
|
+
// Macro repetition operators - * + ?
|
|
39
|
+
{ "type": "keyword2", "regex": "(?<!\\.)[*+?](?![/=])" },
|
|
40
|
+
|
|
41
|
+
// Module paths like std::collections, std::fmt
|
|
42
|
+
{ "type": "constant", "regex": "\\b(?:std|core|alloc)::[a-zA-Z_][a-zA-Z0-9_]*(?:::[a-zA-Z_][a-zA-Z0-9_]*)*" },
|
|
43
|
+
|
|
44
|
+
// Method calls - both .method() and Type::method()
|
|
45
|
+
{ "type": "variable", "regex": "(?:(?<=\\.)|(?<=::))[a-zA-Z_][a-zA-Z0-9_]*(?=\\()" },
|
|
46
|
+
|
|
47
|
+
// Standard library types and traits - MUST come before struct names
|
|
48
|
+
{
|
|
49
|
+
"type": "variable",
|
|
50
|
+
"regex": "\\b(?:Send|Sized|Sync|Unpin|Drop|Fn|FnMut|FnOnce|AsMut|AsRef|From|Into|DoubleEndedIterator|ExactSizeIterator|Extend|IntoIterator|Iterator|Clone|Copy|Default|Eq|Ord|PartialEq|PartialOrd|ToOwned|ToString|TryFrom|TryInto|FromIterator|Box|String|Vec|Option|None|Some|Result|Err|Ok|Future|IntoFuture|AsyncFn|AsyncFnMut|AsyncFnOnce|Debug|Hash|RustcEncodable|RustcDecodable|Encodable|Decodable|Rand|Show|FromPrimitive)\\b"
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// Struct/Enum names (UpperCamelCase) - but exclude known traits
|
|
54
|
+
{ "type": "constant", "regex": "\\b[A-Z][a-zA-Z0-9_]*\\b" },
|
|
55
|
+
|
|
56
|
+
// Strings - double quoted
|
|
57
|
+
{ "type": "string", "regex": "[bc]?\"(?:\\\\.|[^\"])*\"" },
|
|
58
|
+
|
|
59
|
+
// Raw strings
|
|
60
|
+
{ "type": "string", "regex": "[bc]?r\"[^\"]*\"" },
|
|
61
|
+
{ "type": "string", "regex": "[bc]?r#\"[^\"]*\"#" },
|
|
62
|
+
{ "type": "string", "regex": "r##\"[^\"]*\"##" },
|
|
63
|
+
{ "type": "string", "regex": "r###\"[^\"]*\"###" },
|
|
64
|
+
|
|
65
|
+
// Character literals
|
|
66
|
+
{ "type": "string", "regex": "b?'(?:\\\\.|[^'])'" },
|
|
67
|
+
|
|
68
|
+
// String escape sequences
|
|
69
|
+
{ "type": "strEscape", "regex": "\\\\u\\{[0-9a-fA-F_]+\\}|\\\\x[0-9a-fA-F]{2}|\\\\[nrt\\\\0\"']" },
|
|
70
|
+
|
|
71
|
+
// Format macros
|
|
72
|
+
{
|
|
73
|
+
"type": "label",
|
|
74
|
+
"regex": "\\b(?:format|format_args|format_args_nl|const_format_args|print|println|eprint|eprintln|panic|todo|unimplemented|unreachable|write|writeln|assert|debug_assert|assert_eq|assert_ne|assert_matches|debug_assert_eq|debug_assert_ne|debug_assert_matches)!"
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
// Numbers
|
|
78
|
+
{ "type": "number", "regex": "\\b0[xX][0-9a-fA-F_]+\\b" },
|
|
79
|
+
{ "type": "number", "regex": "\\b0[oO][0-7_]+\\b" },
|
|
80
|
+
{ "type": "number", "regex": "\\b0[bB][01_]+\\b" },
|
|
81
|
+
{ "type": "number", "regex": "\\b\\d[\\d_]*(?:\\.\\d[\\d_]*)?(?:[eE][+-]?[\\d_]+)?[fiu]?(?:8|16|32|64|128|size)?\\b" },
|
|
82
|
+
|
|
83
|
+
// Function definitions
|
|
84
|
+
{
|
|
85
|
+
"regex": "\\b(fn)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
|
|
86
|
+
"groupStyles": { "1": "keyword", "2": "tagName" }
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
// Union definitions
|
|
90
|
+
{
|
|
91
|
+
"regex": "\\b(union)\\s+([a-zA-Z_][a-zA-Z0-9_]*)",
|
|
92
|
+
"groupStyles": { "1": "keyword", "2": "type" }
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
// Keywords
|
|
96
|
+
{
|
|
97
|
+
"type": "keyword",
|
|
98
|
+
"regex": "\\b(?:as|break|const|continue|crate|dyn|else|enum|extern|false|fn|for|if|impl|in|let|loop|match|mod|move|mut|pub|ref|return|static|struct|super|trait|true|type|unsafe|use|where|while|async|await|macro|try|yield|default|safe|auto|gen|union)\\b"
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// Built-in types
|
|
102
|
+
{
|
|
103
|
+
"type": "type",
|
|
104
|
+
"regex": "\\b(?:bool|char|str|f16|f32|f64|f128|i8|i16|i32|i64|i128|isize|u8|u16|u32|u64|u128|usize)\\b"
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
// Self types
|
|
108
|
+
{ "type": "variable", "regex": "\\bSelf\\b" },
|
|
109
|
+
|
|
110
|
+
// self value
|
|
111
|
+
{ "type": "constant", "regex": "\\bself\\b" },
|
|
112
|
+
|
|
113
|
+
// Path delimiter
|
|
114
|
+
{ "type": "operator", "regex": "::" },
|
|
115
|
+
|
|
116
|
+
// Macros
|
|
117
|
+
{ "type": "label", "regex": "[a-zA-Z_][a-zA-Z0-9_]*!" },
|
|
118
|
+
|
|
119
|
+
// Lifetimes
|
|
120
|
+
{ "type": "meta", "regex": "'[a-zA-Z_][a-zA-Z0-9_]*" },
|
|
121
|
+
|
|
122
|
+
// Labels
|
|
123
|
+
{ "type": "label", "regex": "'[a-zA-Z_][a-zA-Z0-9_]*:" },
|
|
124
|
+
|
|
125
|
+
// Operators
|
|
126
|
+
{ "type": "operator", "regex": "[?]" },
|
|
127
|
+
{ "type": "operator", "regex": "&&|\\|\\|" },
|
|
128
|
+
{ "type": "operator", "regex": "=>" },
|
|
129
|
+
{ "type": "operator", "regex": "[<!>=]=|[<>]" },
|
|
130
|
+
{ "type": "operator", "regex": "[&~@*!]" },
|
|
131
|
+
{ "type": "operator", "regex": "[+\\-*\\/%^&|]=" },
|
|
132
|
+
|
|
133
|
+
// Punctuation
|
|
134
|
+
{ "type": "operator", "regex": "[.,;(){}[\\]]" },
|
|
135
|
+
|
|
136
|
+
// Default fallback
|
|
137
|
+
{ "type": "default", "regex": "." }
|
|
138
|
+
]
|
|
139
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": ["Smali", ".smali", ".class"],
|
|
3
|
+
"comment": { "startsWith": "#" },
|
|
4
|
+
"rules": [
|
|
5
|
+
// Comments
|
|
6
|
+
{ "type": "comment", "regex": "#.*$" },
|
|
7
|
+
|
|
8
|
+
// Strings
|
|
9
|
+
{ "type": "string", "regex": "\"(?:\\\\.|[^\\\\\"])*\"" },
|
|
10
|
+
|
|
11
|
+
// ---------- Directives & .end/.restart handling ----------
|
|
12
|
+
{
|
|
13
|
+
"type": "keyword2",
|
|
14
|
+
"regex": "^(\\s*)(\\.(?:end\\s+|restart\\s+)?[a-zA-Z_\\-]+)\\b"
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
{
|
|
18
|
+
"type": "methodStart",
|
|
19
|
+
"regex": "(?m)^[ \t]*\\.method",
|
|
20
|
+
"lineBackground": "#FFEDED"
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
// ---------- Instructions ----------
|
|
24
|
+
{
|
|
25
|
+
"type": "keyword",
|
|
26
|
+
"keywords": [
|
|
27
|
+
"nop", "move", "move/from16", "move/16", "move-wide", "move-wide/from16", "move-wide/16", "move-object",
|
|
28
|
+
"move-object/from16", "move-object/16", "move-result", "move-result-wide", "move-result-object",
|
|
29
|
+
"move-exception", "const/4", "const/16", "const", "const/high16", "const-wide/16", "const-wide/32",
|
|
30
|
+
"const-wide", "const-wide/high16", "const-string", "const-string/jumbo", "const-class",
|
|
31
|
+
"monitor-enter", "monitor-exit", "check-cast", "instance-of", "array-length", "new-instance", "new-array",
|
|
32
|
+
"filled-new-array", "filled-new-array/range", "fill-array-data", "cmpl-float", "cmpg-float",
|
|
33
|
+
"cmpl-double", "cmpg-double", "cmp-long", "aget", "aget-wide", "aget-object", "aget-boolean", "aget-byte",
|
|
34
|
+
"aget-char", "aget-short", "aput", "aput-wide", "aput-object", "aput-boolean", "aput-byte", "aput-char",
|
|
35
|
+
"aput-short", "iget", "iget-wide", "iget-object", "iget-boolean", "iget-byte", "iget-char", "iget-short",
|
|
36
|
+
"iput", "iput-wide", "iput-object", "iput-boolean", "iput-byte", "iput-char", "iput-short", "sget", "sget-wide",
|
|
37
|
+
"sget-object", "sget-boolean", "sget-byte", "sget-char", "sget-short", "sput", "sput-wide", "sput-object",
|
|
38
|
+
"sput-boolean", "sput-byte", "sput-char", "sput-short", "invoke-virtual", "invoke-super", "invoke-direct",
|
|
39
|
+
"invoke-static", "invoke-interface", "invoke-virtual/range", "invoke-super/range",
|
|
40
|
+
"invoke-direct/range", "invoke-static/range", "invoke-interface/range", "neg-int", "not-int",
|
|
41
|
+
"neg-long", "not-long", "neg-float", "neg-double", "int-to-long", "int-to-float", "int-to-double",
|
|
42
|
+
"long-to-int", "long-to-float", "long-to-double", "float-to-int", "float-to-long", "float-to-double",
|
|
43
|
+
"double-to-int", "double-to-long", "double-to-float", "int-to-byte", "int-to-char", "int-to-short",
|
|
44
|
+
"add-int", "sub-int", "mul-int", "div-int", "rem-int", "and-int", "or-int", "xor-int", "shl-int", "shr-int",
|
|
45
|
+
"ushr-int", "add-long", "sub-long", "mul-long", "div-long", "rem-long", "and-long", "or-long", "xor-long",
|
|
46
|
+
"shl-long", "shr-long", "ushr-long", "add-float", "sub-float", "mul-float", "div-float", "rem-float",
|
|
47
|
+
"add-double", "sub-double", "mul-double", "div-double", "rem-double", "add-int/2addr", "sub-int/2addr",
|
|
48
|
+
"mul-int/2addr", "div-int/2addr", "rem-int/2addr", "and-int/2addr", "or-int/2addr", "xor-int/2addr",
|
|
49
|
+
"shl-int/2addr", "shr-int/2addr", "ushr-int/2addr", "add-long/2addr", "sub-long/2addr",
|
|
50
|
+
"mul-long/2addr", "div-long/2addr", "rem-long/2addr", "and-long/2addr", "or-long/2addr",
|
|
51
|
+
"xor-long/2addr", "shl-long/2addr", "shr-long/2addr", "ushr-long/2addr", "add-float/2addr",
|
|
52
|
+
"sub-float/2addr", "mul-float/2addr", "div-float/2addr", "rem-float/2addr", "add-double/2addr",
|
|
53
|
+
"sub-double/2addr", "mul-double/2addr", "div-double/2addr", "rem-double/2addr", "add-int/lit16",
|
|
54
|
+
"rsub-int", "mul-int/lit16", "div-int/lit16", "rem-int/lit16", "and-int/lit16", "or-int/lit16",
|
|
55
|
+
"xor-int/lit16", "add-int/lit8", "rsub-int/lit8", "mul-int/lit8", "div-int/lit8", "rem-int/lit8",
|
|
56
|
+
"and-int/lit8", "or-int/lit8", "xor-int/lit8", "shl-int/lit8", "shr-int/lit8", "ushr-int/lit8",
|
|
57
|
+
"iget-volatile", "iput-volatile", "sget-volatile", "sput-volatile", "iget-object-volatile",
|
|
58
|
+
"iget-wide-volatile", "iput-wide-volatile", "sget-wide-volatile", "sput-wide-volatile",
|
|
59
|
+
"throw-verification-error", "execute-inline", "execute-inline/range", "invoke-direct-empty",
|
|
60
|
+
"invoke-object-init/range", "iget-quick", "iget-wide-quick", "iget-object-quick", "iput-quick",
|
|
61
|
+
"iput-wide-quick", "iput-object-quick", "iput-boolean-quick", "iput-byte-quick", "iput-char-quick",
|
|
62
|
+
"iput-short-quick", "iget-boolean-quick", "iget-byte-quick", "iget-char-quick", "iget-short-quick",
|
|
63
|
+
"invoke-virtual-quick", "invoke-virtual-quick/range", "invoke-super-quick",
|
|
64
|
+
"invoke-super-quick/range", "iput-object-volatile", "sget-object-volatile",
|
|
65
|
+
"sput-object-volatile", "packed-switch-payload", "sparse-switch-payload", "array-payload",
|
|
66
|
+
"invoke-polymorphic", "invoke-polymorphic/range", "invoke-custom", "invoke-custom/range",
|
|
67
|
+
"const-method-handle", "const-method-type"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
{
|
|
72
|
+
"type": "keyword2",
|
|
73
|
+
"keywords": [
|
|
74
|
+
"goto","goto/16","goto/32","if-eq","if-ne","if-lt","if-ge","if-gt","if-le","if-eqz",
|
|
75
|
+
"if-nez","if-ltz","if-gez","if-gtz","if-lez","return","return-void","return-wide",
|
|
76
|
+
"return-object","throw","packed-switch","sparse-switch"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
// Access modifiers and declarations
|
|
81
|
+
{
|
|
82
|
+
"type": "keyword",
|
|
83
|
+
"regex": "(?<![\\./])\\b(build|runtime|system|value|name|names|accessFlags|public|private|protected|static|final|synchronized|volatile|bridge|transient|varargs|native|interface|abstract|strictfp|synthetic|annotation|enum|constructor|declared-synchronized|whitelist|greylist|blacklist|greylist-max-o|greylist-max-p|greylist-max-q|greylist-max-r|core-platform-api|test-api)\\b"
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
// ---------- Method header ----------
|
|
87
|
+
{
|
|
88
|
+
"type": "methodStart",
|
|
89
|
+
"regex": "^(\\s*)\\.method\\b"
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
// Primitive types
|
|
93
|
+
{ "type": "type", "regex": "\\b(V|Z|B|S|C|I|J|F|D)\\b" },
|
|
94
|
+
|
|
95
|
+
// Object types
|
|
96
|
+
{ "type": "type", "regex": "(?<=\\[|\\s|->|:|=|,|\\(|\\)|;)L[^;\\s]+;" },
|
|
97
|
+
|
|
98
|
+
// Array types
|
|
99
|
+
{ "type": "type", "regex": "\\[+[^\\s\\]]" },
|
|
100
|
+
|
|
101
|
+
// Registers
|
|
102
|
+
{ "type": "variable", "regex": "\\b[pv][0-9]+\\b" },
|
|
103
|
+
|
|
104
|
+
// ---------- Numbers with suffixes (decimal + hex) ----------
|
|
105
|
+
{
|
|
106
|
+
"type": "number",
|
|
107
|
+
"regex": "\\b(?:0x[0-9a-fA-F]+|-?\\d+(?:\\.\\d+)?)(?:[fFdDsSlLtT])?\\b"
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
// Labels
|
|
111
|
+
{
|
|
112
|
+
"type": "label",
|
|
113
|
+
"regex": "(?<=^|\\s|\\{|\\(|,|;)[:][a-zA-Z_][a-zA-Z0-9_$]*"
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
// Method or field name after ->
|
|
117
|
+
{ "type": "operator", "regex": "(?<=->)[a-zA-Z_][a-zA-Z0-9_$<>]*" },
|
|
118
|
+
|
|
119
|
+
// Full references
|
|
120
|
+
{
|
|
121
|
+
"regex": "(L[a-zA-Z0-9_/]+;)->([a-zA-Z_][a-zA-Z0-9_$<>]*)(?:\\([^)]*\\))?([^\\s,]*)",
|
|
122
|
+
"groupStyles": { "1": "type", "2": "variable" }
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
// Operators
|
|
126
|
+
{ "type": "operator", "regex": "->|:=|=|\\+|-|\\*|/|%|\\||&|\\^|<<|>>|>>>|<|>|<=|>=|==|!=|!|\\(|\\)|\\{|\\}|\\[|\\]|,|;|:" },
|
|
127
|
+
|
|
128
|
+
// Default
|
|
129
|
+
{ "type": "default", "regex": "." }
|
|
130
|
+
]
|
|
131
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": ["XML", ".xml", ".kml", ".plist"],
|
|
3
|
+
"comment": { "startsWith": "<!--", "endsWith": "-->" },
|
|
4
|
+
|
|
5
|
+
"rules": [
|
|
6
|
+
// Comments (<!-- ... -->)
|
|
7
|
+
{ "type": "comment", "regex": "<!--[\\s\\S]*?-->" },
|
|
8
|
+
|
|
9
|
+
// Opening tags with < and tag name (multi-line friendly)
|
|
10
|
+
{
|
|
11
|
+
"regex": "(<\\s*)([A-Za-z_][A-Za-z0-9:._\\-]*)",
|
|
12
|
+
"groupStyles": {
|
|
13
|
+
"1": "operator",
|
|
14
|
+
"2": "tagName"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
// Closing tags with </ and >
|
|
19
|
+
{
|
|
20
|
+
"regex": "(</\\s*)([A-Za-z_][A-Za-z0-9:._\\-]*)(\\s*>)",
|
|
21
|
+
"groupStyles": {
|
|
22
|
+
"1": "operator",
|
|
23
|
+
"2": "tagName",
|
|
24
|
+
"3": "operator"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
// Self-closing tags (<tag ... />)
|
|
29
|
+
{
|
|
30
|
+
"regex": "(<\\s*)([A-Za-z_][A-Za-z0-9:._\\-]*)([^>]*)(/?>)",
|
|
31
|
+
"groupStyles": {
|
|
32
|
+
"1": "operator",
|
|
33
|
+
"2": "tagName",
|
|
34
|
+
"4": "operator"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// XML declarations like <?xml version="1.0"?>
|
|
39
|
+
{
|
|
40
|
+
"regex": "(<\\?xml)([^?]*)(\\?>)",
|
|
41
|
+
"groupStyles": {
|
|
42
|
+
"1": "operator",
|
|
43
|
+
"2": "tagName",
|
|
44
|
+
"3": "operator"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
// Namespaces (xmlns:android="...")
|
|
49
|
+
{
|
|
50
|
+
"regex": "(xmlns:)([A-Za-z0-9_\\-]+)",
|
|
51
|
+
"groupStyles": {
|
|
52
|
+
"1": "attrName",
|
|
53
|
+
"2": "namespace"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
// Attribute names with optional namespace prefix
|
|
58
|
+
{
|
|
59
|
+
"regex": "(?:([A-Za-z0-9_\\-]+):)?([A-Za-z0-9_\\-]+)(?=\\s*=)",
|
|
60
|
+
"groupStyles": {
|
|
61
|
+
"1": "namespace",
|
|
62
|
+
"2": "attrName"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
// Equal sign between name and value
|
|
67
|
+
{ "type": "operator", "regex": "=" },
|
|
68
|
+
|
|
69
|
+
// Attribute values in quotes
|
|
70
|
+
{
|
|
71
|
+
"regex": "(?s)(['\"])(.*?)\\1",
|
|
72
|
+
"groupStyles": {
|
|
73
|
+
"0": "string",
|
|
74
|
+
"2": "propVal"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// Inline color codes (#RGB, #RRGGBB, #AARRGGBB)
|
|
79
|
+
{
|
|
80
|
+
"type": "number",
|
|
81
|
+
"regex": "(?<![;&])#(?:[A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})\\b"
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
// Booleans
|
|
85
|
+
{ "type": "number", "regex": "\\b(true|false)\\b" },
|
|
86
|
+
|
|
87
|
+
// Entities (&, <, etc.)
|
|
88
|
+
{ "type": "constant", "regex": "&[A-Za-z]+;" },
|
|
89
|
+
|
|
90
|
+
// Operators like <, >, /, ?, :
|
|
91
|
+
{ "type": "operator", "regex": "</?|/?>|:|\\?" },
|
|
92
|
+
|
|
93
|
+
// Default fallback
|
|
94
|
+
{ "type": "default", "regex": "." }
|
|
95
|
+
]
|
|
96
|
+
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
package com.aetherlink.dexeditor;
|
|
2
2
|
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.Intent;
|
|
3
5
|
import android.util.Log;
|
|
4
6
|
|
|
7
|
+
import androidx.activity.result.ActivityResult;
|
|
8
|
+
import androidx.activity.result.ActivityResultLauncher;
|
|
9
|
+
import androidx.activity.result.contract.ActivityResultContracts;
|
|
10
|
+
|
|
5
11
|
import com.getcapacitor.JSObject;
|
|
6
12
|
import com.getcapacitor.Plugin;
|
|
7
13
|
import com.getcapacitor.PluginCall;
|
|
@@ -18,8 +24,10 @@ import org.json.JSONObject;
|
|
|
18
24
|
public class DexEditorPluginPlugin extends Plugin {
|
|
19
25
|
|
|
20
26
|
private static final String TAG = "DexEditorPlugin";
|
|
27
|
+
private static final int REQUEST_SMALI_EDITOR = 1001;
|
|
21
28
|
private final DexManager dexManager = new DexManager();
|
|
22
29
|
private final ApkManager apkManager = new ApkManager();
|
|
30
|
+
private PluginCall pendingEditorCall;
|
|
23
31
|
|
|
24
32
|
@Override
|
|
25
33
|
public void load() {
|
|
@@ -538,6 +546,25 @@ public class DexEditorPluginPlugin extends Plugin {
|
|
|
538
546
|
));
|
|
539
547
|
break;
|
|
540
548
|
|
|
549
|
+
case "listApkFiles":
|
|
550
|
+
result.put("data", dexManager.listApkFiles(
|
|
551
|
+
params.getString("apkPath"),
|
|
552
|
+
params.optString("filter", ""),
|
|
553
|
+
params.optInt("limit", 100),
|
|
554
|
+
params.optInt("offset", 0)
|
|
555
|
+
));
|
|
556
|
+
break;
|
|
557
|
+
|
|
558
|
+
case "readApkFile":
|
|
559
|
+
result.put("data", dexManager.readApkFile(
|
|
560
|
+
params.getString("apkPath"),
|
|
561
|
+
params.getString("filePath"),
|
|
562
|
+
params.optBoolean("asBase64", false),
|
|
563
|
+
params.optInt("maxBytes", 0),
|
|
564
|
+
params.optInt("offset", 0)
|
|
565
|
+
));
|
|
566
|
+
break;
|
|
567
|
+
|
|
541
568
|
default:
|
|
542
569
|
result.put("success", false);
|
|
543
570
|
result.put("error", "Unknown action: " + action);
|
|
@@ -545,4 +572,44 @@ public class DexEditorPluginPlugin extends Plugin {
|
|
|
545
572
|
|
|
546
573
|
return result;
|
|
547
574
|
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* 打开原生 Smali 编辑器
|
|
578
|
+
*/
|
|
579
|
+
@PluginMethod
|
|
580
|
+
public void openSmaliEditor(PluginCall call) {
|
|
581
|
+
String content = call.getString("content", "");
|
|
582
|
+
String title = call.getString("title", "Smali Editor");
|
|
583
|
+
String className = call.getString("className", "");
|
|
584
|
+
boolean readOnly = call.getBoolean("readOnly", false);
|
|
585
|
+
|
|
586
|
+
pendingEditorCall = call;
|
|
587
|
+
|
|
588
|
+
Intent intent = new Intent(getContext(), SmaliEditorActivity.class);
|
|
589
|
+
intent.putExtra(SmaliEditorActivity.EXTRA_CONTENT, content);
|
|
590
|
+
intent.putExtra(SmaliEditorActivity.EXTRA_TITLE, title);
|
|
591
|
+
intent.putExtra(SmaliEditorActivity.EXTRA_CLASS_NAME, className);
|
|
592
|
+
intent.putExtra(SmaliEditorActivity.EXTRA_READ_ONLY, readOnly);
|
|
593
|
+
|
|
594
|
+
startActivityForResult(call, intent, "handleEditorResult");
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
@Override
|
|
598
|
+
protected void handleOnActivityResult(int requestCode, int resultCode, Intent data) {
|
|
599
|
+
super.handleOnActivityResult(requestCode, resultCode, data);
|
|
600
|
+
|
|
601
|
+
if (pendingEditorCall != null) {
|
|
602
|
+
JSObject result = new JSObject();
|
|
603
|
+
if (resultCode == Activity.RESULT_OK && data != null) {
|
|
604
|
+
result.put("success", true);
|
|
605
|
+
result.put("content", data.getStringExtra(SmaliEditorActivity.RESULT_CONTENT));
|
|
606
|
+
result.put("modified", data.getBooleanExtra(SmaliEditorActivity.RESULT_MODIFIED, false));
|
|
607
|
+
} else {
|
|
608
|
+
result.put("success", false);
|
|
609
|
+
result.put("cancelled", true);
|
|
610
|
+
}
|
|
611
|
+
pendingEditorCall.resolve(result);
|
|
612
|
+
pendingEditorCall = null;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
548
615
|
}
|