UNPKG

@specs-feup/alpakka

Version:

Alpakka is a [LARA Framework](https://github.com/specs-feup/lara-framework) source-to-source compiler for Android's [smali](https://github.com/google/smali) syntax. It enables the analysis and transformation of Android apps through APK files.

33 lines 1.16 kB
var _a; class DotFormatter { static defaultGraphName = "smali_graph"; static #sanitizeDotLabel(label) { return label.replace(/(?<!\\)"/g, '\\"'); } #formatAttrs(attrs) { return attrs .map(([key, value]) => `${key}="${_a.#sanitizeDotLabel(value)}"`) .join(" "); } format(graph, label) { const graphName = label ?? _a.defaultGraphName; const nodes = graph.nodes .map((node) => { const { id, attrs } = this.formatNode(node); const formattedAttrs = this.#formatAttrs(Object.entries(attrs)); return `"${id}" [${formattedAttrs}];\n`; }) .join(""); const edges = graph.edges .map((edge) => { const { source, target, attrs } = this.formatEdge(edge); const formattedAttrs = this.#formatAttrs(Object.entries(attrs)); return `"${source}" -> "${target}" [${formattedAttrs}];\n`; }) .join(""); return `digraph ${graphName} {\n${nodes}${edges}}\n`; } } _a = DotFormatter; export default DotFormatter; //# sourceMappingURL=DotFormatter.js.map