|
1 | 1 | @_exported import Eval |
2 | | -import Foundation |
3 | 2 | @_exported import class Eval.Pattern |
| 3 | +import Foundation |
4 | 4 |
|
5 | 5 | public class TemplateLanguage: EvaluatorWithLocalContext { |
6 | 6 | public typealias EvaluatedType = String |
@@ -67,7 +67,7 @@ public class TemplateLanguage: EvaluatorWithLocalContext { |
67 | 67 | } |
68 | 68 | return convert(value) |
69 | 69 | } |
70 | | - |
| 70 | + |
71 | 71 | func replaceWhitespaces(_ input: String) -> String { |
72 | 72 | let tag = "{-}" |
73 | 73 | var input = input |
@@ -106,8 +106,8 @@ public class TemplateLanguage: EvaluatorWithLocalContext { |
106 | 106 | } |
107 | 107 | } |
108 | 108 |
|
109 | | -typealias Macro = (arguments: [String], body: String) |
110 | | -typealias BlockRenderer = (_ context: Context) -> String |
| 109 | +internal typealias Macro = (arguments: [String], body: String) |
| 110 | +internal typealias BlockRenderer = (_ context: Context) -> String |
111 | 111 |
|
112 | 112 | extension Context { |
113 | 113 | static let macrosKey: String = "__macros" |
@@ -181,7 +181,7 @@ public class TemplateLibrary { |
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
184 | | - |
| 184 | + |
185 | 185 | public static var printStatement: Pattern<String, TemplateInterpreter<String>> { |
186 | 186 | return Pattern([OpenKeyword("{{"), Variable<Any>("body"), CloseKeyword("}}")]) { variables, interpreter, _ in |
187 | 187 | guard let body = variables["body"] else { return nil } |
@@ -411,12 +411,12 @@ public class StandardLibrary { |
411 | 411 |
|
412 | 412 | public static var numericType: DataType<Double> { |
413 | 413 | let numberLiteral = Literal { value, _ in Double(value) } |
414 | | - let pi = Literal("pi", convertsTo: Double.pi) |
415 | | - return DataType(type: Double.self, literals: [numberLiteral, pi]) { value, _ in String(format: "%g", value) } |
| 414 | + let piLiteral = Literal("pi", convertsTo: Double.pi) |
| 415 | + return DataType(type: Double.self, literals: [numberLiteral, piLiteral]) { value, _ in String(format: "%g", value) } |
416 | 416 | } |
417 | 417 |
|
418 | 418 | public static var stringType: DataType<String> { |
419 | | - let singleQuotesLiteral = literal(opening: "'", closing: "'") { (input, _) in input } |
| 419 | + let singleQuotesLiteral = literal(opening: "'", closing: "'") { input, _ in input } |
420 | 420 | return DataType(type: String.self, literals: [singleQuotesLiteral]) { value, _ in value } |
421 | 421 | } |
422 | 422 |
|
@@ -994,7 +994,7 @@ public class StandardLibrary { |
994 | 994 | } |
995 | 995 |
|
996 | 996 | public static var methodCallWithIntResult: Function<Double> { |
997 | | - return Function([Variable<Any>("lhs"), Keyword("."), Variable<String>("rhs", options: .notInterpreted)]) { (arguments, _, _) -> Double? in |
| 997 | + return Function([Variable<Any>("lhs"), Keyword("."), Variable<String>("rhs", options: .notInterpreted)]) { arguments, _, _ -> Double? in |
998 | 998 | if let lhs = arguments["lhs"] as? NSObjectProtocol, |
999 | 999 | let rhs = arguments["rhs"] as? String, |
1000 | 1000 | let result = lhs.perform(Selector(rhs)) { |
@@ -1170,11 +1170,11 @@ extension String { |
1170 | 1170 |
|
1171 | 1171 | var html: String { |
1172 | 1172 | var html = "" |
1173 | | - for c in self { |
1174 | | - if let entity = String.enc[c] { |
| 1173 | + for character in self { |
| 1174 | + if let entity = String.enc[character] { |
1175 | 1175 | html.append(entity) |
1176 | 1176 | } else { |
1177 | | - html.append(c) |
| 1177 | + html.append(character) |
1178 | 1178 | } |
1179 | 1179 | } |
1180 | 1180 | return html |
|
0 commit comments