lustrec / src / parse.ml @ 89b9e25c
History | View | Annotate | Download (1.91 KB)
1 |
(* ---------------------------------------------------------------------------- |
---|---|
2 |
* SchedMCore - A MultiCore Scheduling Framework |
3 |
* Copyright (C) 2009-2011, ONERA, Toulouse, FRANCE - LIFL, Lille, FRANCE |
4 |
* |
5 |
* This file is part of Prelude |
6 |
* |
7 |
* Prelude is free software; you can redistribute it and/or |
8 |
* modify it under the terms of the GNU Lesser General Public License |
9 |
* as published by the Free Software Foundation ; either version 2 of |
10 |
* the License, or (at your option) any later version. |
11 |
* |
12 |
* Prelude is distributed in the hope that it will be useful, but |
13 |
* WITHOUT ANY WARRANTY ; without even the implied warranty of |
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 |
* Lesser General Public License for more details. |
16 |
* |
17 |
* You should have received a copy of the GNU Lesser General Public |
18 |
* License along with this program ; if not, write to the Free Software |
19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
* USA |
21 |
*---------------------------------------------------------------------------- *) |
22 |
|
23 |
exception Syntax_err of Location.t |
24 |
|
25 |
open Format |
26 |
|
27 |
let report_error loc = |
28 |
Location.print loc; |
29 |
print_string "Syntax error\n" |
30 |
(* |
31 |
let wrap own parsing_fun token_fun lexbuf = |
32 |
try |
33 |
let ast = parsing_fun token_fun lexbuf own in |
34 |
Parsing.clear_parser (); |
35 |
ast |
36 |
with |
37 |
| Parsing.Parse_error -> |
38 |
let loc = Location.curr lexbuf in |
39 |
raise (Syntax_err loc) |
40 |
*) |
41 |
let header own parsing_fun token_fun lexbuf = |
42 |
try |
43 |
let ast = parsing_fun token_fun lexbuf own in |
44 |
Parsing.clear_parser (); |
45 |
ast |
46 |
with |
47 |
| Parsing.Parse_error -> |
48 |
let loc = Location.curr lexbuf in |
49 |
raise (Syntax_err loc) |
50 |
|
51 |
let prog parsing_fun token_fun lexbuf = |
52 |
try |
53 |
let ast = parsing_fun token_fun lexbuf in |
54 |
Parsing.clear_parser (); |
55 |
ast |
56 |
with |
57 |
| Parsing.Parse_error -> |
58 |
let loc = Location.curr lexbuf in |
59 |
raise (Syntax_err loc) |
60 |
|
61 |
(* Local Variables: *) |
62 |
(* compile-command:"make -C .." *) |
63 |
(* End: *) |