Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattgallagher/CwlDemangle
An implementation of Swift mangled symbol parsing and demangled printing in Swift.
https://github.com/mattgallagher/CwlDemangle
Last synced: 3 months ago
JSON representation
An implementation of Swift mangled symbol parsing and demangled printing in Swift.
- Host: GitHub
- URL: https://github.com/mattgallagher/CwlDemangle
- Owner: mattgallagher
- Created: 2016-05-01T01:58:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-12-08T13:33:02.000Z (almost 4 years ago)
- Last Synced: 2024-03-14T22:38:53.655Z (8 months ago)
- Language: Swift
- Homepage:
- Size: 240 KB
- Stars: 118
- Watchers: 6
- Forks: 25
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CwlDemangle
A translation (line-by-line in many cases) of Swift's [Demangler.cpp](https://github.com/apple/swift/blob/master/lib/Demangling/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](https://github.com/apple/swift/blob/master/LICENSE.txt).
## Usage
Parse a `String` containing a mangled Swift symbol with the `parseMangledSwiftSymbol` function:```swift
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.:```swift
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](https://www.cocoawithlove.com/blog/2016/05/01/swift-name-demangling.html)