DecodeableAbstractSyntaxTree

public protocol DecodeableAbstractSyntaxTree : AbstractSyntaxTree

This protocol identifies as set of additional requirements for Nodes 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 }
  • key

    Should be the CodingKey for this node. This is normally generated using the name of the Token.

    Declaration

    Swift

    var key: CodingKey { get }
  • Should be the children of this node

    Declaration

    Swift

    var contents: [DecodeableAbstractSyntaxTree] { get }
  • subscript(_:) Default implementation

    Should 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 or nil 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 found

    Declaration

    Swift

    subscript(index: Int) -> DecodeableAbstractSyntaxTree { get }
  • subscript(key:) Default implementation

    Should return the child node with the specified CodingKey or nil 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 found

    Default 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 or nil 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 found

    Declaration

    Swift

    subscript(name: String) -> DecodeableAbstractSyntaxTree? { get }