         }
         
         let replacementExpressionRange = index ... operandIndex
-        collapsedWrappers.replaceSubrange(replacementExpressionRange, with: [.Expression(expression)])
+        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: MathParser.Expression? {
        guard case .Expression(let e) = self else { return nil }
        return e
    }
    
    var isToken: Bool { return token != nil }
    
    var range: Range<Int> {
        switch self {
            case .Token(let t): return t.range
            case .Expression(let e): return e.range
        }
    }
}

    }
    
    private func expressionizeGroup(_ tokens: Array<GroupedToken>) throws -> Expression {
        var wrappers = tokens.map { TokenOrExpression.token($0) }
        
        while wrappers.count > 1 || wrappers.first?.isToken == true {
            let (indices, maybeOp) = operatorWithHighestPrecedence(wrappers)
