                 sysUnexpectedDesc = NSLocalizedString("unexpected end of input", comment: "Error messages.")
                 
             } else {
-            
+                
                 sysUnexpectedDesc = unexpectedMsg + " " + firstMsg
                 
             }

        }
        
        // Unexpected messages.
        let unexpectedDesc = msgsDesc(unexpectedMsg, messages: unexpected)
        
        // Expected messages.
        let expectingMsg = NSLocalizedString("expecting", comment: "Error messages.")
        let expectedDesc = msgsDesc(expectingMsg, messages: expected)
        
        // Generic messages.
        let genericDesc = msgsDesc("", messages: generic)
        
        let descriptions = [sysUnexpectedDesc, unexpectedDesc, expectedDesc, genericDesc]
        return descriptions.removingDuplicatesAndEmpties().joinWithSeparator("\n")
        
    }
    
    /// Indicates if `self` is an unknown parse error.
    var isUnknown: Bool { return messages.isEmpty }
    
    /// Initializes from a source position and an array of messages.
    init(position: SourcePosition, messages: [Message]) {
        

        
    }
    
    private func formatMessages(messages: [Message], havingType messageType: String) -> String {
        
        let msgs = messages.map({ $0.messageString }).removingDuplicatesAndEmpties()
        
        guard !msgs.isEmpty else { return "" }
        
        let msgType = messageType.isEmpty ? "" : messageType + " "
        
        if msgs.count == 1 {
            
            return msgType + msgs.first!
            
        }
        
        let commaSep = msgs.dropLast().joinWithSeparator(", ")
        
        let orStr =  NSLocalizedString("or", comment: "Error messages.")
        
        return msgType + commaSep + " " + orStr + " " + msgs.last!
        
    }

}

extension SequenceType where Generator.Element == String {
