package earley

  1. Overview
  2. Docs
type state

Type for the internal state of the preprocessor.

val initial_state : state

Initial state of the preprocessor.

val update : state -> string -> int -> string -> state * string * int * bool

update st name lnum line takes as input the state st of the preprocessor, the file name name, the number of the next input line lnum and the next input line line itself. It returns a tuple of the new state, the new file name, the new line number, and a boolean. The new file name and line number can be used to implement line number directives. The boolean is true if the line should be part of the input (i.e. it is not a specific preprocessor line) and false if it should be ignored. The function may raise Preprocessor_error in case of error.

val check_final : state -> string -> unit

check_final st name check that st indeed is a correct state of the preprocessor for the end of input of file name. If it is not the case, then the exception Preprocessor_error is raised.