module Cf_lexer:Lexical analysis with functional composition of regular grammars.sig
..end
This module implements functional parsers of the type defined in the
Cf_parser.X
module using lazy deterministic finite automata. Ordinary
characters are the symbol type.
Note: functions for converting regular expression strings into lexer
expressions are not provided.
class cursor :int ->
object
..end
type
expr_t
type (#cursor, 'a)
rule_t
type(#cursor, 'a)
t =(#cursor as 'b, char, 'a) Cf_parser.X.t
char
.module Op:sig
..end
val nil : expr_t
val create : (#cursor as 'a, 'b) rule_t -> ('a, 'b) t
create ?xf r
to compose a lexical analyzer from the rule r
.type
counter_t = {
|
c_pos : |
(* | The character index (counts from zero). | *) |
|
c_row : |
(* | The column number (counts from zero). | *) |
|
c_col : |
(* | The row number (counts from zero). | *) |
line_cursor
class defined below that indicates the
character index, row and column in the input stream associated with a
cursor position.val counter_zero : counter_t
class line_cursor :?c:counter_t -> string ->
object
..end
Cf_parser.cursor
that intercepts newline characters
to track the row and column of a cursor position.
exception Error of counter_t
raise_exn
exception handler function below.val raise_exn : int -> (char * #line_cursor) Cf_seq.t -> exn
#line_cursor
class type. When the exception handler is
called, the exception returned is constructed as Error c#counter
.