Skip to content

Commit a84925c

Browse files
authored
Merge pull request #84 from rxwei/capture-structure-buffer
Add parameters to parser interface for returning the capture structure.
2 parents 0efba6d + e386710 commit a84925c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Sources/_MatchingEngine/Regex/Parse/Mocking.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,21 @@ public let currentRegexLiteralFormatVersion: CUnsignedInt = 1
186186

187187
/// Interface for libswift.
188188
///
189-
/// Parse a regex string from `inputPtr`, which should be null-terminated
190-
/// C-string. `errOut` will be set if an error was encountered.
189+
/// - Parameters:
190+
/// - inputPtr: A null-terminated C string.
191+
/// - errOut: A buffer accepting an error string upon error.
192+
/// - versionOut: A buffer accepting a regex literal format
193+
/// version.
194+
/// - captureStructureOut: A buffer accepting a byte sequence representing the
195+
/// capture structure.
196+
/// - captureStructureSize: The size of the capture structure buffer. Must be
197+
/// greater than or equal to `strlen(inputPtr)`.
191198
func libswiftParseRegexLiteral(
192199
_ inputPtr: UnsafePointer<CChar>?,
193200
_ errOut: UnsafeMutablePointer<UnsafePointer<CChar>?>?,
194-
_ versionOut: UnsafeMutablePointer<CUnsignedInt>?
201+
_ versionOut: UnsafeMutablePointer<CUnsignedInt>?,
202+
_ captureStructureOut: UnsafeMutablePointer<Int8>?,
203+
_ captureStructureSize: CUnsignedInt
195204
) {
196205
guard let s = inputPtr else { fatalError("Expected input param") }
197206
guard let errOut = errOut else { fatalError("Expected error out param") }

0 commit comments

Comments
 (0)