porffor 0.2.0-47b4f2e → 0.2.0-536e463
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/compiler/decompile.js +9 -10
- package/package.json +1 -1
package/compiler/decompile.js
CHANGED
@@ -116,13 +116,12 @@ export default (wasm, name = '', ind = 0, locals = {}, params = [], returns = []
|
|
116
116
|
return highlightAsm(out);
|
117
117
|
};
|
118
118
|
|
119
|
-
export const highlightAsm = asm =>
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
.replace(/ ;;.*$/gm, _ => `\x1B[90m${_.replaceAll(/\x1B\[[0-9]+m/g, '')}\x1B[0m`);
|
119
|
+
export const highlightAsm = asm => asm
|
120
|
+
.replace(/(local|global|memory)\.[^\s]*/g, _ => `\x1B[31m${_}\x1B[0m`)
|
121
|
+
.replace(/(i(8|16|32|64)x[0-9]+|v128)(\.[^\s]*)?/g, _ => `\x1B[34m${_}\x1B[0m`)
|
122
|
+
.replace(/[^m](i32|i64|f32|f64|drop)(\.[^\s]*)?/g, _ => `${_[0]}\x1B[36m${_.slice(1)}\x1B[0m`)
|
123
|
+
.replace(/(return_call|call|br_if|br|return|throw|rethrow)/g, _ => `\x1B[35m${_}\x1B[0m`)
|
124
|
+
.replace(/(block|loop|if|end|else|try|catch_all|catch|delegate)/g, _ => `\x1B[95m${_}\x1B[0m`)
|
125
|
+
.replace(/unreachable/g, _ => `\x1B[91m${_}\x1B[0m`)
|
126
|
+
.replace(/ \-?[0-9\.]+/g, _ => ` \x1B[33m${_.slice(1)}\x1B[0m`)
|
127
|
+
.replace(/ ;;.*$/gm, _ => `\x1B[90m${_.replaceAll(/\x1B\[[0-9]+m/g, '')}\x1B[0m`);
|
package/package.json
CHANGED