Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow empty lines and comments in block

  • Loading branch information...
commit ba92a2d81caab132c4207f9252df62b2a1768391 1 parent 7094581
@raphink raphink authored
Showing with 8 additions and 6 deletions.
  1. +8 −6 bacula.aug
View
14 bacula.aug
@@ -37,9 +37,13 @@ module Bacula =
let semicolon = [ del /[ \t]*;/ ";" ]
let line (sto:lens) = [ indent . sto . (semicolon|Util.comment_or_eol) ]
- let brackets = del /[ \n\t]*\{\n*/ " {\n" . (line keyvalue |line include)+ . del /[ \t\n]*}/ "\n}"
+ let brackets (sto:lens) = del /[ \n\t]*\{\n*/ " {\n"
+ . (sto|Util.comment)
+ . ((sto|Util.empty|Util.comment)*
+ . (sto|Util.comment))?
+ . del /[ \n\t]*}/ "\n}"
- let directive = [ key /[a-zA-Z]+/ . brackets ]
+ let directive = [ key /[a-zA-Z]+/ . brackets (line keyvalue |line include) ]
let lns = (directive|Util.empty|Util.comment)*
@@ -89,16 +93,14 @@ module Bacula =
(* newline comment *)
test Bacula.lns get "Storage {\n Name = kaki sd\n# just a comment\n}" =
{"Storage"
- {"Name" = "kaki sd"
- {"#comment" = "just a comment"}
- {} }
+ {"Name" = "kaki sd" }
+ {"#comment" = "just a comment" }
}
(* TODO: include statements *)
test Bacula.lns get "Storage {\n @/etc/foo.conf\n}" =
{"Storage"
{"@include" = "/etc/foo.conf"}
- {}
}
(* TODO: support nested directives
Please sign in to comment.
Something went wrong with that request. Please try again.