jon.recoil.org

Module Parser.StateSource

Sourcetype t

State of the parser

Sourceval create : ?pos:Parsexp.Positions.pos -> unit -> State.t

Create a new parser state. pos is the initial position, it defaults to {line=1;col=0;offset=0}.

Sourceval reset : ?pos:Parsexp.Positions.pos -> State.t -> unit

Reset the given parsing state. The following always succeed:

  reset t ?pos;
  assert (t = create ?pos ())
Sourceval offset : State.t -> int

Number of characters fed to the parser

Position in the text

Sourceval line : State.t -> int
Sourceval column : State.t -> int
Sourceval stop : State.t -> unit

Prevent the state from receiving any more characters. Trying to feed more characters will result in an exception, unless the state is reset.