Commits

Yuriy Netesov  committed c424946 Draft

[json::erlang] fixed float serialization

  • Participants
  • Parent commits c5ce899

Comments (0)

Files changed (2)

File generators/erlang/templates/json/serializers.py

         # helper functions
         self.add(TSimple("""
 serialize_int(Val) -> lists:concat(['"', Val, '"']).
-serialize_float(Val) -> lists:concat(['"', Val, '"']).
+serialize_float(Val) -> lists:concat(['"', lists:flatten(io_lib:format("~p",[Val])), '"']).
 serialize_string(Val) ->lists:concat(['"', Val, '"']).
 serialize_list(Fun, Value) -> lists:concat(["[", string:join(lists:map(Fun, Value), ","), "]"]).
         """))

File generators/generator_factory.py

 from python.python_json_generator import PythonJsonGenerator
 from erlang.erlang_binary_generator import ErlangBinaryGenerator
 from erlang.erlang_json_generator import ErlangJsonGenerator
+from protogen.generators.as3.as3_json_generator import As3JsonGenerator
 
 class PythonBinaryGenerator:
 	pass
 class CppBinaryGenerator:
 	pass
 
-class AS3JsonGenerator:
-	pass
 class AS3BinaryGenerator:
 	pass
     
                                                    'binary' : PythonBinaryGenerator()},
                                        'c++' : {'json' : CppJsonGenerator(),
                                                 'binary' : CppBinaryGenerator()},
-                                       'as3' : {'json' : AS3JsonGenerator(),
+                                       'as3' : {'json' : As3JsonGenerator(),
                                                 'binary' : AS3BinaryGenerator()},
                                        'erlang' : {'binary' : ErlangBinaryGenerator(),
                                                    'json' : ErlangJsonGenerator()}