G | |
generic_entry_re, Xorg | |
generic_opt, FAI_DiskConfig | |
generic_opt_list, FAI_DiskConfig | |
group_record, cgrules | |
H | |
hostname, Pg_Hba | |
I | |
indent | |
input1, Test_Xml | |
int, Xorg | |
integer, Rx | |
ip, Rx | |
ipaddr, Pg_Hba | |
ipv4, Rx | |
ipv6, Rx | |
K | |
key_re | |
keys, Test_Authorized_Keys | |
L | |
lbrace, Erlang | |
lbrack, Erlang | |
lbracket, Sep | |
ldapoid_re, Ldif | |
lglob, Erlang | |
list_empty, Test_Up2date | |
list_nocomment_test, Test_IniFile | |
list_one, Test_Up2date | |
list_test, Test_IniFile | |
list_two, Test_Up2date | |
list_two_trailing, Test_Up2date | |
lns, FAI_DiskConfig | |
lns_ace, Test_IniFile | |
lns_acf, Test_IniFile | |
lns_ade, Test_IniFile | |
lns_adf, Test_IniFile | |
lns_bce, Test_IniFile | |
lns_bcf, Test_IniFile | |
lns_bde, Test_IniFile | |
lns_bdf, Test_IniFile | |
loghost_r, Syslog | |
lvmoption, FAI_DiskConfig | |
M | |
meta_release, Test_Apt_Update_Manager | |
mount_option, FAI_DiskConfig | |
mount_option_value, FAI_DiskConfig | |
mount_options, FAI_DiskConfig | |
mountpoint, FAI_DiskConfig | |
mountpoint_kw, FAI_DiskConfig | |
multi, Test_Systemd | |
multiline_ace, Test_IniFile | |
multiline_test, Test_IniFile | |
N | |
name | |
neg1, Rx | |
no_spaces, Rx | |
nocomma, Test_Aliases | |
num, Cron | |
number_re, Postgresql | |
O | |
opt_hash, Syslog | |
opt_plus, Syslog | |
opt_space | |
opt_tab, Sep | |
option, FAI_DiskConfig | |
option_kw, Hosts_Access | |
options, Test_Authorized_Keys | |
optval | |
P | |
partition, FAI_DiskConfig | |
period_name_re, Anacron | |
pipe, Syslog | |
plus, Syslog | |
Q | |
qpidc, Test_Qpid | |
qpidd, Test_Qpid | |
quote, Quote | |
quote_opt, Quote | |
quote_opt_nil, Quote | |
quoted_string_val, Xorg |
let generic_entry_re = /[^# \t\n\/]+/ - entries_re
A generic key/value option
let generic_opt (type:string) (kw:regexp) = [ key type . Util.del_str ":" . store kw ]
A generic key/list option
let generic_opt_list (type:string) (kw:regexp) = [ key type . Util.del_str ":" . counter "locallist" . Build.opt_list [seq "locallist" . store kw] Sep.comma ]
let group_record = generic_record "group" (Util.del_str "@" . store name)
Hostname, FQDN or part of an FQDN possibly starting with a dot.
let hostname = /\.?[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*/
An 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
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> "
let int = /[0-9]+/
One or more digits
let integer = /[0-9]+/
An ipv4 or ipv6
let ip = ipv4 | ipv6
CIDR or ip+netmask
let ipaddr = /[0-9a-fA-F:.]+(\/[0-9]+|[ \t]+[0-9.]+)/
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 key_re = /\$?[A-Za-z0-9_.-]+/
let key_re = /[^=# \t\n]+/
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 "
Format of an LDAP OID from RFC 2251
let ldapoid_re = /[0-9][0-9\.]*/
let list_empty = "keyword=; " test Up2date.lns get list_empty = { "1" = "keyword" { "values" } }
let list_nocomment_test = "test_ace = val1,val2,val3 \n"
let list_one = "keyword=foo; " test Up2date.lns get list_one = { "1" = "keyword" { "values" { "1" = "foo" } } }
let list_test = "test_ace = val1,val2,val3 # a comment\n"
Probably not useful, up2date throws “bar” away
let list_two = "keyword=foo;bar " test Up2date.lns get list_two = { "1" = "keyword" { "values" { "1" = "foo" } { "2" = "bar" } } }
let list_two_trailing = "keyword=foo;bar; " test Up2date.lns get list_two_trailing = { "1" = "keyword" { "values" { "1" = "foo" } { "2" = "bar" } } }
The disk_config lens
let lns = (disk_config|comment|empty)*
let lns_ace = IniFile.lns record_ace comment_ace
let lns_acf = IniFile.lns_noempty record_acf comment_acf
let lns_ade = IniFile.lns record_ade comment_ade
let lns_adf = IniFile.lns_noempty record_adf comment_adf
let lns_bce = IniFile.lns record_bce comment_bce
let lns_bcf = IniFile.lns_noempty record_bce comment_bcf
let lns_bde = IniFile.lns record_bde comment_bde
let lns_bdf = IniFile.lns_noempty record_bdf comment_bdf
Matches a hostname, that is labels speparated by dots, labels can’t start or end with a “-”.
let loghost_r = /[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*/
let lvmoption =
let meta_release = "# default location for the meta-release file [METARELEASE] URI = http://changelogs.ubuntu.com/meta-release URI_LTS = http://changelogs.ubuntu.com/meta-release-lts URI_UNSTABLE_POSTFIX = -development URI_PROPOSED_POSTFIX = -proposed "
Counting options
let mount_option = [ seq "mount_option" . store /[^,= \t\n]+/ . mount_option_value? ]
let mount_option_value = [ label "value" . Util.del_str "=" . store /[^,= \t\n]+/ ]
An array of mount_options
let mount_options = [ label "mount_options" . counter "mount_option" . Build.opt_list mount_option Sep.comma ]
let mountpoint_kw = "-" (* do not mount *) | "swap" (* swap space *)
let multi = "[Unit] After=syslog.target network.target Also=canberra-system-shutdown.service canberra-system-shutdown-reboot.service Before=sysinit.target shutdown.target CapabilityBoundingSet=CAP_SYS_ADMIN CAP_SETUID CAP_SETGID Conflicts=emergency.service emergency.target ControlGroup=%R/user/%I/shared cpu:/ ListenNetlink=kobject-uevent 1 Requires=shutdown.target umount.target final.target Sockets=udev-control.socket udev-kernel.socket WantedBy=halt.target poweroff.target Wants=local-fs.target swap.target Wants=local-fs.target \ swap.target Wants=local-fs.target\ swap.target Wants= local-fs.target "
let multiline_ace = IniFile.entry_multiline IniFile.entry_re sep_ace comment_ace
let multiline_test = "test_ace = val1\n val2\n val3\n"
let name = /([^ \t\n#:|@]+|"[^"|\n]*")/ (* " make emacs calm down *)
let name = /[^@%# \t\n][^ \t\n]*/
LVM volume group name
let name = [ label "name" . store /[^\/ \t\n]+/ ]
Anything but a space, a comma or a comment sign
let neg1 = /[^,# \n\t]+/
A string with no spaces
let no_spaces = /[^ \t\n]+/
Don’t have to have whitespace after a comma
let nocomma = "alias: target1,target2\n"
let num = /[0-9*][0-9\/,*-]*/
A relative decimal number, optionally with unit
let number_re = Rx.reldecimal . /[kMG]?B|[m]?s|min|h|d/?
deletes an optional # sign
let opt_hash = del /#?/ ""
deletes an optional + sign
let opt_plus = del /\+?/ ""
An optional space or tab
let opt_space = /[ \t]*/
Deletes a Rx.opt_space and default to an empty string
let opt_space = del Rx.opt_space ""
Deletes a Rx.opt_space and default to a tab
let opt_tab = del Rx.opt_space "\t"
let option =
Since either an option or a shell command can be given, use an explicit list of known options to avoid misinterpreting a command as an option
let option_kw = "severity" | "spawn" | "twist" | "keepalive" | "linger" | "rfc931" | "banners" | "nice" | "setenv" | "umask" | "user" | /allow/i | /deny/i
let options = "# Example options no-pty ssh-dsa AAAA no-pty,command=\"foo\" ssh-dsa AAAA no-pty,command=\"foo bar\" ssh-dsa AAAA no-pty,from=\"example.com,10.1.1.0/16\" ssh-dsa AAAA no-pty,environment=\"LANG=en_GB.UTF8\" ssh-dsa AAAA "
let optval = /[A-Za-z0-9_.:-]+/
An optional partition number for disk
let partition = [ label "partition" . Util.del_str "." . store /[0-9]+/ ]
The valid values for period_name.
let period_name_re = "monthly"
Deletes a pipe and default to it
let pipe = Util.del_str "|"
Deletes a plus and default to it
let plus = Util.del_str "+"
let qpidc = "# Configuration file for the qpid c++ client library. Entries are of # the form: # name=value ssl-cert-db=/root/certs/server_db ssl-port=5674 "
let qpidd = "# Configuration file for qpidd. Entries are of the form: # name=value # (Note: no spaces on either side of '='). Using default settings: # \"qpidd --help\" or \"man qpidd\" for more details. cluster-mechanism=ANONYMOUS auth=no max-connections=22000 syslog-name=qpidd1 "
A quote, either double or single, default to double
let quote = del /["']/ "\""
An optional quote, either double or single, default to double
let quote_opt = del /["']?/ "\""
An optional quote, either double or single, default to nothing
let quote_opt_nil = del /["']?/ ""
let quoted_string_val = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\""