func (st *state) arrayType(isCast bool) AST {
	st.checkChar('A')

	if len(st.str) == 0 {
		st.fail("missing array dimension")
	}

	var dim AST
	if st.str[0] == '_' {
		dim = &Name{Name: ""}
	} else if isDigit(st.str[0]) {
		i := 1
		for len(st.str) > i && isDigit(st.str[i]) {
			i++
		}
		dim = &Name{Name: st.str[:i]}
		st.advance(i)
	} else {
		dim = st.expression()
	}

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

	t := st.demangleType(isCast)

	arr := &ArrayType{Dimension: dim, Element: t}

	// Qualifiers on the element of an array type go on the whole
	// array type.
	if q, ok := arr.Element.(*TypeWithQualifiers); ok {
		return &TypeWithQualifiers{Base: &ArrayType{Dimension: dim, Element: q.Base}, Qualifiers: q.Qualifiers}
	}

	return arr
}
func (st *state) arrayType(isCast bool) AST {
	st.checkChar('A')

	if len(st.str) == 0 {
		st.fail("missing array dimension")
	}

	var dim AST
	if st.str[0] == '_' {
		dim = &Name{Name: ""}
	} else if isDigit(st.str[0]) {
		i := 1
		for len(st.str) > i && isDigit(st.str[i]) {
			i++
		}
		dim = &Name{Name: st.str[:i]}
		st.advance(i)
	} else {
		dim = st.expression()
	}

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

	t := st.demangleType(isCast)

	arr := &ArrayType{Dimension: dim, Element: t}

	
	
	if q, ok := arr.Element.(*TypeWithQualifiers); ok {
		return &TypeWithQualifiers{Base: &ArrayType{Dimension: dim, Element: q.Base}, Qualifiers: q.Qualifiers}
	}

	return arr
}
func ( st * state ) arrayType ( isCast bool ) AST { st . checkChar ( 'A' ) if len ( st . str ) == 0 { st . fail ( " " ) } var dim AST if st . str [ 0 ] == '_' { dim = & Name { Name : " " } } else if isDigit ( st . str [ 0 ] ) { i := 1 for len ( st . str ) > i && isDigit ( st . str [ i ] ) { i ++ } dim = & Name { Name : st . str [ : i ] } st . advance ( i ) } else { dim = st . expression ( ) } if len ( st . str ) == 0 || st . str [ 0 ] != '_' { st . fail ( " " ) } st . advance ( 1 ) t := st . demangleType ( isCast ) arr := & ArrayType { Dimension : dim , Element : t } // Qualifiers on the element of an array type go on the whole // array type. if q , ok := arr . Element . ( * TypeWithQualifiers ) ; ok { return & TypeWithQualifiers { Base : & ArrayType { Dimension : dim , Element : q . Base } , Qualifiers : q . Qualifiers } } return arr }
// <array-type> ::= A <(positive dimension) number> _ <(element) type>
//              ::= A [<(dimension) expression>] _ <(element) type>
<array - type > :: = A < ( positive dimension ) number > _ < ( element ) type > :: = A [ < ( dimension ) expression > ] _ < ( element ) type >