I | |
identifier | |
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 | |
jettyrealm.aug | |
jmxaccess.aug | |
jmxpassword.aug | |
job_identifier, Anacron | |
json, OpenShift_Quickstarts | |
K | |
Kdump | |
Keepalived | |
kernel, Grub | |
kernel_args, Grub | |
key_comment, Authorized_Keys | |
key_opt_rtable_line, Ntpd | |
key_opt_value_line, BootConf | |
key_opt_weight_rtable_line, Ntpd | |
key_options, Authorized_Keys | |
key_re | |
key_type, Authorized_Keys | |
key_value | |
key_value_line | |
key_value_line_comment | |
key_ws_value | |
keys | |
keyword, Ntpd | |
Keywords | |
knode, Test_Xml | |
kv, Approx | |
kw_arg, Grub | |
kw_boot_arg, Grub | |
kw_menu_arg, Grub | |
kw_pres, Grub |
The left hand side of a definition
let identifier = /[a-zA-Z0-9_-]+/
let identifier = entry_str "Identifier" /[iI]dentifier/
A file inclusion /!\ The manpage is not clear on the syntax
let include = [ indent . key "#include" . Sep.space . store Rx.fspath . eol ]
An include line starting with a “+” and a map name
let include = [ seq "entry" . store "+" . Util.del_opt_ws "" . [ label "map" . store map_name ] . Util.eol ]
let include = Build.key_value_line "include" Sep.space (store Rx.fspath)
An include entry.
let include = [ key "include" . [ label "file" . eq . store word . eol ] ]
Includes another file at this position
let include = [ key ".include" . Util.del_ws_spc . sto_value . (comment|eol) ]
include_dir=/path/to/dir/
let include_dir = [ key "include_dir" . [ label "dir" . eq . store word . eol ] ]
let includedir = [ key /#include(dir)?/ . 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 = Build.key_value_line /include(dir)?/ Sep.space (store Rx.no_spaces)
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 = Util.indent
let indent = Util.indent
Delete indentation, including leading whitespace
let indent = del /[ \t]*/ ""
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) = entry_generic (Util.indent . key kw) sep comment_re 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 ]
let input1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <html>\r <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> "
let int = /[0-9]+/
Store a Rx.integer
let integer = store Rx.integer
One or more digits
let integer = /[0-9]+/
An ipv4 or ipv6
let ip = ipv4 | ipv6
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?
CIDR or ip+netmask
let ipaddr = /[0-9a-fA-F:.]+(\/[0-9]+|[ \t]+[0-9.]+)/
An IP address or range with an optional mask
let ipaddr = [label "ipaddr" . store Rx.ip . netmask?]
let ipaddr_or_hostname = ipaddr | hostname
A device for IP addresses
let ipdev = [ key "dev" . sep_spc . sto_word ]
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 ipv4 = let dot = "." in byte . dot . byte . dot . byte . dot . byte
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}:)/
regular entries
let item = [ key item_re . eq . store word . eol ]
let item_re = /[^#=\n\t\/ ]+/ - (/command\[[^]\/\n]+\]/ | "include" | "include_dir")
The job_identifier for an entry
let job_identifier = [ label "job-identifier" . store Rx.word ]
let json = Json.lns
let kernel = [ command /kernel\$?/ "\t" . (spc . ([switch "type" . eq . store /[a-z]+/] |[switch "no-mem-option"]))* . spc . kernel_args ]
Parse the file name and args on a kernel or module line.
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
let key_comment = [ label "comment" . store Rx.space_in ]
A subnode with a keyword, an optional routing table id and an end of line.
let key_opt_rtable_line (kw:regexp) (sto:lens) = let rtable = [ Util.del_str "rtable" . space . label "rtable" . store rtable_re ] in [ key kw . space . sto . (space . rtable)? . eol ]
A subnode with a keyword, an optional part consisting of a separator and a storing lens, and an end of line
let key_opt_value_line (kw:regexp) (sto:lens) = [ key kw . (space . sto)? . eol ]
A subnode with a keyword, an optional routing table id, an optional weight-value and an end of line.
let key_opt_weight_rtable_line (kw:regexp) (sto:lens) = let rtable = [ Util.del_str "rtable" . space . label "rtable" . store rtable_re ] in let weight = [ Util.del_str "weight" . space . label "weight" . store weight_re ] in [ key kw . space . sto . (space . weight)? . (space . rtable)? . eol ]
A list of key options
let key_options = [ label "options" . Build.opt_list option Sep.comma ]
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 ]
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 ]
let key_value = Build.key_value Rx.word Sep.equal (store Rx.word)
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 ]
let key_value_line = Build.key_value_line Rx.word Sep.equal (store Rx.word)
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) ]
let key_value_line_comment = Build.key_value_line_comment Rx.word Sep.equal (store Rx.word) Util.comment
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 (kw:regexp) = key_value_line kw Util.del_ws_spc (store Rx.space_in)
let key_ws_value = Build.key_ws_value Rx.word
Match any possible key except commands and block names.
let keys = Rx.word - (commands | block_names)
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 keyword = listen | server | servers | sensor
A simple flag function
let knode (r:regexp) = [ key r ]
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 ]