Last active
December 23, 2015 21:39
-
-
Save raphink/6698254 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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