Imported Upstream version 0.10.0
[platform/upstream/augeas.git] / lenses / approx.aug
1 (*
2 Module: Approx
3   Parses /etc/approx/approx.conf
4
5 Author: David Lutterkort <lutter@redhat.com>
6
7 About: Reference
8   This lens tries to keep as close as possible to `man 5 approx.conf` where possible.
9
10 About: License
11    This file is licenced under the LGPLv2+, like the rest of Augeas.
12
13 About: Lens Usage
14    See <lns>.
15
16 About: Configuration files
17    This lens applies to /etc/approx/approx.conf.
18
19 About: Examples
20    The <Test_Approx> file contains various examples and tests.
21 *)
22
23 module Approx =
24   autoload xfm
25
26   (* Variable: eol
27      An <Util.eol> *)
28   let eol = Util.eol
29
30   (* Variable: indent
31      An <Util.indent> *)
32   let indent = Util.indent
33
34   (* Variable: key_re *)
35   let key_re = /\$?[A-Za-z0-9_.-]+/
36
37   (* Variable: sep *)
38   let sep = /[ \t]+/
39
40   (* Variable: value_re *)
41   let value_re = /[^ \t\n](.*[^ \t\n])?/
42
43   (* View: comment *)
44   let comment = [ indent . label "#comment" . del /[#;][ \t]*/ "# "
45         . store /([^ \t\n].*[^ \t\n]|[^ \t\n])/ . eol ]
46
47   (* View: empty
48      An <Util.empty> *)
49   let empty = Util.empty
50
51   (* View: kv *)
52   let kv = [ indent . key key_re . del sep " " . store value_re . eol ]
53
54   (* View: lns *)
55   let lns = (empty | comment | kv) *
56
57   (* View: filter *)
58   let filter = incl "/etc/approx/approx.conf"
59   let xfm = transform lns filter