Skip to content

Instantly share code, notes, and snippets.

@raphink
Last active December 23, 2015 21:39
Show Gist options
  • Save raphink/6698254 to your computer and use it in GitHub Desktop.
Save raphink/6698254 to your computer and use it in GitHub Desktop.
module AIX_Security =
let comment = Util.comment_generic /[ \t]*\*[ \t]*/ "* "
let empty = Util.empty_generic /[ \t]*\*?[ \t]*/
let record =
let section = label "section" . store /[^:=*\r\n]+/ . Sep.colon . Util.eol
in let entry = Util.indent . Build.key_value_line Rx.word Sep.space_equal (store Rx.space_in)
in [ section . (entry|comment|empty)* ]
let lns = (comment|empty)* . record*
let conf = "* comment
* another comment
*
section_title:
key = value
otherkey = other_value
foo = bar with space
* in comment
empty_section:
/path/to/some/fi le:
"
test lns get conf =
{ "#comment" = "comment" }
{ "#comment" = "another comment" }
{ }
{ }
{ "section" = "section_title"
{ "key" = "value" }
{ "otherkey" = "other_value" }
{ }
{ "foo" = "bar with space" }
{ "#comment" = "in comment" }
{ } }
{ "section" = "empty_section"
{ } }
{ "section" = "/path/to/some/fi le" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment