T | |
tab, Sep | |
tag, FAI_DiskConfig | |
target, Crypttab | |
tcp_check, Test_Keepalived | |
the valid values for schedules, Cron | |
title_ace, Test_IniFile | |
title_acf, Test_IniFile | |
title_ade, Test_IniFile | |
title_adf, Test_IniFile | |
title_bce, Test_IniFile | |
title_bcf, Test_IniFile | |
title_bde, Test_IniFile | |
title_bdf, Test_IniFile | |
to_com_chars, Sudoers | |
to_com_dquot, Sudoers | |
to_comment_re | |
to_eol, Xorg | |
token, Syslog | |
trailing_ws, Test_Tmpfiles | |
type_label_lv, FAI_DiskConfig | |
U | |
ul1, Test_Xml | |
unit, Test_Systemd | |
user_record, cgrules | |
V | |
valid_age, Test_Tmpfiles | |
valid_age_tree, Test_Tmpfiles | |
valid_base, Test_Tmpfiles | |
valid_base_tree, Test_Tmpfiles | |
valid_days, Test_Tmpfiles | |
valid_days_tree, Test_Tmpfiles | |
valid_second, Test_Tmpfiles | |
valid_second_tree, Test_Tmpfiles | |
valid_short_args, Test_Tmpfiles | |
valid_short_args_tree, Test_Tmpfiles | |
value, Dovecot | |
value_cmd_re, Systemd | |
value_re | |
value_sep, Systemd | |
value_single_re, Systemd | |
vg_option, FAI_DiskConfig | |
volume_cryptsetup, FAI_DiskConfig | |
volume_full, FAI_DiskConfig | |
volume_lvm, FAI_DiskConfig | |
volume_or_comment, FAI_DiskConfig | |
volume_raid, FAI_DiskConfig | |
volume_tmpfs, FAI_DiskConfig | |
volume_vg, FAI_DiskConfig | |
W | |
with_spaces, Test_FAI_DiskConfig | |
word | |
word_opt_quot_re, Postgresql | |
word_slash, Keepalived | |
ws, cgrules | |
ws_sep, Hosts_Access |
Deletes a Rx.space and default to a tab
let tab = del Rx.space "\t"
A generic tag beginning with a colon
let tag (re:regexp) = [ Util.del_str ":" . key re ]
let target = Rx.device_name
An example of a TCP health checker
let tcp_check = "virtual_server 192.168.1.11 22 { real_server 10.20.40.10 22 { TCP_CHECK { connect_timeout 3 connect_port 22 bindto 192.168.1.1 } } } " test Keepalived.lns get tcp_check = { "virtual_server" { "ip" = "192.168.1.11" } { "port" = "22" } { "real_server" { "ip" = "10.20.40.10" } { "port" = "22" } { "TCP_CHECK" { "connect_timeout" = "3" } { "connect_port" = "22" } { "bindto" = "192.168.1.1" } } } }
let title_ace = IniFile.title IniFile.record_re
let title_acf = IniFile.title IniFile.record_re
let title_ade = IniFile.title IniFile.record_re
let title_adf = IniFile.title IniFile.record_re
let title_bce = IniFile.title IniFile.record_re
let title_bcf = IniFile.title IniFile.record_re
let title_bde = IniFile.title IniFile.record_re
let title_bdf = IniFile.title IniFile.record_re
let to_com_chars = /[^",=#() \t\n\\]+/ (* " relax emacs *)
let to_com_dquot = /"[^",=#()\n\\]+"/ (* " relax emacs *)
Regex until comment
let to_comment_re = /[^";# \t\n][^";#\n]*[^";# \t\n]|[^";# \t\n]/
The regexp to match the value
let to_comment_re = let to_comment_squote = /'[^\n']*'/ in let to_comment_dquote = /"[^\n"]*"/ in let to_comment_noquote = /[^\n \t'"#][^\n#]*[^\n \t#]|[^\n \t'"#]/ in to_comment_squote | to_comment_dquote | to_comment_noquote
Match everything from here to eol, cropping whitespace at both ends
let to_eol = /[^ \t\n](.*[^ \t\n])?/
alphanum or “*”
let token = /([A-Za-z0-9]+|\*)/
The complex example with extra spaces
let trailing_ws = " #Type Path Mode UID GID Age Argument \n d /run/user 0755 root root 10d - \t\n L /tmp/foobar - - - - /dev/null\t\n"
let type_label_lv = label "lv" . [ label "vg" . store (/[^# \t\n-]+/ - "raw") ] . Util.del_str "-" . [ label "name" . store /[^ \t\n]+/ ]
let ul1 = " <ul> <li>test1</li> <li>test2</li> <li>test3</li> <li>test4</li> </ul> " test Xml.doc get ul1 = { "ul" { "#text" = " " } { "li" { "#text" = "test1" } } { "#text" = " " } { "li" { "#text" = "test2" } } { "#text" = " " } { "li" { "#text" = "test3" } } { "#text" = " " } { "li" { "#text" = "test4" } } }
let unit = "# This file is part of systemd. # # See systemd.special(7) for details .include /etc/example [Unit] Description=Locale Service # Add another file .include /etc/example [Service] ExecStart=/lib/systemd/systemd-localed Type=dbus BusName=org.freedesktop.locale1 CapabilityBoundingSet= "
let user_record = generic_record "user" (store name)
Example with a complex age.
let valid_age = "v /var/tmp/js 4221 johnsmith - ~10d12h\n"
Tree for valid_age
let valid_age_tree = { "1" { "type" = "v" } { "path" = "/var/tmp/js" } { "mode" = "4221" } { "uid" = "johnsmith" } { "gid" = "-" } { "age" = "~10d12h" } }
A valid test to be re-used by the failure cases
let valid_base = "H /var/tmp/js 0000 jonhsmith 60 1s foo\n"
Tree for valid_base
let valid_base_tree = { "1" { "type" = "H" } { "path" = "/var/tmp/js" } { "mode" = "0000" } { "uid" = "jonhsmith" } { "gid" = "60" } { "age" = "1s" } { "argument" = "foo" } }
Example with full age unit (plural)
let valid_days = "x /var/tmp/manu - jonhsmith - 9days\n"
Tree for valid_days
let valid_days_tree = { "1" { "type" = "x" } { "path" = "/var/tmp/manu" } { "mode" = "-" } { "uid" = "jonhsmith" } { "gid" = "-" } { "age" = "9days" } }
Example with full age unit
let valid_second = "p+ /var/tmp - jsmith - 0second\n"
Tree for valid_second
let valid_second_tree = { "1" { "type" = "p+" } { "path" = "/var/tmp" } { "mode" = "-" } { "uid" = "jsmith" } { "gid" = "-" } { "age" = "0second" } }
A short argument value example.
let valid_short_args = "h /var/log/journal - - - - C\nh /var/log/journal - - - - +C\n"
Tree for valid_short_args
let valid_short_args_tree = { "1" { "type" = "h" } { "path" = "/var/log/journal" } { "mode" = "-" } { "uid" = "-" } { "gid" = "-" } { "age" = "-" } { "argument" = "C" } } { "2" { "type" = "h" } { "path" = "/var/log/journal" } { "mode" = "-" } { "uid" = "-" } { "gid" = "-" } { "age" = "-" } { "argument" = "+C" } }
Match any value after “ =”.
let value = any . (Rx.space . any)*
let value_cmd_re = /[^#@ \t\n\\-][^#@ \t\n\\-][^# \t\n\\]*/
let value_re = /[^ \t\n](.*[^ \t\n])?/
let value_re = /[^ \t\n;][^\n;]*[^ \t\n;]|[^ \t\n;]/
Multi-value entries separated by whitespace or backslash and newline
let value_sep = del /[ \t]+|[ \t]*\\\\[ \t]*\n[ \t]*/ " "
let value_single_re = /[^# \t\n\\][^#\n\\]*[^# \t\n\\]|[^# \t\n\\]/
An option for volume_vg
let vg_option = [ key "pvcreateopts" . Util.del_str "=\"" . store /[^"\n]*/ . Util.del_str "\"" ]
let volume_cryptsetup = volume_full (key ("swap"|"tmp"|"luks")) device
let volume_full (type:lens) (third_field:lens) =
let volume_lvm = volume_full type_label_lv size (* lvm logical volume: vg name and lv name *) | volume_vg
A succesion of volumes and comments
let volume_or_comment (vol:lens) = (vol|empty|comment)* . vol
let volume_raid = volume_full (key /raid[0156]/) disk_list (* raid level *)
let volume_tmpfs = [ key "tmpfs" . space . mountpoint .space . size . space . mount_options . (space . fs_options)? . eol ]
let volume_vg = [ key "vg" . space . name . space . disk . (space . vg_option)? . eol ]
let with_spaces = "disk_config disk2 raw-disk - 0 - - "
let word = /[^|", \t\n]+/
let word = Rx.word
let word = Rx.word
let word = Rx.word
let word = /[A-Za-z0-9_.:-]+/
An alphanumeric string
let word = /[A-Za-z0-9_.-]+/
our version can’t start with [_.-] because it would mess up the grammar
let word = /[A-Za-z0-9][A-Za-z0-9_.-]*/
Strings that don’t require quotes
let word_opt_quot_re = /[A-Za-z][A-Za-z0-9_]*/
let word_slash = word | "/"
let ws = del /[ \t]+/ " "
let ws_sep = / +/