demangle.go
func (st *state) sourceName() AST {
	val := st.number()
	if val <= 0 {
		st.fail("expected positive number")
	}
	if len(st.str) < val {
		st.fail("not enough characters for identifier")
	}
	id := st.str[:val]
	st.advance(val)

	// Look for GCC encoding of anonymous namespace, and make it
	// more friendly.
	const anonPrefix = "_GLOBAL_"
	if strings.HasPrefix(id, anonPrefix) && len(id) > len(anonPrefix)+2 {
		c1 := id[len(anonPrefix)]
		c2 := id[len(anonPrefix)+1]
		if (c1 == '.' || c1 == '_' || c1 == '$') && c2 == 'N' {
			id = "(anonymous namespace)"
		}
	}

	n := &Name{Name: id}
	return n
}
func (st *state) sourceName() AST {
	val := st.number()
	if val <= 0 {
		st.fail("expected positive number")
	}
	if len(st.str) < val {
		st.fail("not enough characters for identifier")
	}
	id := st.str[:val]
	st.advance(val)

	// Look for GCC encoding of anonymous namespace, and make it
	// more friendly.
	const anonPrefix = "_GLOBAL_"
	if strings.HasPrefix(id, anonPrefix) && len(id) > len(anonPrefix)+2 {
		c1 := id[len(anonPrefix)]
		c2 := id[len(anonPrefix)+1]
		if (c1 == '.' || c1 == '_' || c1 == '$') && c2 == 'N' {
			id = "(anonymous namespace)"
		}
	}

	n := &Name{Name: id}
	return n
}
func ( st * state ) sourceName ( ) AST { val := st . number ( ) if val <= 0 { st . fail ( " " ) } if len ( st . str ) < val { st . fail ( " " ) } id := st . str [ : val ] st . advance ( val ) // Look for GCC encoding of anonymous namespace, and make it // more friendly. const anonPrefix = " " if strings . HasPrefix ( id , anonPrefix ) && len ( id ) > len ( anonPrefix ) + 2 { c1 := id [ len ( anonPrefix ) ] c2 := id [ len ( anonPrefix ) + 1 ] if ( c1 == '.' || c1 == '_' || c1 == '$' ) && c2 == 'N' { id = " " } } n := & Name { Name : id } return n }
// <source-name> ::= <(positive length) number> <identifier>
// identifier ::= <(unqualified source code identifier)>
<source - name > :: = < ( positive length ) number > <identifier > identifier :: = < ( unqualified source code identifier ) >