1
(*********************************************************************************)
4
(* Copyright (C) 2011 Institut National de Recherche en Informatique *)
5
(* et en Automatique. All rights reserved. *)
7
(* This program is free software; you can redistribute it and/or modify *)
8
(* it under the terms of the GNU Library General Public License as *)
9
(* published by the Free Software Foundation; either version 2 of the *)
10
(* License, or any later version. *)
12
(* This program is distributed in the hope that it will be useful, *)
13
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
14
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
15
(* GNU Library General Public License for more details. *)
17
(* You should have received a copy of the GNU Library 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 *)
22
(* Contact: Maxence.Guesdon@inria.fr *)
25
(*********************************************************************************)
27
(* This file is used to generate the code of the module Config_file.Raw.Parse. *)
30
let lexer = Genlex.make_lexer ["="; "{"; "}"; "["; "]"; ";"; "("; ")"; ","]
33
let rec file l = parser
34
| [< id = ident; 'Genlex.Kwd "="; v = value ; result = file ((id, v) :: l) >] -> result
37
| [< 'Genlex.Kwd "{"; v = file []; 'Genlex.Kwd "}" >] -> Section v
38
| [< 'Genlex.Ident s >] -> String s
39
| [< 'Genlex.String s >] -> String s
40
| [< 'Genlex.Int i >] -> Int i
41
| [< 'Genlex.Float f >] -> Float f
42
| [< 'Genlex.Char c >] -> String (String.make 1 c)
43
| [< 'Genlex.Kwd "["; v = list [] >] -> List v
44
| [< 'Genlex.Kwd "("; v = list [] >] -> Tuple v
46
| [< 'Genlex.Ident s >] -> s
47
| [< 'Genlex.String s >] -> s
49
| [< 'Genlex.Kwd ";"; result = list l >] -> result
50
| [< 'Genlex.Kwd ","; result = list l >] -> result
51
| [< v = value; result = list (v :: l) >] -> result
52
| [< 'Genlex.Kwd "]" >] -> List.rev l
53
| [< 'Genlex.Kwd ")" >] -> List.rev l