         }
         
         switch wrapper {
-            case .Token(let t):
+            case .token(let t):
                 return try expressionizeToken(t)
-            case .Expression(let e):
+            case .expression(let e):
                 return e
         }
     }

        }
        
        let replacementExpressionRange = index ... operandIndex
        collapsedWrappers.replaceSubrange(replacementExpressionRange, with: [.Expression(expression)])
        
        return collapsedWrappers
    }

}

private enum TokenOrExpression {
    case token(GroupedToken)
    case expression(MathParser.Expression)
    
    var token: GroupedToken? {
        guard case .token(let t) = self else { return nil }
        return t
    }
    
    var expression: Expression? {
        guard case .expression(let e) = self else { return nil }
        return e
    }
    
// <rdar://problem/27805272> Segfault when compiling "Result" enum
//    var isToken: Bool { return token != nil }
    var isToken: Bool {
        if case .token(_) = self { return true }
        return false
    }
    
    var range: Range<Int> {
        switch self {
            case .token(let t): return t.range
            case .expression(let e): return e.range
        }
    }
}
