Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / src / parse.ml @ b38ffff3

History | View | Annotate | Download (1.58 KB)

1
(********************************************************************)
2
(*                                                                  *)
3
(*  The LustreC compiler toolset   /  The LustreC Development Team  *)
4
(*  Copyright 2012 -    --   ONERA - CNRS - INPT                    *)
5
(*                                                                  *)
6
(*  LustreC is free software, distributed WITHOUT ANY WARRANTY      *)
7
(*  under the terms of the GNU Lesser General Public License        *)
8
(*  version 2.1.                                                    *)
9
(*                                                                  *)
10
(********************************************************************)
11

    
12
exception Syntax_err of Location.t
13

    
14
open Format
15

    
16
let report_error loc =
17
  Location.print loc;
18
  print_string "Syntax error\n"
19
(*
20
let wrap own parsing_fun token_fun lexbuf =
21
  try
22
    let ast = parsing_fun token_fun lexbuf own in
23
    Parsing.clear_parser ();
24
    ast
25
  with
26
  | Parsing.Parse_error ->
27
    let loc = Location.curr lexbuf in
28
    raise (Syntax_err loc)
29
 *)
30
let header own parsing_fun token_fun lexbuf =
31
  try
32
    let ast = parsing_fun token_fun lexbuf own in
33
    Parsing.clear_parser ();
34
    ast
35
  with
36
  | Parsing.Parse_error ->
37
    let loc = Location.curr lexbuf in
38
    raise (Syntax_err loc)
39

    
40
let prog parsing_fun token_fun lexbuf =
41
  try
42
    let ast = parsing_fun token_fun lexbuf in
43
    Parsing.clear_parser ();
44
    ast
45
  with
46
  | Parsing.Parse_error ->
47
    let loc = Location.curr lexbuf in
48
    raise (Syntax_err loc)
49

    
50
(* Local Variables: *)
51
(* compile-command:"make -C .." *)
52
(* End: *)