Blame compiler/ppparse.ml
|
Packit |
bd2e5d |
(***********************************************************************)
|
|
Packit |
bd2e5d |
(* *)
|
|
Packit |
bd2e5d |
(* MLTk, Tcl/Tk interface of OCaml *)
|
|
Packit |
bd2e5d |
(* *)
|
|
Packit |
bd2e5d |
(* Francois Rouaix, Francois Pessaux, Jun Furuse and Pierre Weis *)
|
|
Packit |
bd2e5d |
(* projet Cristal, INRIA Rocquencourt *)
|
|
Packit |
bd2e5d |
(* Jacques Garrigue, Kyoto University RIMS *)
|
|
Packit |
bd2e5d |
(* *)
|
|
Packit |
bd2e5d |
(* Copyright 2002 Institut National de Recherche en Informatique et *)
|
|
Packit |
bd2e5d |
(* en Automatique and Kyoto University. All rights reserved. *)
|
|
Packit |
bd2e5d |
(* This file is distributed under the terms of the GNU Library *)
|
|
Packit |
bd2e5d |
(* General Public License, with the special exception on linking *)
|
|
Packit |
bd2e5d |
(* described in file LICENSE found in the OCaml source tree. *)
|
|
Packit |
bd2e5d |
(* *)
|
|
Packit |
bd2e5d |
(***********************************************************************)
|
|
Packit |
bd2e5d |
|
|
Packit |
bd2e5d |
exception Error of string
|
|
Packit |
bd2e5d |
|
|
Packit |
bd2e5d |
let parse_channel ic =
|
|
Packit |
bd2e5d |
let lexbuf = Lexing.from_channel ic in
|
|
Packit |
bd2e5d |
try
|
|
Packit |
bd2e5d |
Ppyac.code_list Pplex.token lexbuf
|
|
Packit |
bd2e5d |
with
|
|
Packit |
bd2e5d |
| Pplex.Error s ->
|
|
Packit |
bd2e5d |
let loc_start = Lexing.lexeme_start lexbuf
|
|
Packit |
bd2e5d |
and loc_end = Lexing.lexeme_end lexbuf
|
|
Packit |
bd2e5d |
in
|
|
Packit |
bd2e5d |
raise (Error (Printf.sprintf "parse error at char %d, %d: %s"
|
|
Packit |
bd2e5d |
loc_start loc_end s))
|
|
Packit |
bd2e5d |
| Parsing.Parse_error ->
|
|
Packit |
bd2e5d |
let loc_start = Lexing.lexeme_start lexbuf
|
|
Packit |
bd2e5d |
and loc_end = Lexing.lexeme_end lexbuf
|
|
Packit |
bd2e5d |
in
|
|
Packit |
bd2e5d |
raise (Error (Printf.sprintf "parse error at char %d, %d"
|
|
Packit |
bd2e5d |
loc_start loc_end))
|
|
Packit |
bd2e5d |
;;
|