/// ------------------------------------------------------------------------------------
        private string ParseTextInBrackets(string pattern, Match match)
        {
            var group = new PatternGroup(_currEnvType)
            {
                GroupType = GroupType.And
            };
            var symbolsInBracketedText = string.Empty;
            var bracketedText          = ParseTextBetweenOpenAndCloseSymbols(match.Result("${bracketedText}"),
                                                                             FindInnerMostBracesPair, ParseTextInBraces);

            foreach (var chr in bracketedText)
            {
                if (chr <= kMinToken)
                {
                    symbolsInBracketedText += chr;
                }
                else if (_tokenGroups[chr] is string)
                {
                    // The only time a token group is a string is when it contains a diacritic pattern cluster.
                    if (((string)_tokenGroups[chr]).Contains(App.DottedCircle))
                    {
                        group.SetDiacriticPattern((string)_tokenGroups[chr]);
                    }
                    _tokenGroups.Remove(chr);
                }
                else
                {
                    group.AddMember(_tokenGroups[chr]);
                    _tokenGroups.Remove(chr);
                }
            }

            if (symbolsInBracketedText != string.Empty)
            {
                // If plain text (i.e. not features or classes) is found between the square brackets,
                // then if it represents a single phone, that's fine. Otherwise, it's an error.
                // This deals with patterns like "[b[0*]]" (where 0 is the diacritic placeholder).
                // By the time we get here, it's assumed the SearchQueryValidator has caught errors.
                var phonesInBrackets = _project.PhoneticParser.Parse(symbolsInBracketedText, true, false);
                group.AddMember(new PatternGroupMember(phonesInBrackets[0]));
            }

            if (group.Members.Count == 1 && group.Members[0] is PatternGroup)
            {
                group = (PatternGroup)group.Members[0];
            }

            _tokenGroups[++_token] = group;
            return(ReplaceMatchedTextWithToken(pattern, match, _token));
        }