demangle.go
func ToAST(name string, options ...Option) (AST, error) {
	if strings.HasPrefix(name, "_Z") {
		a, err := doDemangle(name[2:], options...)
		return a, adjustErr(err, 2)
	}

	const prefix = "_GLOBAL_"
	if strings.HasPrefix(name, prefix) {
		// The standard demangler ignores NoParams for global
		// constructors.  We are compatible.
		i := 0
		for i < len(options) {
			if options[i] == NoParams {
				options = append(options[:i], options[i+1:]...)
			} else {
				i++
			}
		}
		a, err := globalCDtorName(name[len(prefix):], options...)
		return a, adjustErr(err, len(prefix))
	}

	return nil, ErrNotMangledName
}
func ToAST(name string, options ...Option) (AST, error) {
	if strings.HasPrefix(name, "_Z") {
		a, err := doDemangle(name[2:], options...)
		return a, adjustErr(err, 2)
	}

	const prefix = "_GLOBAL_"
	if strings.HasPrefix(name, prefix) {
		// The standard demangler ignores NoParams for global
		// constructors.  We are compatible.
		i := 0
		for i < len(options) {
			if options[i] == NoParams {
				options = append(options[:i], options[i+1:]...)
			} else {
				i++
			}
		}
		a, err := globalCDtorName(name[len(prefix):], options...)
		return a, adjustErr(err, len(prefix))
	}

	return nil, ErrNotMangledName
}
func ToAST ( name string , options ... Option ) ( AST , error ) { if strings . HasPrefix ( name , " " ) { a , err := doDemangle ( name [ 2 : ] , options ... ) return a , adjustErr ( err , 2 ) } const prefix = " " if strings . HasPrefix ( name , prefix ) { // The standard demangler ignores NoParams for global // constructors.  We are compatible. i := 0 for i < len ( options ) { if options [ i ] == NoParams { options = append ( options [ : i ] , options [ i + 1 : ] ... ) } else { i ++ } } a , err := globalCDtorName ( name [ len ( prefix ) : ] , options ... ) return a , adjustErr ( err , len ( prefix ) ) } return nil , ErrNotMangledName }
// ToAST demangles a C++ symbol name into an abstract syntax tree
// representing the symbol.
// If the NoParams option is passed, and the name has a function type,
// the parameter types are not demangled.
// If the name does not appear to be a C++ symbol name at all, the
// error will be ErrNotMangledName.
ToAST demangles a C ++ symbol name into an abstract syntax tree representing the symbol . If the NoParams option is passed and the name has a function type the parameter types are not demangled . If the name does not appear to be a C ++ symbol name at all the error will be ErrNotMangledName .