Functions
The following functions are available globally.
-
Concatenates two production strings
Declaration
Swift
public func <+> (lhs: ProductionString, rhs: ProductionString) -> ProductionString
Parameters
lhs
First production string
rhs
Second production string
Return Value
Concatenation of the given production strings
-
Concatenates a production string and a symbol
Declaration
Swift
public func <+> (lhs: ProductionString, rhs: Symbol) -> ProductionString
Parameters
lhs
A production string
rhs
A symbol
Return Value
Concatenation of the production string and symbol
-
Concatenates a production string and a symbol
Declaration
Swift
public func <+> (lhs: Symbol, rhs: ProductionString) -> ProductionString
Parameters
lhs
A symbol
rhs
A production string
Return Value
Concatenation of the production string and symbol
-
Concatenates two production symbols into a production string
Declaration
Swift
public func <+> (lhs: Symbol, rhs: Symbol) -> ProductionString
Parameters
lhs
First symbol
rhs
Second symbol
Return Value
Concatenation of the given symbols
-
Concatenates every possible production of the first production result with every possible production of the second production result
Declaration
Swift
public func <+> (lhs: ProductionResult, rhs: ProductionResult) -> ProductionResult
Parameters
lhs
First production result
rhs
Second production result
Return Value
Every possible concatenation of the production strings in the given production results
-
Concatenates every production string of the production result with the given production string
Declaration
Swift
public func <+> (lhs: ProductionResult, rhs: ProductionString) -> ProductionResult
Parameters
lhs
Production result
rhs
Production string
Return Value
Concatenation of every production string in the production result with the given production string
-
Concatenates the given production string with every production string of the production result
Declaration
Swift
public func <+> (lhs: ProductionString, rhs: ProductionResult) -> ProductionResult
Parameters
lhs
Production string
rhs
Production result
Return Value
Concatenation of the given production string with every production string in the production result
-
Generates a production result containing every production string of the given production results
Declaration
Swift
public func <|> (lhs: ProductionResult, rhs: ProductionResult) -> ProductionResult
Parameters
lhs
First production result
rhs
Second production result
Return Value
Joined production result of the given production results
-
Generates a production result containing every production of the left production result and the production string
Declaration
Swift
public func <|> (lhs: ProductionResult, rhs: ProductionString) -> ProductionResult
Parameters
lhs
Production result
rhs
Production string
Return Value
A production result generated by merging the left production result with the right production string
-
Generates a production result containing the left production string and every production of the right production string
Declaration
Swift
public func <|> (lhs: ProductionString, rhs: ProductionResult) -> ProductionResult
Parameters
lhs
Production string
rhs
Production result
Return Value
A production result generated by merging the left production string with the right production result
-
Generates a production result containing the left and right production string
Declaration
Swift
public func <|> (lhs: ProductionString, rhs: ProductionString) -> ProductionResult
Parameters
lhs
First production string
rhs
Second production string
Return Value
A production result containing the left and right production string
-
Generates a production result containing the left production string and the right symbol
Declaration
Swift
public func <|> (lhs: ProductionString, rhs: Symbol) -> ProductionResult
Parameters
lhs
Production string
rhs
Symbol
Return Value
A production result allowing the left production string and the right symbol
-
Generates a production result containing the left symbol and the right production string
Declaration
Swift
public func <|> (lhs: Symbol, rhs: ProductionString) -> ProductionResult
Parameters
lhs
Symbol
rhs
Production string
Return Value
A production result allowing the left symbol and the right production string
-
Generates a production result by appending the right symbol to the left production result
Declaration
Swift
public func <|> (lhs: ProductionResult, rhs: Symbol) -> ProductionResult
Parameters
lhs
Production result
rhs
Symbol
Return Value
A production result allowing every production string of the left production result and the right symbol
-
Generates a production result by appending the left symbol to the right production result
Declaration
Swift
public func <|> (lhs: Symbol, rhs: ProductionResult) -> ProductionResult
Parameters
lhs
Symbol
rhs
Production result
Return Value
A production result allowing the left symbol and every production string of the right production result
-
Generates a production result containing the left and right symbol
Declaration
Swift
public func <|> (lhs: Symbol, rhs: Symbol) -> ProductionResult
Parameters
lhs
Left symbol
rhs
Right symbol
Return Value
A production result allowing either the left or the right symbol
-
Generates a production from a given non-terminal and produced sequence of symbols
Declaration
Swift
public func --> (lhs: NonTerminal, rhs: ProductionString) -> Production
Parameters
lhs
Non-terminal pattern
rhs
Produced string of symbols
Return Value
Production with the given pattern and generated result
-
Generates a set of productions from a given non-terminal and produced result
Declaration
Swift
public func --> (lhs: NonTerminal, rhs: ProductionResult) -> [Production]
Parameters
lhs
Non-terminal pattern
rhs
Collection of possible produced strings of symbols
Return Value
Productions with the given pattern and generated results
-
Generates a production from the given non-terminal to the given symbol
Declaration
Swift
public func --> (lhs: NonTerminal, rhs: Symbol) -> Production
Parameters
lhs
Non-terminal pattern
rhs
Produced symbol
Return Value
Production with the given pattern generating the given symbol
-
Creates a new non-regular terminal symbol
Note: The value of the terminal string may not overlap partially with any other non-terminal contained in a grammar.
Declaration
Swift
public func t(_ value: String) -> Symbol
Parameters
value
Value of the terminal symbol
Return Value
A terminal symbol with the given value
-
Creates a new non-terminal symbol
Declaration
Swift
public func n(_ name: String) -> Symbol
Parameters
name
Name of the non-terminal symbol
Return Value
A non-terminal symbol with the given name
-
Creates a new regular terminal symbol
Note: The value of the terminal string may not overlap partially with any other non-terminal contained in a grammar. For regular terminals, it it may be deriable to add word boundary markers:
\b
.Throws
An error indicating that the given regular expression is invalidDeclaration
Swift
public func rt(_ value: String) throws -> Symbol
Parameters
value
Regular value of the terminal
Return Value
A regular terminal symbol
-
Determines if two syntax trees are equal to each other.
This function returns true, if both trees have the same structure, equal keys in equal nodes and equal leafs
Declaration
Swift
public func == <Element, LeafElement>(lhs: SyntaxTree<Element, LeafElement>, rhs: SyntaxTree<Element, LeafElement>) -> Bool where Element : Equatable, LeafElement : Equatable
Parameters
lhs
First tree to compare
rhs
Second tree to compare
Return Value
A boolean value indicating whether the provided trees are equal to each other