Skip to content

Commit 39de08b

Browse files
committed
- Swift 5 verified
1 parent f46c075 commit 39de08b

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

Common/Tracery.Eval.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension Tracery {
3030

3131
func eval(_ nodes: [ParserNode]) throws -> String {
3232

33-
var choices = 1
33+
// var choices = 1
3434

3535
// the execution stack
3636
// var stack = [ExecutionContext]()
@@ -142,7 +142,7 @@ extension Tracery {
142142
try applyMods(nodes: choice.nodes, mods: mods)
143143
// try pushContext(choice.nodes, affectsEvaluationLevel: false)
144144
trace("🎲 picked \(choice.nodes)")
145-
choices *= values.count
145+
// choices *= values.count
146146

147147
case let .tag(name, values):
148148

@@ -280,7 +280,7 @@ extension Tracery {
280280
state = .apply(mapping.candidates[index].value.nodes)
281281
trace("📙 eval \(runTime ? "runtime" : "") \(node)")
282282

283-
choices *= mapping.candidates.count
283+
// choices *= mapping.candidates.count
284284
}
285285

286286
if name.isEmpty {
@@ -291,7 +291,7 @@ extension Tracery {
291291
let value = mapping.candidates[i]
292292
trace("📗 get tag[\(name)] --> \(value)")
293293
state = .apply([.text(value)])
294-
choices *= mapping.candidates.count
294+
// choices *= mapping.candidates.count
295295
}
296296
else if let object = objects[name] {
297297
let value = "\(object)"
@@ -315,8 +315,8 @@ extension Tracery {
315315
}
316316
}
317317

318-
trace("🧾 had \(choices) options to chose from")
319-
318+
// trace("🧾 had \(choices) options to chose from")
319+
320320
// finally pop the last
321321
// context and
322322
return popContext().result

Testing/Kalk.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class Kalk: XCTestCase {
2929
XCTAssertGreaterThan(Double(t.expand("#.k(#kalkRand3#)#"))!, 9.99)
3030
}
3131

32-
func testKalk2() {
33-
let t = Tracery()
34-
Tracery.logLevel = .verbose
35-
XCTAssertEqual(t.expand("[=2+2]"), "4.0")
36-
}
32+
// func testKalk2() {
33+
// let t = Tracery()
34+
// Tracery.logLevel = .verbose
35+
// XCTAssertEqual(t.expand("[=2+2]"), "4.0")
36+
// }
3737

3838
}

Testing/TextFormat.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ class TextFormat: XCTestCase {
6868
let lines = [
6969
"[origin]",
7070
"#second#",
71-
"#second# #second#",
71+
"[second]",
72+
"overwritten",
7273
"[second]",
7374
"result",
7475
]

0 commit comments

Comments
 (0)