@l1yp/file-viewer 0.1.0
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/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/FileViewer.js +7 -0
- package/dist/FileViewer.vue.d.ts +37 -0
- package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/AppxViewer.js +7 -0
- package/dist/components/AppxViewer.vue.d.ts +18 -0
- package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/ArchiveBrowser.js +7 -0
- package/dist/components/ArchiveBrowser.vue.d.ts +18 -0
- package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js +279 -0
- package/dist/components/AudioViewer.js +7 -0
- package/dist/components/AudioViewer.vue.d.ts +21 -0
- package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/BinObjBrowser.js +7 -0
- package/dist/components/BinObjBrowser.vue.d.ts +19 -0
- package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/components/CertViewer.js +7 -0
- package/dist/components/CertViewer.vue.d.ts +17 -0
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/ClassViewer.js +7 -0
- package/dist/components/ClassViewer.vue.d.ts +15 -0
- package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/CodeBlock.js +7 -0
- package/dist/components/CodeBlock.vue.d.ts +17 -0
- package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/CodeView.js +7 -0
- package/dist/components/CodeView.vue.d.ts +21 -0
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +180 -0
- package/dist/components/CsvViewer.js +7 -0
- package/dist/components/CsvViewer.vue.d.ts +26 -0
- package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/DicomViewer.js +7 -0
- package/dist/components/DicomViewer.vue.d.ts +30 -0
- package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js +362 -0
- package/dist/components/DocxViewer.js +7 -0
- package/dist/components/DocxViewer.vue.d.ts +19 -0
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/DrawioViewer.js +7 -0
- package/dist/components/DrawioViewer.vue.d.ts +16 -0
- package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/DxfViewer.js +7 -0
- package/dist/components/DxfViewer.vue.d.ts +14 -0
- package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js +239 -0
- package/dist/components/EbookViewer.js +7 -0
- package/dist/components/EbookViewer.vue.d.ts +22 -0
- package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/EmlViewer.js +7 -0
- package/dist/components/EmlViewer.vue.d.ts +21 -0
- package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/components/EplViewer.js +7 -0
- package/dist/components/EplViewer.vue.d.ts +19 -0
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/FileViewerBody.js +7 -0
- package/dist/components/FileViewerBody.vue.d.ts +47 -0
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +599 -0
- package/dist/components/FileViewerPanel.js +7 -0
- package/dist/components/FileViewerPanel.vue.d.ts +3 -0
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +207 -0
- package/dist/components/FontViewer.js +7 -0
- package/dist/components/FontViewer.vue.d.ts +17 -0
- package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/FrontmatterCard.js +7 -0
- package/dist/components/FrontmatterCard.vue.d.ts +11 -0
- package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/GeoViewer.js +7 -0
- package/dist/components/GeoViewer.vue.d.ts +17 -0
- package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js +255 -0
- package/dist/components/HarViewer.js +7 -0
- package/dist/components/HarViewer.vue.d.ts +20 -0
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js +322 -0
- package/dist/components/HexViewer.js +7 -0
- package/dist/components/HexViewer.vue.d.ts +22 -0
- package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/components/HprofViewer.js +7 -0
- package/dist/components/HprofViewer.vue.d.ts +27 -0
- package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js +561 -0
- package/dist/components/ImageLightbox.js +7 -0
- package/dist/components/ImageLightbox.vue.d.ts +3 -0
- package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/components/InlineText.d.ts +29 -0
- package/dist/components/InlineText.js +21 -0
- package/dist/components/JksViewer.js +7 -0
- package/dist/components/JksViewer.vue.d.ts +22 -0
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js +353 -0
- package/dist/components/JsonlViewer.js +7 -0
- package/dist/components/JsonlViewer.vue.d.ts +15 -0
- package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/LogViewer.js +7 -0
- package/dist/components/LogViewer.vue.d.ts +29 -0
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +670 -0
- package/dist/components/LrcViewer.js +7 -0
- package/dist/components/LrcViewer.vue.d.ts +17 -0
- package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/MarkdownTable.js +7 -0
- package/dist/components/MarkdownTable.vue.d.ts +19 -0
- package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/MarkdownText.d.ts +30 -0
- package/dist/components/MarkdownText.js +21 -0
- package/dist/components/MhtViewer.js +7 -0
- package/dist/components/MhtViewer.vue.d.ts +22 -0
- package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/MindMapView.js +7 -0
- package/dist/components/MindMapView.vue.d.ts +23 -0
- package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js +337 -0
- package/dist/components/MissingDependency.js +7 -0
- package/dist/components/MissingDependency.vue.d.ts +17 -0
- package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/ModelViewer.js +7 -0
- package/dist/components/ModelViewer.vue.d.ts +18 -0
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/MsiViewer.js +7 -0
- package/dist/components/MsiViewer.vue.d.ts +19 -0
- package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js +136 -0
- package/dist/components/NotebookViewer.js +7 -0
- package/dist/components/NotebookViewer.vue.d.ts +20 -0
- package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/PdfViewer.js +7 -0
- package/dist/components/PdfViewer.vue.d.ts +19 -0
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/PptxViewer.js +7 -0
- package/dist/components/PptxViewer.vue.d.ts +20 -0
- package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/PsdViewer.js +7 -0
- package/dist/components/PsdViewer.vue.d.ts +15 -0
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/QmcAudioViewer.js +7 -0
- package/dist/components/QmcAudioViewer.vue.d.ts +18 -0
- package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/RasterViewer.js +7 -0
- package/dist/components/RasterViewer.vue.d.ts +21 -0
- package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/RtfViewer.js +7 -0
- package/dist/components/RtfViewer.vue.d.ts +21 -0
- package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/SevenZipBrowser.js +7 -0
- package/dist/components/SevenZipBrowser.vue.d.ts +13 -0
- package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js +366 -0
- package/dist/components/SqliteViewer.js +7 -0
- package/dist/components/SqliteViewer.vue.d.ts +18 -0
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js +186 -0
- package/dist/components/SubtitleViewer.js +7 -0
- package/dist/components/SubtitleViewer.vue.d.ts +15 -0
- package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/XlsxChart.js +7 -0
- package/dist/components/XlsxChart.vue.d.ts +14 -0
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +240 -0
- package/dist/components/XlsxViewer.js +7 -0
- package/dist/components/XlsxViewer.vue.d.ts +22 -0
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +814 -0
- package/dist/components/XmindViewer.js +7 -0
- package/dist/components/XmindViewer.vue.d.ts +13 -0
- package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/ZipBrowser.js +7 -0
- package/dist/components/ZipBrowser.vue.d.ts +14 -0
- package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js +326 -0
- package/dist/components/ZoomImage.js +7 -0
- package/dist/components/ZoomImage.vue.d.ts +29 -0
- package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js +147 -0
- package/dist/components/epl/EplCodeBlock.js +7 -0
- package/dist/components/epl/EplCodeBlock.vue.d.ts +15 -0
- package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/components/epl/EplDoc.js +7 -0
- package/dist/components/epl/EplDoc.vue.d.ts +19 -0
- package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/components/epl/EplMethod.js +7 -0
- package/dist/components/epl/EplMethod.vue.d.ts +14 -0
- package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/epl/EplResource.js +7 -0
- package/dist/components/epl/EplResource.vue.d.ts +15 -0
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/epl/EplTree.js +7 -0
- package/dist/components/epl/EplTree.vue.d.ts +27 -0
- package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/epl/EplVarTable.js +7 -0
- package/dist/components/epl/EplVarTable.vue.d.ts +21 -0
- package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/epl/docTypes.d.ts +12 -0
- package/dist/components/epl/numbering.d.ts +21 -0
- package/dist/components/epl/numbering.js +14 -0
- package/dist/components/icons/Icon.js +7 -0
- package/dist/components/icons/Icon.vue.d.ts +14 -0
- package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/icons/iconPaths.d.ts +60 -0
- package/dist/components/icons/iconPaths.js +54 -0
- package/dist/components/optionalViewer.d.ts +14 -0
- package/dist/components/optionalViewer.js +37 -0
- package/dist/components/ui/ClampBlock.d.ts +82 -0
- package/dist/components/ui/ClampBlock.js +63 -0
- package/dist/composables/useFileViewer.d.ts +428 -0
- package/dist/composables/useFileViewer.js +27 -0
- package/dist/composables/useLightbox.d.ts +33 -0
- package/dist/composables/useLightbox.js +17 -0
- package/dist/composables/useLogRules.d.ts +47 -0
- package/dist/composables/useLogRules.js +74 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +30 -0
- package/dist/lib/aes.d.ts +25 -0
- package/dist/lib/aes.js +99 -0
- package/dist/lib/appx.d.ts +66 -0
- package/dist/lib/appx.js +112 -0
- package/dist/lib/archive.d.ts +29 -0
- package/dist/lib/asn1.d.ts +47 -0
- package/dist/lib/asn1.js +122 -0
- package/dist/lib/binobj.d.ts +69 -0
- package/dist/lib/binobj.js +430 -0
- package/dist/lib/brotli.d.ts +14 -0
- package/dist/lib/brotli.js +16 -0
- package/dist/lib/bzip2.d.ts +14 -0
- package/dist/lib/bzip2.js +161 -0
- package/dist/lib/classfile.d.ts +72 -0
- package/dist/lib/classfile.js +210 -0
- package/dist/lib/codePreview.d.ts +22 -0
- package/dist/lib/codePreview.js +27 -0
- package/dist/lib/codefold.d.ts +14 -0
- package/dist/lib/codefold.js +30 -0
- package/dist/lib/codeformat.d.ts +21 -0
- package/dist/lib/codeformat.js +130 -0
- package/dist/lib/csv.d.ts +19 -0
- package/dist/lib/csv.js +74 -0
- package/dist/lib/des.d.ts +17 -0
- package/dist/lib/des.js +928 -0
- package/dist/lib/diagram.d.ts +5 -0
- package/dist/lib/diagram.js +479 -0
- package/dist/lib/dicom.d.ts +69 -0
- package/dist/lib/dicom.js +442 -0
- package/dist/lib/dicomCodecs.d.ts +28 -0
- package/dist/lib/dicomCodecs.js +156 -0
- package/dist/lib/dicomRender.d.ts +46 -0
- package/dist/lib/dicomRender.js +114 -0
- package/dist/lib/dxf.d.ts +86 -0
- package/dist/lib/dxf.js +399 -0
- package/dist/lib/eml.d.ts +40 -0
- package/dist/lib/eml.js +46 -0
- package/dist/lib/encoding.d.ts +28 -0
- package/dist/lib/encoding.js +44 -0
- package/dist/lib/epl/code/ast.d.ts +150 -0
- package/dist/lib/epl/code/codeDataParser.d.ts +3 -0
- package/dist/lib/epl/code/codeDataParser.js +330 -0
- package/dist/lib/epl/code/codeLines.d.ts +20 -0
- package/dist/lib/epl/code/codeLines.js +191 -0
- package/dist/lib/epl/code/structures.d.ts +86 -0
- package/dist/lib/epl/code/textCode.d.ts +29 -0
- package/dist/lib/epl/code/textCode.js +150 -0
- package/dist/lib/epl/code/variable.d.ts +25 -0
- package/dist/lib/epl/eplDocument.d.ts +21 -0
- package/dist/lib/epl/eplDocument.js +36 -0
- package/dist/lib/epl/imageList.d.ts +28 -0
- package/dist/lib/epl/imageList.js +66 -0
- package/dist/lib/epl/index.d.ts +53 -0
- package/dist/lib/epl/index.js +45 -0
- package/dist/lib/epl/io/binaryReader.d.ts +56 -0
- package/dist/lib/epl/io/binaryReader.js +119 -0
- package/dist/lib/epl/io/encoding.d.ts +16 -0
- package/dist/lib/epl/io/encoding.js +27 -0
- package/dist/lib/epl/model/eplSystemId.d.ts +64 -0
- package/dist/lib/epl/model/eplSystemId.js +16 -0
- package/dist/lib/epl/model/section.d.ts +46 -0
- package/dist/lib/epl/names/eplLibData.js +39 -0
- package/dist/lib/epl/names/idToNameMap.d.ts +33 -0
- package/dist/lib/epl/names/idToNameMap.js +130 -0
- package/dist/lib/epl/names/libNameProvider.d.ts +15 -0
- package/dist/lib/epl/names/libNameProvider.js +18 -0
- package/dist/lib/epl/program.d.ts +120 -0
- package/dist/lib/epl/program.js +134 -0
- package/dist/lib/epl/projectFileReader.d.ts +23 -0
- package/dist/lib/epl/projectFileReader.js +65 -0
- package/dist/lib/epl/sections/code.d.ts +20 -0
- package/dist/lib/epl/sections/esystemInfo.d.ts +14 -0
- package/dist/lib/epl/sections/losable.d.ts +11 -0
- package/dist/lib/epl/sections/projectConfig.d.ts +23 -0
- package/dist/lib/epl/sections/resource.d.ts +57 -0
- package/dist/lib/fb2.d.ts +14 -0
- package/dist/lib/fb2.js +62 -0
- package/dist/lib/fileType.d.ts +315 -0
- package/dist/lib/fileType.js +800 -0
- package/dist/lib/fonts.d.ts +8 -0
- package/dist/lib/fonts.js +4 -0
- package/dist/lib/format.d.ts +16 -0
- package/dist/lib/format.js +38 -0
- package/dist/lib/frontmatter.d.ts +13 -0
- package/dist/lib/frontmatter.js +23 -0
- package/dist/lib/geo.d.ts +30 -0
- package/dist/lib/geo.js +235 -0
- package/dist/lib/har.d.ts +171 -0
- package/dist/lib/har.js +397 -0
- package/dist/lib/highlight.d.ts +18 -0
- package/dist/lib/highlight.js +34 -0
- package/dist/lib/highlightLangs.d.ts +15 -0
- package/dist/lib/highlightLangs.js +93 -0
- package/dist/lib/hprof.d.ts +211 -0
- package/dist/lib/hprof.js +709 -0
- package/dist/lib/ipynb.d.ts +48 -0
- package/dist/lib/ipynb.js +130 -0
- package/dist/lib/jks.d.ts +86 -0
- package/dist/lib/jks.js +167 -0
- package/dist/lib/jsonl.d.ts +29 -0
- package/dist/lib/jsonl.js +24 -0
- package/dist/lib/lrc.d.ts +32 -0
- package/dist/lib/lrc.js +84 -0
- package/dist/lib/lzma.d.ts +70 -0
- package/dist/lib/lzma.js +204 -0
- package/dist/lib/markdown/blocks.d.ts +9 -0
- package/dist/lib/markdown/blocks.js +221 -0
- package/dist/lib/markdown/index.d.ts +3 -0
- package/dist/lib/markdown/inline.d.ts +33 -0
- package/dist/lib/markdown/inline.js +84 -0
- package/dist/lib/markdown/math.d.ts +5 -0
- package/dist/lib/markdown/math.js +25 -0
- package/dist/lib/markdown/segmentize.d.ts +11 -0
- package/dist/lib/markdown/segmentize.js +28 -0
- package/dist/lib/markdown/styles.d.ts +26 -0
- package/dist/lib/markdown/styles.js +135 -0
- package/dist/lib/mht.d.ts +51 -0
- package/dist/lib/mht.js +122 -0
- package/dist/lib/midi.d.ts +28 -0
- package/dist/lib/midi.js +84 -0
- package/dist/lib/mime.d.ts +82 -0
- package/dist/lib/mime.js +151 -0
- package/dist/lib/mindmap.d.ts +51 -0
- package/dist/lib/mindmap.js +113 -0
- package/dist/lib/mobi.d.ts +15 -0
- package/dist/lib/mobi.js +68 -0
- package/dist/lib/msi.d.ts +50 -0
- package/dist/lib/msi.js +332 -0
- package/dist/lib/optionalDep.d.ts +26 -0
- package/dist/lib/optionalDep.js +20 -0
- package/dist/lib/pkcs12.d.ts +56 -0
- package/dist/lib/pkcs12.js +356 -0
- package/dist/lib/qmc.d.ts +50 -0
- package/dist/lib/qmc.js +213 -0
- package/dist/lib/rar.d.ts +16 -0
- package/dist/lib/rar.js +40 -0
- package/dist/lib/rawPreview.d.ts +12 -0
- package/dist/lib/rawPreview.js +54 -0
- package/dist/lib/rc2.d.ts +12 -0
- package/dist/lib/rc2.js +298 -0
- package/dist/lib/resolveInput.d.ts +22 -0
- package/dist/lib/resolveInput.js +55 -0
- package/dist/lib/rtf.d.ts +53 -0
- package/dist/lib/rtf.js +413 -0
- package/dist/lib/sevenZip.d.ts +82 -0
- package/dist/lib/sevenZip.js +395 -0
- package/dist/lib/sha1.d.ts +24 -0
- package/dist/lib/sha1.js +53 -0
- package/dist/lib/sha256.d.ts +21 -0
- package/dist/lib/sha256.js +119 -0
- package/dist/lib/speechAudio.d.ts +36 -0
- package/dist/lib/speechAudio.js +85 -0
- package/dist/lib/sqlite.d.ts +38 -0
- package/dist/lib/sqlite.js +104 -0
- package/dist/lib/subtitle.d.ts +26 -0
- package/dist/lib/subtitle.js +99 -0
- package/dist/lib/tarball.d.ts +20 -0
- package/dist/lib/tarball.js +248 -0
- package/dist/lib/viewerFormats.d.ts +35 -0
- package/dist/lib/viewerFormats.js +83 -0
- package/dist/lib/viewerKind.d.ts +36 -0
- package/dist/lib/viewerKind.js +233 -0
- package/dist/lib/x509.d.ts +68 -0
- package/dist/lib/x509.js +267 -0
- package/dist/lib/xlsx.d.ts +55 -0
- package/dist/lib/xlsx.js +321 -0
- package/dist/lib/xlsxCharts.d.ts +34 -0
- package/dist/lib/xlsxCharts.js +152 -0
- package/dist/lib/xmind.d.ts +6 -0
- package/dist/lib/xmind.js +124 -0
- package/dist/lib/zip.d.ts +56 -0
- package/dist/lib/zip.js +169 -0
- package/dist/style.css +2 -0
- package/dist/types.d.ts +42 -0
- package/package.json +128 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode an archive entry's filename bytes, sniffing the encoding.
|
|
3
|
+
*
|
|
4
|
+
* Archive formats store names in whatever byte encoding the producer's OS used: ZIP without its UTF-8 flag and
|
|
5
|
+
* legacy tar both carry raw bytes, and on Chinese Windows that's usually **GBK** — which turns into mojibake if
|
|
6
|
+
* force-decoded as UTF-8. So we probe: try strict UTF-8 first (the modern default, and a superset of ASCII); if
|
|
7
|
+
* the bytes aren't valid UTF-8, try GBK; if neither decodes cleanly, fall back to a lossless `\uXXXX` escape of
|
|
8
|
+
* the raw bytes so the name is at least unambiguous instead of garbled.
|
|
9
|
+
*
|
|
10
|
+
* "Strict" = a `fatal` TextDecoder that throws on an invalid sequence, which is exactly our "is it this
|
|
11
|
+
* encoding?" probe. Non-streaming `decode()` calls are independent, so the decoders are safely reused.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Decode a TEXT file's bytes, sniffing the encoding: UTF-8 → GBK → lenient UTF-8.
|
|
15
|
+
*
|
|
16
|
+
* Same probe as {@link decodeFileNameBytes}, but for file *content* (e.g. a `.lrc` lyrics file, which on
|
|
17
|
+
* Chinese Windows is almost always GBK and turns to mojibake if force-decoded as UTF-8). The last resort
|
|
18
|
+
* differs: instead of a `\uXXXX` escape (right for a filename) we fall back to a non-fatal UTF-8 decode,
|
|
19
|
+
* which yields the readable text with `�` for any stray invalid byte — the sane default for prose.
|
|
20
|
+
*/
|
|
21
|
+
export declare function decodeTextSniff(bytes: Uint8Array): string;
|
|
22
|
+
/**
|
|
23
|
+
* Decode filename bytes as UTF-8 → GBK → `\uXXXX` escape (in that order of preference).
|
|
24
|
+
*
|
|
25
|
+
* `normalizeSeparators` rewrites backslashes to '/' on a *successfully decoded* name (ZIP from Windows'
|
|
26
|
+
* Compress-Archive emits '\'), but never on the escaped fallback — whose own `\u…` backslashes must survive.
|
|
27
|
+
*/
|
|
28
|
+
export declare function decodeFileNameBytes(bytes: Uint8Array, normalizeSeparators?: boolean): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/lib/encoding.ts
|
|
2
|
+
var e = new TextDecoder("utf-8", { fatal: !0 }), t = null, n = !1;
|
|
3
|
+
function r() {
|
|
4
|
+
if (!n) {
|
|
5
|
+
n = !0;
|
|
6
|
+
try {
|
|
7
|
+
t = new TextDecoder("gbk", { fatal: !0 });
|
|
8
|
+
} catch {
|
|
9
|
+
t = null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
function i(e) {
|
|
15
|
+
let t = "";
|
|
16
|
+
for (let n of e) n >= 32 && n < 127 ? t += String.fromCharCode(n) : t += "\\u" + n.toString(16).padStart(4, "0");
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
19
|
+
function a(t) {
|
|
20
|
+
if (t.length === 0) return "";
|
|
21
|
+
try {
|
|
22
|
+
return e.decode(t);
|
|
23
|
+
} catch {}
|
|
24
|
+
let n = r();
|
|
25
|
+
if (n) try {
|
|
26
|
+
return n.decode(t);
|
|
27
|
+
} catch {}
|
|
28
|
+
return new TextDecoder("utf-8").decode(t);
|
|
29
|
+
}
|
|
30
|
+
function o(t, n = !1) {
|
|
31
|
+
if (t.length === 0) return "";
|
|
32
|
+
try {
|
|
33
|
+
let r = e.decode(t);
|
|
34
|
+
return n ? r.replace(/\\/g, "/") : r;
|
|
35
|
+
} catch {}
|
|
36
|
+
let a = r();
|
|
37
|
+
if (a) try {
|
|
38
|
+
let e = a.decode(t);
|
|
39
|
+
return n ? e.replace(/\\/g, "/") : e;
|
|
40
|
+
} catch {}
|
|
41
|
+
return i(t);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { o as decodeFileNameBytes, a as decodeTextSniff };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decompiled code AST — the TS shape of EProjectFile's `Expressions/` and `Statements/` node trees.
|
|
3
|
+
*
|
|
4
|
+
* The C# uses a class hierarchy with virtual `ToTextCode`; here the nodes are plain discriminated unions
|
|
5
|
+
* (`kind`) built by {@link parseStatementBlock} and rendered by the text layer. Two transient markers
|
|
6
|
+
* (`paramListEnd` / `arrayLiteralEnd`) exist only to signal list termination during parsing and never appear
|
|
7
|
+
* in a finished tree.
|
|
8
|
+
*/
|
|
9
|
+
export interface NumberExpr {
|
|
10
|
+
kind: 'number';
|
|
11
|
+
value: number;
|
|
12
|
+
}
|
|
13
|
+
export interface StringExpr {
|
|
14
|
+
kind: 'string';
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
export interface BoolExpr {
|
|
18
|
+
kind: 'bool';
|
|
19
|
+
value: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface DateTimeExpr {
|
|
22
|
+
kind: 'datetime';
|
|
23
|
+
/** OLE Automation date (days since 1899-12-30); rendered to `[yyyy年MM月dd日…]`. */
|
|
24
|
+
oa: number;
|
|
25
|
+
}
|
|
26
|
+
/** `#常量` — user constant (libraryId -2) or a support-library constant. */
|
|
27
|
+
export interface ConstantExpr {
|
|
28
|
+
kind: 'constant';
|
|
29
|
+
libraryId: number;
|
|
30
|
+
constantId: number;
|
|
31
|
+
}
|
|
32
|
+
/** `#库类型.成员` — a support-library enum constant. */
|
|
33
|
+
export interface EmnuExpr {
|
|
34
|
+
kind: 'emnu';
|
|
35
|
+
libraryId: number;
|
|
36
|
+
structId: number;
|
|
37
|
+
memberId: number;
|
|
38
|
+
}
|
|
39
|
+
export interface VariableExpr {
|
|
40
|
+
kind: 'variable';
|
|
41
|
+
id: number;
|
|
42
|
+
}
|
|
43
|
+
export interface MethodPtrExpr {
|
|
44
|
+
kind: 'methodPtr';
|
|
45
|
+
methodId: number;
|
|
46
|
+
}
|
|
47
|
+
/** Omitted argument — renders as nothing. */
|
|
48
|
+
export interface DefaultExpr {
|
|
49
|
+
kind: 'default';
|
|
50
|
+
}
|
|
51
|
+
/** `{a, b, c}` array/byte-set literal. */
|
|
52
|
+
export interface ArrayExpr {
|
|
53
|
+
kind: 'array';
|
|
54
|
+
items: Expr[];
|
|
55
|
+
}
|
|
56
|
+
/** `target.成员` — member access (libraryId -2 ⇒ user member, otherwise a library type member). */
|
|
57
|
+
export interface AccessMemberExpr {
|
|
58
|
+
kind: 'accessMember';
|
|
59
|
+
target: Expr;
|
|
60
|
+
libraryId: number;
|
|
61
|
+
structId: number;
|
|
62
|
+
memberId: number;
|
|
63
|
+
}
|
|
64
|
+
/** `target[index]` — array element access. */
|
|
65
|
+
export interface AccessArrayExpr {
|
|
66
|
+
kind: 'accessArray';
|
|
67
|
+
target: Expr;
|
|
68
|
+
index: Expr;
|
|
69
|
+
}
|
|
70
|
+
/** A call / operator. libraryId: ≥0 library, -1 empty, -2 user method, -3 DLL command. */
|
|
71
|
+
export interface CallExpr {
|
|
72
|
+
kind: 'call';
|
|
73
|
+
libraryId: number;
|
|
74
|
+
methodId: number;
|
|
75
|
+
/** Skip the vtable (calling a specific parent method). */
|
|
76
|
+
invokeSpecial: boolean;
|
|
77
|
+
/** ThisCall target, or null. */
|
|
78
|
+
target: Expr | null;
|
|
79
|
+
/** Argument list (each omitted arg is a `default` node), or null when absent. */
|
|
80
|
+
paramList: Expr[] | null;
|
|
81
|
+
}
|
|
82
|
+
export type Expr = NumberExpr | StringExpr | BoolExpr | DateTimeExpr | ConstantExpr | EmnuExpr | VariableExpr | MethodPtrExpr | DefaultExpr | ArrayExpr | AccessMemberExpr | AccessArrayExpr | CallExpr | {
|
|
83
|
+
kind: 'paramListEnd';
|
|
84
|
+
} | {
|
|
85
|
+
kind: 'arrayLiteralEnd';
|
|
86
|
+
};
|
|
87
|
+
export interface StatementBlock {
|
|
88
|
+
statements: Stmt[];
|
|
89
|
+
}
|
|
90
|
+
/** Shared fields of the four loop statements (判断循环 / 循环判断 / 变量循环 / 计次循环). */
|
|
91
|
+
export interface LoopCommon {
|
|
92
|
+
block: StatementBlock;
|
|
93
|
+
unexaminedCode: string | null;
|
|
94
|
+
commentOnStart: string | null;
|
|
95
|
+
commentOnEnd: string | null;
|
|
96
|
+
maskOnStart: boolean;
|
|
97
|
+
maskOnEnd: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface CaseInfo {
|
|
100
|
+
condition: Expr | null;
|
|
101
|
+
unexaminedCode: string | null;
|
|
102
|
+
block: StatementBlock;
|
|
103
|
+
comment: string | null;
|
|
104
|
+
mask: boolean;
|
|
105
|
+
}
|
|
106
|
+
export type Stmt = {
|
|
107
|
+
kind: 'expression';
|
|
108
|
+
expr: CallExpr | null;
|
|
109
|
+
mask: boolean;
|
|
110
|
+
comment: string | null;
|
|
111
|
+
} | {
|
|
112
|
+
kind: 'unexamined';
|
|
113
|
+
code: string;
|
|
114
|
+
mask: boolean;
|
|
115
|
+
} | {
|
|
116
|
+
kind: 'if';
|
|
117
|
+
condition: Expr | null;
|
|
118
|
+
unexaminedCode: string | null;
|
|
119
|
+
block: StatementBlock;
|
|
120
|
+
comment: string | null;
|
|
121
|
+
mask: boolean;
|
|
122
|
+
} | {
|
|
123
|
+
kind: 'ifElse';
|
|
124
|
+
condition: Expr | null;
|
|
125
|
+
unexaminedCode: string | null;
|
|
126
|
+
blockOnTrue: StatementBlock;
|
|
127
|
+
blockOnFalse: StatementBlock;
|
|
128
|
+
comment: string | null;
|
|
129
|
+
mask: boolean;
|
|
130
|
+
} | ({
|
|
131
|
+
kind: 'while';
|
|
132
|
+
condition: Expr | null;
|
|
133
|
+
} & LoopCommon) | ({
|
|
134
|
+
kind: 'doWhile';
|
|
135
|
+
condition: Expr | null;
|
|
136
|
+
} & LoopCommon) | ({
|
|
137
|
+
kind: 'for';
|
|
138
|
+
start: Expr | null;
|
|
139
|
+
end: Expr | null;
|
|
140
|
+
step: Expr | null;
|
|
141
|
+
var: Expr | null;
|
|
142
|
+
} & LoopCommon) | ({
|
|
143
|
+
kind: 'counter';
|
|
144
|
+
count: Expr | null;
|
|
145
|
+
var: Expr | null;
|
|
146
|
+
} & LoopCommon) | {
|
|
147
|
+
kind: 'switch';
|
|
148
|
+
cases: CaseInfo[];
|
|
149
|
+
defaultBlock: StatementBlock;
|
|
150
|
+
};
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { gbk as e } from "../io/encoding.js";
|
|
2
|
+
import { BinaryReader as t } from "../io/binaryReader.js";
|
|
3
|
+
import { decomposeLibDataTypeId as n, isLibDataType as r } from "../model/eplSystemId.js";
|
|
4
|
+
//#region src/lib/epl/code/codeDataParser.ts
|
|
5
|
+
var i = new Set([
|
|
6
|
+
80,
|
|
7
|
+
81,
|
|
8
|
+
82,
|
|
9
|
+
83,
|
|
10
|
+
84,
|
|
11
|
+
85,
|
|
12
|
+
106,
|
|
13
|
+
107,
|
|
14
|
+
108,
|
|
15
|
+
109,
|
|
16
|
+
110,
|
|
17
|
+
111,
|
|
18
|
+
112,
|
|
19
|
+
113
|
|
20
|
+
]), a = { kind: "paramListEnd" }, o = { kind: "arrayLiteralEnd" }, s = { kind: "default" };
|
|
21
|
+
function c(n, r = e()) {
|
|
22
|
+
return l(new t(n, r));
|
|
23
|
+
}
|
|
24
|
+
function l(e) {
|
|
25
|
+
let t = [];
|
|
26
|
+
for (;;) {
|
|
27
|
+
let n;
|
|
28
|
+
for (;;) {
|
|
29
|
+
if (e.pos >= e.length) return { statements: t };
|
|
30
|
+
if (n = e.readByte(), i.has(n)) break;
|
|
31
|
+
}
|
|
32
|
+
let r = e.pos - 1;
|
|
33
|
+
if (n === 80 || n === 81 || n === 82 || n === 83 || n === 84 || n === 111 || n === 113) return e.pos = r, { statements: t };
|
|
34
|
+
if (n === 85) continue;
|
|
35
|
+
if (n === 109) {
|
|
36
|
+
if (e.readByte() !== 110) throw Error("CodeData: expected 0x6E after 0x6D");
|
|
37
|
+
let n = [], r;
|
|
38
|
+
do {
|
|
39
|
+
let t = u(e), i = t.exp.paramList?.[0] ?? null, a = l(e);
|
|
40
|
+
if (n.push({
|
|
41
|
+
condition: i,
|
|
42
|
+
unexaminedCode: t.unexaminedCode,
|
|
43
|
+
block: a,
|
|
44
|
+
comment: t.comment,
|
|
45
|
+
mask: t.mask
|
|
46
|
+
}), e.readByte() !== 83) throw Error("CodeData: expected 0x53 (case end)");
|
|
47
|
+
r = e.readByte();
|
|
48
|
+
} while (r === 110);
|
|
49
|
+
if (r !== 111) throw Error("CodeData: expected 0x6F (default)");
|
|
50
|
+
let i = l(e);
|
|
51
|
+
if (e.readByte() !== 84) throw Error("CodeData: expected 0x54 (switch end)");
|
|
52
|
+
e.readByte(), t.push({
|
|
53
|
+
kind: "switch",
|
|
54
|
+
cases: n,
|
|
55
|
+
defaultBlock: i
|
|
56
|
+
});
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
let { exp: a, unexaminedCode: o, comment: s, mask: c } = u(e);
|
|
60
|
+
switch (n) {
|
|
61
|
+
case 112: {
|
|
62
|
+
let n = l(e);
|
|
63
|
+
if (e.readByte() !== 113) throw Error("CodeData: expected 0x71 (loop end)");
|
|
64
|
+
let r = u(e);
|
|
65
|
+
if (a.libraryId !== 0) throw Error("CodeData: bad loop library id");
|
|
66
|
+
let i = {
|
|
67
|
+
block: n,
|
|
68
|
+
unexaminedCode: o,
|
|
69
|
+
commentOnStart: s,
|
|
70
|
+
commentOnEnd: r.comment,
|
|
71
|
+
maskOnStart: c,
|
|
72
|
+
maskOnEnd: r.mask
|
|
73
|
+
};
|
|
74
|
+
switch (a.methodId) {
|
|
75
|
+
case 3:
|
|
76
|
+
t.push({
|
|
77
|
+
kind: "while",
|
|
78
|
+
condition: a.paramList?.[0] ?? null,
|
|
79
|
+
...i
|
|
80
|
+
});
|
|
81
|
+
break;
|
|
82
|
+
case 5:
|
|
83
|
+
t.push({
|
|
84
|
+
kind: "doWhile",
|
|
85
|
+
condition: r.exp.paramList?.[0] ?? null,
|
|
86
|
+
...i,
|
|
87
|
+
unexaminedCode: r.unexaminedCode
|
|
88
|
+
});
|
|
89
|
+
break;
|
|
90
|
+
case 7:
|
|
91
|
+
t.push({
|
|
92
|
+
kind: "counter",
|
|
93
|
+
count: a.paramList?.[0] ?? null,
|
|
94
|
+
var: a.paramList?.[1] ?? null,
|
|
95
|
+
...i
|
|
96
|
+
});
|
|
97
|
+
break;
|
|
98
|
+
case 9:
|
|
99
|
+
t.push({
|
|
100
|
+
kind: "for",
|
|
101
|
+
start: a.paramList?.[0] ?? null,
|
|
102
|
+
end: a.paramList?.[1] ?? null,
|
|
103
|
+
step: a.paramList?.[2] ?? null,
|
|
104
|
+
var: a.paramList?.[3] ?? null,
|
|
105
|
+
...i
|
|
106
|
+
});
|
|
107
|
+
break;
|
|
108
|
+
default: throw Error(`CodeData: unknown loop methodId ${a.methodId}`);
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case 108: {
|
|
113
|
+
let n = l(e);
|
|
114
|
+
if (e.readByte() !== 82) throw Error("CodeData: expected 0x52");
|
|
115
|
+
e.readByte(), t.push({
|
|
116
|
+
kind: "if",
|
|
117
|
+
condition: a.paramList?.[0] ?? null,
|
|
118
|
+
unexaminedCode: o,
|
|
119
|
+
block: n,
|
|
120
|
+
comment: s,
|
|
121
|
+
mask: c
|
|
122
|
+
});
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
case 107: {
|
|
126
|
+
let n = l(e);
|
|
127
|
+
if (e.readByte() !== 80) throw Error("CodeData: expected 0x50");
|
|
128
|
+
let r = l(e);
|
|
129
|
+
if (e.readByte() !== 81) throw Error("CodeData: expected 0x51");
|
|
130
|
+
e.readByte(), t.push({
|
|
131
|
+
kind: "ifElse",
|
|
132
|
+
condition: a.paramList?.[0] ?? null,
|
|
133
|
+
unexaminedCode: o,
|
|
134
|
+
blockOnTrue: n,
|
|
135
|
+
blockOnFalse: r,
|
|
136
|
+
comment: s,
|
|
137
|
+
mask: c
|
|
138
|
+
});
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case 106:
|
|
142
|
+
o == null ? a.libraryId === -1 ? t.push({
|
|
143
|
+
kind: "expression",
|
|
144
|
+
expr: null,
|
|
145
|
+
mask: !1,
|
|
146
|
+
comment: s
|
|
147
|
+
}) : t.push({
|
|
148
|
+
kind: "expression",
|
|
149
|
+
expr: a,
|
|
150
|
+
mask: c,
|
|
151
|
+
comment: s
|
|
152
|
+
}) : t.push({
|
|
153
|
+
kind: "unexamined",
|
|
154
|
+
code: o,
|
|
155
|
+
mask: c
|
|
156
|
+
});
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function u(e) {
|
|
162
|
+
let t = e.readInt32(), n = e.readInt16(), r = e.readInt16(), i = e.readBStr(), a = e.readBStr(), o = (r & 32) != 0, s = (r & 16) != 0;
|
|
163
|
+
if (i != null) {
|
|
164
|
+
let e = i.indexOf("\0");
|
|
165
|
+
e !== -1 && (i = i.slice(0, e)), i === "" && (i = null);
|
|
166
|
+
}
|
|
167
|
+
if (a != null) {
|
|
168
|
+
let e = a.indexOf("\0");
|
|
169
|
+
e !== -1 && (a = a.slice(0, e)), a === "" && (a = null);
|
|
170
|
+
}
|
|
171
|
+
let c = {
|
|
172
|
+
kind: "call",
|
|
173
|
+
libraryId: n,
|
|
174
|
+
methodId: t,
|
|
175
|
+
invokeSpecial: s,
|
|
176
|
+
target: null,
|
|
177
|
+
paramList: null
|
|
178
|
+
};
|
|
179
|
+
if (e.pos !== e.length) {
|
|
180
|
+
let t = e.readByte();
|
|
181
|
+
if (t === 54) c.paramList = d(e);
|
|
182
|
+
else if (t === 56) --e.pos, c.target = f(e), c.paramList = d(e);
|
|
183
|
+
else throw --e.pos, Error("CodeData: bad call terminator");
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
exp: c,
|
|
187
|
+
unexaminedCode: i,
|
|
188
|
+
comment: a,
|
|
189
|
+
mask: o
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function d(e) {
|
|
193
|
+
let t = [];
|
|
194
|
+
for (;;) {
|
|
195
|
+
let n = f(e);
|
|
196
|
+
if (n === a) break;
|
|
197
|
+
t.push(n);
|
|
198
|
+
}
|
|
199
|
+
return t;
|
|
200
|
+
}
|
|
201
|
+
function f(e, t = !0) {
|
|
202
|
+
let i;
|
|
203
|
+
for (;;) {
|
|
204
|
+
let n = e.readByte();
|
|
205
|
+
if (n === 1) {
|
|
206
|
+
i = a;
|
|
207
|
+
break;
|
|
208
|
+
} else if (n === 22) {
|
|
209
|
+
i = s;
|
|
210
|
+
break;
|
|
211
|
+
} else if (n === 23) {
|
|
212
|
+
i = {
|
|
213
|
+
kind: "number",
|
|
214
|
+
value: e.readFloat64()
|
|
215
|
+
};
|
|
216
|
+
break;
|
|
217
|
+
} else if (n === 24) {
|
|
218
|
+
i = {
|
|
219
|
+
kind: "bool",
|
|
220
|
+
value: e.readInt16() !== 0
|
|
221
|
+
};
|
|
222
|
+
break;
|
|
223
|
+
} else if (n === 25) {
|
|
224
|
+
i = {
|
|
225
|
+
kind: "datetime",
|
|
226
|
+
oa: e.readFloat64()
|
|
227
|
+
};
|
|
228
|
+
break;
|
|
229
|
+
} else if (n === 26) {
|
|
230
|
+
i = {
|
|
231
|
+
kind: "string",
|
|
232
|
+
value: e.readBStr() ?? ""
|
|
233
|
+
};
|
|
234
|
+
break;
|
|
235
|
+
} else if (n === 27) {
|
|
236
|
+
i = {
|
|
237
|
+
kind: "constant",
|
|
238
|
+
libraryId: -2,
|
|
239
|
+
constantId: e.readInt32()
|
|
240
|
+
};
|
|
241
|
+
break;
|
|
242
|
+
} else if (n === 28) {
|
|
243
|
+
i = {
|
|
244
|
+
kind: "constant",
|
|
245
|
+
libraryId: e.readInt16() - 1,
|
|
246
|
+
constantId: e.readInt16() - 1
|
|
247
|
+
};
|
|
248
|
+
break;
|
|
249
|
+
} else if (n === 29) continue;
|
|
250
|
+
else if (n === 30) {
|
|
251
|
+
i = {
|
|
252
|
+
kind: "methodPtr",
|
|
253
|
+
methodId: e.readInt32()
|
|
254
|
+
};
|
|
255
|
+
break;
|
|
256
|
+
} else if (n === 33) {
|
|
257
|
+
i = u(e).exp;
|
|
258
|
+
break;
|
|
259
|
+
} else if (n === 35) {
|
|
260
|
+
let t = e.readInt16() - 1;
|
|
261
|
+
i = {
|
|
262
|
+
kind: "emnu",
|
|
263
|
+
libraryId: e.readInt16() - 1,
|
|
264
|
+
structId: t,
|
|
265
|
+
memberId: e.readInt32() - 1
|
|
266
|
+
};
|
|
267
|
+
break;
|
|
268
|
+
} else if (n === 55) continue;
|
|
269
|
+
else if (n === 31) {
|
|
270
|
+
let t = [], n;
|
|
271
|
+
for (; (n = f(e)) !== o;) t.push(n);
|
|
272
|
+
i = {
|
|
273
|
+
kind: "array",
|
|
274
|
+
items: t
|
|
275
|
+
};
|
|
276
|
+
break;
|
|
277
|
+
} else if (n === 32) {
|
|
278
|
+
i = o;
|
|
279
|
+
break;
|
|
280
|
+
} else if (n === 56) {
|
|
281
|
+
let n = e.readInt32();
|
|
282
|
+
if (n === 83951614) return e.readByte(), f(e, !0);
|
|
283
|
+
i = {
|
|
284
|
+
kind: "variable",
|
|
285
|
+
id: n
|
|
286
|
+
}, t = !0;
|
|
287
|
+
break;
|
|
288
|
+
} else if (n === 59) {
|
|
289
|
+
i = {
|
|
290
|
+
kind: "number",
|
|
291
|
+
value: e.readInt32()
|
|
292
|
+
};
|
|
293
|
+
break;
|
|
294
|
+
} else throw Error(`CodeData: unknown expression type 0x${n.toString(16)}`);
|
|
295
|
+
}
|
|
296
|
+
if (t && (i.kind === "variable" || i.kind === "call" || i.kind === "accessMember" || i.kind === "accessArray")) for (; e.pos !== e.length;) {
|
|
297
|
+
let t = e.readByte();
|
|
298
|
+
if (t === 57) {
|
|
299
|
+
let t = e.readInt32(), a = e.readInt32();
|
|
300
|
+
if (r(a)) {
|
|
301
|
+
let { lib: e, type: r } = n(a);
|
|
302
|
+
i = {
|
|
303
|
+
kind: "accessMember",
|
|
304
|
+
target: i,
|
|
305
|
+
libraryId: e,
|
|
306
|
+
structId: r,
|
|
307
|
+
memberId: t - 1
|
|
308
|
+
};
|
|
309
|
+
} else i = {
|
|
310
|
+
kind: "accessMember",
|
|
311
|
+
target: i,
|
|
312
|
+
libraryId: -2,
|
|
313
|
+
structId: a,
|
|
314
|
+
memberId: t
|
|
315
|
+
};
|
|
316
|
+
} else if (t === 58) i = {
|
|
317
|
+
kind: "accessArray",
|
|
318
|
+
target: i,
|
|
319
|
+
index: f(e, !1)
|
|
320
|
+
};
|
|
321
|
+
else if (t === 55) break;
|
|
322
|
+
else {
|
|
323
|
+
--e.pos;
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return i;
|
|
328
|
+
}
|
|
329
|
+
//#endregion
|
|
330
|
+
export { c as parseStatementBlock };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IdToNameMap } from '../names/idToNameMap';
|
|
2
|
+
/**
|
|
3
|
+
* One guide column's visual on a given line, forming a continuous bracket down a block's own column:
|
|
4
|
+
* - `top` ┌ — the block's header (the vertical drops in here, with a tick toward the keyword).
|
|
5
|
+
* - `bottom` └ — the block's end (the vertical arrives from above and turns toward the row).
|
|
6
|
+
* - `tee` ├ — a branch divider inside the block (否则 / 判断 case / 默认): the vertical passes through.
|
|
7
|
+
* - `mid` │ — a plain pass-through (a body line, or an enclosing block's column running past this row).
|
|
8
|
+
* - `blank` — the column is occupied (so the body stays indented) but no line is drawn: a commented-out
|
|
9
|
+
* (masked) control-flow block keeps its nesting but shows no guide.
|
|
10
|
+
*/
|
|
11
|
+
export type GuideSeg = 'top' | 'bottom' | 'mid' | 'tee' | 'blank';
|
|
12
|
+
/** One rendered source line: the text + one guide segment per enclosing/own block column (left to right). */
|
|
13
|
+
export interface CodeLine {
|
|
14
|
+
text: string;
|
|
15
|
+
segs: GuideSeg[];
|
|
16
|
+
/** A hidden control-flow terminator row (carries only the └ guide): rendered, but takes no line number. */
|
|
17
|
+
noNo?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** Decompile a method's expression data into IDE-style display lines (text + guide segments). */
|
|
20
|
+
export declare function methodCodeLines(expressionData: Uint8Array, nm: IdToNameMap, dec: TextDecoder): CodeLine[];
|