two new tests for comments and one (tiny) fix for trailing comments

This commit is contained in:
alisdair sullivan 2012-04-01 17:53:59 -07:00
parent 447e0b1356
commit 19402fbee4
5 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,10 @@
// comment
{ // comment
"key" // comment
: // comment
[ // comment
true // comment
, // comment
false // comment
] // comment
} // comment

View file

@ -0,0 +1,4 @@
{name, "comment_style_a"}.
{jsx, [start_object,{key, <<"key">>}, start_array, {literal, true}, {literal, false}, end_array, end_object,end_json]}.
{json, "comment_style_a.json"}.
{jsx_flags, [comments]}.

View file

@ -0,0 +1 @@
/* comment */ { /* comment */ "key" /* comment */ : /* comment */ [ /* comment */ true /* comment */ , /* comment */ false /* comment */ ] /* comment */ } /* comment */

View file

@ -0,0 +1,4 @@
{name, "comment_style_a"}.
{jsx, [start_object,{key, <<"key">>}, start_array, {literal, true}, {literal, false}, end_array, end_object,end_json]}.
{json, "comment_style_a.json"}.
{jsx_flags, [comments]}.

View file

@ -972,7 +972,7 @@ single_comment(<<?newline, Rest/binary>>, Handler, Stack, Opts) ->
end_comment(Rest, Handler, Stack, Opts); end_comment(Rest, Handler, Stack, Opts);
single_comment(<<_/utf8, Rest/binary>>, Handler, Stack, Opts) -> single_comment(<<_/utf8, Rest/binary>>, Handler, Stack, Opts) ->
single_comment(Rest, Handler, Stack, Opts); single_comment(Rest, Handler, Stack, Opts);
single_comment(<<>>, Handler, [done], Opts) -> single_comment(<<>>, Handler, [done], Opts=#opts{explicit_end=false}) ->
end_comment(<<>>, Handler, [done], Opts); end_comment(<<>>, Handler, [done], Opts);
single_comment(<<>>, Handler, Stack, Opts) -> single_comment(<<>>, Handler, Stack, Opts) ->
?incomplete(single_comment, <<>>, Handler, Stack, Opts); ?incomplete(single_comment, <<>>, Handler, Stack, Opts);