E | |
email, Keepalived | |
empty | |
empty_c_style, Util | |
empty_generic, Util | |
entries, Syslog | |
entry | |
entry_generic, Xorg | |
entry_int, Xorg | |
entry_rgb, Xorg | |
entry_sto, Mke2fs | |
entry_str, Xorg | |
entry_xy, Xorg | |
eol, Keepalived | |
except, Access | |
F | |
facilities, Syslog | |
field, Keepalived | |
file, Syslog | |
filter | |
flag | |
fs_types, Mke2fs | |
fs_types_entry, Mke2fs | |
fs_types_record, Mke2fs | |
fs_types_title, Mke2fs | |
G | |
global_conf, Keepalived | |
global_defs, Keepalived | |
global_defs_field, Keepalived | |
H | |
host_alias, Sudoers | |
hostname, Syslog | |
hostnames, Syslog | |
hour, Cron | |
I | |
identifier, Xorg | |
includedir, Sudoers | |
includes, Xinetd | |
indent, Keepalived | |
indented_entry, IniFile | |
indented_title, IniFile | |
indented_title_label, IniFile | |
input_device, Xorg | |
ip6_dotint, Resolv | |
ipaddr | |
ipdev, Keepalived | |
K | |
key_value, Build | |
key_value_line, Build | |
key_value_line_comment, Build |
A simple email address entry
let email = [ indent . label "email" . sto_email_addr . comment_or_eol ]
Empty line, an eol subnode
let empty = [ eol ]
Map empty lines
let empty = Util.empty
let empty = IniFile.empty
let empty = Util.empty
let empty = Util.empty
Map empty lines, including empty asterisk comments
let empty = [ del /[ \t]*\*?[ \t]*\n/ "\n" ]
Map empty lines
let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
Map empty lines, including empty comments
let empty = empty_generic /[ \t]*#?[ \t]*/
Map empty lines, including C-style empty comment
let empty_c_style = empty_generic /[ \t]*( (\/\/)|(\/\*[ \t]*\*\/) )?[ \t]*/
A generic definition of empty Map empty lines, including empty comments
let empty_generic ( r:regexp ) = [ del r "" . del_str "\n" ]
entries are either comments/empty lines or entries
let entries = ( empty | comment | entry )*
let entry = [ Util.del_opt_ws "" . key entry_re . Util.del_ws_spc . store /[^# \n\t]+/ . eol ] | comment
A valid entry line Definition:
let entry = [ access . colon . user_list . (except user_list)? . colon . origin_list . (except origin_list)? . Util.eol ]
A crontab entry
let entry = [ label "entry" . indent . ( time | schedule ) . sep_spc . user . sep_spc . store Rx.space_in . eol ]
Generic INI File entry
let entry ( kw:regexp ) (sep:lens) (comment:lens) = [ key kw . sep . sto_to_comment? . (comment|eol) ] | comment
A generic entry for lens lns
let entry ( kw:regexp ) (lns:lens) = Build.key_value_line kw sep lns
let entry = nameserver | domain | search | sortlist | options
an entry contains selectors and an action
let entry = [ label "entry" . selectors . sep_tab . [ label "action" . action ] . eol ]
An entry without a specific handler.
let entry_generic = [ indent . key generic_entry_re . sep_spc . store to_eol . eol ]
This matches an entry which takes a single integer for an argument
let entry_int ( canon:string ) (re:regexp) = [ indent . del re canon . label canon . sep_spc . store int . eol ]
This matches an entry which takes 3 integers as arguments representing red, green and blue components
let entry_rgb ( canon:string ) (re:regexp) = [ indent . del re canon . label canon . [ label "red" . sep_spc . store int ] . [ label "green" . sep_spc . store int ] . [ label "blue" . sep_spc . store int ] . eol ]
Store a regexp as entry value
let entry_sto ( kw:regexp ) (val:regexp) = entry kw (store val)
This matches an entry which takes a single quoted string
let entry_str ( canon:string ) (re:regexp) = [ indent . del re canon . label canon . sep_spc . quoted_string_val . eol ]
This matches an entry which takes 2 integers as arguments representing X and Y coordinates
let entry_xy ( canon:string ) (re:regexp) = [ indent . del re canon . label canon . [ label "x" . sep_spc . store int ] . [ label "y" . sep_spc . store int ] . eol ]
let eol = Util.eol
The except operator makes it possible to write very compact rules.
let except ( lns:lens ) = [ label "except" . Sep.space . del /[Ee][Xx][Cc][Ee][Pp][Tt]/ "EXCEPT" . Sep.space . lns ]
a list of facilities, separated by commas
let facilities = label_opt_list "facility" ( store token ) comma
let field ( kw:string ) (sto:lens) = indent . Build.key_value_line_comment kw sep_spc sto comment_eol
a file may start with a “-” meaning it does not gets sync’ed everytime
let file = [ Build.xchgs "-" "no_sync" ]? . [ label "file" . store file_r ]
A simple flag subnode, consisting of a single key
let flag ( kw:regexp ) = [ key kw ]
A single word
let flag ( kw:regexp ) = indent . Build.flag kw
A fs_types section
let fs_types = IniFile.record fs_types_title ( fs_types_record | comment )
Possible entries under a fs_types_record group
let fs_types_entry =list_sto "features" ( [del /\^/ "^" . label "disable"]? . key Rx.word ) | list_sto "options" (key Rx.word . Util.del_str "=" . store Rx.word) | entry_sto "lazy_itable_init" ("true"|"false") | entry_sto "flex_bg_size" Rx.integer
Fs group records under the fs_types section
let fs_types_record = [ label "filesystem" . Util.indent . store Rx.word . del /[ \t]*=[ \t]*\{[ \t]*\n/ " = {\n" . ((Util.indent . (fs_types_entry|common_entry)) | empty | comment)* . del /[ \t]*\}[ \t]*\n/ " }\n" ]
Title for the fs_types section
let fs_types_title = IniFile.title "fs_types"
A global configuration entry
let global_conf = global_defs | static_routes
A global_defs block
let global_defs = block "global_defs" global_defs_field
Possible fields in the global_defs block
let global_defs_field = block "notification_email" email | field "notification_email_from" sto_email_addr | field "smtp_server" sto_word | field "smtp_connect_timeout" sto_num | field "lvs_id" sto_word | field "router_id" sto_word
Host_Alias, see alias_field
let host_alias = alias_entry "Host_Alias" "host" sto_to_com
a program begins with an optional hash, and a + or -
let hostname = [ label "hostname" . opt_hash . ( plus | [ Build.xchgs "-" "reverse" ] ) . hostnames . eol . entries ]
a list of hostnames
let hostnames = label_opt_list_or "hostname" ( store Rx.word ) comma "*"
let hour = [ label "hour" . store num ]
let identifier = entry_str "Identifier" /[iI]dentifier/
let includedir = [ key "#includedir" . Sep.space . store Rx.fspath . eol ]
It would be nice if we could use the directories given in include and includedir directives to parse additional files instead of hardcoding all the places where xinetd config files can be found; but that is currently not possible, and implementing that has a good amount of hairy corner cases to consider.
let includes = [ key /include|includedir/ . Util.del_ws_spc . store /[^ \t\n]+/ . eol ]
let indent = Util.indent
Generic INI File entry that might be indented with an arbitrary amount of whitespace
let indented_entry ( kw:regexp ) (sep:lens) (comment:lens) = [ Util.del_opt_ws "" . key kw . sep . sto_to_comment? . (comment|eol) ] | comment
Title for record.
let indented_title ( kw:regexp ) = Util.indent . title kw
Title for record.
let indented_title_label ( name:string ) (kw:regexp) = Util.indent . title_label name kw
let input_device = [ indent . del /[iI]nput[dD]evice/ "InputDevice" . label "InputDevice" . sep_spc . quoted_string_val . [ label "option" . sep_spc . quoted_string_val ]* . eol ]
ip6-dotint option, which supports negation
let ip6_dotint = let negate = [ del "no-" "no-" . label "negate" ] in [ negate? . key "ip6-dotint" ]
An IP address or range with an optional mask
let ipaddr = label "ipaddr" . store /[0-9\.-]+/ . prefixlen?
An IP address or range with an optional mask
let ipaddr = [label "ipaddr" . store Rx.ip . netmask?]
A device for IP addresses
let ipdev = [ key "dev" . sep_spc . sto_word ]
Same as key_value_line, but does not end with an end of line
let key_value ( kw: regexp ) (sep:lens) (sto:lens) = [ key kw . sep . sto ]
A subnode with a keyword, a separator and a storing lens, and an end of line
let key_value_line ( kw:regexp ) (sep:lens) (sto:lens) = [ key kw . sep . sto . eol ]
Same as key_value_line, but allows to have a comment in the end of a line and an end of line
let key_value_line_comment ( kw:regexp ) (sep:lens) (sto:lens) (comment:lens) = [ key kw . sep . sto . (eol|comment) ]