Ejemplo n.º 1
0
        static ValueStore.Node GetNodeRecursive(ValueStore.Node current, Match match, int index)
        {
            Capture next;
            var     groupIndex = FindNextCapture(match, index, out next);

            if (groupIndex < 0)
            {
                Debug.LogWarning("Unexpected end of captures in match: " + match);
                return(current);
            }
            else if (groupIndex == 2)
            {
                var child = current.GetOrCreateChild(next.Value);
                return(GetNodeRecursive(child, match, next.Index + next.Length));
            }
            else if (groupIndex == 3 || groupIndex == 4)
            {
                var isQuoted = (groupIndex == 3);
                var variant  = current.GetOrCreateVariant(ProcessQuotedString(next.Value, isQuoted));
                return(GetNodeRecursive(variant, match, next.Index + next.Length));
            }
            else
            {
                return(current);
            }
        }