demangler-1.3.2.0: Demangler for C++ mangled names.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Demangler

Synopsis

Documentation

data Context Source #

The Context provides a persistent information and collection over a set of demangling calls. This allows for additional efficiency in memory storage.

Instances

Instances details
Sayable saytag (WithContext Encoding) => Sayable saytag Result Source # 
Instance details

Defined in Demangler.PPrint

Methods

sayable :: Result -> Saying saytag #

Sayable "diagnostic" (WithContext Encoding) => Sayable "diagnostic" Result Source # 
Instance details

Defined in Demangler.PPrint

Methods

sayable :: Result -> Saying "diagnostic" #

newDemangling :: Context Source #

Return an initial Context useable for calls to demangle.

data Demangled Source #

The Demangled data structure holds the demangled name in data-oriented format. This format encodes the various roles and portions of the mangled name in an AST-like structure that closely matches the mangled specification. Unfortunately, this is a relatively messy representation that is not easy to work with, and where things that might seem simple (e.g. the base function name) can be encoded in a number of different ways. Therefore, the details of this structure are not exported and it should either be rendered to printable version via the sayable package or inspected via accessor functions (like functionName).

Instances

Instances details
Sayable saytag (WithContext Encoding) => Sayable saytag Result Source # 
Instance details

Defined in Demangler.PPrint

Methods

sayable :: Result -> Saying saytag #

Sayable "diagnostic" (WithContext Encoding) => Sayable "diagnostic" Result Source # 
Instance details

Defined in Demangler.PPrint

Methods

sayable :: Result -> Saying "diagnostic" #

demangle :: Text -> Context -> Result Source #

Demangle an input string, given a Context for demangling.

The signature of this function makes it ideal for State evaluation.

demangle1 :: Text -> Result Source #

Demangle a single entry. If there are multiple entries to be demangled, use demangle for efficient batching and memory reduction.

functionName :: Result -> Maybe (NonEmpty Text) Source #

Returns the base function name. This is the core text name for the function (C-style) followed by the parent class/namespace (innermost-to-outermost) but without any argument and template information and therefore it is not necessarily unique. The parent names have any template information removed as well. For example:

std::mapchar::insert(...) returns "insert" :| [ "map", "std" ]

The reason for the reversed form is that the base name is usually the most relevant, and the parent information can be optionally consumed (and lazily generated) as needed.

If the name could not be demangled, the non-demangled form is returned (perhaps it is a plain function name already?).

If the demangled name is not a function (e.g. a data or special name) then Nothing is returned.