Skip to content

Commit

Permalink
Json: support empty comments
Browse files Browse the repository at this point in the history
  • Loading branch information
raphink committed Jul 29, 2015
1 parent 827b7f6 commit 7dcc29f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lenses/json.aug
Expand Up @@ -18,6 +18,7 @@ let eol = del spc "\n"
let delim (c:string) (d:string) = del (c . spc) d
let dels (s:string) = del s s
let comment = Util.comment_generic /\/\/[ \t]*/ "// " . del spc ""
| [ del /\/\/[ \t\n]*\n/ "//\n" ]

let comma = delim "," "," . comment?
let colon = delim ":" ":"
Expand Down
4 changes: 4 additions & 0 deletions lenses/tests/test_json.aug
Expand Up @@ -331,12 +331,16 @@ test lns get t =

(* Comments *)
test lns get "// A comment
//
{\"menu\": 1 }
//
// Another comment\n" =
{ "#comment" = "A comment" }
{ }
{ "dict"
{ "entry" = "menu"
{ "number" = "1" } } }
{ }
{ "#comment" = "Another comment" }


Expand Down

0 comments on commit 7dcc29f

Please sign in to comment.