   // points to OA[j] and NA[i + 1] and OA[j + 1] contain identical symbol table entry pointers, then
   // OA[j + 1] is set to line i + 1 and NA[i + 1] is set to line j + 1.
   var i = 1
-  while (i < na.count - 1) {
-    if case .index(let j) = na[i], j + 1 < oa.count {
-      if case .symbol(let newEntry) = na[i + 1], case .symbol(let oldEntry) = oa[j + 1], newEntry === oldEntry {
+  while i < na.count - 1 {
+    if case let .index(j) = na[i], j + 1 < oa.count,
+        case let .symbol(newEntry) = na[i + 1],
+        case let .symbol(oldEntry) = oa[j + 1], newEntry === oldEntry {
         na[i + 1] = .index(j + 1)
         oa[j + 1] = .index(i + 1)
       }
-    }
+
     i += 1
   }
 

  var runningOffset = 0
  for (index, item) in oa.enumerated() {
    deleteOffsets[index] = runningOffset
    if case .symbol(_) = item {
      steps.append(.delete(index))
      runningOffset += 1
    }

  // points to OA[j] and NA[i - 1] and OA[j - 1] contain identical symbol table pointers, then
  // NA[i - 1] is replaced by j - 1 and OA[j - 1] is replaced by i - 1.
  i = na.count - 1
  while i > 0 {
    if case let .index(j) = na[i], j - 1 >= 0,
        case let .symbol(newEntry) = na[i - 1],
        case let .symbol(oldEntry) = oa[j - 1], newEntry === oldEntry {
        na[i - 1] = .index(j - 1)
        oa[j - 1] = .index(i - 1)
    }

    i -= 1
  }

