redsnow 0.3.7 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +4 -4
- data/ext/drafter/Makefile +54 -0
- data/ext/drafter/appveyor.yml +10 -0
- data/ext/drafter/bin/drafter +0 -0
- data/ext/{snowcrash → drafter}/build/Makefile +29 -14
- data/ext/{snowcrash/build/snowcrash.Makefile → drafter/build/drafter.Makefile} +1 -1
- data/ext/{snowcrash/build/snowcrash.target.mk → drafter/build/drafter.target.mk} +25 -23
- data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/libmarkdownparser.target.mk +7 -7
- data/ext/drafter/build/ext/snowcrash/libsnowcrash.target.mk +152 -0
- data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/libsundown.target.mk +13 -13
- data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/perf-libsnowcrash.target.mk +14 -20
- data/ext/drafter/build/ext/snowcrash/snowcrash.Makefile +6 -0
- data/ext/{snowcrash → drafter}/build/gyp-mac-tool +0 -0
- data/ext/{snowcrash/build/libsnowcrash.target.mk → drafter/build/libdrafter.target.mk} +29 -36
- data/ext/drafter/build/libsos.target.mk +133 -0
- data/ext/drafter/build/out/Release/drafter +0 -0
- data/ext/drafter/build/out/Release/libdrafter.dylib +0 -0
- data/ext/drafter/build/out/Release/libmarkdownparser.a +0 -0
- data/ext/drafter/build/out/Release/libsnowcrash.a +0 -0
- data/ext/drafter/build/out/Release/libsos.a +0 -0
- data/ext/{snowcrash → drafter}/build/out/Release/libsundown.a +0 -0
- data/ext/{snowcrash → drafter}/build/out/Release/linker.lock +0 -0
- data/ext/drafter/build/out/Release/obj.target/drafter/src/config.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/drafter/src/main.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/drafter/src/reporting.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Serialize.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeAST.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeResult.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeSourcemap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/cdrafter.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Blueprint.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/BlueprintSourcemap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HTTP.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HeadersParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSON.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONOneOfParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONSourcemap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONTypeSectionParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONValueMemberParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Section.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Signature.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/UriTemplateParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/posix/RegexMatch.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/snowcrash.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsos/ext/sos/src/sos.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html_smartypants.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
- data/ext/drafter/circle.yml +12 -0
- data/ext/{snowcrash → drafter}/config.gypi +1 -1
- data/ext/{snowcrash → drafter}/config.mk +0 -0
- data/ext/{snowcrash → drafter}/configure +16 -5
- data/ext/drafter/drafter.gyp +118 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/Makefile +4 -12
- data/ext/{snowcrash → drafter/ext/snowcrash}/Vagrantfile +14 -4
- data/ext/drafter/ext/snowcrash/appveyor.yml +7 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/common.gypi +0 -0
- data/ext/drafter/ext/snowcrash/configure +197 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/Makefile +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/CONTRIBUTING.md +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/Makefile +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/Makefile.win +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/examples/smartypants.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/examples/sundown.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini_href_e.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini_html_e.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html_smartypants.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html_block_names.txt +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/html_blocks.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/stack.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/stack.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/sundown.def +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/markdown/markdown.vcproj +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/msvc.sln +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/sundown/sundown.vcproj +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/ByteBuffer.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/ByteBuffer.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownNode.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownNode.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownParser.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownParser.h +10 -2
- data/ext/{snowcrash → drafter/ext/snowcrash}/provisioning.sh +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/snowcrash.gyp +41 -39
- data/ext/{snowcrash → drafter/ext/snowcrash}/snowcrash.xcworkspace/contents.xcworkspacedata +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ActionParser.h +50 -6
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/AssetParser.h +1 -12
- data/ext/drafter/ext/snowcrash/src/AttributesParser.h +121 -0
- data/ext/drafter/ext/snowcrash/src/Blueprint.cc +90 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Blueprint.h +169 -33
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintParser.h +305 -48
- data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.cc +81 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintSourcemap.h +130 -39
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintUtility.h +10 -4
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/CodeBlockUtility.h +1 -1
- data/ext/drafter/ext/snowcrash/src/DataStructureGroupParser.h +154 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/HTTP.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/HTTP.h +0 -0
- data/ext/drafter/ext/snowcrash/src/HeadersParser.cc +110 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/HeadersParser.h +123 -54
- data/ext/drafter/ext/snowcrash/src/MSON.cc +272 -0
- data/ext/drafter/ext/snowcrash/src/MSON.h +399 -0
- data/ext/drafter/ext/snowcrash/src/MSONMixinParser.h +95 -0
- data/ext/drafter/ext/snowcrash/src/MSONNamedTypeParser.h +108 -0
- data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.cc +132 -0
- data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.h +80 -0
- data/ext/drafter/ext/snowcrash/src/MSONParameterParser.h +232 -0
- data/ext/drafter/ext/snowcrash/src/MSONPropertyMemberParser.h +91 -0
- data/ext/drafter/ext/snowcrash/src/MSONSourcemap.cc +141 -0
- data/ext/drafter/ext/snowcrash/src/MSONSourcemap.h +181 -0
- data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.cc +209 -0
- data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.h +213 -0
- data/ext/drafter/ext/snowcrash/src/MSONUtility.h +423 -0
- data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.cc +179 -0
- data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.h +346 -0
- data/ext/drafter/ext/snowcrash/src/ModelTable.h +87 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ParameterParser.h +120 -61
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ParametersParser.h +17 -18
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/PayloadParser.h +36 -18
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Platform.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/RegexMatch.h +0 -0
- data/ext/drafter/ext/snowcrash/src/RelationParser.h +75 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ResourceGroupParser.h +127 -33
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ResourceParser.h +126 -33
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Section.cc +6 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Section.h +15 -2
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionParser.h +3 -1
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionParserData.h +15 -5
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionProcessor.h +24 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Signature.cc +14 -0
- data/ext/drafter/ext/snowcrash/src/Signature.h +80 -0
- data/ext/drafter/ext/snowcrash/src/SignatureSectionProcessor.h +439 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SourceAnnotation.h +3 -2
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/StringUtility.h +103 -6
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/UriTemplateParser.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/UriTemplateParser.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ValuesParser.h +1 -13
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/posix/RegexMatch.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/snowcrash.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/snowcrash.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/win/RegexMatch.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/AUTHORS +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/DEPS +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/OWNERS +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/PRESUBMIT.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/buildbot/buildbot_run.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/codereview.settings +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/data/win/large-pdb-shim.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp.bat +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp_main.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSNew.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSProject.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSSettings.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSToolFile.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSUserFile.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSUtil.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSVersion.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/__init__.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/__init__.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/common.py +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/easy_xml.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/flock_tool.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/__init__.py +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/android.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/cmake.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/eclipse.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/gypd.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/gypsh.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/make.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/msvs.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/ninja.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/xcode.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/input.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/input.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/mac_tool.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/msvs_emulation.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/ninja_syntax.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/ordered_dict.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/win_tool.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcode_emulation.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcodeproj_file.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xml_fix.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylintrc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/samples/samples +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/samples/samples.bat +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/setup.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/emacs/gyp.el +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/graphviz.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_gyp.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_sln.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_vcproj.py +0 -0
- data/ext/drafter/ext/snowcrash/vcbuild.bat +139 -0
- data/ext/drafter/ext/sos/Makefile +57 -0
- data/ext/drafter/ext/sos/src/sos.cc +200 -0
- data/ext/drafter/ext/sos/src/sos.h +179 -0
- data/ext/drafter/ext/sos/src/sosJSON.h +105 -0
- data/ext/drafter/ext/sos/src/sosYAML.h +104 -0
- data/ext/{snowcrash → drafter}/src/Serialize.cc +30 -15
- data/ext/drafter/src/Serialize.h +135 -0
- data/ext/drafter/src/SerializeAST.cc +775 -0
- data/ext/drafter/src/SerializeAST.h +19 -0
- data/ext/drafter/src/SerializeResult.cc +67 -0
- data/ext/drafter/src/SerializeResult.h +26 -0
- data/ext/drafter/src/SerializeSourcemap.cc +446 -0
- data/ext/drafter/src/SerializeSourcemap.h +19 -0
- data/ext/drafter/src/Version.h +38 -0
- data/ext/drafter/src/cdrafter.cc +44 -0
- data/ext/drafter/src/cdrafter.h +55 -0
- data/ext/drafter/src/config.cc +80 -0
- data/ext/drafter/src/config.h +35 -0
- data/ext/drafter/src/drafter.cc +22 -0
- data/ext/drafter/src/drafter.h +38 -0
- data/ext/drafter/src/main.cc +91 -0
- data/ext/drafter/src/reporting.cc +162 -0
- data/ext/drafter/src/reporting.h +28 -0
- data/ext/drafter/src/stream.h +146 -0
- data/ext/drafter/tools/homebrew/drafter.rb +12 -0
- data/ext/{snowcrash → drafter}/vcbuild.bat +3 -3
- data/lib/redsnow.rb +6 -11
- data/lib/redsnow/binding.rb +11 -201
- data/lib/redsnow/blueprint.rb +104 -169
- data/lib/redsnow/parseresult.rb +28 -42
- data/lib/redsnow/sourcemap.rb +92 -177
- data/lib/redsnow/version.rb +1 -1
- data/redsnow.gemspec +1 -1
- metadata +249 -197
- data/ext/snowcrash/bin/snowcrash +0 -0
- data/ext/snowcrash/build/out/Release/libmarkdownparser.a +0 -0
- data/ext/snowcrash/build/out/Release/libsnowcrash.dylib +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/ByteBuffer.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownNode.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownParser.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprint.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprintSourcemap.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CSourceAnnotation.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/HTTP.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Section.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Serialize.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeJSON.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeYAML.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Signature.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/UriTemplateParser.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/csnowcrash.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/posix/RegexMatch.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/snowcrash.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/snowcrash/src/snowcrash/snowcrash.o +0 -0
- data/ext/snowcrash/build/out/Release/snowcrash +0 -0
- data/ext/snowcrash/src/CBlueprint.cc +0 -628
- data/ext/snowcrash/src/CBlueprint.h +0 -366
- data/ext/snowcrash/src/CBlueprintSourcemap.cc +0 -630
- data/ext/snowcrash/src/CBlueprintSourcemap.h +0 -351
- data/ext/snowcrash/src/CSourceAnnotation.cc +0 -154
- data/ext/snowcrash/src/CSourceAnnotation.h +0 -106
- data/ext/snowcrash/src/Serialize.h +0 -71
- data/ext/snowcrash/src/SerializeJSON.cc +0 -1221
- data/ext/snowcrash/src/SerializeJSON.h +0 -24
- data/ext/snowcrash/src/SerializeYAML.cc +0 -702
- data/ext/snowcrash/src/SerializeYAML.h +0 -24
- data/ext/snowcrash/src/Signature.h +0 -32
- data/ext/snowcrash/src/SymbolTable.h +0 -94
- data/ext/snowcrash/src/Version.h +0 -39
- data/ext/snowcrash/src/csnowcrash.cc +0 -29
- data/ext/snowcrash/src/csnowcrash.h +0 -40
- data/ext/snowcrash/src/snowcrash/snowcrash.cc +0 -200
- data/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
- data/ext/snowcrash/tools/homebrew/snowcrash.rb +0 -12
@@ -0,0 +1,57 @@
|
|
1
|
+
# Default Shell
|
2
|
+
SHELL = /bin/bash
|
3
|
+
|
4
|
+
# Default build path
|
5
|
+
BUILD_PATH = build
|
6
|
+
|
7
|
+
# Flags
|
8
|
+
CXXFLAGS = -g -O3 -fPIC -Wall -Werror -Wsign-compare
|
9
|
+
LDFLAGS = -g -O3 -Wall -Werror
|
10
|
+
|
11
|
+
# SOS source directory
|
12
|
+
SRC_PATH = src
|
13
|
+
|
14
|
+
# SOS test source directory
|
15
|
+
TEST_SRC_PATH = test
|
16
|
+
|
17
|
+
# SOS include paths
|
18
|
+
INCLUDES = -I$(SRC_PATH)
|
19
|
+
|
20
|
+
# Test include paths
|
21
|
+
TEST_INCLUDES = $(INCLUDES) -I$(TEST_SRC_PATH) -Itest/ext/Catch/single_include
|
22
|
+
|
23
|
+
# SOS objects
|
24
|
+
LIB_SRC = $(SRC_PATH)/sos.cc
|
25
|
+
LIB_OBJ = $(BUILD_PATH)/sos.o
|
26
|
+
|
27
|
+
# SOS tests object
|
28
|
+
TEST_SRC = $(TEST_SRC_PATH)/test-libsos.cc
|
29
|
+
TEST_OBJ = $(BUILD_PATH)/test-libsos.o
|
30
|
+
|
31
|
+
.PHONY: all
|
32
|
+
all: libsos.a test-libsos
|
33
|
+
|
34
|
+
libsos.a: $(LIB_OBJ)
|
35
|
+
$(AR) rcs $(BUILD_PATH)/libsos.a $^
|
36
|
+
|
37
|
+
test-libsos: libsos.a $(TEST_OBJ)
|
38
|
+
$(CXX) $(TEST_OBJ) $(BUILD_PATH)/libsos.a $(LDFLAGS) -o $(BUILD_PATH)/$@
|
39
|
+
|
40
|
+
.PHONY: test
|
41
|
+
test: test-libsos
|
42
|
+
$(BUILD_PATH)/test-libsos
|
43
|
+
|
44
|
+
.PHONY: clean
|
45
|
+
clean:
|
46
|
+
$(RM) -r build
|
47
|
+
|
48
|
+
$(BUILD_PATH)/%.o: $(SRC_PATH)/%.cc
|
49
|
+
$(CXX) $(CXXFLAGS) $(INCLUDES) -MP -MMD -c $< -o $@
|
50
|
+
|
51
|
+
$(BUILD_PATH)/%.o: $(TEST_SRC_PATH)/%.cc
|
52
|
+
$(CXX) $(CXXFLAGS) $(TEST_INCLUDES) -MP -MMD -c $< -o $@
|
53
|
+
|
54
|
+
$(LIB_OBJ): | $(BUILD_PATH)
|
55
|
+
|
56
|
+
$(BUILD_PATH):
|
57
|
+
mkdir -p $(BUILD_PATH)
|
@@ -0,0 +1,200 @@
|
|
1
|
+
//
|
2
|
+
// sos.cc
|
3
|
+
// sos
|
4
|
+
//
|
5
|
+
// Created by Pavan Kumar Sunkara on 20/01/15.
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#include "sos.h"
|
10
|
+
|
11
|
+
sos::Base::Base(Base::Type type_)
|
12
|
+
: type(type_)
|
13
|
+
{
|
14
|
+
m_object.reset(::new KeyValues);
|
15
|
+
m_array.reset(::new Bases);
|
16
|
+
}
|
17
|
+
|
18
|
+
sos::Base::Base(const sos::Base& rhs)
|
19
|
+
{
|
20
|
+
this->type = rhs.type;
|
21
|
+
this->str = rhs.str;
|
22
|
+
this->number = rhs.number;
|
23
|
+
this->boolean = rhs.boolean;
|
24
|
+
this->keys = rhs.keys;
|
25
|
+
|
26
|
+
this->m_object.reset(::new KeyValues(*rhs.m_object.get()));
|
27
|
+
this->m_array.reset(::new Bases(*rhs.m_array.get()));
|
28
|
+
}
|
29
|
+
|
30
|
+
sos::Base& sos::Base::operator=(const sos::Base &rhs)
|
31
|
+
{
|
32
|
+
this->type = rhs.type;
|
33
|
+
this->str = rhs.str;
|
34
|
+
this->number = rhs.number;
|
35
|
+
this->boolean = rhs.boolean;
|
36
|
+
this->keys = rhs.keys;
|
37
|
+
|
38
|
+
this->m_object.reset(::new KeyValues(*rhs.m_object.get()));
|
39
|
+
this->m_array.reset(::new Bases(*rhs.m_array.get()));
|
40
|
+
|
41
|
+
return *this;
|
42
|
+
}
|
43
|
+
|
44
|
+
sos::KeyValues& sos::Base::object()
|
45
|
+
{
|
46
|
+
if (!m_object.get())
|
47
|
+
throw "no object key-values set";
|
48
|
+
|
49
|
+
return *m_object;
|
50
|
+
}
|
51
|
+
|
52
|
+
const sos::KeyValues& sos::Base::object() const
|
53
|
+
{
|
54
|
+
if (!m_object.get())
|
55
|
+
throw "no object key-values set";
|
56
|
+
|
57
|
+
return *m_object;
|
58
|
+
}
|
59
|
+
|
60
|
+
sos::Bases& sos::Base::array()
|
61
|
+
{
|
62
|
+
if (!m_array.get())
|
63
|
+
throw "no array values set";
|
64
|
+
|
65
|
+
return *m_array;
|
66
|
+
}
|
67
|
+
|
68
|
+
const sos::Bases& sos::Base::array() const
|
69
|
+
{
|
70
|
+
if (!m_array.get())
|
71
|
+
throw "no array values set";
|
72
|
+
|
73
|
+
return *m_array;
|
74
|
+
}
|
75
|
+
|
76
|
+
sos::Null::Null()
|
77
|
+
: Base(NullType)
|
78
|
+
{}
|
79
|
+
|
80
|
+
sos::String::String(std::string str_)
|
81
|
+
{
|
82
|
+
type = StringType;
|
83
|
+
str = str_;
|
84
|
+
}
|
85
|
+
|
86
|
+
sos::Number::Number(double number_)
|
87
|
+
{
|
88
|
+
type = NumberType;
|
89
|
+
number = number_;
|
90
|
+
}
|
91
|
+
|
92
|
+
sos::Boolean::Boolean(bool boolean_)
|
93
|
+
{
|
94
|
+
type = BooleanType;
|
95
|
+
boolean = boolean_;
|
96
|
+
}
|
97
|
+
|
98
|
+
sos::Array::Array()
|
99
|
+
: Base(ArrayType)
|
100
|
+
{}
|
101
|
+
|
102
|
+
void sos::Array::push(const sos::Base& value)
|
103
|
+
{
|
104
|
+
array().push_back(value);
|
105
|
+
}
|
106
|
+
|
107
|
+
void sos::Array::set(const size_t index, const sos::Base& value)
|
108
|
+
{
|
109
|
+
if (array().size() <= index)
|
110
|
+
throw "not enough array values set";
|
111
|
+
|
112
|
+
array().at(index) = value;
|
113
|
+
}
|
114
|
+
|
115
|
+
bool sos::Array::empty()
|
116
|
+
{
|
117
|
+
return array().empty();
|
118
|
+
}
|
119
|
+
|
120
|
+
sos::Object::Object()
|
121
|
+
: Base(ObjectType)
|
122
|
+
{}
|
123
|
+
|
124
|
+
void sos::Object::set(const std::string& key, const sos::Base& value)
|
125
|
+
{
|
126
|
+
if (std::find(keys.begin(), keys.end(), key) != keys.end())
|
127
|
+
throw "key already present in the object";
|
128
|
+
|
129
|
+
keys.push_back(key);
|
130
|
+
object().operator[](key) = value;
|
131
|
+
}
|
132
|
+
|
133
|
+
bool sos::Object::empty()
|
134
|
+
{
|
135
|
+
return keys.empty();
|
136
|
+
}
|
137
|
+
|
138
|
+
sos::Serialize::Serialize()
|
139
|
+
{}
|
140
|
+
|
141
|
+
void sos::Serialize::process(const Base& root, std::ostream& os, size_t level)
|
142
|
+
{
|
143
|
+
sos::Base::Type type = root.type;
|
144
|
+
|
145
|
+
switch (type) {
|
146
|
+
|
147
|
+
case Base::NullType:
|
148
|
+
null(os);
|
149
|
+
break;
|
150
|
+
|
151
|
+
case Base::StringType:
|
152
|
+
string(root.str, os);
|
153
|
+
break;
|
154
|
+
|
155
|
+
case Base::NumberType:
|
156
|
+
number(root.number, os);
|
157
|
+
break;
|
158
|
+
|
159
|
+
case Base::BooleanType:
|
160
|
+
boolean(root.boolean, os);
|
161
|
+
break;
|
162
|
+
|
163
|
+
case Base::ArrayType:
|
164
|
+
array(root, os, level);
|
165
|
+
break;
|
166
|
+
|
167
|
+
case Base::ObjectType:
|
168
|
+
object(root, os, level);
|
169
|
+
break;
|
170
|
+
|
171
|
+
default:
|
172
|
+
break;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
std::string sos::escapeNewlines(const std::string &input)
|
177
|
+
{
|
178
|
+
size_t pos = 0;
|
179
|
+
std::string target(input);
|
180
|
+
|
181
|
+
while ((pos = target.find("\n", pos)) != std::string::npos) {
|
182
|
+
target.replace(pos, 1, "\\n");
|
183
|
+
pos += 2;
|
184
|
+
}
|
185
|
+
|
186
|
+
return target;
|
187
|
+
}
|
188
|
+
|
189
|
+
std::string sos::escapeDoubleQuotes(const std::string &input)
|
190
|
+
{
|
191
|
+
size_t pos = 0;
|
192
|
+
std::string target(input);
|
193
|
+
|
194
|
+
while ((pos = target.find("\"", pos)) != std::string::npos) {
|
195
|
+
target.replace(pos, 1, "\\\"");
|
196
|
+
pos += 2;
|
197
|
+
}
|
198
|
+
|
199
|
+
return target;
|
200
|
+
}
|
@@ -0,0 +1,179 @@
|
|
1
|
+
//
|
2
|
+
// sos.h
|
3
|
+
// sos
|
4
|
+
//
|
5
|
+
// Created by Pavan Kumar Sunkara on 10/01/15.
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef SOS_H
|
10
|
+
#define SOS_H
|
11
|
+
|
12
|
+
#include <string>
|
13
|
+
#include <vector>
|
14
|
+
#include <map>
|
15
|
+
#include <ostream>
|
16
|
+
#include <algorithm>
|
17
|
+
#include <memory>
|
18
|
+
|
19
|
+
namespace sos {
|
20
|
+
|
21
|
+
/** Forward Declaration */
|
22
|
+
class Base;
|
23
|
+
|
24
|
+
/** Key-value pairs (object) */
|
25
|
+
typedef std::map<std::string, Base> KeyValues;
|
26
|
+
|
27
|
+
/** List of keys for object (for deterministic output) */
|
28
|
+
typedef std::vector<std::string> Keys;
|
29
|
+
|
30
|
+
/** Array of values */
|
31
|
+
typedef std::vector<Base> Bases;
|
32
|
+
|
33
|
+
/** Base class for values */
|
34
|
+
class Base {
|
35
|
+
public:
|
36
|
+
|
37
|
+
/** Enum for Type of the value */
|
38
|
+
enum Type {
|
39
|
+
UndefinedType = 0,
|
40
|
+
NullType, // Null
|
41
|
+
StringType, // A string
|
42
|
+
NumberType, // A number
|
43
|
+
BooleanType, // A boolean value
|
44
|
+
ArrayType, // An array
|
45
|
+
ObjectType // An object
|
46
|
+
};
|
47
|
+
|
48
|
+
/** Type of the value */
|
49
|
+
Type type;
|
50
|
+
|
51
|
+
/** String value */
|
52
|
+
std::string str;
|
53
|
+
|
54
|
+
/** Number value */
|
55
|
+
double number;
|
56
|
+
|
57
|
+
/** Boolean value */
|
58
|
+
bool boolean;
|
59
|
+
|
60
|
+
/** Object value */
|
61
|
+
KeyValues& object();
|
62
|
+
const KeyValues& object() const;
|
63
|
+
|
64
|
+
Keys keys;
|
65
|
+
|
66
|
+
/** Array value */
|
67
|
+
Bases& array();
|
68
|
+
const Bases& array() const;
|
69
|
+
|
70
|
+
/** Constructor */
|
71
|
+
Base(Type type_ = UndefinedType);
|
72
|
+
|
73
|
+
/** Copy constructor */
|
74
|
+
Base(const Base& rhs);
|
75
|
+
|
76
|
+
/** Assignment operator */
|
77
|
+
Base& operator=(const Base& rhs);
|
78
|
+
|
79
|
+
/** Destructor */
|
80
|
+
~Base() {};
|
81
|
+
|
82
|
+
private:
|
83
|
+
std::auto_ptr<KeyValues> m_object;
|
84
|
+
std::auto_ptr<Bases> m_array;
|
85
|
+
};
|
86
|
+
|
87
|
+
class Null : public Base {
|
88
|
+
public:
|
89
|
+
|
90
|
+
/** Constructor */
|
91
|
+
Null();
|
92
|
+
};
|
93
|
+
|
94
|
+
class String : public Base {
|
95
|
+
public:
|
96
|
+
|
97
|
+
/** Constructor */
|
98
|
+
String(std::string string_ = "");
|
99
|
+
};
|
100
|
+
|
101
|
+
class Number : public Base {
|
102
|
+
public:
|
103
|
+
|
104
|
+
/** Constructor */
|
105
|
+
Number(double number_ = 0);
|
106
|
+
};
|
107
|
+
|
108
|
+
class Boolean : public Base {
|
109
|
+
public:
|
110
|
+
|
111
|
+
/** Constructor */
|
112
|
+
Boolean(bool boolean_ = false);
|
113
|
+
};
|
114
|
+
|
115
|
+
class Array : public Base {
|
116
|
+
public:
|
117
|
+
|
118
|
+
/** Constructor */
|
119
|
+
Array();
|
120
|
+
|
121
|
+
void push(const Base& value);
|
122
|
+
void set(const size_t index, const Base& value);
|
123
|
+
|
124
|
+
/** Check if empty */
|
125
|
+
bool empty();
|
126
|
+
};
|
127
|
+
|
128
|
+
class Object : public Base {
|
129
|
+
public:
|
130
|
+
|
131
|
+
/** Constructor */
|
132
|
+
Object();
|
133
|
+
|
134
|
+
void set(const std::string& key, const Base& value);
|
135
|
+
|
136
|
+
/** Check if empty */
|
137
|
+
bool empty();
|
138
|
+
};
|
139
|
+
|
140
|
+
/** Base class for serializers */
|
141
|
+
struct Serialize {
|
142
|
+
|
143
|
+
/** Constructor */
|
144
|
+
Serialize();
|
145
|
+
|
146
|
+
/** Destructor */
|
147
|
+
virtual ~Serialize() {};
|
148
|
+
|
149
|
+
/** Process the given value with the serializer logic */
|
150
|
+
void process(const Base& value, std::ostream& os, size_t level = 0);
|
151
|
+
|
152
|
+
virtual void null(std::ostream& os) = 0;
|
153
|
+
virtual void string(const std::string& value, std::ostream& os) = 0;
|
154
|
+
virtual void number(double value, std::ostream& os) = 0;
|
155
|
+
virtual void boolean(bool value, std::ostream& os) = 0;
|
156
|
+
virtual void array(const Base& value, std::ostream& os, size_t level) = 0;
|
157
|
+
virtual void object(const Base& value, std::ostream& os, size_t level) = 0;
|
158
|
+
|
159
|
+
virtual void indent(size_t level, std::ostream& os) = 0;
|
160
|
+
};
|
161
|
+
|
162
|
+
/**
|
163
|
+
* \brief Escape every double quote in input string.
|
164
|
+
* \param input A string to escape its double quotes.
|
165
|
+
* \return A new string with double quotes escaped.
|
166
|
+
*/
|
167
|
+
std::string escapeDoubleQuotes(const std::string& input);
|
168
|
+
|
169
|
+
/**
|
170
|
+
* \brief Escape new lines in input string.
|
171
|
+
* \param input A string to escape its new lines.
|
172
|
+
* \return A new string with lines escaped.
|
173
|
+
*
|
174
|
+
* This function replaces all occurences of "\n" with "\\n".
|
175
|
+
*/
|
176
|
+
std::string escapeNewlines(const std::string& input);
|
177
|
+
}
|
178
|
+
|
179
|
+
#endif
|
@@ -0,0 +1,105 @@
|
|
1
|
+
//
|
2
|
+
// sosJSON.h
|
3
|
+
// sos
|
4
|
+
//
|
5
|
+
// Created by Pavan Kumar Sunkara on 11/01/15.
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef SOS_JSON_H
|
10
|
+
#define SOS_JSON_H
|
11
|
+
|
12
|
+
#include "sos.h"
|
13
|
+
|
14
|
+
namespace sos {
|
15
|
+
|
16
|
+
struct SerializeJSON : public Serialize {
|
17
|
+
|
18
|
+
virtual void indent(size_t level, std::ostream& os) {
|
19
|
+
|
20
|
+
for (size_t i = 0; i < level; ++i) {
|
21
|
+
os << " ";
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
virtual void null(std::ostream& os) {
|
26
|
+
|
27
|
+
os << "null";
|
28
|
+
}
|
29
|
+
|
30
|
+
virtual void string(const std::string& value, std::ostream& os) {
|
31
|
+
|
32
|
+
std::string normalized = escapeDoubleQuotes(value);
|
33
|
+
normalized = escapeNewlines(normalized);
|
34
|
+
|
35
|
+
os << "\"" << normalized << "\"";
|
36
|
+
}
|
37
|
+
|
38
|
+
virtual void number(double value, std::ostream& os) {
|
39
|
+
|
40
|
+
os << value;
|
41
|
+
}
|
42
|
+
|
43
|
+
virtual void boolean(bool value, std::ostream& os) {
|
44
|
+
|
45
|
+
os << (value ? "true" : "false");
|
46
|
+
}
|
47
|
+
|
48
|
+
virtual void array(const Base& value, std::ostream& os, size_t level) {
|
49
|
+
|
50
|
+
os << "[";
|
51
|
+
|
52
|
+
if (!value.array().empty()) {
|
53
|
+
|
54
|
+
os << "\n";
|
55
|
+
size_t i = 0;
|
56
|
+
|
57
|
+
for (Bases::const_iterator it = value.array().begin(); it != value.array().end(); ++i, ++it) {
|
58
|
+
|
59
|
+
if (i > 0 && i < value.array().size()) {
|
60
|
+
os << ",\n";
|
61
|
+
}
|
62
|
+
|
63
|
+
indent(level + 1, os);
|
64
|
+
process(*it, os, level + 1);
|
65
|
+
}
|
66
|
+
|
67
|
+
os << "\n";
|
68
|
+
indent(level, os);
|
69
|
+
}
|
70
|
+
|
71
|
+
os << "]";
|
72
|
+
}
|
73
|
+
|
74
|
+
virtual void object(const Base& value, std::ostream& os, size_t level) {
|
75
|
+
|
76
|
+
os << "{";
|
77
|
+
|
78
|
+
if (!value.keys.empty()) {
|
79
|
+
|
80
|
+
os << "\n";
|
81
|
+
size_t i = 0;
|
82
|
+
|
83
|
+
for (Keys::const_iterator it = value.keys.begin(); it != value.keys.end(); ++i, ++it) {
|
84
|
+
|
85
|
+
if (i > 0 && i < value.keys.size()) {
|
86
|
+
os << ",\n";
|
87
|
+
}
|
88
|
+
|
89
|
+
indent(level + 1, os);
|
90
|
+
string(*it, os);
|
91
|
+
|
92
|
+
os << ": ";
|
93
|
+
process(value.object().at(*it), os, level + 1);
|
94
|
+
}
|
95
|
+
|
96
|
+
os << "\n";
|
97
|
+
indent(level, os);
|
98
|
+
}
|
99
|
+
|
100
|
+
os << "}";
|
101
|
+
}
|
102
|
+
};
|
103
|
+
}
|
104
|
+
|
105
|
+
#endif
|