Пример #1
0
        public int Key => key; // Used to save the state

        public int Push(int beg, int end, int groupId)
        {
            // Ensure there is a stack present for the groupId
            if (!capture.ContainsKey(groupId))
                capture[groupId] = new Stack<CaptureInfo>();

            // Create the capture info struct and add it to the stack
            var info = new CaptureInfo(beg, end, groupId, ++key);
            capture[groupId].Push(info);

            // Return the new key as a convenience
            return info.key;
        }
Пример #2
0
        public int Key => key; // Used to save the state

        public int Push(int beg, int end, int groupId)
        {
            // Ensure there is a stack present for the groupId
            if (!capture.ContainsKey(groupId))
            {
                capture[groupId] = new Stack <CaptureInfo>();
            }

            // Create the capture info struct and add it to the stack
            var info = new CaptureInfo(beg, end, groupId, ++key);

            capture[groupId].Push(info);

            // Return the new key as a convenience
            return(info.key);
        }