File tree 2 files changed +27
-3
lines changed
2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change
1
+ import Foundation
2
+
3
+ public struct Formatter {
4
+ private let parser : Parser
5
+
6
+ public init (
7
+ colored: Bool = true ,
8
+ renderer: Renderer ,
9
+ preserveUnbeautifiedLines: Bool = false ,
10
+ additionalLines: @escaping ( ) -> ( String ? )
11
+ ) {
12
+ self . parser = Parser (
13
+ colored: colored,
14
+ renderer: renderer,
15
+ preserveUnbeautifiedLines: preserveUnbeautifiedLines,
16
+ additionalLines: additionalLines
17
+ )
18
+ }
19
+
20
+ public func parse( line: String ) -> String ? {
21
+ parser. parse ( line: line)
22
+ }
23
+
24
+ }
Original file line number Diff line number Diff line change 1
- public class Parser {
1
+ package class Parser {
2
2
private let colored : Bool
3
3
4
4
private let renderer : OutputRendering
@@ -98,7 +98,7 @@ public class Parser {
98
98
99
99
// MARK: - Init
100
100
101
- public init (
101
+ package init (
102
102
colored: Bool = true ,
103
103
renderer: Renderer ,
104
104
preserveUnbeautifiedLines: Bool = false ,
@@ -117,7 +117,7 @@ public class Parser {
117
117
self . additionalLines = additionalLines
118
118
}
119
119
120
- public func parse( line: String ) -> String ? {
120
+ package func parse( line: String ) -> String ? {
121
121
// Find first parser that can parse specified string
122
122
guard let idx = captureGroupTypes. firstIndex ( where: { $0. regex. match ( string: line) } ) else {
123
123
// Some uncommon cases, which have additional logic and don't follow default flow
You can’t perform that action at this time.
0 commit comments