Module DypSource

Sourceval dypgen_verbose : int ref

by default = 0, gives infos about the parsing if set>0, breaks re-entrancy if set>2.

Sourcetype 'a nt_prio =
  1. | No_priority
  2. | Eq_priority of 'a
  3. | Less_priority of 'a
  4. | Lesseq_priority of 'a
  5. | Greater_priority of 'a
  6. | Greatereq_priority of 'a
    (*

    This type makes possible to assign precedence to non terminals in the rhs of rules. If the non_terminal_priority of the non terminal E in the following rule : A -> E is Less_priority pc1, and that the parser has so far reduced a substring to E yielding the priority class pc2 for this substring, then the parser reduces with A -> E to A only if we have the relation pc1 -> pc2 in the priority set used to construct the parsing_device (see below create_parsing_device). The Toeq constructor behaves the same way except that it also accepts pc1 for priority class of the substring even if we don't have pc1 -> pc1 in the priority set.

    *)
Sourcetype regexp =
  1. | RE_Char of char
  2. | RE_Char_set of (char * char) list
  3. | RE_Char_set_exclu of (char * char) list
  4. | RE_String of string
  5. | RE_Alt of regexp list
  6. | RE_Seq of regexp list
  7. | RE_Star of regexp
  8. | RE_Plus of regexp
  9. | RE_Option of regexp
  10. | RE_Name of string
  11. | RE_Eof_char
Sourcetype symb =
  1. | Ter of string
  2. | Ter_NL of string
  3. | Non_ter of string * string nt_prio
  4. | Non_ter_NL of string * string nt_prio
  5. | Regexp of regexp
  6. | Regexp_NL of regexp
Sourcetype rule_options =
  1. | No_layout_inside
  2. | No_layout_follows
