Esempio n. 1
0
        public void Match(ref PcreRefMatch match, ReadOnlySpan <char> subject, PcreMatchSettings settings, int startIndex, uint additionalOptions)
        {
            var input = new Native.match_input();

            settings.FillMatchInput(ref input);

            Native.match_result result;
            CalloutInterop.CalloutInteropInfo calloutInterop;

            fixed(char *pSubject = subject)
            fixed(uint *pOVec = match.OutputVector)
            {
                input.code               = _code;
                input.subject            = pSubject;
                input.subject_length     = (uint)subject.Length;
                input.output_vector      = pOVec;
                input.start_index        = (uint)startIndex;
                input.additional_options = additionalOptions;

                if (input.subject == (char *)0 && input.subject_length == 0)
                {
                    input.subject = (char *)1; // PCRE doesn't like null subjects, even if the length is zero
                }
                CalloutInterop.Prepare(subject, this, ref input, out calloutInterop, settings.RefCallout);

                Native.match(ref input, out result);
            }

            AfterMatch(result, ref calloutInterop);

            match.Update(subject, result);
        }
Esempio n. 2
0
        public PcreMatch Match(string subject, PcreMatchSettings settings, int startIndex, uint additionalOptions)
        {
            var input = new Native.match_input();

            settings.FillMatchInput(ref input);

            var oVector = new uint[OutputVectorSize];

            Native.match_result result;
            CalloutInterop.CalloutInteropInfo calloutInterop;

            fixed(char *pSubject = subject)
            fixed(uint *pOVec = &oVector[0])
            {
                input.code               = _code;
                input.subject            = pSubject;
                input.subject_length     = (uint)subject.Length;
                input.output_vector      = pOVec;
                input.start_index        = (uint)startIndex;
                input.additional_options = additionalOptions;

                CalloutInterop.Prepare(subject, this, ref input, out calloutInterop, settings.Callout);

                Native.match(ref input, out result);
            }

            AfterMatch(result, ref calloutInterop);

            return(new PcreMatch(subject, this, ref result, oVector));
        }
Esempio n. 3
0
        public PcreMatch Match(string subject, PcreMatchSettings settings)
        {
            var input = new Native.match_input();

            settings.FillMatchInput(ref input);
            return(Match(subject, settings, ref input));
        }
Esempio n. 4
0
        public PcreMatch Match(string subject, PcreMatchSettings settings, int startIndex, uint additionalOptions)
        {
            var input = new Native.match_input();

            settings.FillMatchInput(ref input);
            input.start_index        = (uint)startIndex;
            input.additional_options = additionalOptions;
            return(Match(subject, settings, ref input));
        }