Functions
The following functions are available globally.
-
This is where the
Matcheris able to determine theMatchResultfor a given input inside the provided substring rangeDeclaration
Swift
internal func matchStatement<T, E>(amongst statements: [Pattern<T, E>], in input: String, from start: String.Index? = nil, interpreter: E, context: Context, connectedRanges: [ClosedRange<String.Index>] = []) -> MatchResult<T> where E : InterpreterParameters
amongstAll the
Matcherinstances to evaluate, in priority orderinThe input
fromThe start of the checked range
interpreterAn interpreter instance - if variables need any further evaluation
contextThe context - if variables need any contextual information
connectedRangesRanges of string indices that are connected with opening-closing tag pairs, respectively
Return Value
The result of the match operation
-
Independent helper function that determines the pairs of opening and closing keywords
Declaration
Swift
internal func collectConnectedRanges(input: String, statements: [Pattern<Any, TypedInterpreter>]) -> [ClosedRange<String.Index>]Parameters
inputThe input string to search ranges in
statementsPatterns that contain the opening and closing keyword types that should be matched
Return Value
The ranges of opening-closing pairs, keeping logical hierarchy
-
Syntactic sugar for
MatchElementinstances to feel like concatenation, whenever the input requires an array of elements.Declaration
Swift
public func + (left: PatternElement, right: PatternElement) -> [PatternElement]Parameters
leftLeft hand side
rightRight hand side
Return Value
An array with two elements (left and right in this order)
-
Syntactic sugar for appended arrays
Declaration
Swift
internal func + <A>(array: [A], element: A) -> [A]Parameters
arrayThe array to append
elementThe appended element
Return Value
A new array by appending
arraywithelement -
Syntactic sugar for appending mutable arrays
Declaration
Swift
internal func += <A>(array: inout [A], element: A)Parameters
arrayThe array to append
elementThe appended element
View on GitHub
Install in Dash
Functions Reference