Parser[S: (Any #read & Equatable[S]), optional D: Any #share, optional V: Any #share]¶
Stores a source of inputs to a parse, and a memo of parse results from prior parses. Used to initiate a parse attempt.
Constructors¶
create¶
Parameters¶
Returns¶
- Parser[S, D, V] tag^
Public Behaviours¶
insert_segment¶
Insert a source segment at the given index. The insertion will happen upon the next call to parse()
.
Parameters¶
remove_segment¶
Removes the source segment at the given index. The removal will happen upon the next call to parse()
.
Parameters¶
- index: USize val
parse¶
Initiates a parse attempt with the given rule.
be parse(
rule: RuleNode[S, D, V] val,
data: D,
callback: ParseCallback[S, D, V] val,
start: (Loc[S] val | None val) = reference,
clear_memo: Bool val = false)
Parameters¶
- rule: RuleNode[S, D, V] val
- data: D
- callback: ParseCallback[S, D, V] val
- start: (Loc[S] val | None val) = reference
- clear_memo: Bool val = false
Public Functions¶
num_segments¶
Returns the number of segments currently in the source.
Returns¶
- USize val