 extension Version: StringLiteralConvertible {
     public typealias ExtendedGraphemeClusterLiteralType = StringLiteralType
     
-    public class func convertFromExtendedGraphemeClusterLiteral(value: ExtendedGraphemeClusterLiteralType) -> Self {
+    public static func convertFromExtendedGraphemeClusterLiteral(value: ExtendedGraphemeClusterLiteralType) -> Version {
         return self(major: value.toInt()!)
     }
     
-    public class func convertFromStringLiteral(value: StringLiteralType) -> Self {
+    public static func convertFromStringLiteral(value: StringLiteralType) -> Version {
         return self(value)
     }
 }

import Foundation


public class Version : Equatable, Comparable {
    public let major: Int
    public let minor: Int?
    public let patch: Int?
    public let prerelease: String?
    public let build: String?
    
    public required init(major: Int = 0, minor: Int? = nil, patch: Int? = nil, prerelease: String? = nil, build: String? = nil) {
        self.major = major
        self.minor = minor
        self.patch = patch

let anchoredPattern = Regex(pattern: "/\\A\\s*(\(pattern.pattern))?\\s*\\z/")

extension Version {
    public static func valid(string: String) -> Bool {
        return anchoredPattern.match(string)
    }
}
