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); }
public PcreDfaMatchResult DfaMatch(string subject, PcreDfaMatchSettings settings, int startIndex, uint additionalOptions) { var input = new Native.dfa_match_input(); settings.FillMatchInput(ref input); var oVector = new uint[2 * Math.Max(1, settings.MaxResults)]; 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.dfa_match(ref input, out result); } AfterMatch(result, ref calloutInterop); return(new PcreDfaMatchResult(subject, ref result, oVector)); }
private PcreMatch Match(string subject, PcreMatchSettings settings, ref Native.match_input input) { var oVector = new uint[2 * (CaptureCount + 1)]; 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; 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)); }