Skip to content

Instantly share code, notes, and snippets.

Created November 3, 2015 22:54
Show Gist options
  • Save anonymous/fc5a863a13fdaaf0c702 to your computer and use it in GitHub Desktop.
Save anonymous/fc5a863a13fdaaf0c702 to your computer and use it in GitHub Desktop.
class Parser<T> : StringLiteralConvertible {
typealias StringLiteralType = Swift.StringLiteralType
typealias ExtendedGraphemeClusterLiteralType = ExtendedGraphemeClusterType
typealias UnicodeScalarLiteralType = UnicodeScalarType
let token: String
required init(stringLiteral value: StringLiteralType) {
self.token = value
}
required init(extendedGraphemeClusterLiteral value: ExtendedGraphemeClusterLiteralType) {
self.token = value
}
required init(unicodeScalarLiteral value: UnicodeScalarLiteralType) {
self.token = value
}
}
var s: Parser<String> = "hi"
print(s.token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment