private int captureType(
        final List<Token> tokens,
        final int index,
        final Signal endSignal,
        final String name,
        final String referencedName)
    {
        final List<Token> typeTokens = new ArrayList<>();

        int i = index;
        Token token = tokens.get(i);
        typeTokens.add(token);
        do
        {
            token = tokens.get(++i);
            typeTokens.add(token);
        }
        while (endSignal != token.signal() || !name.equals(token.name()));

        updateComponentTokenCounts(typeTokens);

        final String typeName = null == referencedName ? name : referencedName;
        final List<Token> existingTypeTokens = typesByNameMap.get(typeName);

        if (null == existingTypeTokens || existingTypeTokens.get(0).version() > typeTokens.get(0).version())
        {
            typesByNameMap.put(typeName, typeTokens);
        }

        return i;
    }
Construct an array of namespace strings based on the supplied namespaceName,
accounting for the CPP_NAMESPACES_COLLAPSE option.

@param namespaceName a namespace name that may contain period-separated nested namespaces
@return an array of nested namespace strings
sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Ir.java