FunctionProtocol

public protocol FunctionProtocol

Functions can process values in given DataTypes, allowing the expressions to be feature-rich

  • Functions use similar conversion methods as DataTypes. If they return nil, the function does not apply to the given input. Otherwise, the result is expressed as an instance of a given DataType It uses the interpreter the and parsing context to be able to effectively process the content

    Declaration

    Swift

    func convert(input: String, interpreter: TypedInterpreter, context: Context, connectedRanges: [ClosedRange<String.Index>]) -> Any?

    Parameters

    input

    The input to convert as a DataType value

    interpreter

    An interpreter instance if the content needs any further evaluation

    context

    The context - if vaiables need any contextual information

    connectedRanges

    Ranges of string indices that are connected with opening-closing tag pairs, respectively

    Return Value

    A valid value of any DataType or nil if it cannot be processed