CwlDemangle

master

An implementation of Swift mangled symbol parsing and demangled printing in Swift.
mattgallagher/CwlDemangle

CwlDemangle

A translation (line-by-line in many cases) of Swift's Demangler.cpp into Swift.

License note

I usually place my code under an ISC-style license but since this project is derived from the Swift project, it is covered by that project's Apache License 2.0 with runtime library exception.

Usage

Parse a String containing a mangled Swift symbol with the parseMangledSwiftSymbol function:

let swiftSymbol = try parseMangledSwiftSymbol(input)

Print the symbol to a string with description (to get the .default printing options) or use the print(using:) function, e.g.:

let result = swiftSymbol.print(using:
   SymbolPrintOptions.default.union(.synthesizeSugarOnTypes))

Article

Read more about this project in the associated article on Cocoa with Love: Comparing Swift to C++ for parsing

Description

  • Swift Tools 5.1.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Mar 14 2024 19:39:48 GMT-0900 (Hawaii-Aleutian Daylight Time)