Permalink
Browse files

naked elements allowed again

  • Loading branch information...
1 parent ab1c0d0 commit 18dbbc5169317f20da2f57cd259720e10b748e6d Chris Anderson committed Aug 8, 2008
Showing with 183 additions and 203 deletions.
  1. +14 −9 json_eep.erl
  2. +168 −189 json_grammar.erl
  3. +1 −1 json_grammar.yrl
  4. +0 −4 json_lex2.xrl
View
@@ -30,7 +30,7 @@
-author('bob@mochimedia.com').
-author('jchris@grabb.it').
-export([json_to_term/1, term_to_json/1]).
--export([test/0]).
+-export([test/0,profile/0]).
-define(Q, $\").
@@ -216,13 +216,18 @@ equiv_list([V1 | L1], [V2 | L2]) ->
end.
profile() ->
- profile_next(tests(binary)).
+ {ok, Tracer} = fprof:profile(start),
+ fprof:trace([start, {tracer, Tracer}]),
+ profile_next(tests(binary)),
+ fprof:trace(stop),
+ fprof:analyse().
+
profile_next([]) -> ok;
-profile_next([{E,J}|Rest]) ->
+profile_next([{_,J}|Rest]) ->
Term = json_to_term(J),
- Json = term_to_json(Term),
+ % term_to_json(Term),
profile_next(Rest).
test() ->
@@ -245,18 +250,18 @@ tests(binary) ->
{{[{<<"key">>,<<"value">>}]}, "{\"key\":\"value\"}"},
{{[]},"{}"},
{[], "[]"},
- {[1], "[1]"},
- {[3.1416], "[3.14160]"}, % text representation may truncate, trail zeroes
- {[-1], "[-1]"},
+ {1, "1"},
+ {3.1416, "3.14160"}, % text representation may truncate, trail zeroes
+ {-1, "-1"},
{[-3.1416], "[-3.14160]"},
{{[{<<"number">>, 12.0e10}]}, "{\"number\":1.20000e+11}"},
{[1.234E+10], "[1.23400e+10]"},
{[-1.234E-10], "[-1.23400e-10]"},
{[10.0], "[1.0e+01]"},
{[123.456], "[1.23456E+2]"},
{[10.0], "[1e1]"},
- {[<<"foo">>], "[\"foo\"]"},
- {[<<>>], "[\"\"]"},
+ {<<"foo">>, "\"foo\""},
+ {[<<"">>], "[\"\"]"},
{[<<"1/4">>], "[\"1\/4\"]"},
{[<<"name is \"Quentin\"">>], "[\"name is \\\"Quentin\\\"\"]"},
{[<<"\n\n\n">>], "[\"\\n\\n\\n\"]"},
Oops, something went wrong.

0 comments on commit 18dbbc5

Please sign in to comment.