Sourcetype rule = string * symb list * string * rule_options list
Sourcetype nt_cons_map
Sourcetype ('obj, 'gd, 'ld) merge_function = ('obj * 'gd * 'ld) list -> 'obj list * 'gd * 'ld
Sourcetype debug_infos = {
  1. prt_state : out_channel -> unit;
  2. prt_grammar : out_channel -> unit;
}
Sourcetype ('t, 'o, 'gd, 'ld, 'l) action =
  1. | Dypgen_action of 'o list -> (Lexing.position * Lexing.position) -> (Lexing.position * Lexing.position) list -> 'gd -> 'ld -> 'ld -> debug_infos -> ('t, 'o, 'gd, 'ld, 'l) parser_pilot -> (unit -> string list) -> 'o * bool * bool * 'gd * 'ld * (rule * ('t, 'o, 'gd, 'ld, 'l) action * (int * ('t, 'o, 'gd, 'ld, 'l) inherited_val) list) list * (string * string) list * string list list * out_channel option * out_channel option * ('t, 'o, 'gd, 'ld, 'l) parsing_device option
Sourceand ('t, 'o, 'gd, 'ld, 'l) inherited_val = 'o list -> (Lexing.position * Lexing.position) -> (Lexing.position * Lexing.position) list -> 'gd -> 'ld -> 'ld -> debug_infos -> ('t, 'o, 'gd, 'ld, 'l) parser_pilot -> (unit -> string list) -> 'o
Sourceand ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parser_pilot = {
  1. pp_dev : ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parsing_device;
  2. pp_par : ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parser_parameters;
  3. pp_gd : 'global_data;
  4. pp_ld : 'local_data;
}
Sourceand ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parsing_device
Sourceand ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parser_parameters
Sourcetype ('token, 'obj, 'gd, 'ld, 'l) dypgen_toolbox = {
  1. parser_pilot : ('token, 'obj, 'gd, 'ld, 'l) parser_pilot;
  2. global_data : 'gd;
  3. local_data : 'ld;
  4. last_local_data : 'ld;
  5. next_lexeme : unit -> string list;
  6. symbol_start : unit -> int;
  7. symbol_start_pos : unit -> Lexing.position;
  8. symbol_end : unit -> int;
  9. symbol_end_pos : unit -> Lexing.position;
  10. rhs_start : int -> int;
  11. rhs_start_pos : int -> Lexing.position;
  12. rhs_end : int -> int;
  13. rhs_end_pos : int -> Lexing.position;
  14. print_state : out_channel -> unit;
  15. print_grammar : out_channel -> unit;
}
Sourcetype ('token, 'obj, 'gd, 'ld, 'l) dyp_action =
  1. | Add_rules of (rule * (('token, 'obj, 'gd, 'ld, 'l) dypgen_toolbox -> 'obj list -> 'obj * ('token, 'obj, 'gd, 'ld, 'l) dyp_action list)) list
  2. | Bind_to_cons of (string * string) list
  3. | Global_data of 'gd
  4. | Keep_grammar
  5. | Parser of ('token, 'obj, 'gd, 'ld, 'l) parsing_device
  6. | Local_data of 'ld
  7. | Next_grammar of out_channel
  8. | Next_state of out_channel
  9. | Relation of string list list
  10. | Dont_shift
Sourceexception Giveup

This exception can be raised by an action, then the parser gives up the current reduction and the parsing along the current path is stopped.

Sourceexception Undefined_nt of string

This exception is raised when there is in the grammar a non terminal that is in a right-hand side but never in a left-hand side (i.e. it is never defined). The string represents this non terminal.

Sourceexception Undefined_ter of string

Same as above but for terminals instead.

Sourceexception Bad_constructor of string * string * string

This exception is raised when a value is returned by a user action with a bad constructor (not corresponding to the non terminal). This can only happen with rules defined dynamically. 1st string is the rule and can be used to be printed. 2nd string is the name of the constructor that should have been used. 3rd string is the name of the constructor that has been used.

Sourceexception Constructor_mismatch of string * string

This exception is raised when a nt is added with a constructor cons but it already exists with another constructor. 1st string is the name of the previous constructor, 2nd string is the name of the constructor one tried to add.

Sourceexception Syntax_error

This exception is raised if the parser is stuck in a situtation where no shift and no reduction is possible.

Sourceval keep_all : ('obj, 'gd, 'ld) merge_function
Sourceval keep_one : ('obj, 'gd, 'ld) merge_function
Sourceval dummy_lexbuf_position : 'a -> Lexing.position * Lexing.position
Sourcemodule Tools : sig ... end
Sourceval print_regexp : regexp -> string
Sourcetype 'obj dyplexbuf
Sourceval lexeme : 'obj dyplexbuf -> string
Sourceval lexeme_char : 'obj dyplexbuf -> int -> char
Sourceval lexeme_start : 'obj dyplexbuf -> int
Sourceval lexeme_end : 'obj dyplexbuf -> int
Sourceval lexeme_start_p : 'obj dyplexbuf -> Lexing.position
Sourceval lexeme_end_p : 'obj dyplexbuf -> Lexing.position
Sourceval flush_input : 'obj dyplexbuf -> unit
Sourceval from_string : ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parser_pilot -> string -> 'obj dyplexbuf
Sourceval from_channel : ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parser_pilot -> in_channel -> 'obj dyplexbuf
Sourceval from_function : ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parser_pilot -> (bytes -> int -> int) -> 'obj dyplexbuf
Sourceval dyplex_lexbuf_position : 'obj dyplexbuf -> Lexing.position * Lexing.position
Sourceval std_lexbuf : 'obj dyplexbuf -> Lexing.lexbuf
Sourceval set_newline : 'obj dyplexbuf -> unit
Sourceval set_fname : 'obj dyplexbuf -> string -> unit
Sourceval make_parser : (rule * ('token, 'obj, 'global_data, 'local_data, 'lexbuf) action * (int * ('token, 'obj, 'global_data, 'local_data, 'lexbuf) inherited_val) list) list -> string list list -> 'global_data -> 'local_data -> nt_cons_map -> string list -> bool -> int -> bool -> ('token -> 'obj) -> ('token -> int) -> ('token -> string) -> ('global_data -> 'global_data -> bool) -> ('local_data -> 'local_data -> bool) -> ('obj -> bool) array -> ('obj -> string) -> string array -> (string, int) Hashtbl.t -> ('obj, 'global_data, 'local_data) merge_function array -> ('lexbuf -> Lexing.position * Lexing.position) -> (string * regexp) list -> ((string * regexp) list * (int * ('obj dyplexbuf -> 'obj)) list) -> (string * (regexp list * ('obj list -> 'obj dyplexbuf -> 'obj) list)) list -> (string * int) list -> ('obj dyplexbuf -> 'obj) -> bool -> ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parser_pilot
Sourceval update_pp : ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parser_pilot -> ('token, 'obj, 'global_data, 'local_data, 'lexbuf) dyp_action list -> ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parser_pilot
Sourceval lex : string -> 'obj list -> 'obj dyplexbuf -> 'obj
Sourceval parse : ('token, 'obj, 'global_data, 'local_data, 'lexbuf) parser_pilot -> string -> ?global_data:'global_data -> ?local_data:'local_data -> ?match_len:[ `longest | `shortest ] -> ?keep_data:[ `both | `global | `local | `none ] -> ?lexpos:('lexbuf -> Lexing.position * Lexing.position) -> ?use_rule_order:bool -> ?use_all_actions:bool -> ('lexbuf -> 'token) -> 'lexbuf -> ('obj * string) list
Sourceval lexparse : ('token, 'obj, 'global_data, 'local_data, 'obj dyplexbuf) parser_pilot -> string -> ?global_data:'global_data -> ?local_data:'local_data -> ?match_len:[ `longest | `shortest ] -> ?keep_data:[ `both | `global | `local | `none ] -> ?choose_token:[ `first | `all ] -> ?use_rule_order:bool -> ?use_all_actions:bool -> 'obj dyplexbuf -> ('obj * string) list
Sourceval log_channel : out_channel ref
Sourceval function_free_pdev : ('t, 'o, 'gd, 'ld, 'lb) parsing_device -> ('t, 'o, 'gd, 'ld, 'lb) parsing_device
Sourceval import_functions : ('t, 'o, 'gd, 'ld, 'l) parsing_device -> ('t, 'o, 'gd, 'ld, 'l) parser_pilot -> (rule * (('t, 'o, 'gd, 'ld, 'l) dypgen_toolbox -> 'o list -> 'o * ('t, 'o, 'gd, 'ld, 'l) dyp_action list)) list -> ('t, 'o, 'gd, 'ld, 'l) parsing_device
Sourceval is_re_name : ('t, 'o, 'gd, 'ld, 'l) parser_pilot -> string -> bool
Sourceval version : string