Make_utf8.ParseA parser p is a sink of token. As long as it signals needs_more p more token can be pushed into the parser via put token p or the input stream can be ended via put_end p.
has_ended p is equivalent to not (needs_more p). has_ended p signals that the parser has either succeeded or failed.
If it has succeeded the final value is available via final p.
type token = Position.range * Token.tType of the tokens.
type item = tokenIn order to conform to the interface Fmlib_std.Interfaces.SINK.
val needs_more : t -> boolneeds_more p Does the parser p need more tokens?
put tok p Push token tok into the parser p.
Even if the parser has ended, more tokens can be pushed into the parser. The parser stores the token as lookahead token.
If the parser has already received the end of the token stream via put_end, then all subsequent tokens are ignored.
type final = Final.tType of the final result.
val has_succeeded : t -> boolhas_succeeded p Has the parser p succeeded?
val has_ended : t -> boolhas_ended p Has the parser p ended parsing and either succeeded or failed?
has_ended p is the same as not (needs_more p)
final p The final object constructed by the parser p in case of success.
Precondition: has_succeeded p
type expect = string * Indent.expectation optionType of expectations.
val has_failed_syntax : t -> boolhas_failed_syntax p Has the parser p failed with a syntax error?
failed_expectations p The failed expectations due to a syntax error.
Precondition: has_failed_syntax p
type semantic = Semantic.tType of semantic errors.
val has_failed_semantic : t -> boolHas the parser failed because of a semantic error?
The semantic error encountered.
Precondition: A semantic error has occurred.
type state = State.tType of the state of the parser (in many cases unit)
val has_lookahead : t -> boolhas_lookahead p Are there any unconsumed lookahead tokens in the buffer or has the end token not yet been consumed?
The first lookahead token (or None in case there is none).
val has_received_end : t -> boolhas_received_end p Has the parser p already received the end of token stream via put_end?
val has_consumed_end : t -> boolhas_consumed_end p Has the parser p already received the end of token stream via put_end and consumed it?
fold_lookahead a ftok fend p
Fold the lookahead tokens with the start value a and the folding function ftok. At the end of the lookahead tokens, call fend if there is an unconsumed end.
transfer_lookahead p_old p_new
Transfer the lookahead tokens from p_old to p_new