private void captureTypes(final List<Token> tokens, final int beginIndex, final int endIndex)
    {
        for (int i = beginIndex; i <= endIndex; i++)
        {
            final Token token = tokens.get(i);
            final int typeBeginIndex = i;

            switch (token.signal())
            {
                case BEGIN_COMPOSITE:
                    i = captureType(tokens, i, Signal.END_COMPOSITE, token.name(), token.referencedName());
                    captureTypes(tokens, typeBeginIndex + 1, i - 1);
                    break;

                case BEGIN_ENUM:
                    i = captureType(tokens, i, Signal.END_ENUM, token.name(), token.referencedName());
                    break;

                case BEGIN_SET:
                    i = captureType(tokens, i, Signal.END_SET, token.name(), token.referencedName());
                    break;

                default:
                    break;
            }
        }
    }
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