Library
Module
Module type
Parameter
Class
Class type
type item = token
In order to conform to the interface Fmlib_std.Interfaces.SINK
.
val needs_more : t -> bool
needs_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 = Position.range * Token.t
Type of the final result.
val has_succeeded : t -> bool
has_succeeded p
Has the parser p
succeeded?
final p
The final object constructed by the parser p
in case of success.
Precondition: has_succeeded p
type expect = string * Indent.expectation option
Type of expectations.
val has_failed_syntax : t -> bool
has_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
The first lookahead character or None
if there is no character in the lookahead buffer.
val position : t -> Position.t
Line and column number of the current position of the lexer.
A lexer does not consume the entire input stream. It just consumes characters until a token has been recognized. In case of the successful recognition of a token, it returns the token (see final
). Then it can be restarted to recognize the next token.