ConstructResult
public protocol ConstructResult : GrammarComponent
A ConstructResult is a specification for how to compute the result of a successful parse.
-
The type of characters of the input being parsed.
Declaration
Swift
associatedtype Char -
Constructs the result of a successful invocation of a parse rule.
Declaration
Swift
func evalRule<RHS>(input: Input<Char>, key: ItemKey<Param>, completed: RHS) -> Result where RHS : CompletedRightHandSide, Self.Param == RHS.Param, Self.Result == RHS.ResultParameters
inputThe input, part of which has been successfully parsed.
keyThis key designates which part of the input has been parsed as what symbol.
completedInformation about the completed right-hand side of the rule.
Return Value
The result.
-
Constructs the result from a terminal result.
Declaration
Swift
func terminal(key: ItemKey<Param>, result: Result?) -> ResultParameters
keyThe key for which this terminal has been parsed successfully.
resultThe result of parsing / lexing the terminal.
Return Value
The result.
-
This is called to merge all results for that particular
keyinto a single result.Declaration
Swift
func merge(key: ItemKey<Param>, results: [Result]) -> ResultParameters
keyThe key for which parsing has completed successfully.
resultsThe results of all successful parses for the particular
keyunder consideration. If all such parses have returned anilresult, thenresultswill be empty.Return Value
An result that represents the merge of
results. -
Undocumented
Declaration
Swift
func nameOf(symbol: Symbol) -> String
ConstructResult Protocol Reference