• OCaml logo OCaml logo
  • Learn
  • Packages
  • Community
  • Blog
  • Playground
  • Searching...
    Or go to: Standard Library API
  • Learn
  • Packages
  • Community
  • Blog
  • Playground
  • Get started
  • parsexp

  • Documentation
  • parsexp lib
  • Parsexp .Single_and_positions .State Module
package parsexp
  • parsexp
    • Parsexp
      • Conv
      • Conv_error
      • Conv_many
      • Conv_many_at_once
      • Conv_single
      • Cst
        • Forget
      • Eager
        • Lexbuf_consumer
        • Stack
        • State
          • Read_only
      • Eager_and_positions
        • Lexbuf_consumer
        • Stack
        • State
          • Read_only
      • Eager_cst
        • Lexbuf_consumer
        • Stack
        • State
          • Read_only
      • Eager_just_positions
        • Lexbuf_consumer
        • Stack
        • State
          • Read_only
      • Eager_parser
        • Lexbuf_consumer
        • Stack
        • State
          • Read_only
      • Many
        • Stack
        • State
      • Many_and_positions
        • Stack
        • State
      • Many_cst
        • Stack
        • State
      • Many_just_positions
        • Stack
        • State
      • Of_sexp_error
      • Old_parser_cont_state
      • Parse_error
      • Parser
        • Stack
        • State
      • Positions
        • Builder
        • Iterator
      • Private
        • Automaton
          • Context
          • For_cst
          • Kind
          • Mode
          • Stack
            • For_cst
            • Just_positions
          • State
        • Automaton_stack
          • For_cst
          • Just_positions
        • Automaton_state
          • Context
          • For_cst
          • Kind
          • Mode
          • State
      • Single
        • Stack
        • State
      • Single_and_positions
        • Stack
        • State
      • Single_just_positions
        • Stack
        • State
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t

State of the parser

val create : ?pos:Positions.pos -> unit -> t

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

val reset : ?pos:Positions.pos -> t -> unit

Reset the given parsing state. The following always succeed:

reset t ?pos;
assert (t = create ?pos ())
val offset : t -> int

Number of characters fed to the parser

Position in the text

val line : t -> int
val column : t -> int
val position : t -> Positions.pos
val stop : 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.

Footer

OCaml

Innovation. Community. Security.

GitHub Discord Twitter Peertube RSS

About Us

  • Industrial Users
  • Academic Users
  • Why OCaml

Resources

  • Get Started
  • Language Manual
  • Standard Library API
  • Books
  • Releases

Community

  • Blog
  • Jobs

Policies

  • Carbon Footprint
  • Governance
  • Privacy
  • Code of Conduct