echo [args]
let echo = Build.key_value_line "echo" space (store word)
mailonchange has specific syntax
let email = [ Util.indent . key "mailonchange" . space . [ label "emailaddress" . store email_addr ] . space . [ label "threshold" . store number ] . eol ]
A simple email address entry
let email = [ indent . label "email" . sto_email_addr . comment_or_eol ]
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
An Util.empty
let empty = Util.empty
A C-style empty line
let empty = Util.empty_any
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 = Util.empty
let empty = Util.empty
let empty = Util.empty
Map empty lines.
let empty = Util.empty
let empty = Util.empty
let empty = Util.empty
Comment are not allowed, even empty comments
let empty = Util.empty_generic Rx.opt_space
Empty line
let empty = empty_generic Rx.opt_space comment_re
Map empty lines
let empty = Util.empty
Map empty lines, including empty comments
let empty = [ del /#?[ \t]*\n/ "\n" ]
let empty = IniFile.empty
let empty = Util.empty
let empty = Util.empty
let empty = Util.empty
let empty = Util.empty
let empty = Util.empty
let empty = Util.empty_generic_dos /[ \t]*[#;]?[ \t]*/
Map empty lines, including empty asterisk comments
let empty = [ del /[ \t]*\*?[ \t]*\n/ "\n" ]
An empty line or a non-indented empty comment
let empty = IniFile.empty_noindent
Map empty lines
let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
let empty = Util.empty
Empty example
let empty = "\n\n\n"
let empty = "keyword= " test Up2date.lns get empty = { "1" = "keyword" }
Empty lines
let empty = Util.empty
An empty line
let empty = Util.empty_dos
let empty = Util.empty
Map empty lines, including empty comments
let empty = empty_generic empty_generic_re
let empty = Util.empty
let empty = Util.empty
Either empty or empty_c_style
let empty_any = empty_generic (empty_generic_re | empty_c_style_re)
Map empty lines, including C-style empty comment
let empty_c_style = empty_generic empty_c_style_re
let empty_c_style_re = /[ \t]*((\/\/)|(\/\*[ \t]*\*\/))?[ \t]*/
let empty_dos = empty_generic_dos /[ \t]*#?[ \t]*/
test Xml.empty_element get empty1 = { "a" = "#empty" }
let empty_entry = Build.key_value_line Rx.word Sep.equal Quote.dquote_opt_nil
let empty_entry = Build.key_value_line Rx.word Sep.equal blank_val
Empty line, including empty comments
let empty_generic (indent:regexp) (comment_re:regexp) = Util.empty_generic_dos (indent . comment_re? . Rx.opt_space)
A generic definition of empty Map empty lines, including empty comments
let empty_generic (r:regexp) = [ del r "" . del_str "\n" ]
A generic definition of empty with dos newlines Map empty lines, including empty comments
let empty_generic_dos (r:regexp) = [ del r "" . del /\r?\n/ "\n" ]
let empty_generic_re = /[ \t]*#?[ \t]*/
Empty line, without indentation
let empty_noindent = empty_generic "" comment_re
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"
let entries = Build.key_value_line ("Explanation"|"Package"|"Pin-Priority") colon (store Rx.space_in) | pin | Util.comment
All the combined entries.
let entries = map_entry | base_entry | scope_entry | filter_entry | simple_entry "threads" | simple_entry "uid" | simple_entry "gid" | simple_entry_opt_list_value "uri" spc | simple_entry "ldap_version" | simple_entry "binddn" | simple_entry "bindpw" | simple_entry "rootpwmoddn" | simple_entry "rootpwmodpw" | simple_entry "sasl_mech" | simple_entry "sasl_realm" | simple_entry "sasl_authcid" | simple_entry "sasl_authzid" | simple_entry "sasl_secprops" | simple_entry "sasl_canonicalize" | simple_entry "krb5_ccname" | simple_entry "deref" | simple_entry "referrals" | simple_entry "bind_timelimit" | simple_entry "timelimit" | simple_entry "idle_timelimit" | simple_entry "reconnect_sleeptime" | simple_entry "reconnect_retrytime" | simple_entry "ssl" | simple_entry "tls_reqcert" | simple_entry "tls_cacertdir" | simple_entry "tls_cacertfile" | simple_entry "tls_randfile" | simple_entry "tls_ciphers" | simple_entry "tls_cert" | simple_entry "tls_key" | simple_entry "pagesize" | simple_entry_opt_list_value "nss_initgroups_ignoreusers" comma | simple_entry "nss_min_uid" | simple_entry "nss_nested_groups" | simple_entry "nss_getgrent_skipmembers" | simple_entry "nss_disable_enumeration" | simple_entry "validnames" | simple_entry "ignorecase" | simple_entry "pam_authz_search" | simple_entry_quoted_value "pam_password_prohibit_message" | simple_entry "reconnect_invalidate" | simple_entry "cache" | simple_entry "log" | simple_entry "pam_authc_ppolicy"
entries are either comments/empty lines or entries
let entries = (empty | comment | entry )*
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 = IniFile.indented_entry entry_re sep comment
A valid entry line Definition:
let entry = [ access . colon . user_list . (except user_list)? . colon . origin_list . (except origin_list)? . Util.eol ]
let entry = Build.key_value_line Rx.word Sep.space_equal Quote.any_opt
let entry = [ label "target" . store target . space . [ label "linkname" . store linkname . eol ] ]
An anacrontab entry
let entry = [ label "entry" . Util.indent . ( period | period_name ) . Sep.space . delay . Sep.space . job_identifier . Sep.space . store Rx.space_in . Util.eol ]
let entry = IniFile.entry Rx.word sep comment
An apt.conf entry, recursive
let rec entry_noeol = let value = Util.del_str "\"" . store /[^"\n]+/ . del /";?/ "\";" in let opt_eol = del /[ \t\n]*/ "\n" in let long_eol = del /[ \t]*\n+/ "\n" in let list_elem = [ opt_eol . label "@elem" . value ] in let eol_comment = del /([ \t\n]*\n)?/ "" . comment in [ key name_re . Sep.space . value ] | [ key name_re . del /[ \t\n]*\{/ " {" . ( (opt_eol . entry_noeol) | list_elem | eol_comment )* . del /[ \t\n]*\};?/ "\n};" ] | [ key name_re . Util.del_str "::" . entry_noeol ]
A single map entry from start to finish, including multi-mounts
let entry = [ seq "entry" . entry_mkey . Util.del_ws_tab . entry_options? . ( entry_locations | entry_multimounts ) . Util.eol ]
let entry = IniFile.indented_entry IniFile.entry_re sep comment
let entry = [ label "entry" . store no_semicolon . (semicol . field_no_colon "provider")? . colon . field_int "frequency" . colon . field_word "parameter" . colon . field_word "signal_source" . colon . field_int "symbol_rate" . colon . vpid . colon . apid . colon . tpid . colon . caid . colon . field_int "sid" . colon . field_int "nid" . colon . field_int "tid" . colon . field_int "rid" . eol ]
A crontab entry
let entry = [ label "entry" . indent . prefix? . ( time | schedule ) . sep_spc . user . sep_spc . store Rx.space_in . eol ]
A crontab entry for a user’s crontab
let entry = [ label "entry" . Cron.indent . Cron.prefix? . ( Cron.time | Cron.schedule ) . Cron.sep_spc . store Rx.space_in . Cron.eol ]
An entry of fields, quoted or not
let entry (sep_str:string) = let field = [ seq "field" . store (/[^"#\r\n]/ - sep_str)* ] | [ seq "field" . store /("[^"#]*")+/ ] in let sep = Util.del_str sep_str in [ seq "entry" . counter "field" . Build.opt_list field sep . eol ]
Map simple “key = value” entries including “key =” entries with empty value.
let entry = [ indent . key keys. eq . (Sep.opt_space . store value)? . eol ]
let entry = [ label "bookmark" . store Rx.no_spaces . (Sep.space . [ label "label" . store Rx.space_in ])? . Util.eol ]
let entry = bool ("multi"|"nospoof"|"spoofalert"|"reorder") | bool_warn "spoof" | list "order" "order" | trim
let entry = [ seq "line" . daemon_list . (except daemon_list)? . colon . client_list . (except client_list)? . ( (colon . option)+ | (colon . shell_command)? ) . Util.eol ]
Generic INI File entry
let entry (kw:regexp) (sep:lens) (comment:lens) = entry_generic (key kw) sep comment_re comment
An inputrc mapping entry
let entry = let mapping = [ label "mapping" . store /[A-Za-z0-9_."\*\/+\,\\-]+/ ] in [ label "entry" . Util.del_str "\"" . store /[^" \t\n]+/ . Util.del_str "\":" . Sep.space . mapping . Util.eol ]
A known_hosts entry
let entry = let alias = [ label "alias" . store Rx.neg1 ] in let key = [ label "key" . store Rx.neg1 ] in [ Util.indent . seq "entry" . marker? . store Rx.neg1 . (Sep.comma . Build.opt_list alias Sep.comma)? . Sep.space . type . Sep.space . key . Util.comment_or_eol ]
struct passwd
let entry = [ key username . colon . password . uid . gid . class . change_date . expire_date . name . home . shell . eol ]
A generic entry for lens lns
let entry (kw:regexp) (lns:lens) = Build.key_value_line kw sep lns
let entry = alias | options | kv_line_command /install|remove/ | blacklist | config | softdep
let entry = Build.key_value_line Rx.word Sep.space_equal (store Rx.space_in)
Define the accepted entries, such as param for regular configuration files, and macro for resources.cfg .
let entry = param | macro
Network / netmask line
let entry = [ seq "network" . indent . [ label "network" . store Rx.ipv4 ] . sep . [ label "netmask" . store Rx.ipv4 ] . comment_or_eol ]
let entry = let alias = [ seq "alias" . store Rx.word ] in [ seq "network" . counter "alias" . [ label "name" . store Rx.word ] . [ Sep.space . label "number" . store ipv4 ] . [ Sep.space . label "aliases" . Build.opt_list alias Sep.space ]? . (Util.eol|Util.comment) ]
let entry = IniFile.indented_entry IniFile.entry_re sep comment
struct passwd
let entry = [ key username . colon . password . uid . gid . name . home . shell . eol ]
let entry = entry_gen number | entry_gen word_opt_quot | entry_gen word_quot (* anything else *)
let entry = let protocol = [ label "protocol" . store protoname ] in let number = [ label "number" . store Rx.integer ] in let alias = [ label "alias" . store protoname ] in [ seq "protocol" . protocol . Sep.space . number . (Sep.space . Build.opt_list alias Sep.space)? . Util.comment_or_eol ]
let entry = Build.key_value_line Rx.word Sep.equal (store Rx.space_in)
An entry is either an allow statement or a group definition.
let entry = allow | group
let entry = nameserver | domain | search | sortlist | options | lookup | family
An entry contains selectors and an action
let entry = [ label "entry" . Syslog.selectors . Syslog.sep_tab . [ label "action" . action ] . Util.eol ]
An IniFile.entry, or description
let entry = IniFile.entry (IniFile.entry_re - "description") sep comment | description
let entry = [ key word . colon . [ label "password" . sto_to_col? . colon ] . common . eol ]
let entry = let some_value = Sep.space_equal . store to_comment_re
let entry = let username = [ label "username" . store Rx.no_spaces ] in let usernames = Build.opt_list username Sep.space in Build.key_value_line Rx.word Sep.space_equal usernames
let entry = let comma_list_re = "password-stores" in let space_list_re = "global-ignores" | "preserved-conflict-file-exts" in let std_re = /[^ \t\r\n\/=#]+/ - (comma_list_re | space_list_re) in entry_std | IniFile.entry_list_nocomment comma_list_re sep Rx.word Sep.comma | IniFile.entry_list_nocomment space_list_re sep Rx.no_spaces (del /(\r?\n)?[ \t]+/ " ")
One route
let entry = [ store subnet . del /[ \t]*via[ \t]*/ " via " . key router . Util.del_str "\n" ]
an entry contains selectors and an action
let entry = [ label "entry" . selectors . sep_tab . [ label "action" . action ] . eol ]
An IniFile.entry
let entry = entry_single | entry_multi | entry_command | entry_env | comment
A star condition gets mapped as direct value of the “allow” node.
test Reprepro_Uploaders.entry get "allow * by anybody\n" = { "allow" = "*" { "by" = "anybody" } }
Empty inline table
test Toml.entry get "name = { }\n" = { "entry" = "name" { "inline_table" { } } }
let rec entry = hash (entry|simple|array)
let entry = [ seq "entry" . store key_re . Sep.equal . ( multi_entry | single_entry )? . Util.eol ]
let entry = Build.key_value_line Rx.word Sep.space_equal Quote.double_opt
let entry = [ key Rx.word . colon . (space . anchor)? . eol . (indent . comment)* . ((inherit . (repo+)?) | repo+) ]
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
Exec* flags “@” and “-”.
let entry_command_flags = let exit = [ label "ignoreexit" . Util.del_str "-" ] in let arg0 = [ label "arg0" . Util.del_str "@" ] in exit? . arg0?
let entry_command_kw = /Exec[A-Za-z][A-Za-z0-9._-]+/
Entry that takes a space separated set of ENV=value key/value pairs
let entry_env = let envkv (env_val:lens) = key env_key . Util.del_str "=" . env_val
let entry_env_kw = "Environment"
Prototype for our various key=value lines, with optional comment
let entry_fn (kw:regexp) (val:lens) = [ key kw . sep . val . (eol_comment|eol) ]
Builder to construct entries
let entry_gen (lns:lens) = Util.indent . Build.key_value_line_comment Rx.word sep lns Util.comment_eol
A very generic INI File entry It allows to set the key lens (to set indentation or subnodes linked to the key) as well as the comment separator regexp, used to tune the store regexps.
let entry_generic (kw:lens) (sep:lens) (comment_re:regexp) (comment:lens) = entry_generic_nocomment kw sep comment_re comment | comment
An entry without a specific handler.
let entry_generic = [ indent . key generic_entry_re . sep_spc . store to_eol . eol ]
A very generic INI File entry, not including comments It allows to set the key lens (to set indentation or subnodes linked to the key) as well as the comment separator regexp, used to tune the store regexps.
let entry_generic_nocomment (kw:lens) (sep:lens) (comment_re:regexp) (comment:lens) = let bare_re_noquot = (/[^" \t\r\n]/ - comment_re) in let bare_re = (/[^\r\n]/ - comment_re)+ in let no_quot = /[^"\r\n]*/ in let bare = Quote.do_dquote_opt_nil (store (bare_re_noquot . (bare_re* . bare_re_noquot)?)) in let quoted = Quote.do_dquote (store (no_quot . comment_re+ . no_quot)) in [ kw . sep . (Sep.opt_space . bare)? . (comment|eol) ] | [ kw . sep . Sep.opt_space . quoted . (comment|eol) ]
Host component with optional weight of an entry location
let entry_host = [ label "host" . store hostname . ( Util.del_str "(" . [ label "weight" . store weight ] . Util.del_str ")" )? ]
This matches an entry which takes a single integer for an argument
let entry_int (canon:string) (re:regexp) = [ indent . del re canon . label canon . sep_spc . store int . eol ]
The key for an entry in the config file
let entry_key = Rx.word
Generic INI File list entry
let entry_list (kw:regexp) (sep:lens) (sto:regexp) (list_sep:lens) (comment:lens) = let list = counter "elem" . Build.opt_list [ seq "elem" . store sto ] list_sep in Build.key_value_line_comment kw sep (Sep.opt_space . list) comment
Generic INI File list entry without an end-of-line comment
let entry_list_nocomment (kw:regexp) (sep:lens) (sto:regexp) (list_sep:lens) = let list = counter "elem" . Build.opt_list [ seq "elem" . store sto ] list_sep in Build.key_value_line kw sep (Sep.opt_space . list)
A single location with one or more hosts, and one path
let entry_location = ( entry_host . ( Sep.comma . entry_host )* )? . Sep.colon . entry_path
Multiple locations (each with one or more hosts), separated by spaces
let entry_locations = [ label "location" . counter "location" . [ seq "location" . entry_location ] . ( [ Util.del_ws_spc . seq "location" . entry_location ] )* ]
let entry_multi_kw = let forbidden = entry_single_kw | entry_command_kw | entry_env_kw in /[A-Za-z][A-Za-z0-9._-]+/ - forbidden
Generic multiline INI File entry
let entry_multiline (kw:regexp) (sep:lens) (comment:lens) = entry_multiline_generic (key kw) sep comment_re comment (comment|eol)
A very generic multiline INI File entry It allows to set the key lens (to set indentation or subnodes linked to the key) as well as the comment separator regexp, used to tune the store regexps.
let entry_multiline_generic (kw:lens) (sep:lens) (comment_re:regexp) (comment:lens) (eol:lens) = let newline = /\r?\n[ \t]+/ in let bare = let word_re_noquot = (/[^" \t\r\n]/ - comment_re)+ in let word_re = (/[^\r\n]/ - comment_re)+ in let base_re = (word_re_noquot . (word_re* . word_re_noquot)?) in let sto_re = base_re . (newline . base_re)* | (newline . base_re)+ in Quote.do_dquote_opt_nil (store sto_re) in let quoted = let no_quot = /[^"\r\n]*/ in let base_re = (no_quot . comment_re+ . no_quot) in let sto_re = base_re . (newline . base_re)* | (newline . base_re)+ in Quote.do_dquote (store sto_re) in [ kw . sep . (Sep.opt_space . bare)? . eol ] | [ kw . sep . Sep.opt_space . quoted . eol ] | comment
Generic multiline INI File entry without an end-of-line comment
let entry_multiline_nocomment (kw:regexp) (sep:lens) (comment:lens) = entry_multiline_generic (key kw) sep comment_re comment eol
Parses one of many mountpoints given for a multimount line
let entry_multimount = entry_mkey . Util.del_ws_tab . entry_options? . entry_locations
Separator for multimount entries, permits line spanning with “\”
let entry_multimount_sep = del /[ \t]+(\\\\[ \t]*\n[ \t]+)?/ " "
Parses multiple mountpoints given on an entry line
let entry_multimounts = [ label "mount" . counter "mount" . [ seq "mount" . entry_multimount ] . ( [ entry_multimount_sep . seq "mount" . entry_multimount ] )* ]
let entry_options = Util.del_str "-" . comma_sep_list "opt" . Util.del_ws_tab
let entry_or_comment = entry | comment
Path component of an entry location
let entry_path = [ label "path" . store path ]
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-]+/
This matches an entry which takes 3 integers as arguments representing red, green and blue components
let entry_rgb (canon:string) (re:regexp) = [ indent . del re canon . label canon . [ label "red" . sep_spc . store int ] . [ label "green" . sep_spc . store int ] . [ label "blue" . sep_spc . store int ] . eol ]
Entry that takes a single value containing spaces
let entry_single = entry_fn entry_single_kw [ label "value" . sto_value_single ]?
let entry_single_kw = "Description"
A standard entry Similar to a IniFile.entry_multiline_nocomment entry, but allows ‘;’
let entry_std = IniFile.entry_multiline_generic (key std_re) sep "#" comment IniFile.eol
Store a regexp as entry value
let entry_sto (kw:regexp) (val:regexp) = entry kw (store val)
This matches an entry which takes a single quoted string
let entry_str (canon:string) (re:regexp) = [ indent . del re canon . label canon . sep_spc . quoted_non_empty_string_val . eol ]
The value for an entry may contain all sorts of things
let entry_value = /[A-Za-z0-9_.-:%]+/
Store a value that doesn’t contain spaces
let entry_value = [ label "value" . sto_value ]
This matches an entry which takes 2 integers as arguments representing X and Y coordinates
let entry_xy (canon:string) (re:regexp) = [ indent . del re canon . label canon . [ label "x" . sep_spc . store int ] . [ label "y" . sep_spc . store int ] . eol ]
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
let eol = Util.eol
let eol = Util.eol
An Util.eol
let eol = Util.eol
And Util.eol end of line
let eol = Util.eol
let eol = Util.del_str "\n"
let eol = Util.eol
let eol = Util.eol
let eol = Util.eol
let eol = Util.eol
let eol = Util.eol
let eol = Util.eol
let eol = Util.eol
let eol = Util.eol
let eol = Util.eol
let eol = Util.del_str "\n"
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 = Util.eol
Only eol, don’t include whitespace
let eol = Util.del_str "\n"
let eol = Util.eol
let eol = Util.eol
let eol = del /[ \t]*(#)?[ \t]*\n/ "\n"
let eol = Util.eol
let eol = Util.eol
let eol = Util.eol
An end of line
let eol = Util.doseol
Delete end of line, including optional trailing whitespace
let eol = del /[ \t]*\n/ "\n"
let eol = Util.eol
let eol = Util.eol
let eq = del /[ \t]*=/ " ="
let eq = dels "="
let equal = Sep.equal
let equal = del /[ \t]*=[ \t]*/ " = "
let equal = Util.del_str "="
let equal = Sep.equal
Parse a line that looks almost like a valid setting, but isn’t, into an ‘#error’ node.
let error (kw:regexp) = let not_kw = /[a-zA-Z]+/ - kw in [ label "#error" . Util.del_opt_ws "\t" . store (not_kw . /([^a-zA-Z\n].*[^ \t\n])?/) . eol ]
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" } } }
The except operator makes it possible to write very compact rules.
let except (lns:lens) = [ label "except" . Sep.space . del /[Ee][Xx][Cc][Ee][Pp][Tt]/ "EXCEPT" . Sep.space . lns ]
The except operator makes it possible to write very compact rules.
let except (lns:lens) = [ label "except" . Sep.space . del /except/i "EXCEPT" . Sep.space . lns ]
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 "
pw_expire
let expire_date = [ label "expire_date" . store integer? . colon ]