A decimal value (using ‘,’ or ‘.’
let decimal = /[0-9]+([.,][0-9]+)?/
A full configuration
let default_approx = "# The following are the defaults, so there is no need # to uncomment them unless you want a different value. # See approx.conf(5) for details. $interface any $port 9999 $interval 720 $max_wait 10 $max_rate unlimited $debug false # Here are some examples of remote repository mappings. # See http://www.debian.org/mirror/list for mirror sites. debian http://ftp.nl.debian.org/debian debian-volatile http://ftp.nl.debian.org/debian-volatile security http://security.debian.org "
let default_sysctl = "# Kernel sysctl configuration file # Controls IP packet forwarding net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = \t0 kernel.sysrq = 0 ; Semicolon comments are also allowed net.ipv4.tcp_mem = \t393216 524288 786432 "
Delete optional whitespace
let del_opt_ws = del /[ \t]*/
Delete a string and default to it
let del_str (s:string) = del s s
Delete mandatory whitespace
let del_ws = del /[ \t]+/
Delete mandatory whitespace, default to single space
let del_ws_spc = del_ws " "
Delete mandatory whitespace, default to single tab
let del_ws_tab = del_ws "\t"
let desc = "[Unit] Description=RPC Description=RPC bind service Description=RPC bind\\ service Description= Resets System Activity Logs "
let device = [ label "device" . store Rx.fspath ]
A Linux device name like eth0 or i2c-0.
let device_name = /[a-zA-Z0-9_?.+:!-]+/
let disk = [ label "disk" . store /[^., \t\n]+/ . partition? ]
let disk_config = let other_label = Rx.fspath - "lvm" - "raid" - "end" - /disk[0-9]+/ - "cryptsetup" - "tmpfs" in disk_config_entry "lvm" lvmoption volume_lvm | disk_config_entry "raid" raidoption volume_raid | disk_config_entry "tmpfs" option volume_tmpfs | disk_config_entry "end" option volume (* there shouldn't be an option here *) | disk_config_entry /disk[0-9]+/ option volume | disk_config_entry "cryptsetup" cryptoption volume_cryptsetup | disk_config_entry other_label option volume
let disk_config_entry (kw:regexp) (opt:lens) (vol:lens) = [ key "disk_config" . space . store kw . (space . opt)* . eol . (volume_or_comment vol)? ]
A list of disk_with_opts
let disk_list = Build.opt_list disk_with_opt Sep.comma
A disk with a spare/missing option for raids
let disk_with_opt = [ label "disk" . store /[^:., \t\n]+/ . partition? . spare_missing* ]
Delete end of line with optional carriage return, including optional trailing whitespace
let doseol = del /[ \t]*\r?\n/ "\n"
Deletes a dot and default to it
let dot = Util.del_str "."
The regexp to store when value is optionally double-quoted
let double_opt_re = /[^\n\t "]([^\n"]*[^\n\t "])?/
A double quote
let dquote = Util.del_str "\""
An optional double quote, default to double
let dquote_opt = del /"?/ "\""
An optional double quote, default to nothing
let dquote_opt_nil = del /"?/ ""
To be refined
let email_addr = /[A-Za-z0-9_+.-]+@[A-Za-z0-9_.-]+/
let empty = Util.empty
let empty = Util.empty
let empty = Util.empty
let empty = Util.empty
let empty = Util.empty
let empty = Util.empty
let empty = "keyword= " test Up2date.lns get empty = { "1" = "keyword" }
let empty = Util.empty
let empty_generic_re = /[ \t]*#?[ \t]*/
let empty1 = "<a/>"
let empty2 = "<a foo=\"bar\"/>"
let empty3 = "<a foo=\"bar\"></a>\n"
let empty4 = "<a foo=\"bar\" far=\"baz\"/>"
encrypt tag
let encrypt = tag "encrypt"
This is a list of all patterns which have specific handlers, and should therefore not be matched by the generic handler
let entries_re = /([oO]ption|[sS]creen|[iI]nput[dD]evice|[dD]river|[sS]ub[sS]ection|[dD]isplay|[iI]dentifier|[vV]ideo[rR]am|[dD]efault[dD]epth|[dD]evice)/
let entry_ace = IniFile.entry IniFile.entry_re sep_ace comment_ace
let entry_acf = IniFile.entry IniFile.entry_re sep_acf comment_acf
let entry_ade = IniFile.entry IniFile.entry_re sep_ade comment_ade
let entry_adf = IniFile.entry IniFile.entry_re sep_adf comment_adf
let entry_bce = IniFile.entry IniFile.entry_re sep_bce comment_bce
let entry_bcf = IniFile.entry IniFile.entry_re sep_bcf comment_bcf
let entry_bde = IniFile.entry IniFile.entry_re sep_bde comment_bde
let entry_bdf = IniFile.entry IniFile.entry_re sep_bdf comment_bdf
let entry_command_kw = /Exec[A-Za-z][A-Za-z0-9._-]+/
let entry_env_kw = "Environment"
let entry_multi_kw = /[A-Za-z][A-Za-z0-9._-]+/ - entry_single_kw - entry_command_kw - entry_env_kw
let entry_prefix = /-/
Regexp for possible entry keyword (path, allow, deny)
let entry_re = /path|allow|deny/
Default regexp for entry keyword
let entry_re = ( /[A-Za-z][A-Za-z0-9._-]+/ )
let entry_re = /[A-Za-z][A-Za-z0-9._\(\) \t-]+/
let entry_single_kw = "Description"
let env = "[Service] Environment=LANG=C Environment=LANG=C FOO=BAR Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION= Environment=LANG=C\ FOO=BAR "
let env_key = /[A-Za-z0-9_]+(\[[0-9]+\])?/
let eol = Util.eol
An Util.eol
let eol = Util.eol
let eol = Util.eol
let eol = Util.eol
let eol = Util.eol
End of line, inherited from Util.eol
let eol = Util.eol
let eol = del /[ \t]*(#)?[ \t]*\n/ "\n"
let eol = Util.eol
let eol = Util.eol
Delete end of line, including optional trailing whitespace
let eol = del /[ \t]*\n/ "\n"
let eol = Util.eol
let equal = del /[ \t]*=[ \t]*/ " = "
let equal = Util.del_str "="
let exec = "[Service] ExecStart=/bin/ls ExecReload=/bin/kill -USR1 $MAINPID ExecStart=/sbin/rpcbind -w ExecStartPost=/bin/systemctl disable firstboot-graphical.service firstboot-text.service ExecStartPre=/sbin/modprobe -qa $SUPPORTED_DRIVERS ExecStop=/usr/sbin/aiccu stop ExecStopPost=-/bin/systemctl poweroff ExecStopPost=@/bin/systemctl poweroff ExecStopPost=-@/bin/systemctl poweroff ExecStopPost=/bin/systemctl\ poweroff "
A full configuration file
let file = "# # Aliases in this file will NOT be expanded in the header from # Mail, but WILL be visible over networks or from /bin/mail. # Basic system aliases -- these MUST be present. mailer-daemon: postmaster postmaster: root # General redirections for pseudo accounts. bin: root , adm, bob daemon: root adm: root file: /var/foo pipe1: |/bin/ls pipe2 : |\"/usr/bin/ls args,\" "
a file begins with a / and get almost anything else after
let file_r = /\/[^ \t\n]+/
let filesystem = [ label "filesystem" . store filesystem_kw ]
Regexps for filesystem
let filesystem_kw = "-" | "swap"
let filters = "<Chain \"PreCache\"> <Rule \"no_fqdn\"> <Match \"regex\"> Host \"^[^\.]*$\" Invert false </Match> Target \"stop\" </Rule> </Chain> "
let fs_option = [ key /createopts|tuneopts/ . Util.del_str "=\"" . store /[^"\n]*/ . Util.del_str "\"" ]
An array of fs_options
let fs_options =
let fspath = Rx.fspath
A filesystem path
let fspath = /[^ \t\n]+/
let full = "path ~ ^/file_(metadata|content)/user_files/ # Set environments environment production, development environment foo method find, search auth yes method save allow /^(.+\.)?example.com$/ allow_ip 192.168.100.0/24 # Added in Puppet 3.0.0 # This overrides the previous auth authenticated any "