demangle.go
func (st *state) vectorType(isCast bool) AST {
	if len(st.str) == 0 {
		st.fail("expected vector dimension")
	}

	var dim AST
	if st.str[0] == '_' {
		st.advance(1)
		dim = st.expression()
	} else {
		num := st.number()
		dim = &Name{Name: fmt.Sprintf("%d", num)}
	}

	if len(st.str) == 0 || st.str[0] != '_' {
		st.fail("expected _ after vector dimension")
	}
	st.advance(1)

	t := st.demangleType(isCast)

	return &VectorType{Dimension: dim, Base: t}
}
func (st *state) vectorType(isCast bool) AST {
	if len(st.str) == 0 {
		st.fail("expected vector dimension")
	}

	var dim AST
	if st.str[0] == '_' {
		st.advance(1)
		dim = st.expression()
	} else {
		num := st.number()
		dim = &Name{Name: fmt.Sprintf("%d", num)}
	}

	if len(st.str) == 0 || st.str[0] != '_' {
		st.fail("expected _ after vector dimension")
	}
	st.advance(1)

	t := st.demangleType(isCast)

	return &VectorType{Dimension: dim, Base: t}
}
func ( st * state ) vectorType ( isCast bool ) AST { if len ( st . str ) == 0 { st . fail ( " " ) } var dim AST if st . str [ 0 ] == '_' { st . advance ( 1 ) dim = st . expression ( ) } else { num := st . number ( ) dim = & Name { Name : fmt . Sprintf ( " " , num ) } } if len ( st . str ) == 0 || st . str [ 0 ] != '_' { st . fail ( " " ) } st . advance ( 1 ) t := st . demangleType ( isCast ) return & VectorType { Dimension : dim , Base : t } }
// <vector-type> ::= Dv <number> _ <type>
//               ::= Dv _ <expression> _ <type>
<vector - type > :: = Dv <number > _ <type > :: = Dv _ <expression > _ <type >