Decodable
protocol Decodable
Makes it possible for any Decodable to be constructed using a source string and language. You can specify your own
AbstractSyntaxTreeConstructor should you wish.
-
Creates a new instance of the
Decodeableusing the supplied source and language.Declaration
Swift
static func decode(_ source: String, using language: Grammar) throws -> SelfParameters
sourceThe source to be parsed and then decoded
languageThe language to parse the source with
Return Value
A new instance of the Type
-
Creates a new instance of the
Decodeableusing the supplied source and language. You typically do not need to use this variant of the function and can use the simplerdecode(_ source:String, using language:Language) throws ->Selfwhich does not require the provision of your ownDecodableAbstractSyntaxTreeDeclaration
Swift
static func decode<AST>(_ source: String, with astType: AST.Type, using language: Grammar) throws -> Self where AST : DecodeableAbstractSyntaxTreeParameters
sourceThe source to be parsed and then decoded
astTypeThe intermediate
DecodeableAbstractSyntaxTreelanguageThe language to parse the source with
Return Value
A new instance of the Type
Decodable Extension Reference