DataTypeProtocol
public protocol DataTypeProtocol
Data types tell the framework which kind of data can be parsed in the expressions
-
If the framework meets with some static value that hasn’t been processed before, it tries to convert it with every registered data type. This method returns nil if the conversion could not have been processed with any of the type’s literals.
Declaration
Swift
func convert(input: String, interpreter: TypedInterpreter) -> Any?
Parameters
input
The input to convert as a
DataType
valueinterpreter
An interpreter instance if the content needs any further evaluation
Return Value
The value of the
DataType
ornil
if it cannot be processed -
This is a convenience method, for debugging and value printing purposes, which can return a string from the current data type. It does not need to be unique or always the same for the same input values.
Declaration
Swift
func print(value input: Any, printer: Printer) -> String?
Parameters
input
Any value that is a valid
DataType
printer
An interpreter instance if the content recursively contains further data types to print
Return Value
The string representation of the value or
nil
if it cannot be processed