let map_line = [ command "map" "\t" . spc . [ label "from" . store /[()A-za-z0-9]+/ ] . spc . [ label "to" . store /[()A-za-z0-9]+/ ] . eol ]
let menu_setting = kw_menu_arg "default" | kw_menu_arg "fallback" | kw_pres "hiddenmenu" | kw_menu_arg "timeout" | kw_menu_arg "splashimage" | kw_menu_arg "gfxmenu" | kw_menu_arg "background" | serial | terminal | password_arg | color | device
can contain an option
let method = [ label "method" . store Rx.word . ( Sep.tab . option )? ]
let minute = [ label "minute" . store num ]
Individual moddir search path entry
let modpath = [ seq "modpath" . store /[^ :\t\n]+/ ]
Solaris extension adds module$ and kernel$ for variable interpolation
let module_line = [ command /module\$?/ "\t" . spc . kernel_args ]
let month = [ label "month" . store alphanum ]
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 *)
Permits a second form for Solaris multiboot kernels that take a path (with a slash) as their first arg, e.g.
let multiboot_arg = [ label "@path" . store (Rx.word . "/" . Rx.no_spaces) ]
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]+/ ]
Regex for entry names
let name_re = /[A-Za-z][A-Za-z-]*/
Regex for entry names with colons
let name_re_colons = /[A-Za-z][A-Za-z:-]*/
A block with a block title and name
let named_block (kw:string) (sto:lens) = lens_block (key kw . sep_spc . sto_word) sto
A block with a block title, a name and an argument
let named_block_arg (kw:string) (name:string) (arg:string) (sto:lens) = lens_block (named_block_arg_title kw name arg) sto
A title lens for named_block_arg
let named_block_arg_title (kw:string) (name:string) (arg:string) = key kw . sep_spc . [ label name . sto_word ] . sep_spc . [ label arg . sto_word ]
A nameserver entry
let nameserver = Build.key_value_line_comment "nameserver" Sep.space (store Rx.ip) comment_eol
Anything but a space, a comma or a comment sign
let neg1 = /[^,# \n\t]+/
Negation of boolean values for defaults.
let negate_node = [ del "!" "!" . label "negate" ]
Format is @NETGROUP[@@NISDOMAIN]
let netgroup = [ label "netgroup" . Util.del_str "@" . store user_re . [ label "nisdomain" . Util.del_str "@@" . store Rx.word ]? ]
A network mask for IP addresses
let netmask = [ label "netmask" . Util.del_str "/" . store Rx.ip ]
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"
test Xml.notation_def get "<!NOTATION not3 SYSTEM \"\">" = { "!NOTATION" = "not3" { "SYSTEM" = "" } }
let num = /[0-9*][0-9\/,*-]*/
let opt_eol = del /[ \t]*\n?/ " "
deletes an optional # sign
let opt_hash = del /#?/ ""
Same as list, but there might be only one element in the list
let opt_list (lns:lens) (sep:lens) = lns . ( sep . lns )*
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 opt_ws = Util.del_opt_ws ""
let option =
part of method
let option = [ label "option" . store word ]
let option = [ indent . del /[oO]ption/ "Option" . label "Option" . sep_spc . quoted_string_val . [ label "value" . sep_spc . quoted_string_val ]* . eol ]
let options = let opt_value = /[^#" \t\n\\\\]+|"[^#"\n\\\\]*"/ in let option = [ key Rx.word . (Util.del_str "=" . store opt_value)? ] in [ key "options" . sep_space . sto_no_spaces . (sep_space . option)* . Util.comment_or_eol ]
Options values
let options = let options_entry = Build.key_value ("ndots"|"timeout"|"attempts") (Util.del_str ":") (store Rx.integer) | Build.flag ("debug"|"rotate"|"no-check-names" |"inet6"|"ip6-bytestring"|"edns0") | ip6_dotint in Build.key_value_line_comment "options" Sep.space (Build.opt_list options_entry Sep.space) comment_eol
let optval = /[A-Za-z0-9_.:-]+/
origin_list can be a single ipaddr/originname/domain/fqdn or a list of those values
let origin_list = let origin_re = Rx.no_spaces - /[Ee][Xx][Cc][Ee][Pp][Tt]/ in Build.opt_list [ label "origin" . store origin_re ] Sep.space
Params can have sub params
let param = [ Util.indent . param_def . [ Sep.space . param_def ]* . Util.eol ]
define a field
let param_def = key /[A-Za-z0-9_]+/ . Sep.opt_space . Sep.equal . Sep.opt_space . store Rx.no_spaces
A single parameter for defaults
let parameter = parameter_flag | parameter_integer | parameter_string | parameter_lists
A flag parameter for defaults
let parameter_flag_kw = "always_set_home" | "authenticate" | "env_editor" | "env_reset" | "fqdn" | "ignore_dot" | "ignore_local_sudoers" | "insults" | "log_host" | "log_year" | "long_otp_prompt" | "mail_always" | "mail_badpass" | "mail_no_host" | "mail_no_perms" | "mail_no_user" | "noexec" | "path_info" | "passprompt_override" | "preserve_groups" | "requiretty" | "root_sudo" | "rootpw" | "runaspw" | "set_home" | "set_logname" | "setenv" | "shell_noargs" | "stay_setuid" | "targetpw" | "tty_tickets" | "visiblepw" | "closefrom_override" | "closefrom_override" | "compress_io" | "fast_glob" | "log_input" | "log_output" | "pwfeedback" | "umask_override" | "use_pty"
An integer parameter for defaults
let parameter_integer_nobool_kw = "passwd_tries"
A list of comma-separated parameters for defaults
let parameter_list = parameter . ( sep_com . parameter )*
A single list parameter for defaults
let parameter_lists_kw = "env_check" | "env_delete" | "env_keep"
A string parameter for defaults
let parameter_string_nobool_kw = "badpass_message" | "editor" | "mailsub" | "noexec_file" | "passprompt" | "runas_default" | "syslog_badpri" | "syslog_goodpri" | "timestampdir" | "timestampowner" | "secure_path"
An optional partition number for disk
let partition = [ label "partition" . Util.del_str "." . store /[0-9]+/ ]
let password_arg = [ key "password" . (spc . [ switch "md5" ])? . spc . store (/[^ \t\n]+/ - "--md5") . (spc . [ label "file" . store /[^ \t\n]+/ ])? . eol ]
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 port = [ label "port" . store num_re ]
A prefix for IP addresses
let prefixlen = [ label "prefixlen" . Util.del_str "/" . sto_num ]
a program begins with an optional hash, a bang, and an optional + or -
let program = [ label "program" . opt_hash . bang . ( opt_plus | [ Build.xchgs "-" "reverse" ] ) . programs . eol . entries ]
a list of programs
let programs = label_opt_list_or "program" (store word) comma "*"
The XML prolog tag is mapped in a “#declaration” node, which contains an “#attribute” node with various attributes of the tag.
test Xml.prolog get "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" = { "#declaration" { "#attribute" { "version" = "1.0" } { "encoding" = "UTF-8" } } }
let protocol = [ label "protocol" . store protocol_re ]
let quoted_string_val = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\""