Dovecot

Parses dovecot configuration files.

Author: Serge Smetana serge..nosp@m.smetana@gmai.nosp@m.l.com Acunote http://www.acunote.com Pluron, Inc.  http://pluron.com

Summary
DovecotParses dovecot configuration files.
LicenseThis file is licensed under the LGPL v2+.
Configuration filesThis lens applies to /etc/dovecot/dovecot.conf and files in /etc/dovecot/conf.d/.
ExamplesThe Test_Dovecot file contains various examples and tests.
TODOSupport for multiline values like queries in dict-sql.conf
USEFUL PRIMITIVES
indent
eol
emptyMap empty lines.
commentMap comments in “#comment” nodes.
eq
any
valueMatch any value after “ =”.
command_start
block_argsMap block arguments after block name and before “{“
ENTRIES
commands
block_names
keysMatch any possible key except commands and block names.
entryMap simple “key = value” entries including “key =” entries with empty value.
commandMap commands started with “!”
blockMap block enclosed in brackets recursively.
LENS AND FILTER
lnsThe Dovecot lens
filter

License

This file is licensed under the LGPL v2+.

Configuration files

This lens applies to /etc/dovecot/dovecot.conf and files in /etc/dovecot/conf.d/.  See filter.

Examples

The Test_Dovecot file contains various examples and tests.

TODO

Support for multiline values like queries in dict-sql.conf

USEFUL PRIMITIVES

indent

let indent = Util.indent

eol

let eol = Util.eol

empty

let empty = Util.empty

Map empty lines.

comment

let comment = Util.comment

Map comments in “#comment” nodes.

eq

let eq = del /[ \t]*=/ " ="

any

let any = Rx.no_spaces

value

let value = any . (Rx.space . any)*

Match any value after “ =”.  Should not start and end with spaces.  May contain spaces inside

command_start

let command_start = Util.del_str "!"

block_args

let block_args = Sep.space . store /[A-Za-z0-9\/\\_-]+/

Map block arguments after block name and before “{“

ENTRIES

commands

let commands = /include|include_try/

block_names

let block_names = /dict|userdb|passdb|protocol|service|plugin|namespace|map|fields|unix_listener|fifo_listener|inet_listener/

keys

let keys = Rx.word - (commands | block_names)

Match any possible key except commands and block names.

entry

let entry = [ indent . key keys. eq . (Sep.opt_space . store value)? . eol ]

Map simple “key = value” entries including “key =” entries with empty value.

command

let command = [ command_start . key commands . Sep.space . store Rx.fspath . eol ]

Map commands started with “!”.

block

let rec block = [ indent . key block_names . block_args? . Build.block_newlines (entry|block) comment . eol ]

Map block enclosed in brackets recursively.  Block may be indented and have optional argument.  Block body may have entries, comments, empty lines, and nested blocks recursively.

LENS AND FILTER

lns

let lns = (comment|empty|entry|command|block)*

The Dovecot lens

filter

Provides unit tests and examples for the Dovecot lens.
let indent = Util.indent
let eol = Util.eol
let empty = Util.empty
Map empty lines.
let comment = Util.comment
Map comments in “#comment” nodes.
let eq = del /[ \t]*=/ " ="
let any = Rx.no_spaces
let value = any . (Rx.space . any)*
Match any value after “ =”.
let command_start = Util.del_str "!"
let block_args = Sep.space . store /[A-Za-z0-9\/\\_-]+/
Map block arguments after block name and before “{“
let commands = /include|include_try/
let block_names = /dict|userdb|passdb|protocol|service|plugin|namespace|map|fields|unix_listener|fifo_listener|inet_listener/
let keys = Rx.word - (commands | block_names)
Match any possible key except commands and block names.
let entry = [ indent . key keys. eq . (Sep.opt_space . store value)? . eol ]
Map simple “key = value” entries including “key =” entries with empty value.
let command = [ command_start . key commands . Sep.space . store Rx.fspath . eol ]
Map commands started with “!”
let rec block = [ indent . key block_names . block_args? . Build.block_newlines (entry|block) comment . eol ]
Map block enclosed in brackets recursively.
let lns = (comment|empty|entry|command|block)*
The Dovecot lens
Close