D | |
decimal | |
default_approx, Test_Approx | |
default_sysctl, Test_Sysctl | |
del_opt_ws, Util | |
del_str, Util | |
del_ws, Util | |
del_ws_spc, Util | |
del_ws_tab, Util | |
desc, Test_Systemd | |
device, FAI_DiskConfig | |
device_name, Rx | |
disk, FAI_DiskConfig | |
disk_config, FAI_DiskConfig | |
disk_config_entry, FAI_DiskConfig | |
disk_list, FAI_DiskConfig | |
disk_with_opt, FAI_DiskConfig | |
doseol, Util | |
dot, Syslog | |
double_opt_re, Quote | |
dquote, Quote | |
dquote_opt, Quote | |
dquote_opt_nil, Quote | |
E | |
email_addr | |
empty | |
empty_c_style_re, Util | |
empty_generic_re, Util | |
empty1, Test_Xml | |
empty2, Test_Xml | |
empty3, Test_Xml | |
empty4, Test_Xml | |
encrypt, FAI_DiskConfig | |
entries_re, Xorg | |
entry_ace, Test_IniFile | |
entry_acf, Test_IniFile | |
entry_ade, Test_IniFile | |
entry_adf, Test_IniFile | |
entry_bce, Test_IniFile | |
entry_bcf, Test_IniFile | |
entry_bde, Test_IniFile | |
entry_bdf, Test_IniFile | |
entry_command_kw, Systemd | |
entry_env_kw, Systemd | |
entry_multi_kw, Systemd | |
entry_prefix, Cron | |
entry_re | |
entry_single_kw, Systemd | |
env, Test_Systemd | |
env_key, Systemd | |
eol | |
equal | |
example | |
exclamation_mark, Test_Tmpfiles | |
exclamation_mark_tree, Test_Tmpfiles | |
exec, Test_Systemd |
let decimal = Rx.reldecimal
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 excludes = "lvm" | "raid" | "end" | /disk[0-9]+/ | "cryptsetup" | "tmpfs" in let other_label = Rx.fspath - excludes 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 /"?/ ""
let email_addr = Rx.email_addr
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
Empty example
let empty = "\n\n\n"
let empty = "keyword= " test Up2date.lns get empty = { "1" = "keyword" }
let empty = Util.empty
let empty_c_style_re = /[ \t]*((\/\/)|(\/\*[ \t]*\*\/))?[ \t]*/
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 = let forbidden = entry_single_kw | entry_command_kw | entry_env_kw in /[A-Za-z][A-Za-z0-9._-]+/ - forbidden
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 Environment=\"LANG=foo bar\" FOO=BAR Environment=OPTIONS=\"-LS0-6d\" Environment=OPTIONS='-LS0-6d' "
let env_key = /[A-Za-z0-9_]+(\[[0-9]+\])?/
let eol = IniFile.eol
An Util.eol
let eol = 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.doseol
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 "="
The example from https://github.com/mojombo/toml
let example = "# This is a TOML document. Boom. title = \"TOML Example\" [owner] name = \"Tom Preston-Werner\" organization = \"GitHub\" bio = \"GitHub Cofounder & CEO\nLikes tater tots and beer.\" dob = 1979-05-27T07:32:00Z # First class dates? Why not? [database] server = \"192.168.1.1\" ports = [ 8001, 8001, 8002 ] connection_max = 5000 enabled = true [servers] # You can indent as you please. Tabs or spaces. TOML don't care. [servers.alpha] ip = \"10.0.0.1\" dc = \"eqdc10\" [servers.beta] ip = \"10.0.0.2\" dc = \"eqdc10\" country = \"ä¸å½\" # This should be parsed as UTF-8 [clients] data = [ [\"gamma\", \"delta\"], [1, 2] ] # just an update to make sure parsers support it # Line breaks are OK when inside arrays hosts = [ \"alpha\", \"omega\" ] # Products [[products]] name = \"Hammer\" sku = 738594937 [[products]] name = \"Nail\" sku = 284758393 color = \"gray\" " test Toml.lns get example = { "#comment" = "This is a TOML document. Boom." } { } { "entry" = "title" { "string" = "TOML Example" } } { } { "table" = "owner" { "entry" = "name" { "string" = "Tom Preston-Werner" } } { "entry" = "organization" { "string" = "GitHub" } } { "entry" = "bio" { "string" = "GitHub Cofounder & CEO Likes tater tots and beer." } } { "entry" = "dob" { "datetime" = "1979-05-27T07:32:00Z" } { "#comment" = "First class dates? Why not?" } } { } } { "table" = "database" { "entry" = "server" { "string" = "192.168.1.1" } } { "entry" = "ports" { "array" { } { "integer" = "8001" } { } { "integer" = "8001" } { } { "integer" = "8002" } { } } } { "entry" = "connection_max" { "integer" = "5000" } } { "entry" = "enabled" { "bool" = "true" } } { } } { "table" = "servers" { } { "#comment" = "You can indent as you please. Tabs or spaces. TOML don't care." } } { "table" = "servers.alpha" { "entry" = "ip" { "string" = "10.0.0.1" } } { "entry" = "dc" { "string" = "eqdc10" } } { } } { "table" = "servers.beta" { "entry" = "ip" { "string" = "10.0.0.2" } } { "entry" = "dc" { "string" = "eqdc10" } } { "entry" = "country" { "string" = "ä¸å½" } { "#comment" = "This should be parsed as UTF-8" } } { } } { "table" = "clients" { "entry" = "data" { "array" { } { "array" { "string" = "gamma" } { } { "string" = "delta" } } { } { "array" { "integer" = "1" } { } { "integer" = "2" } } { } } { "#comment" = "just an update to make sure parsers support it" } } { } { "#comment" = "Line breaks are OK when inside arrays" } { "entry" = "hosts" { "array" { } { "string" = "alpha" } { } { "string" = "omega" } { } } } { } { "#comment" = "Products" } { } } { "@table" = "products" { "entry" = "name" { "string" = "Hammer" } } { "entry" = "sku" { "integer" = "738594937" } } { } } { "@table" = "products" { "entry" = "name" { "string" = "Nail" } } { "entry" = "sku" { "integer" = "284758393" } } { "entry" = "color" { "string" = "gray" } } }
Example with an exclamation mark in the type
let exclamation_mark = "D! /tmp/foo - - - - -\n"
Tree for exclamation_mark
let exclamation_mark_tree = { "1" { "type" = "D!" } { "path" = "/tmp/foo" } { "mode" = "-" } { "uid" = "-" } { "gid" = "-" } { "age" = "-" } { "argument" = "-" } }
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 "