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
Decodeable
using the supplied source and language.Declaration
Swift
static func decode(_ source: String, using language: Grammar) throws -> Self
Parameters
source
The source to be parsed and then decoded
language
The language to parse the source with
Return Value
A new instance of the Type
-
Creates a new instance of the
Decodeable
using 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 ->Self
which does not require the provision of your ownDecodableAbstractSyntaxTree
Declaration
Swift
static func decode<AST>(_ source: String, with astType: AST.Type, using language: Grammar) throws -> Self where AST : DecodeableAbstractSyntaxTree
Parameters
source
The source to be parsed and then decoded
astType
The intermediate
DecodeableAbstractSyntaxTree
language
The language to parse the source with
Return Value
A new instance of the Type