private int RetrievePayloadIndex(string payload, IList <IParseTO> result, ref StringBuilder region, ref bool openRegion, ref IParseTO currentNode, ref IParseTO root, string methodPayload)
        {
            var previousPayload = '\0';
            int payloadIndex;

            for (payloadIndex = 0; payloadIndex < methodPayload.Length; payloadIndex++)
            {
                var currentPayload    = methodPayload[payloadIndex];
                var shouldAddToRegion = _parserHelper.ShouldAddToRegion(methodPayload, currentPayload, previousPayload, payloadIndex, true, '[');
                shouldAddToRegion = _parserHelper.ShouldAddToRegion(methodPayload, currentPayload, previousPayload, payloadIndex, shouldAddToRegion, ']');

                if (currentPayload == '[' && previousPayload == '[')
                {
                    currentNode    = openRegion ? _parserHelper.CurrentNode(currentNode, region, payloadIndex) : ParseTO(currentNode, payloadIndex, result, ref root, ref openRegion);
                    currentPayload = '\0';
                }

                if (currentPayload == ']' && previousPayload == ']')
                {
                    openRegion = _parserHelper.ProcessOpenRegion(payload, openRegion, payloadIndex, ref currentNode, ref region, ref currentPayload);
                }

                if (openRegion && shouldAddToRegion && currentPayload != '\0')
                {
                    region.Append(currentPayload);
                }
                previousPayload = currentPayload;
            }

            return(payloadIndex);
        }
Пример #2
0
 static IParseTO CurrentNode(IParseTO currentNode, StringBuilder region, int i) => _parserHelper.CurrentNode(currentNode, region, i);