3 Parses Pylons Paste ini configuration files.
5 Author: Andrew Colin Kissa <andrew@topdog.za.net>
6 Baruwa Enterprise Edition http://www.baruwa.com
9 This file is licensed under the LGPL v2+.
11 About: Configuration files
12 This lens applies to /etc/baruwa See <filter>.
18 (************************************************************************
19 * Group: USEFUL PRIMITIVES
20 *************************************************************************)
22 let comment = IniFile.comment IniFile.comment_re IniFile.comment_default
24 let sep = IniFile.sep "=" "="
28 let optspace = del /\n/ "\n"
30 let entry_re = ( /[A-Za-z][:#A-Za-z0-9._-]+/)
32 let plugin_re = /[A-Za-z][;:#A-Za-z0-9._-]+/
34 let plugins_kw = /plugins/
36 let debug_kw = /debug/
38 let normal_opts = entry_re - (debug_kw|plugins_kw)
40 let del_opt_ws = del /[\t ]*/ ""
42 let new_ln_sep = optspace . del_opt_ws . store plugin_re
44 let plugins_multiline = sep . counter "items" . [ seq "items" . new_ln_sep]*
46 let sto_multiline = optspace . Sep.opt_space . store (Rx.space_in . (/[ \t]*\n/ . Rx.space . Rx.space_in)*)
48 (************************************************************************
50 *************************************************************************)
52 let set_option = Util.del_str "set "
53 let no_inline_comment_entry (kw:regexp) (sep:lens) (comment:lens) =
54 [ set_option . key debug_kw . sep . IniFile.sto_to_eol . eol ]
55 | [ key plugins_kw . plugins_multiline . eol]
56 | [ key kw . sep . IniFile.sto_to_eol? . eol ]
59 let entry = no_inline_comment_entry normal_opts sep comment
61 (************************************************************************
63 *************************************************************************)
65 let title = IniFile.title IniFile.record_re
67 let record = IniFile.record title entry
69 (************************************************************************
70 * Group: LENS & FILTER
71 *************************************************************************)
73 let lns = IniFile.lns record comment
75 let filter = incl "/etc/baruwa/*.ini"
77 let xfm = transform lns filter