1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
2011-07-27 07:17:02 -07:00
|
|
|
(* OCaml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
2001-12-07 05:41:02 -08:00
|
|
|
(* under the terms of the GNU Library General Public License, with *)
|
|
|
|
(* the special exception on linking described in file ../LICENSE. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
2001-10-26 15:38:48 -07:00
|
|
|
(** The run-time library for parsers generated by [ocamlyacc]. *)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2001-12-03 14:16:03 -08:00
|
|
|
val symbol_start : unit -> int
|
2002-11-01 09:06:47 -08:00
|
|
|
(** [symbol_start] and {!Parsing.symbol_end} are to be called in the
|
|
|
|
action part of a grammar rule only. They return the offset of the
|
|
|
|
string that matches the left-hand side of the rule: [symbol_start()]
|
|
|
|
returns the offset of the first character; [symbol_end()] returns the
|
|
|
|
offset after the last character. The first character in a file is at
|
|
|
|
offset 0. *)
|
2001-10-26 15:38:48 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
val symbol_end : unit -> int
|
2001-12-03 14:16:03 -08:00
|
|
|
(** See {!Parsing.symbol_start}. *)
|
2001-10-26 15:38:48 -07:00
|
|
|
|
2001-12-03 14:16:03 -08:00
|
|
|
val rhs_start : int -> int
|
2002-11-01 09:06:47 -08:00
|
|
|
(** Same as {!Parsing.symbol_start} and {!Parsing.symbol_end}, but
|
|
|
|
return the offset of the string matching the [n]th item on the
|
2001-10-26 15:38:48 -07:00
|
|
|
right-hand side of the rule, where [n] is the integer parameter
|
2004-04-14 08:37:30 -07:00
|
|
|
to [rhs_start] and [rhs_end]. [n] is 1 for the leftmost item. *)
|
2001-10-26 15:38:48 -07:00
|
|
|
|
2001-12-03 14:16:03 -08:00
|
|
|
val rhs_end : int -> int
|
2001-10-26 15:38:48 -07:00
|
|
|
(** See {!Parsing.rhs_start}. *)
|
|
|
|
|
2002-11-01 09:06:47 -08:00
|
|
|
val symbol_start_pos : unit -> Lexing.position;;
|
|
|
|
(** Same as [symbol_start], but return a [position] instead of an offset. *)
|
|
|
|
|
|
|
|
val symbol_end_pos : unit -> Lexing.position
|
|
|
|
(** Same as [symbol_end], but return a [position] instead of an offset. *)
|
|
|
|
|
|
|
|
val rhs_start_pos : int -> Lexing.position
|
|
|
|
(** Same as [rhs_start], but return a [position] instead of an offset. *)
|
|
|
|
|
|
|
|
val rhs_end_pos : int -> Lexing.position
|
|
|
|
(** Same as [rhs_end], but return a [position] instead of an offset. *)
|
|
|
|
|
2001-12-03 14:16:03 -08:00
|
|
|
val clear_parser : unit -> unit
|
2001-10-26 15:38:48 -07:00
|
|
|
(** Empty the parser stack. Call it just after a parsing function
|
|
|
|
has returned, to remove all pointers from the parser stack
|
|
|
|
to structures that were built by semantic actions during parsing.
|
|
|
|
This is optional, but lowers the memory requirements of the
|
|
|
|
programs. *)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2001-12-03 14:16:03 -08:00
|
|
|
exception Parse_error
|
2001-10-26 15:38:48 -07:00
|
|
|
(** Raised when a parser encounters a syntax error.
|
|
|
|
Can also be raised from the action part of a grammar rule,
|
|
|
|
to initiate error recovery. *)
|
|
|
|
|
2008-08-06 02:38:25 -07:00
|
|
|
val set_trace: bool -> bool
|
|
|
|
(** Control debugging support for [ocamlyacc]-generated parsers.
|
|
|
|
After [Parsing.set_trace true], the pushdown automaton that
|
|
|
|
executes the parsers prints a trace of its actions (reading a token,
|
|
|
|
shifting a state, reducing by a rule) on standard output.
|
|
|
|
[Parsing.set_trace false] turns this debugging trace off.
|
2010-05-21 11:30:12 -07:00
|
|
|
The boolean returned is the previous state of the trace flag.
|
|
|
|
@since 3.11.0
|
|
|
|
*)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2001-10-30 08:52:04 -08:00
|
|
|
(**/**)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2001-12-28 15:13:52 -08:00
|
|
|
(** {6 } *)
|
2001-10-26 15:38:48 -07:00
|
|
|
|
|
|
|
(** The following definitions are used by the generated parsers only.
|
2012-03-14 09:03:15 -07:00
|
|
|
They are not intended to be used directly by user programs. *)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-07-12 07:28:51 -07:00
|
|
|
type parser_env
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
type parse_tables =
|
1995-07-12 07:28:51 -07:00
|
|
|
{ actions : (parser_env -> Obj.t) array;
|
1995-06-18 07:45:56 -07:00
|
|
|
transl_const : int array;
|
|
|
|
transl_block : int array;
|
1995-05-04 03:15:53 -07:00
|
|
|
lhs : string;
|
|
|
|
len : string;
|
|
|
|
defred : string;
|
|
|
|
dgoto : string;
|
|
|
|
sindex : string;
|
|
|
|
rindex : string;
|
|
|
|
gindex : string;
|
|
|
|
tablesize : int;
|
|
|
|
table : string;
|
1995-08-09 02:39:43 -07:00
|
|
|
check : string;
|
2001-11-05 05:34:42 -08:00
|
|
|
error_function : string -> unit;
|
|
|
|
names_const : string;
|
|
|
|
names_block : string }
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
exception YYexit of Obj.t
|
|
|
|
|
|
|
|
val yyparse :
|
2001-12-03 14:16:03 -08:00
|
|
|
parse_tables -> int -> (Lexing.lexbuf -> 'a) -> Lexing.lexbuf -> 'b
|
1995-07-12 07:28:51 -07:00
|
|
|
val peek_val : parser_env -> int -> 'a
|
1995-08-09 02:39:43 -07:00
|
|
|
val is_current_lookahead : 'a -> bool
|
|
|
|
val parse_error : string -> unit
|