DecodeableAbstractSyntaxTree
public protocol DecodeableAbstractSyntaxTree : AbstractSyntaxTree
This protocol identifies as set of additional requirements for Node
s in order for them to be used for decoding. Some elements of the implementation are
provided through an extension.
-
The String the was matched for the node
Declaration
Swift
var stringValue: String { get }
-
Should be the
CodingKey
for this node. This is normally generated using the name of theToken
.Declaration
Swift
var key: CodingKey { get }
-
Should be the children of this node
Declaration
Swift
var contents: [DecodeableAbstractSyntaxTree] { get }
-
subscript(_:)
Default implementationShould return the child node at the supplied
index
. A default implementation is provided through an extension.-Parameter index: The index of the desired child -Returns: The child node
Default Implementation
Returns the child node at the supplied
index
-Parameter index: The index of the desired child -Returns: The child node
Returns the child node with the specified
CodingKey
ornil
if it does not exist. A default implementation is provided through an extension.-Parameter key: The key of the desired child -Returns: The child node, or
nil
if not foundDeclaration
Swift
subscript(index: Int) -> DecodeableAbstractSyntaxTree { get }
-
subscript(key:)
Default implementationShould return the child node with the specified
CodingKey
ornil
if it does not exist. A default implementation is provided through an extension.-Parameter key: The key of the desired child -Returns: The child node, or
nil
if not foundDefault Implementation
Returns the child node at the supplied
index
-Parameter index: The index of the desired child -Returns: The child node
Declaration
Swift
subscript(key codingKey: CodingKey) -> DecodeableAbstractSyntaxTree? { get }
-
Should return the child node with the specified
String
as a key ornil
if it does not exist. A default implementation is provided through an extension.-Parameter name: The name of the desired child -Returns: The child node, or
nil
if not foundDeclaration
Swift
subscript(name: String) -> DecodeableAbstractSyntaxTree? { get }