Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
I
 identifier, Xorg
 include
 include_dir, Nrpe
 includedir, Sudoers
 includes, Xinetd
 indent
 indented_entry, IniFile
 indented_title, IniFile
 indented_title_label, IniFile
 INI File settings
 IniFile
 input_device, Xorg
 input1, Test_Xml
 Inputrc
 install_remove, Modprobe
 int, Xorg
 integer
 Internal primitives, IniFile
 ip, Rx
 ip6_dotint, Resolv
 ipaddr
 ipaddr_or_hostname, Pg_Hba
 ipdev, Keepalived
 IPs, Rx
 Iptables
 ipv4
 ipv6, Rx
 item, Nrpe
 item_re, Nrpe
J
 job_identifier, Anacron
K
 Kdump
 Keepalived
 kernel, Grub
 kernel_args, Grub
 key_comment, Authorized_Keys
 key_options, Authorized_Keys
 key_re
 key_type, Authorized_Keys
 key_value
 key_value_line
 key_value_line_comment
 key_ws_value
 keys, Test_Authorized_Keys
 knode, Test_Xml
 kv, Approx
 kw_arg, Grub
 kw_boot_arg, Grub
 kw_menu_arg, Grub
 kw_pres, Grub
let identifier = entry_str "Identifier" /[iI]dentifier/
let include = [ indent . key "#include" . Sep.space . store Rx.fspath . eol ]
A file inclusion /!\ The manpage is not clear on the syntax
let include = [ seq "entry" . store "+" . Util.del_opt_ws "" . [ label "map" . store map_name ] . Util.eol ]
An include line starting with a “+” and a map name
let include = Build.key_value_line "include" Sep.space (store Rx.fspath)
let include = [ key "include" . [ label "file" . eq . store word . eol ] ]
An include entry.
let include = [ key ".include" . Util.del_ws_spc . sto_value . (comment|eol) ]
Includes another file at this position
let include_dir = [ key "include_dir" . [ label "dir" . eq . store word . eol ] ]
include_dir=/path/to/dir/
let includedir = [ key /#include(dir)?/ . Sep.space . store Rx.fspath . eol ]
let includes = Build.key_value_line /include(dir)?/ Sep.space (store Rx.no_spaces)
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 indent = Util.indent
An Util.indent
let indent = Util.indent
An indentation
let indent = Util.indent
let indent = Util.indent
let indent = Util.indent
let indent = Util.indent
let indent = del /[ \t]*/ ""
Delete indentation, including leading whitespace
let indent = Util.indent
let indented_entry (kw:regexp) (sep:lens) (comment:lens) = [ Util.del_opt_ws "" . key kw . sep . sto_to_comment? . (comment|eol) ] | comment
Generic INI File entry that might be indented with an arbitrary amount of whitespace
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
Title for record.
subversion only supports comments starting with “#”
Generic module to create INI files lenses
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 ]
let input1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html> <head> <title>Wiki</title> </head> <body> <h1>Augeas</h1> <p class=\"main\">Augeas is now able to parse XML files!</p> <ul> <li>Translate from XML to a tree syntax</li> <li>Translate from the tree back to XML</li> <!-- this is some comment --> <li>this</li> </ul> </body> </html> "
Parses /etc/inputrc
let int = /[0-9]+/
let integer = store Rx.integer
Store a Rx.integer
let integer = /[0-9]+/
One or more digits
let ip = ipv4 | ipv6
An ipv4 or ipv6
let ip6_dotint = let negate = [ del "no-" "no-" . label "negate" ] in [ negate? . key "ip6-dotint" ]
ip6-dotint option, which supports negation
let ipaddr = label "ipaddr" . store /[0-9.-]+/ . prefixlen?
An IP address or range with an optional mask
let ipaddr = /[0-9a-fA-F:.]+(\/[0-9]+|[ \t]+[0-9.]+)/
CIDR or ip+netmask
let ipaddr = [label "ipaddr" . store Rx.ip . netmask?]
An IP address or range with an optional mask
let ipaddr_or_hostname = ipaddr | hostname
let ipdev = [ key "dev" . sep_spc . sto_word ]
A device for IP addresses
Cf.
Parse the iptables file format as produced by iptables-save.
let ipv4 = let dot = "." in let digits = /(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/ in digits . (dot . digits . (dot . digits . (dot . "0")?)?)?
A network IP, trailing .0 may be omitted
let ipv4 = let dot = "." in let digits = /(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)/ in digits . dot . digits . dot . digits . dot . digits
let ipv6 = /(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})/ | ( /([0-9A-Fa-f]{1,4}:){6}/ . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/ . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/ ) | ( /([0-9A-Fa-f]{1,4}:){0,5}:/ . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/ . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/ ) | ( /::([0-9A-Fa-f]{1,4}:){0,5}/ . /((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}/ . /(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))/ ) | ( /[0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}/ . /[0-9A-Fa-f]{1,4}/ ) | /(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})/ | /(([0-9A-Fa-f]{1,4}:){1,7}:)/
let item = [ key item_re . eq . store word . eol ]
regular entries
let item_re = "server_port" | "command_prefix" | "server_address" | "allowed_hosts" | "debug" | "nrpe_user" | "nrpe_group" | "dont_blame_nrpe" | "command_timeout" | "connection_timeout" | "allow_weak_random_seed" | "pid_file" | "log_facility"
regular entries re
let job_identifier = [ label "job-identifier" . store Rx.word ]
The job_identifier for an entry
Parses /etc/kdump.conf
Parses /etc/keepalived/keepalived.conf
let kernel = [ command /kernel\$?/ "\t" . (spc . ([switch "type" . eq . store /[a-z]+/] |[switch "no-mem-option"]))* . spc . kernel_args ]
let kernel_args = let arg = /[A-Za-z0-9_.$-]+/ - /type|no-mem-option/ in store /(\([a-z0-9,]+\))?\/[^ \t\n]*/ . (spc . multiboot_arg)? . (spc . [ key arg . (eq. store /([^ \t\n])*/)?])* . eol
Parse the file name and args on a kernel or module line.
let key_comment = [ label "comment" . store Rx.space_in ]
let key_options = [ label "options" . Build.opt_list option Sep.comma ]
A list of key options
let key_re = /\$?[A-Za-z0-9_.-]+/
let key_re = /[^=# \t\n]+/
let key_type = let key_type_re = /ecdsa-sha2-nistp[0-9]+/ | /ssh-[a-z]+/ in [ label "type" . store key_type_re ]
let key_value (kw: regexp) (sep:lens) (sto:lens) = [ key kw . sep . sto ]
Same as key_value_line, but does not end with an end of line
let key_value = Build.key_value Rx.word Sep.equal (store Rx.word)
let key_value_line (kw:regexp) (sep:lens) (sto:lens) = [ key kw . sep . sto . eol ]
A subnode with a keyword, a separator and a storing lens, and an end of line
let key_value_line = Build.key_value_line Rx.word Sep.equal (store Rx.word)
let key_value_line_comment (kw:regexp) (sep:lens) (sto:lens) (comment:lens) = [ key kw . sep . sto . (eol|comment) ]
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 = Build.key_value_line_comment Rx.word Sep.equal (store Rx.word) Util.comment
let key_ws_value (kw:regexp) = key_value_line kw Util.del_ws_spc (store Rx.space_in)
Store a key/value pair where key and value are separated by whitespace and the value goes to the end of the line.
let key_ws_value = Build.key_ws_value Rx.word
let keys = "# Example keys, one of each type # ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDpWrKYsEsVUyuwMN4ReBN/TMGsaUWzDKDz/uQr6MlNNM95MDK/BPyJ+DiBiNMFVLpRt3gH3eCJBLJKMuUDaTNy5uym2zNgAaAIVct6M2GHI68W3iY3Ja8/MaRPbyTpMh1O74S+McpAW1SGL2YzFchYMjTnu/kOD3lxiWNiDLvdLFZu0wPOi7CYG37VXR4Thb0cC92zqnCjaP1TwfhpEYUZoowElYkoV2vG+19O6cRm/zduYcf8hmegZKB4GFUJTtZ2gZ18XJDSQd0ykK3KPt/+bKskdrtfiOwSZAmUZmd2YuAlY6+CBn1T3UBdQntueukd0z1xhd6SX7Bl8+qyqLQ3 user@example ssh-dsa AAAA user@example ecdsa-sha2-nistp256 AAAA user@example # Example comments ssh-dsa AAAA ssh-dsa AAAA user@example "
let knode (r:regexp) = [ key r ]
A simple flag function
let kv = [ indent . key key_re . del sep " " . store value_re . eol ]
let kw_arg (kw:regexp) (indent:string) (dflt_sep:string) = [ command kw indent . value_sep dflt_sep . value_to_eol . eol ]
let kw_boot_arg (kw:regexp) = kw_arg kw "\t" " "
let kw_menu_arg (kw:regexp) = kw_arg kw "" " "
let kw_pres (kw:string) = [ opt_ws . key kw . del_to_eol . eol ]
Close