Skip to content

Add parameters to parser interface for returning the capture structure. #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Sources/_MatchingEngine/Regex/Parse/Mocking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,21 @@ public let currentRegexLiteralFormatVersion: CUnsignedInt = 1

/// Interface for libswift.
///
/// Parse a regex string from `inputPtr`, which should be null-terminated
/// C-string. `errOut` will be set if an error was encountered.
/// - Parameters:
/// - inputPtr: A null-terminated C string.
/// - errOut: A buffer accepting an error string upon error.
/// - versionOut: A buffer accepting a regex literal format
/// version.
/// - captureStructureOut: A buffer accepting a byte sequence representing the
/// capture structure.
/// - captureStructureSize: The size of the capture structure buffer. Must be
/// greater than or equal to `strlen(inputPtr)`.
func libswiftParseRegexLiteral(
_ inputPtr: UnsafePointer<CChar>?,
_ errOut: UnsafeMutablePointer<UnsafePointer<CChar>?>?,
_ versionOut: UnsafeMutablePointer<CUnsignedInt>?
_ versionOut: UnsafeMutablePointer<CUnsignedInt>?,
_ captureStructureOut: UnsafeMutablePointer<Int8>?,
_ captureStructureSize: CUnsignedInt
) {
guard let s = inputPtr else { fatalError("Expected input param") }
guard let errOut = errOut else { fatalError("Expected error out param") }
Expand Down