@@ -13,7 +13,7 @@ internal struct Parser {
1313 // MARK: Types
1414
1515 /// An equation component.
16- private struct EquationComponent < T, U> {
16+ struct EquationComponent < T, U> {
1717 let regex : Regex < T >
1818 let terminatingRegex : Regex < U >
1919 let equation : Component . ComponentType
@@ -23,42 +23,42 @@ internal struct Parser {
2323 // MARK: Private properties
2424
2525 /// An inline equation component.
26- private static let inline = EquationComponent (
26+ static let inline = EquationComponent (
2727 regex: #/\$(.|\s)*?\$/# ,
2828 terminatingRegex: #/\$/# ,
2929 equation: . inlineEquation,
3030 supportsRecursion: false )
3131
3232 /// An TeX-style block equation component.
33- private static let tex = EquationComponent (
33+ static let tex = EquationComponent (
3434 regex: #/\$\$(.|\s)*?\$\$/# ,
3535 terminatingRegex: #/\$\$/# ,
3636 equation: . texEquation,
3737 supportsRecursion: false )
3838
3939 /// A block equation.
40- private static let block = EquationComponent (
40+ static let block = EquationComponent (
4141 regex: #/\\\[(.|\s)*?\\\]/# ,
4242 terminatingRegex: #/\\\]/# ,
4343 equation: . blockEquation,
4444 supportsRecursion: false )
4545
4646 /// A named equation component.
47- private static let named = EquationComponent (
48- regex: #/\\begin{equation}(.|\s)*\\end{equation}/# ,
47+ static let named = EquationComponent (
48+ regex: #/\\begin{equation}(.|\s)*? \\end{equation}/# ,
4949 terminatingRegex: #/\\end{equation}/# ,
5050 equation: . namedEquation,
5151 supportsRecursion: true )
5252
5353 /// A named no number equation component.
54- private static let namedNoNumber = EquationComponent (
55- regex: #/\\begin{equation\*}(.|\s)*\\end{equation\*}/# ,
54+ static let namedNoNumber = EquationComponent (
55+ regex: #/\\begin{equation\*}(.|\s)*? \\end{equation\*}/# ,
5656 terminatingRegex: #/\\end{equation\*}/# ,
5757 equation: . namedNoNumberEquation,
5858 supportsRecursion: true )
5959
6060 // Order matters
61- private static let allEquations : [ EquationComponent ] = [
61+ static let allEquations : [ EquationComponent ] = [
6262 inline,
6363 tex,
6464 block,
@@ -185,22 +185,3 @@ extension Parser {
185185 }
186186
187187}
188-
189- // MARK: Private static methods
190-
191- extension Parser {
192-
193- /// Determines if an index is smaller than all of the indexes in another
194- /// array.
195- ///
196- /// - Parameters:
197- /// - index: The index to compare.
198- /// - indexes: The indexes. The value `index` should not be present in this.
199- /// - Returns: A boolean.
200- private static func isSmallest( _ index: String . Index ? , outOf indexes: [ String . Index ? ] ) -> Bool {
201- guard let index = index else { return false }
202- let indexes = indexes. filter ( { $0 != nil } ) . map ( { $0! } ) as! [ String . Index ]
203- return indexes. first ( where: { $0 < index } ) == nil
204- }
205-
206- }
0 commit comments