1 /* 'df' command for virtual domains. -*- text -*-
2 (C) Copyright 2007-2008 Richard W.M. Jones, Red Hat Inc.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version,
9 with the OCaml linking exception described in ../COPYING.LIB.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 /* Parser for LVM2 metadata.
23 http://plus.kaist.ac.kr/~shoh/ocaml/ocamllex-ocamlyacc/ocamlyacc-tutorial/
27 open Diskimage_lvm2_metadata
30 %token LBRACE RBRACE /* { } */
31 %token LSQUARE RSQUARE /* [ ] */
34 %token <string> STRING /* "string" */
35 %token <Int63.t> INT /* an integer */
36 %token <float> FLOAT /* a float */
37 %token <string> IDENT /* a naked keyword/identifier */
38 %token EOF /* end of file */
41 %type <Diskimage_lvm2_metadata.metadata> input
45 input : lines EOF { List.rev $1 }
48 lines : /* empty */ { [] }
49 | lines line { $2 :: $1 }
52 line : /* empty */ /* These dummy entries get removed after parsing. */
56 | IDENT LBRACE lines RBRACE
57 { ($1, Metadata (List.rev $3)) }
60 value : STRING { String $1 }
63 | LSQUARE list RSQUARE
64 { List (List.rev $2) }
67 list : /* empty */ { [] }