Module Earley_core.Input
Type
Reading from a buffer
- val read : buffer -> int -> char * buffer * int
- read buf posreturns the character at position- posin the buffer- buf, together with the new buffer and position.
- val get : buffer -> int -> char
- get buf posreturns the character at position- posin the buffer- buf.
Creating a buffer
- val from_file : string -> buffer
- from_file fnreturns a buffer constructed using the file- fn.
- val from_channel : ?filename:string -> Stdlib.in_channel -> buffer
- from_channel ~filename chreturns a buffer constructed using the channel- ch. The optional- filenameis only used as a reference to the channel in error messages.
- val from_string : ?filename:string -> string -> buffer
- from_string ~filename strreturns a buffer constructed using the string- str. The optional- filenameis only used as a reference to the channel in error messages.
- val from_fun : ('a -> unit) -> string -> ('a -> string) -> 'a -> buffer
- from_fun finalise name get datareturns a buffer constructed from the object- datausing the- getfunction. The get function is used to obtain one line of input from- data. The- finalisefunction is applied to- datawhen the end of file is reached. The- namestring is used to reference the origin of the data in error messages.
Creating buffers with a custom preprocessor
- exception- Preprocessor_error of string * string
- Exception that can be raised by a preprocessor in case of error. The first string references the name of the buffer (e.g. the name of the corresponding file) and the second string contains the message. 
- module type Preprocessor = sig ... end
- Specification of a preprocessor. 
- module WithPP : functor (PP : Preprocessor) -> sig ... end
- Functor for building buffers with a preprocessor. 
Buffer manipulation functions
- val is_empty : buffer -> int -> bool
- is_empty buftest whether the buffer- bufis empty.
- val line_num : buffer -> int
- line_num bufreturns the current line number of- buf.
- val line_offset : buffer -> int
- line_beginning bufreturns the offset of the current line in the buffer- buf.
- val line : buffer -> string
- line bufreturns the current line in the buffer- buf.
- val line_length : buffer -> int
- line_length bufreturns the length of the current line in the buffer- buf.
- val utf8_col_num : buffer -> int -> int
- utf8_col_num buf posreturns the utf8 column number corresponding to the position- posin- buf.
- val normalize : buffer -> int -> buffer * int
- normalize buf posensures that- posis less than the length of the current line in- str.
- val filename : buffer -> string
- filename bufreturns the file name associated to the- buf.
- val buffer_uid : buffer -> int
- buffer_uid bufreturns a unique identifier for- buf.
- val buffer_before : buffer -> int -> buffer -> int -> bool
- leq_bug b1 i1 b2 i2returns true if the position- b1, i1is before- b2, i2. Gives meaningless result if- b1and- b2do not refer to the same file.
module OrdTbl : sig ... end- module Tbl : sig ... end
- Second kind of table: unordered, but imperative and more efficient