1(**************************************************************************)
2(*                                                                        *)
3(*                                 OCaml                                  *)
4(*                                                                        *)
5(*             Xavier Leroy, projet Cristal, INRIA Rocquencourt           *)
6(*                                                                        *)
7(*   Copyright 1996 Institut National de Recherche en Informatique et     *)
8(*     en Automatique.                                                    *)
9(*                                                                        *)
10(*   All rights reserved.  This file is distributed under the terms of    *)
11(*   the GNU Lesser General Public License version 2.1, with the          *)
12(*   special exception on linking described in the file LICENSE.          *)
13(*                                                                        *)
14(**************************************************************************)
15
16(** The run-time library for parsers generated by [ocamlyacc]. *)
17
18val symbol_start : unit -> int
19(** [symbol_start] and {!Parsing.symbol_end} are to be called in the
20   action part of a grammar rule only. They return the offset of the
21   string that matches the left-hand side of the rule: [symbol_start()]
22   returns the offset of the first character; [symbol_end()] returns the
23   offset after the last character. The first character in a file is at
24   offset 0. *)
25
26val symbol_end : unit -> int
27(** See {!Parsing.symbol_start}. *)
28
29val rhs_start : int -> int
30(** Same as {!Parsing.symbol_start} and {!Parsing.symbol_end}, but
31   return the offset of the string matching the [n]th item on the
32   right-hand side of the rule, where [n] is the integer parameter
33   to [rhs_start] and [rhs_end]. [n] is 1 for the leftmost item. *)
34
35val rhs_end : int -> int
36(** See {!Parsing.rhs_start}. *)
37
38val symbol_start_pos : unit -> Lexing.position
39(** Same as [symbol_start], but return a [position] instead of an offset. *)
40
41val symbol_end_pos : unit -> Lexing.position
42(** Same as [symbol_end], but return a [position] instead of an offset. *)
43
44val rhs_start_pos : int -> Lexing.position
45(** Same as [rhs_start], but return a [position] instead of an offset. *)
46
47val rhs_end_pos : int -> Lexing.position
48(** Same as [rhs_end], but return a [position] instead of an offset. *)
49
50val clear_parser : unit -> unit
51(** Empty the parser stack. Call it just after a parsing function
52   has returned, to remove all pointers from the parser stack
53   to structures that were built by semantic actions during parsing.
54   This is optional, but lowers the memory requirements of the
55   programs. *)
56
57exception Parse_error
58(** Raised when a parser encounters a syntax error.
59   Can also be raised from the action part of a grammar rule,
60   to initiate error recovery. *)
61
62val set_trace: bool -> bool
63(** Control debugging support for [ocamlyacc]-generated parsers.
64    After [Parsing.set_trace true], the pushdown automaton that
65    executes the parsers prints a trace of its actions (reading a token,
66    shifting a state, reducing by a rule) on standard output.
67    [Parsing.set_trace false] turns this debugging trace off.
68    The boolean returned is the previous state of the trace flag.
69    @since 3.11.0
70*)
71
72(**/**)
73
74(** {6  } *)
75
76(** The following definitions are used by the generated parsers only.
77   They are not intended to be used directly by user programs. *)
78
79type parser_env
80
81type parse_tables =
82  { actions : (parser_env -> Obj.t) array;
83    transl_const : int array;
84    transl_block : int array;
85    lhs : string;
86    len : string;
87    defred : string;
88    dgoto : string;
89    sindex : string;
90    rindex : string;
91    gindex : string;
92    tablesize : int;
93    table : string;
94    check : string;
95    error_function : string -> unit;
96    names_const : string;
97    names_block : string }
98
99exception YYexit of Obj.t
100
101val yyparse :
102  parse_tables -> int -> (Lexing.lexbuf -> 'a) -> Lexing.lexbuf -> 'b
103val peek_val : parser_env -> int -> 'a
104val is_current_lookahead : 'a -> bool
105val parse_error : string -> unit
106