Trapperkeeper

Parses Trapperkeeper configuration files

Author: Raphael Pinson raphael.nosp@m..pinson@camptoc.nosp@m.amp.com

Summary
TrapperkeeperParses Trapperkeeper configuration files
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageTo be documented
Configuration filesThis lens applies to Trapperkeeper webservice configuration files.
ExamplesThe <Test_Trapperkeeper> file contains various examples and tests.
USEFUL PRIMITIVES
empty
comment
sep
sep_with_spc
BLOCKS (FROM 1.2, FOR 0.10 COMPATIBILITY)
block_ldelim_newlines_re
block_rdelim_newlines_re
block_ldelim_newlines_default
block_rdelim_newlines_default
block_newlineA block enclosed in brackets, with newlines forced and indentation defaulting to a tab.
ENTRY TYPES
simple
array
hash
ENTRY
entry
LENS AND FILTER
lns
filter

License

This file is licenced under the LGPL v2+, like the rest of Augeas.

Lens Usage

To be documented

Configuration files

This lens applies to Trapperkeeper webservice configuration files.  See filter.

Examples

The <Test_Trapperkeeper> file contains various examples and tests.

USEFUL PRIMITIVES

empty

let empty = Util.empty

comment

let comment = Util.comment

sep

let sep = del /[ \t]*[:=]/ ":"

sep_with_spc

let sep_with_spc = sep . Sep.opt_space

BLOCKS (FROM 1.2, FOR 0.10 COMPATIBILITY)

block_ldelim_newlines_re

block_rdelim_newlines_re

let block_rdelim_newlines_re = /[ \t]*\}/

block_ldelim_newlines_default

block_rdelim_newlines_default

let block_rdelim_newlines_default = "}"

block_newline

let block_newlines (entry:lens) (comment:lens) = del block_ldelim_newlines_re block_ldelim_newlines_default . ((entry | comment) . (Util.empty | entry | comment)*)? . del block_rdelim_newlines_re block_rdelim_newlines_default

A block enclosed in brackets, with newlines forced and indentation defaulting to a tab.

Parameters

entry:lensthe entry to be stored inside the block.  This entry should not include Util.empty, Util.comment or Util.comment_noindent, should be indented and finish with an eol.

ENTRY TYPES

simple

array

let array = let lbrack = Util.del_str "[" in let rbrack = Util.del_str "]" in let opt_space = del /[ \t]*/ "" in let comma = opt_space . Util.del_str "," . opt_space

hash

let hash (lns:lens) = [ Util.indent . label "@hash" . store Rx.word . sep . block_newlines lns Util.comment . Util.eol ]

ENTRY

entry

let rec entry = hash (entry|simple|array)

LENS AND FILTER

lns

let lns = (empty|comment)* . (entry . (empty|comment)*)*

filter

let empty = Util.empty
let comment = Util.comment
let sep = del /[ \t]*[:=]/ ":"
let sep_with_spc = sep . Sep.opt_space
let block_rdelim_newlines_re = /[ \t]*\}/
let block_rdelim_newlines_default = "}"
let block_newlines (entry:lens) (comment:lens) = del block_ldelim_newlines_re block_ldelim_newlines_default . ((entry | comment) . (Util.empty | entry | comment)*)? . del block_rdelim_newlines_re block_rdelim_newlines_default
A block enclosed in brackets, with newlines forced and indentation defaulting to a tab.
let array = let lbrack = Util.del_str "[" in let rbrack = Util.del_str "]" in let opt_space = del /[ \t]*/ "" in let comma = opt_space . Util.del_str "," . opt_space
let hash (lns:lens) = [ Util.indent . label "@hash" . store Rx.word . sep . block_newlines lns Util.comment . Util.eol ]
let rec entry = hash (entry|simple|array)
let lns = (empty|comment)* . (entry . (empty|comment)*)*
let empty = empty_generic empty_generic_re
Map empty lines, including empty comments
let comment = comment_generic /[ \t]*#[ \t]*/ "# "
Map comments into “#comment” nodes
let comment_noindent = comment_generic /#[ \t]*/ "# "
Map comments into “#comment” nodes, without indentation
Close