Skip to content

Instantly share code, notes, and snippets.

@adamkuipers
Forked from anonymous/test.swift
Created November 3, 2015 22:55
Show Gist options
  • Save adamkuipers/581d1a0fc63abdb85afb to your computer and use it in GitHub Desktop.
Save adamkuipers/581d1a0fc63abdb85afb 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