Deletes a Rx.space and default to a tab
let tab = del Rx.space "\t"
A table or array of tables
let table = table_gen "table" "[" "]" | table_gen "@table" "[[" "]]"
A generic table
let table_gen (name:string) (lbrack:string) (rbrack:string) = let title = Util.indent . label name . Util.del_str lbrack . store /[^]\r\n.]+(\.[^]\r\n.]+)*/ . Util.del_str rbrack . eol in [ title . (entry|empty|comment)* ]
A generic tag beginning with a colon
let tag (re:regexp) = [ Util.del_str ":" . key re ]
Tag specification for spec
let tag_spec = [ label "tag" . store /(NO)?(PASSWD|EXEC|SETENV)/ . sep_col ]
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 tcp_check_field = let word_re = "bindto" in let num_re = /connect_(timeout|port)/ in field word_re sto_word | field num_re sto_num
let tcp_listen_options = let value = Erlang.make_value Erlang.bare | Erlang.tuple Erlang.bare Erlang.bare in Erlang.list "tcp_listen_options" value
tempcomp has specific syntax
let tempcomp = [ Util.indent . key "tempcomp" . space . [ label "sensorfile" . store path ] . space . [ label "interval" . store number ] . space . ( [ label "t0" . store number ] . space . [ label "k0" . store number ] . space . [ label "k1" . store number ] . space . [ label "k2" . store number ] | [ label "pointfile" . store path ] ) . eol ]
let terminal = [ command "terminal" "" . ([ spc . switch /dumb|no-echo|no-edit|silent/ ] |[ spc . switch_arg /timeout|lines/ ])* . [ spc . key /console|serial|hercules/ ]* . eol ]
test test_user get "root @pbuilder +secre-taries @my\ admin\ group EXAMPLE\\\\cslack MY\ EX-AMPLE\ 9\\\\cslack\ group " = { "user" = "root" } { "user" = "@pbuilder" } { "user" = "+secre-taries" } { "user" = "@my\\ admin\\ group" } { "user" = "EXAMPLE\\\\cslack" } { "user" = "MY\\ EX-AMPLE\\ 9\\\\cslack\\ group" } let conf = " Host_Alias LOCALNET = 192.168.0.0/24, localhost # User alias specification User_Alias EXAMPLE_ADMINS = cslack, EXAMPLE\\\\cslack,\ EXAMPLE\\\\jmalstrom # Cmnd alias specification Cmnd_Alias \ DEBIAN_TOOLS \ = \ /usr/bin/apt-get,\ /usr/bin/auto-get, \ /usr/bin/dpkg, /usr/bin/dselect, /usr/sbin/dpkg-reconfigure \ : PBUILDER = /usr/sbin/pbuilder Cmnd_Alias ICAL = /bin/cat /home/rpinson/.kde/share/apps/korganizer/std.ics Defaults@LOCALNET !lecture, \ \t\t tty_tickets,!fqdn, !!env_reset Defaults !visiblepw Defaults:buildd env_keep+=\"APT_CONFIG DEBIAN_FRONTEND SHELL\" Defaults!PBUILDER env_keep+=\"HOME ARCH DIST DISTRIBUTION PDEBUILD_PBUILDER\" # User privilege specification root ALL=(ALL) ALL root ALL=(: ALL) ALL root ALL=(ALL :ALL) ALL # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL, NOPASSWD : NOSETENV: \ DEBIAN_TOOLS %pbuilder LOCALNET = NOPASSWD: PBUILDER www-data +biglab=(rpinson)NOEXEC: ICAL \ : \ localhost = NOPASSWD: /usr/bin/
Time in the format “minute hour dayofmonth month dayofweek”
let time = [ label "time" . minute . sep_spc . hour . sep_spc . dayofmonth . sep_spc . month . sep_spc . dayofweek ]
The time filter definition
let time = kw_word "TIME"
Uses standard INI File title
let title = IniFile.indented_title IniFile.record_re
let title = IniFile.title Rx.word
let title = IniFile.indented_title IniFile.record_re
let title = del /title[ \t=]+/ "title " . value_to_eol . eol
Title for record.
let title (kw:regexp) = Util.del_str "[" . key kw . Util.del_str "]". eol
let title = IniFile.indented_title IniFile.record_re
An IniFile.title
let title = IniFile.title IniFile.record_re
let title = IniFile.title IniFile.entry_re
An IniFile.title
let title = IniFile.title IniFile.record_re
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
Title for record.
let title_label (name:string) (kw:regexp) = label name . Util.del_str "[" . store kw . Util.del_str "]". eol
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]+|\*)/
let tpid = let tpid_bylang = [ label "tpid_bylang" . store Rx.integer . (equal . langs)? ] in field_int "tpid" . ( semicol . Build.opt_list tpid_bylang comma )?
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 transport = [ label "transport" . (store Rx.word)? ] . colon . nexthop
let trim = let trim_list = Build.opt_list [seq "trim" . store Rx.word] (del /[:;,]/ ":") in Build.key_value_line "trim" Sep.space trim_list
A tuple of values
let tuple (one:lens) (two:lens) = [ rspace lbrace . label "tuple" . [ label "value" . one ] . lrspace comma . [ label "value" . two ] . lspace rbrace ]
A tuple of 3 values
let tuple3 (one:lens) (two:lens) (three:lens) = [ rspace lbrace . label "tuple" . [ label "value" . one ] . lrspace comma . [ label "value" . two ] . lrspace comma . [ label "value" . three ] . lspace rbrace ]
yp, file, dir etc but not ldap
let type = Rx.word - /ldap/
Bits, exponent, and modulus are taken directly from the RSA host key; they can be obtained, for example, from /etc/ssh/ssh_host_key.pub.
let type = [ label "type" . store Rx.neg1 ]
One letter.
let type = /([fFwdDvqQpLcbCxXrRzZtThHaAm]|[AabcLp]\+)!?/
let type_label_lv = label "lv" . [ label "vg" . store (/[^# \t\n-]+/ - "raw") ] . Util.del_str "-" . [ label "name" . store /[^ \t\n]+/ ]