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
|
open LustreSpec
|
16
|
open Corelang
|
17
|
|
18
|
let report_error loc =
|
19
|
Location.print loc;
|
20
|
print_string "Syntax error\n"
|
21
|
|
22
|
let header parsing_fun token_fun lexbuf =
|
23
|
try
|
24
|
let ast = parsing_fun token_fun lexbuf in
|
25
|
Parsing.clear_parser ();
|
26
|
ast
|
27
|
with
|
28
|
| Parsing.Parse_error ->
|
29
|
let loc = Location.curr lexbuf in
|
30
|
raise (Syntax_err loc)
|
31
|
|
32
|
let prog parsing_fun token_fun lexbuf =
|
33
|
try
|
34
|
let ast = parsing_fun token_fun lexbuf in
|
35
|
Parsing.clear_parser ();
|
36
|
ast
|
37
|
with
|
38
|
| Parsing.Parse_error ->
|
39
|
let loc = Location.curr lexbuf in
|
40
|
raise (Syntax_err loc)
|
41
|
|
42
|
(* Local Variables: *)
|
43
|
(* compile-command:"make -C .." *)
|
44
|
(* End: *)
|