File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Sources/_StringProcessing/RegexDSL Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,11 @@ public protocol RegexProtocol {
12
12
}
13
13
14
14
/// A regular expression.
15
+ @frozen
15
16
public struct Regex < Capture> : RegexProtocol {
16
17
/// A program representation that caches any lowered representation for
17
18
/// execution.
19
+ @usableFromInline
18
20
internal class Program {
19
21
/// The underlying AST.
20
22
let ast : AST
@@ -34,13 +36,20 @@ public struct Regex<Capture>: RegexProtocol {
34
36
}
35
37
}
36
38
39
+ @usableFromInline
37
40
let program : Program
38
41
var ast : AST { program. ast }
39
42
40
43
init ( ast: AST ) {
41
44
self . program = Program ( ast: ast)
42
45
}
43
46
47
+ // Compiler interface. Do not change independently.
48
+ @usableFromInline
49
+ init ( _regexString pattern: String ) {
50
+ self . init ( ast: try ! parse ( pattern, . traditional) )
51
+ }
52
+
44
53
public init < Content: RegexProtocol > (
45
54
_ content: Content
46
55
) where Content. Capture == Capture {
You can’t perform that action at this time.
0 commit comments