CompletedRightHandSide
public protocol CompletedRightHandSide : GrammarComponent
Information about the right-hand side of a rule that has successfully completed parsing. This information is used when constructing the result of a successful parse.
Seealso
ConstructResult-
The index of the rule in
Grammar.rules
.Declaration
Swift
var ruleIndex: RuleIndex { get }
-
The number of symbols on the right-hand side of the rule.
Declaration
Swift
var count: Int { get }
-
Returns information about the parse of the
k
-th symbol on the right-hand side of the rule.Declaration
Swift
func rhs(_ k: Int) -> (inputParam: Param, outputParam: Param, result: Result, startPosition: Int, endPosition: Int)
Parameters
k
For a rule of the form
L => R1 ... Rn
, the information returned is aboutRk
.Return Value
Information about the parse of the
k
-th symbolRk
on the right hand side of the rule.inputParam
: The input parameter ofRk
.outputParam
: The output parameter ofRk
result
: The result of parsingRk
.startPosition
: The (inclusive) position of the input where the successful parse started.endPosition
: The (exclusive) position of the input where the successful parse ended.