1 /* 'df' command for virtual domains. -*- text -*-
2 (C) Copyright 2007-2008 Richard W.M. Jones, Red Hat Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /* Parser for LVM2 metadata.
22 http://plus.kaist.ac.kr/~shoh/ocaml/ocamllex-ocamlyacc/ocamlyacc-tutorial/
26 open Diskimage_lvm2_metadata
29 %token LBRACE RBRACE /* { } */
30 %token LSQUARE RSQUARE /* [ ] */
33 %token <string> STRING /* "string" */
34 %token <Int63.t> INT /* an integer */
35 %token <float> FLOAT /* a float */
36 %token <string> IDENT /* a naked keyword/identifier */
37 %token EOF /* end of file */
40 %type <Diskimage_lvm2_metadata.metadata> input
44 input : lines EOF { List.rev $1 }
47 lines : /* empty */ { [] }
48 | lines line { $2 :: $1 }
51 line : /* empty */ /* These dummy entries get removed after parsing. */
55 | IDENT LBRACE lines RBRACE
56 { ($1, Metadata (List.rev $3)) }
59 value : STRING { String $1 }
62 | LSQUARE list RSQUARE
63 { List (List.rev $2) }
66 list : /* empty */ { [] }