lounge_lizard 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Guardfile +33 -0
- data/LICENSE.txt +21 -0
- data/README.md +50 -0
- data/Rakefile +43 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/circle.yml +14 -0
- data/ext/drafter/CHANGELOG.md +278 -0
- data/ext/drafter/Dockerfile +17 -0
- data/ext/drafter/Makefile +62 -0
- data/ext/drafter/appveyor.yml +17 -0
- data/ext/drafter/bin/drafter +0 -0
- data/ext/drafter/build/Makefile +387 -0
- data/ext/drafter/build/drafter.Makefile +6 -0
- data/ext/drafter/build/drafter.target.mk +159 -0
- data/ext/drafter/build/ext/snowcrash/libmarkdownparser.target.mk +141 -0
- data/ext/drafter/build/ext/snowcrash/libsnowcrash.target.mk +154 -0
- data/ext/drafter/build/ext/snowcrash/libsundown.target.mk +149 -0
- data/ext/drafter/build/ext/snowcrash/perf-libsnowcrash.target.mk +147 -0
- data/ext/drafter/build/ext/snowcrash/snowcrash.Makefile +6 -0
- data/ext/drafter/build/gyp-mac-tool +606 -0
- data/ext/drafter/build/libdrafter.target.mk +186 -0
- data/ext/drafter/build/libsos.target.mk +137 -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/drafter/build/out/Release/libsundown.a +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/ConversionContext.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/NamedTypesRegistry.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractAPI.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractDataStructure.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractElementFactory.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractSourceMap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Render.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/drafter.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter_private.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/ComparableVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Element.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/ExpandVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/IsExpandableVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/JSONSchemaVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/PrintVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Query.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Registry.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/RenderJSONVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/SerializeCompactVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/SerializeVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/TypeQueryVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/VisitorUtils.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/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.o +0 -0
- data/ext/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 +32 -0
- data/ext/drafter/config.gypi +10 -0
- data/ext/drafter/config.mk +5 -0
- data/ext/drafter/configure +224 -0
- data/ext/drafter/drafter.gyp +189 -0
- data/ext/drafter/drafter.xcworkspace/contents.xcworkspacedata +13 -0
- data/ext/drafter/ext/snowcrash/Makefile +58 -0
- data/ext/drafter/ext/snowcrash/appveyor.yml +7 -0
- data/ext/drafter/ext/snowcrash/common.gypi +165 -0
- data/ext/drafter/ext/snowcrash/configure +197 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/Makefile +90 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/CONTRIBUTING.md +10 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/Makefile +84 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/Makefile.win +33 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/examples/smartypants.c +72 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/examples/sundown.c +80 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini.h +37 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.c +108 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.c +84 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.c +647 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.h +77 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.c +389 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html_block_names.txt +25 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.c +297 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.h +51 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.c +225 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.h +96 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/html_blocks.h +206 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.c +2726 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.h +147 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.c +204 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.h +58 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.c +81 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.h +29 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/sundown.def +20 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/markdown/markdown.vcproj +188 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/msvc.sln +38 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/sundown/sundown.vcproj +206 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.cc +160 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.h +90 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.cc +152 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.h +103 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.cc +388 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.h +106 -0
- data/ext/drafter/ext/snowcrash/snowcrash.gyp +196 -0
- data/ext/drafter/ext/snowcrash/src/ActionParser.h +560 -0
- data/ext/drafter/ext/snowcrash/src/AssetParser.h +123 -0
- data/ext/drafter/ext/snowcrash/src/AttributesParser.h +123 -0
- data/ext/drafter/ext/snowcrash/src/Blueprint.cc +90 -0
- data/ext/drafter/ext/snowcrash/src/Blueprint.h +489 -0
- data/ext/drafter/ext/snowcrash/src/BlueprintParser.h +845 -0
- data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.cc +81 -0
- data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.h +345 -0
- data/ext/drafter/ext/snowcrash/src/BlueprintUtility.h +111 -0
- data/ext/drafter/ext/snowcrash/src/CodeBlockUtility.h +276 -0
- data/ext/drafter/ext/snowcrash/src/DataStructureGroupParser.h +157 -0
- data/ext/drafter/ext/snowcrash/src/HTTP.cc +49 -0
- data/ext/drafter/ext/snowcrash/src/HTTP.h +108 -0
- data/ext/drafter/ext/snowcrash/src/HeadersParser.cc +117 -0
- data/ext/drafter/ext/snowcrash/src/HeadersParser.h +377 -0
- data/ext/drafter/ext/snowcrash/src/MSON.cc +272 -0
- data/ext/drafter/ext/snowcrash/src/MSON.h +405 -0
- data/ext/drafter/ext/snowcrash/src/MSONMixinParser.h +103 -0
- data/ext/drafter/ext/snowcrash/src/MSONNamedTypeParser.h +135 -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 +166 -0
- data/ext/drafter/ext/snowcrash/src/MSONPropertyMemberParser.h +106 -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 +506 -0
- data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.cc +214 -0
- data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.h +390 -0
- data/ext/drafter/ext/snowcrash/src/ModelTable.h +87 -0
- data/ext/drafter/ext/snowcrash/src/ParameterParser.h +516 -0
- data/ext/drafter/ext/snowcrash/src/ParametersParser.h +222 -0
- data/ext/drafter/ext/snowcrash/src/PayloadParser.h +733 -0
- data/ext/drafter/ext/snowcrash/src/Platform.h +33 -0
- data/ext/drafter/ext/snowcrash/src/RegexMatch.h +32 -0
- data/ext/drafter/ext/snowcrash/src/RelationParser.h +87 -0
- data/ext/drafter/ext/snowcrash/src/ResourceGroupParser.h +297 -0
- data/ext/drafter/ext/snowcrash/src/ResourceParser.h +536 -0
- data/ext/drafter/ext/snowcrash/src/Section.cc +48 -0
- data/ext/drafter/ext/snowcrash/src/Section.h +60 -0
- data/ext/drafter/ext/snowcrash/src/SectionParser.h +246 -0
- data/ext/drafter/ext/snowcrash/src/SectionParserData.h +109 -0
- data/ext/drafter/ext/snowcrash/src/SectionProcessor.h +299 -0
- data/ext/drafter/ext/snowcrash/src/Signature.cc +75 -0
- data/ext/drafter/ext/snowcrash/src/Signature.h +103 -0
- data/ext/drafter/ext/snowcrash/src/SignatureSectionProcessor.h +442 -0
- data/ext/drafter/ext/snowcrash/src/SourceAnnotation.h +166 -0
- data/ext/drafter/ext/snowcrash/src/StringUtility.h +323 -0
- data/ext/drafter/ext/snowcrash/src/UriTemplateParser.cc +195 -0
- data/ext/drafter/ext/snowcrash/src/UriTemplateParser.h +240 -0
- data/ext/drafter/ext/snowcrash/src/ValuesParser.h +111 -0
- data/ext/drafter/ext/snowcrash/src/posix/RegexMatch.cc +99 -0
- data/ext/drafter/ext/snowcrash/src/snowcrash.cc +90 -0
- data/ext/drafter/ext/snowcrash/src/snowcrash.h +44 -0
- data/ext/drafter/ext/snowcrash/src/win/RegexMatch.cc +78 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/AUTHORS +12 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/DEPS +23 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/OWNERS +1 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/PRESUBMIT.py +137 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/buildbot_run.py +136 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/commit_queue/OWNERS +6 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/commit_queue/cq_config.json +15 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/codereview.settings +10 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/data/win/large-pdb-shim.cc +12 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/gyp +8 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/gyp.bat +5 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/gyp_main.py +16 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSNew.py +340 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSProject.py +208 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSSettings.py +1096 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSToolFile.py +58 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUserFile.py +147 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.py +270 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.py +445 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/__init__.py +548 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/__init__.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.py +608 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/easy_xml.py +157 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/flock_tool.py +54 -0
- data/ext/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/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/analyzer.py +741 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/android.py +1069 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/cmake.py +1248 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +99 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/eclipse.py +425 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypd.py +94 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypsh.py +56 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.py +2218 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/msvs.py +3467 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.py +2427 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.py +1300 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/input.py +2899 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/input.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/mac_tool.py +605 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.py +1093 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.py +160 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ordered_dict.py +289 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/simple_copy.py +46 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/simple_copy.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/win_tool.py +314 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.py +1664 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_ninja.py +276 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_ninja.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.py +2927 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xml_fix.py +69 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylintrc +307 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/samples/samples +81 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/samples/samples.bat +5 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/setup.py +19 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/emacs/gyp.el +275 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/graphviz.py +100 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_gyp.py +155 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_sln.py +169 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_vcproj.py +329 -0
- data/ext/drafter/ext/snowcrash/vcbuild.bat +139 -0
- data/ext/drafter/ext/sos/Makefile +62 -0
- data/ext/drafter/ext/sos/src/sos.cc +235 -0
- data/ext/drafter/ext/sos/src/sos.h +188 -0
- data/ext/drafter/ext/sos/src/sosJSON.h +121 -0
- data/ext/drafter/ext/sos/src/sosYAML.h +105 -0
- data/ext/drafter/src/ConversionContext.cc +39 -0
- data/ext/drafter/src/ConversionContext.h +34 -0
- data/ext/drafter/src/NamedTypesRegistry.cc +405 -0
- data/ext/drafter/src/NamedTypesRegistry.h +28 -0
- data/ext/drafter/src/NodeInfo.h +143 -0
- data/ext/drafter/src/RefractAPI.cc +579 -0
- data/ext/drafter/src/RefractAPI.h +28 -0
- data/ext/drafter/src/RefractDataStructure.cc +1199 -0
- data/ext/drafter/src/RefractDataStructure.h +26 -0
- data/ext/drafter/src/RefractElementFactory.cc +107 -0
- data/ext/drafter/src/RefractElementFactory.h +67 -0
- data/ext/drafter/src/RefractSourceMap.cc +29 -0
- data/ext/drafter/src/RefractSourceMap.h +57 -0
- data/ext/drafter/src/Render.cc +157 -0
- data/ext/drafter/src/Render.h +40 -0
- data/ext/drafter/src/Serialize.cc +160 -0
- data/ext/drafter/src/Serialize.h +289 -0
- data/ext/drafter/src/SerializeAST.cc +507 -0
- data/ext/drafter/src/SerializeAST.h +29 -0
- data/ext/drafter/src/SerializeResult.cc +170 -0
- data/ext/drafter/src/SerializeResult.h +34 -0
- data/ext/drafter/src/SerializeSourcemap.cc +331 -0
- data/ext/drafter/src/SerializeSourcemap.h +21 -0
- data/ext/drafter/src/Version.h +40 -0
- data/ext/drafter/src/config.cc +91 -0
- data/ext/drafter/src/config.h +38 -0
- data/ext/drafter/src/drafter.cc +137 -0
- data/ext/drafter/src/drafter.h +102 -0
- data/ext/drafter/src/drafter_private.cc +85 -0
- data/ext/drafter/src/drafter_private.h +34 -0
- data/ext/drafter/src/main.cc +137 -0
- data/ext/drafter/src/refract/AppendDecorator.h +58 -0
- data/ext/drafter/src/refract/Build.h +67 -0
- data/ext/drafter/src/refract/ComparableVisitor.cc +43 -0
- data/ext/drafter/src/refract/ComparableVisitor.h +62 -0
- data/ext/drafter/src/refract/Element.cc +409 -0
- data/ext/drafter/src/refract/Element.h +656 -0
- data/ext/drafter/src/refract/ElementFwd.h +37 -0
- data/ext/drafter/src/refract/ElementInserter.h +59 -0
- data/ext/drafter/src/refract/Exception.h +31 -0
- data/ext/drafter/src/refract/ExpandVisitor.cc +359 -0
- data/ext/drafter/src/refract/ExpandVisitor.h +58 -0
- data/ext/drafter/src/refract/FilterVisitor.h +52 -0
- data/ext/drafter/src/refract/IsExpandableVisitor.cc +140 -0
- data/ext/drafter/src/refract/IsExpandableVisitor.h +31 -0
- data/ext/drafter/src/refract/Iterate.h +160 -0
- data/ext/drafter/src/refract/JSONSchemaVisitor.cc +675 -0
- data/ext/drafter/src/refract/JSONSchemaVisitor.h +73 -0
- data/ext/drafter/src/refract/PrintVisitor.cc +164 -0
- data/ext/drafter/src/refract/PrintVisitor.h +50 -0
- data/ext/drafter/src/refract/Query.cc +13 -0
- data/ext/drafter/src/refract/Query.h +38 -0
- data/ext/drafter/src/refract/Registry.cc +114 -0
- data/ext/drafter/src/refract/Registry.h +43 -0
- data/ext/drafter/src/refract/RenderJSONVisitor.cc +255 -0
- data/ext/drafter/src/refract/RenderJSONVisitor.h +51 -0
- data/ext/drafter/src/refract/SerializeCompactVisitor.cc +167 -0
- data/ext/drafter/src/refract/SerializeCompactVisitor.h +56 -0
- data/ext/drafter/src/refract/SerializeVisitor.cc +214 -0
- data/ext/drafter/src/refract/SerializeVisitor.h +55 -0
- data/ext/drafter/src/refract/TypeQueryVisitor.cc +46 -0
- data/ext/drafter/src/refract/TypeQueryVisitor.h +110 -0
- data/ext/drafter/src/refract/Visitor.h +126 -0
- data/ext/drafter/src/refract/VisitorUtils.cc +63 -0
- data/ext/drafter/src/refract/VisitorUtils.h +231 -0
- data/ext/drafter/src/reporting.cc +263 -0
- data/ext/drafter/src/reporting.h +39 -0
- data/ext/drafter/src/stream.h +148 -0
- data/ext/drafter/tools/homebrew/drafter.rb +18 -0
- data/ext/drafter/tools/make-tarball.sh +39 -0
- data/ext/drafter/tools/refract-filter.py +96 -0
- data/ext/drafter/tools/release.sh +17 -0
- data/ext/drafter/vcbuild.bat +203 -0
- data/lib/lounge_lizard/binding.rb +29 -0
- data/lib/lounge_lizard/version.rb +3 -0
- data/lib/lounge_lizard.rb +18 -0
- data/lounge_lizard.gemspec +37 -0
- metadata +547 -0
@@ -0,0 +1,507 @@
|
|
1
|
+
//
|
2
|
+
// SerializeAST.cc
|
3
|
+
// drafter
|
4
|
+
//
|
5
|
+
// Created by Pavan Kumar Sunkara on 18/01/15.
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#include "StringUtility.h"
|
10
|
+
#include "SerializeAST.h"
|
11
|
+
|
12
|
+
#include <stdlib.h>
|
13
|
+
|
14
|
+
#include "SourceAnnotation.h"
|
15
|
+
#include "RefractDataStructure.h"
|
16
|
+
#include "RefractAPI.h"
|
17
|
+
#include "Render.h"
|
18
|
+
#include "SectionProcessor.h"
|
19
|
+
|
20
|
+
#include "NamedTypesRegistry.h"
|
21
|
+
#include "ConversionContext.h"
|
22
|
+
|
23
|
+
using namespace drafter;
|
24
|
+
|
25
|
+
using snowcrash::AssetRole;
|
26
|
+
using snowcrash::BodyExampleAssetRole;
|
27
|
+
using snowcrash::BodySchemaAssetRole;
|
28
|
+
|
29
|
+
using snowcrash::Element;
|
30
|
+
using snowcrash::Elements;
|
31
|
+
using snowcrash::KeyValuePair;
|
32
|
+
using snowcrash::Metadata;
|
33
|
+
using snowcrash::Header;
|
34
|
+
using snowcrash::Reference;
|
35
|
+
using snowcrash::DataStructure;
|
36
|
+
using snowcrash::Asset;
|
37
|
+
using snowcrash::Payload;
|
38
|
+
using snowcrash::Value;
|
39
|
+
using snowcrash::Parameter;
|
40
|
+
using snowcrash::TransactionExample;
|
41
|
+
using snowcrash::Request;
|
42
|
+
using snowcrash::Response;
|
43
|
+
using snowcrash::Action;
|
44
|
+
using snowcrash::Resource;
|
45
|
+
using snowcrash::Blueprint;
|
46
|
+
|
47
|
+
sos::String AssetRoleToString(const AssetRole& role)
|
48
|
+
{
|
49
|
+
std::string str;
|
50
|
+
|
51
|
+
switch (role) {
|
52
|
+
case BodyExampleAssetRole:
|
53
|
+
str = "bodyExample";
|
54
|
+
break;
|
55
|
+
|
56
|
+
case BodySchemaAssetRole:
|
57
|
+
str = "bodySchema";
|
58
|
+
break;
|
59
|
+
|
60
|
+
default:
|
61
|
+
break;
|
62
|
+
}
|
63
|
+
|
64
|
+
return sos::String(str);
|
65
|
+
}
|
66
|
+
|
67
|
+
sos::String ElementClassToString(const Element::Class& element)
|
68
|
+
{
|
69
|
+
std::string str;
|
70
|
+
|
71
|
+
switch (element) {
|
72
|
+
case Element::CategoryElement:
|
73
|
+
str = "category";
|
74
|
+
break;
|
75
|
+
|
76
|
+
case Element::CopyElement:
|
77
|
+
str = "copy";
|
78
|
+
break;
|
79
|
+
|
80
|
+
case Element::ResourceElement:
|
81
|
+
str = "resource";
|
82
|
+
break;
|
83
|
+
|
84
|
+
case Element::DataStructureElement:
|
85
|
+
str = "dataStructure";
|
86
|
+
break;
|
87
|
+
|
88
|
+
case Element::AssetElement:
|
89
|
+
str = "asset";
|
90
|
+
break;
|
91
|
+
|
92
|
+
default:
|
93
|
+
break;
|
94
|
+
}
|
95
|
+
|
96
|
+
return sos::String(str);
|
97
|
+
}
|
98
|
+
|
99
|
+
sos::Object WrapKeyValue(const KeyValuePair& keyValue)
|
100
|
+
{
|
101
|
+
sos::Object keyValueObject;
|
102
|
+
|
103
|
+
// Name
|
104
|
+
keyValueObject.set(SerializeKey::Name, sos::String(keyValue.first));
|
105
|
+
|
106
|
+
// Value
|
107
|
+
keyValueObject.set(SerializeKey::Value, sos::String(keyValue.second));
|
108
|
+
|
109
|
+
return keyValueObject;
|
110
|
+
}
|
111
|
+
|
112
|
+
sos::Object WrapMetadata(const Metadata& metadata)
|
113
|
+
{
|
114
|
+
return WrapKeyValue(metadata);
|
115
|
+
}
|
116
|
+
|
117
|
+
sos::Object WrapHeader(const Header& header)
|
118
|
+
{
|
119
|
+
return WrapKeyValue(header);
|
120
|
+
}
|
121
|
+
|
122
|
+
sos::Object WrapReference(const Reference& reference)
|
123
|
+
{
|
124
|
+
sos::Object referenceObject;
|
125
|
+
|
126
|
+
// Id
|
127
|
+
referenceObject.set(SerializeKey::Id, sos::String(reference.id));
|
128
|
+
|
129
|
+
return referenceObject;
|
130
|
+
}
|
131
|
+
|
132
|
+
sos::Object WrapDataStructure(const DataStructure& dataStructure, ConversionContext& context)
|
133
|
+
{
|
134
|
+
sos::Object dataStructureObject;
|
135
|
+
|
136
|
+
refract::IElement *element = DataStructureToRefract(MakeNodeInfoWithoutSourceMap(dataStructure), context);
|
137
|
+
dataStructureObject = SerializeRefract(element, context);
|
138
|
+
|
139
|
+
if (element) {
|
140
|
+
delete element;
|
141
|
+
}
|
142
|
+
|
143
|
+
return dataStructureObject;
|
144
|
+
}
|
145
|
+
|
146
|
+
sos::Object WrapAsset(const Asset& asset, const AssetRole& role)
|
147
|
+
{
|
148
|
+
sos::Object assetObject;
|
149
|
+
|
150
|
+
// Element
|
151
|
+
assetObject.set(SerializeKey::Element, ElementClassToString(Element::AssetElement));
|
152
|
+
|
153
|
+
// Attributes
|
154
|
+
sos::Object attributes;
|
155
|
+
|
156
|
+
/// Role
|
157
|
+
attributes.set(SerializeKey::Role, AssetRoleToString(role));
|
158
|
+
|
159
|
+
assetObject.set(SerializeKey::Attributes, attributes);
|
160
|
+
|
161
|
+
// Content
|
162
|
+
assetObject.set(SerializeKey::Content, sos::String(asset));
|
163
|
+
|
164
|
+
return assetObject;
|
165
|
+
}
|
166
|
+
|
167
|
+
sos::Object WrapPayload(const Payload& payload, const Action* action, ConversionContext& context)
|
168
|
+
{
|
169
|
+
sos::Object payloadObject;
|
170
|
+
|
171
|
+
// Reference
|
172
|
+
if (!payload.reference.id.empty()) {
|
173
|
+
payloadObject.set(SerializeKey::Reference, WrapReference(payload.reference));
|
174
|
+
}
|
175
|
+
|
176
|
+
// Name
|
177
|
+
payloadObject.set(SerializeKey::Name, sos::String(payload.name));
|
178
|
+
|
179
|
+
// Description
|
180
|
+
payloadObject.set(SerializeKey::Description, sos::String(payload.description));
|
181
|
+
|
182
|
+
// Headers
|
183
|
+
payloadObject.set(SerializeKey::Headers,
|
184
|
+
WrapCollection<Header>()(payload.headers, WrapHeader));
|
185
|
+
|
186
|
+
snowcrash::Asset payloadBody = renderPayloadBody(MakeNodeInfoWithoutSourceMap(payload),
|
187
|
+
action ? MakeNodeInfoWithoutSourceMap(*action) : NodeInfo<Action>(),
|
188
|
+
context).first;
|
189
|
+
|
190
|
+
snowcrash::Asset payloadSchema = renderPayloadSchema(MakeNodeInfoWithoutSourceMap(payload),
|
191
|
+
action ? MakeNodeInfoWithoutSourceMap(*action) : NodeInfo<Action>(),
|
192
|
+
context).first;
|
193
|
+
|
194
|
+
// Body
|
195
|
+
payloadObject.set(SerializeKey::Body, sos::String(payloadBody));
|
196
|
+
|
197
|
+
// Schema
|
198
|
+
payloadObject.set(SerializeKey::Schema, sos::String(payloadSchema));
|
199
|
+
|
200
|
+
// Content
|
201
|
+
sos::Array content;
|
202
|
+
|
203
|
+
/// Attributes
|
204
|
+
if (!payload.attributes.empty()) {
|
205
|
+
content.push(WrapDataStructure(payload.attributes, context));
|
206
|
+
}
|
207
|
+
|
208
|
+
/// Asset 'bodyExample'
|
209
|
+
if (!payload.body.empty()) {
|
210
|
+
content.push(WrapAsset(payload.body, BodyExampleAssetRole));
|
211
|
+
}
|
212
|
+
|
213
|
+
/// Asset 'bodySchema'
|
214
|
+
if (!payload.schema.empty()) {
|
215
|
+
content.push(WrapAsset(payload.schema, BodySchemaAssetRole));
|
216
|
+
}
|
217
|
+
|
218
|
+
payloadObject.set(SerializeKey::Content, content);
|
219
|
+
|
220
|
+
return payloadObject;
|
221
|
+
}
|
222
|
+
|
223
|
+
sos::Object WrapParameterValue(const Value& value)
|
224
|
+
{
|
225
|
+
sos::Object object;
|
226
|
+
object.set(SerializeKey::Value, sos::String(value.c_str()));
|
227
|
+
|
228
|
+
return object;
|
229
|
+
}
|
230
|
+
|
231
|
+
sos::Object WrapParameter(const Parameter& parameter)
|
232
|
+
{
|
233
|
+
sos::Object parameterObject;
|
234
|
+
|
235
|
+
// Name
|
236
|
+
parameterObject.set(SerializeKey::Name, sos::String(parameter.name));
|
237
|
+
|
238
|
+
// Description
|
239
|
+
parameterObject.set(SerializeKey::Description, sos::String(parameter.description));
|
240
|
+
|
241
|
+
// Type
|
242
|
+
parameterObject.set(SerializeKey::Type, sos::String(parameter.type));
|
243
|
+
|
244
|
+
// Use
|
245
|
+
parameterObject.set(SerializeKey::Required, sos::Boolean(parameter.use != snowcrash::OptionalParameterUse));
|
246
|
+
|
247
|
+
// Default Value
|
248
|
+
parameterObject.set(SerializeKey::Default, sos::String(parameter.defaultValue));
|
249
|
+
|
250
|
+
// Example Value
|
251
|
+
parameterObject.set(SerializeKey::Example, sos::String(parameter.exampleValue));
|
252
|
+
|
253
|
+
// Values
|
254
|
+
parameterObject.set(SerializeKey::Values,
|
255
|
+
WrapCollection<Value>()(parameter.values, WrapParameterValue));
|
256
|
+
|
257
|
+
return parameterObject;
|
258
|
+
}
|
259
|
+
|
260
|
+
sos::Object WrapTransactionExample(const TransactionExample& example, const Action& action, ConversionContext& context)
|
261
|
+
{
|
262
|
+
sos::Object exampleObject;
|
263
|
+
|
264
|
+
// Name
|
265
|
+
exampleObject.set(SerializeKey::Name, sos::String(example.name));
|
266
|
+
|
267
|
+
// Description
|
268
|
+
exampleObject.set(SerializeKey::Description, sos::String(example.description));
|
269
|
+
|
270
|
+
// Requests
|
271
|
+
exampleObject.set(SerializeKey::Requests,
|
272
|
+
WrapCollection<Request>()(example.requests, WrapPayload, &action, std::ref(context)));
|
273
|
+
|
274
|
+
// Responses
|
275
|
+
exampleObject.set(SerializeKey::Responses,
|
276
|
+
WrapCollection<Response>()(example.responses, WrapPayload, (Action *) NULL, std::ref(context)));
|
277
|
+
|
278
|
+
return exampleObject;
|
279
|
+
}
|
280
|
+
|
281
|
+
sos::Object WrapAction(const Action& action, ConversionContext& context)
|
282
|
+
{
|
283
|
+
sos::Object actionObject;
|
284
|
+
|
285
|
+
// Name
|
286
|
+
actionObject.set(SerializeKey::Name, sos::String(action.name));
|
287
|
+
|
288
|
+
// Description
|
289
|
+
actionObject.set(SerializeKey::Description, sos::String(action.description));
|
290
|
+
|
291
|
+
// HTTP Method
|
292
|
+
actionObject.set(SerializeKey::Method, sos::String(action.method));
|
293
|
+
|
294
|
+
// Parameters
|
295
|
+
actionObject.set(SerializeKey::Parameters,
|
296
|
+
WrapCollection<Parameter>()(action.parameters, WrapParameter));
|
297
|
+
|
298
|
+
// Attributes
|
299
|
+
sos::Object attributes;
|
300
|
+
|
301
|
+
/// Relation
|
302
|
+
attributes.set(SerializeKey::Relation, sos::String(action.relation.str));
|
303
|
+
|
304
|
+
/// URI Template
|
305
|
+
attributes.set(SerializeKey::URITemplate, sos::String(action.uriTemplate));
|
306
|
+
|
307
|
+
actionObject.set(SerializeKey::Attributes, attributes);
|
308
|
+
|
309
|
+
// Content
|
310
|
+
sos::Array content;
|
311
|
+
|
312
|
+
if (!action.attributes.empty()) {
|
313
|
+
content.push(WrapDataStructure(action.attributes, context));
|
314
|
+
}
|
315
|
+
|
316
|
+
actionObject.set(SerializeKey::Content, content);
|
317
|
+
|
318
|
+
// Transaction Examples
|
319
|
+
actionObject.set(SerializeKey::Examples,
|
320
|
+
WrapCollection<TransactionExample>()(action.examples, WrapTransactionExample, action, std::ref(context)));
|
321
|
+
|
322
|
+
return actionObject;
|
323
|
+
}
|
324
|
+
|
325
|
+
sos::Object WrapResource(const Resource& resource, ConversionContext& context)
|
326
|
+
{
|
327
|
+
sos::Object resourceObject;
|
328
|
+
|
329
|
+
// Element
|
330
|
+
resourceObject.set(SerializeKey::Element, ElementClassToString(Element::ResourceElement));
|
331
|
+
|
332
|
+
// Name
|
333
|
+
resourceObject.set(SerializeKey::Name, sos::String(resource.name));
|
334
|
+
|
335
|
+
// Description
|
336
|
+
resourceObject.set(SerializeKey::Description, sos::String(resource.description));
|
337
|
+
|
338
|
+
// URI Template
|
339
|
+
resourceObject.set(SerializeKey::URITemplate, sos::String(resource.uriTemplate));
|
340
|
+
|
341
|
+
// Model
|
342
|
+
sos::Object model = (resource.model.name.empty() ? sos::Object() : WrapPayload(resource.model, NULL, context));
|
343
|
+
resourceObject.set(SerializeKey::Model, model);
|
344
|
+
|
345
|
+
// Parameters
|
346
|
+
resourceObject.set(SerializeKey::Parameters,
|
347
|
+
WrapCollection<Parameter>()(resource.parameters, WrapParameter));
|
348
|
+
|
349
|
+
// Actions
|
350
|
+
resourceObject.set(SerializeKey::Actions,
|
351
|
+
WrapCollection<Action>()(resource.actions, WrapAction, std::ref(context)));
|
352
|
+
|
353
|
+
// Content
|
354
|
+
sos::Array content;
|
355
|
+
|
356
|
+
if (!resource.attributes.empty()) {
|
357
|
+
content.push(WrapDataStructure(resource.attributes, context));
|
358
|
+
}
|
359
|
+
|
360
|
+
resourceObject.set(SerializeKey::Content, content);
|
361
|
+
|
362
|
+
return resourceObject;
|
363
|
+
}
|
364
|
+
|
365
|
+
sos::Object WrapResourceGroup(const Element& resourceGroup, ConversionContext& context)
|
366
|
+
{
|
367
|
+
sos::Object resourceGroupObject;
|
368
|
+
|
369
|
+
// Name
|
370
|
+
resourceGroupObject.set(SerializeKey::Name, sos::String(resourceGroup.attributes.name));
|
371
|
+
|
372
|
+
// Description && Resources
|
373
|
+
std::string description;
|
374
|
+
sos::Array resources;
|
375
|
+
|
376
|
+
for (Elements::const_iterator it = resourceGroup.content.elements().begin();
|
377
|
+
it != resourceGroup.content.elements().end();
|
378
|
+
++it) {
|
379
|
+
|
380
|
+
if (it->element == Element::ResourceElement) {
|
381
|
+
resources.push(WrapResource(it->content.resource, context));
|
382
|
+
}
|
383
|
+
else if (it->element == Element::CopyElement) {
|
384
|
+
|
385
|
+
if (!description.empty()) {
|
386
|
+
snowcrash::TwoNewLines(description);
|
387
|
+
}
|
388
|
+
|
389
|
+
description += it->content.copy;
|
390
|
+
}
|
391
|
+
}
|
392
|
+
|
393
|
+
resourceGroupObject.set(SerializeKey::Description, sos::String(description));
|
394
|
+
resourceGroupObject.set(SerializeKey::Resources, resources);
|
395
|
+
|
396
|
+
return resourceGroupObject;
|
397
|
+
}
|
398
|
+
|
399
|
+
sos::Object WrapElement(const Element& element, ConversionContext& context)
|
400
|
+
{
|
401
|
+
sos::Object elementObject;
|
402
|
+
|
403
|
+
elementObject.set(SerializeKey::Element, ElementClassToString(element.element));
|
404
|
+
|
405
|
+
if (!element.attributes.name.empty()) {
|
406
|
+
|
407
|
+
sos::Object attributes;
|
408
|
+
|
409
|
+
attributes.set(SerializeKey::Name, sos::String(element.attributes.name));
|
410
|
+
elementObject.set(SerializeKey::Attributes, attributes);
|
411
|
+
}
|
412
|
+
|
413
|
+
switch (element.element) {
|
414
|
+
case Element::CopyElement:
|
415
|
+
{
|
416
|
+
elementObject.set(SerializeKey::Content, sos::String(element.content.copy));
|
417
|
+
break;
|
418
|
+
}
|
419
|
+
|
420
|
+
case Element::CategoryElement:
|
421
|
+
{
|
422
|
+
elementObject.set(SerializeKey::Content,
|
423
|
+
WrapCollection<Element>()(element.content.elements(), WrapElement, std::ref(context)));
|
424
|
+
break;
|
425
|
+
}
|
426
|
+
|
427
|
+
case Element::DataStructureElement:
|
428
|
+
{
|
429
|
+
return WrapDataStructure(element.content.dataStructure, context);
|
430
|
+
}
|
431
|
+
|
432
|
+
case Element::ResourceElement:
|
433
|
+
{
|
434
|
+
return WrapResource(element.content.resource, context);
|
435
|
+
}
|
436
|
+
|
437
|
+
default:
|
438
|
+
break;
|
439
|
+
}
|
440
|
+
|
441
|
+
return elementObject;
|
442
|
+
}
|
443
|
+
|
444
|
+
bool IsElementResourceGroup(const Element& element)
|
445
|
+
{
|
446
|
+
return element.element == Element::CategoryElement && element.category == Element::ResourceGroupCategory;
|
447
|
+
}
|
448
|
+
|
449
|
+
sos::Object WrapBlueprintAST(const Blueprint& blueprint, ConversionContext& context)
|
450
|
+
{
|
451
|
+
sos::Object blueprintObject;
|
452
|
+
|
453
|
+
// Version
|
454
|
+
blueprintObject.set(SerializeKey::Version, sos::String(AST_SERIALIZATION_VERSION));
|
455
|
+
|
456
|
+
// Metadata
|
457
|
+
blueprintObject.set(SerializeKey::Metadata,
|
458
|
+
WrapCollection<Metadata>()(blueprint.metadata, WrapKeyValue));
|
459
|
+
|
460
|
+
// Name
|
461
|
+
blueprintObject.set(SerializeKey::Name, sos::String(blueprint.name));
|
462
|
+
|
463
|
+
// Description
|
464
|
+
blueprintObject.set(SerializeKey::Description, sos::String(blueprint.description));
|
465
|
+
|
466
|
+
// Element
|
467
|
+
blueprintObject.set(SerializeKey::Element, ElementClassToString(blueprint.element));
|
468
|
+
|
469
|
+
// Resource Groups
|
470
|
+
blueprintObject.set(SerializeKey::ResourceGroups,
|
471
|
+
WrapCollectionIf<Element>()(blueprint.content.elements(), WrapResourceGroup, IsElementResourceGroup, context));
|
472
|
+
|
473
|
+
// Content
|
474
|
+
blueprintObject.set(SerializeKey::Content,
|
475
|
+
WrapCollection<Element>()(blueprint.content.elements(), WrapElement, std::ref(context)));
|
476
|
+
|
477
|
+
return blueprintObject;
|
478
|
+
}
|
479
|
+
|
480
|
+
sos::Object drafter::WrapBlueprint(const snowcrash::ParseResult<snowcrash::Blueprint>& blueprint, ConversionContext& context)
|
481
|
+
{
|
482
|
+
sos::Object blueprintObject;
|
483
|
+
snowcrash::Error error;
|
484
|
+
|
485
|
+
if (blueprint.report.error.code != snowcrash::Error::OK) {
|
486
|
+
throw blueprint.report.error;
|
487
|
+
}
|
488
|
+
|
489
|
+
try {
|
490
|
+
RegisterNamedTypes(MakeNodeInfo(blueprint.node.content.elements(), blueprint.sourceMap.content.elements()), context);
|
491
|
+
blueprintObject = WrapBlueprintAST(blueprint.node, context);
|
492
|
+
}
|
493
|
+
catch (std::exception& e) {
|
494
|
+
error = snowcrash::Error(e.what(), snowcrash::MSONError);
|
495
|
+
}
|
496
|
+
catch (snowcrash::Error& e) {
|
497
|
+
error = e;
|
498
|
+
}
|
499
|
+
|
500
|
+
context.GetNamedTypesRegistry().clearAll(true);
|
501
|
+
|
502
|
+
if (error.code != snowcrash::Error::OK) {
|
503
|
+
throw error;
|
504
|
+
}
|
505
|
+
|
506
|
+
return blueprintObject;
|
507
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
//
|
2
|
+
// SerializeAST.h
|
3
|
+
// drafter
|
4
|
+
//
|
5
|
+
// Created by Pavan Kumar Sunkara on 18/01/15.
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef DRAFTER_SERIALIZEAST_H
|
10
|
+
#define DRAFTER_SERIALIZEAST_H
|
11
|
+
|
12
|
+
#include "Serialize.h"
|
13
|
+
|
14
|
+
namespace drafter {
|
15
|
+
|
16
|
+
class ConversionContext;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* NOTE: depracated as entry point for serialization
|
20
|
+
*
|
21
|
+
* Since version 2.0.0 you should use everywhere `WrapResult()` function instead of this one
|
22
|
+
*
|
23
|
+
* This function now works just as AST serialization wrapper
|
24
|
+
* additionaly there is changed function interface
|
25
|
+
*/
|
26
|
+
sos::Object WrapBlueprint(const snowcrash::ParseResult<snowcrash::Blueprint>& blueprint, ConversionContext& context);
|
27
|
+
}
|
28
|
+
|
29
|
+
#endif
|
@@ -0,0 +1,170 @@
|
|
1
|
+
//
|
2
|
+
// SerializeResult.cc
|
3
|
+
// drafter
|
4
|
+
//
|
5
|
+
// Created by Jiri Kratochvil on 27-02-2015
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#include "RefractAPI.h"
|
10
|
+
#include "RefractDataStructure.h"
|
11
|
+
|
12
|
+
#include "SerializeResult.h"
|
13
|
+
#include "SerializeSourcemap.h"
|
14
|
+
#include "SerializeAST.h"
|
15
|
+
|
16
|
+
#include "SourceAnnotation.h"
|
17
|
+
#include "SectionProcessor.h"
|
18
|
+
|
19
|
+
#include "refract/Build.h"
|
20
|
+
#include "refract/ElementInserter.h"
|
21
|
+
|
22
|
+
#include "NamedTypesRegistry.h"
|
23
|
+
#include "ConversionContext.h"
|
24
|
+
|
25
|
+
using namespace drafter;
|
26
|
+
|
27
|
+
sos::Object WrapLocation(const mdp::BytesRange& range)
|
28
|
+
{
|
29
|
+
sos::Object location;
|
30
|
+
|
31
|
+
location.set(SerializeKey::AnnotationLocationIndex, sos::Number(range.location));
|
32
|
+
location.set(SerializeKey::AnnotationLocationLength, sos::Number(range.length));
|
33
|
+
|
34
|
+
return location;
|
35
|
+
}
|
36
|
+
|
37
|
+
sos::Object drafter::WrapAnnotation(const snowcrash::SourceAnnotation& annotation)
|
38
|
+
{
|
39
|
+
sos::Object object;
|
40
|
+
|
41
|
+
object.set(SerializeKey::AnnotationCode, sos::Number(annotation.code));
|
42
|
+
object.set(SerializeKey::AnnotationMessage, sos::String(annotation.message));
|
43
|
+
object.set(SerializeKey::AnnotationLocation, WrapCollection<mdp::BytesRange>()(annotation.location, WrapLocation));
|
44
|
+
|
45
|
+
return object;
|
46
|
+
}
|
47
|
+
|
48
|
+
sos::Object WrapParseResultAST(snowcrash::ParseResult<snowcrash::Blueprint>& blueprint,
|
49
|
+
ConversionContext& context)
|
50
|
+
{
|
51
|
+
sos::Object object;
|
52
|
+
snowcrash::Error error;
|
53
|
+
|
54
|
+
object.set(SerializeKey::Version, sos::String(PARSE_RESULT_SERIALIZATION_VERSION));
|
55
|
+
|
56
|
+
if (blueprint.report.error.code == snowcrash::Error::OK) {
|
57
|
+
try {
|
58
|
+
object.set(SerializeKey::Ast, WrapBlueprint(blueprint, context));
|
59
|
+
|
60
|
+
if (context.options.generateSourceMap) {
|
61
|
+
object.set(SerializeKey::Sourcemap, WrapBlueprintSourcemap(blueprint.sourceMap, context));
|
62
|
+
}
|
63
|
+
}
|
64
|
+
catch (std::exception& e) {
|
65
|
+
error = snowcrash::Error(e.what(), snowcrash::MSONError);
|
66
|
+
}
|
67
|
+
catch (snowcrash::Error& e) {
|
68
|
+
error = e;
|
69
|
+
}
|
70
|
+
|
71
|
+
if (error.code != snowcrash::Error::OK) {
|
72
|
+
blueprint.report.error = error;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
for (auto& warning : context.warnings) {
|
77
|
+
blueprint.report.warnings.push_back(warning);
|
78
|
+
}
|
79
|
+
|
80
|
+
object.set(SerializeKey::Error, WrapAnnotation(blueprint.report.error));
|
81
|
+
object.set(SerializeKey::Warnings, WrapCollection<snowcrash::SourceAnnotation>()(blueprint.report.warnings, WrapAnnotation));
|
82
|
+
|
83
|
+
return object;
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
namespace helper {
|
88
|
+
|
89
|
+
struct AnnotationToRefract {
|
90
|
+
|
91
|
+
const std::string& key;
|
92
|
+
|
93
|
+
AnnotationToRefract(const std::string& key) : key(key) {}
|
94
|
+
|
95
|
+
refract::IElement* operator()(snowcrash::SourceAnnotation& annotation) {
|
96
|
+
return drafter::AnnotationToRefract(annotation, key);
|
97
|
+
}
|
98
|
+
};
|
99
|
+
}
|
100
|
+
|
101
|
+
refract::IElement* drafter::WrapParseResultRefract(snowcrash::ParseResult<snowcrash::Blueprint>& blueprint,
|
102
|
+
ConversionContext& context)
|
103
|
+
{
|
104
|
+
snowcrash::Error error;
|
105
|
+
refract::IElement* blueprintRefract = NULL;
|
106
|
+
|
107
|
+
refract::ArrayElement* parseResult = new refract::ArrayElement;
|
108
|
+
parseResult->element(SerializeKey::ParseResult);
|
109
|
+
|
110
|
+
if (blueprint.report.error.code == snowcrash::Error::OK) {
|
111
|
+
try {
|
112
|
+
RegisterNamedTypes(MakeNodeInfo(blueprint.node.content.elements(), blueprint.sourceMap.content.elements()), context);
|
113
|
+
blueprintRefract = BlueprintToRefract(MakeNodeInfo(blueprint.node, blueprint.sourceMap), context);
|
114
|
+
}
|
115
|
+
catch (std::exception& e) {
|
116
|
+
error = snowcrash::Error(e.what(), snowcrash::MSONError);
|
117
|
+
}
|
118
|
+
catch (snowcrash::Error& e) {
|
119
|
+
error = e;
|
120
|
+
}
|
121
|
+
|
122
|
+
context.GetNamedTypesRegistry().clearAll(true);
|
123
|
+
|
124
|
+
if (error.code != snowcrash::Error::OK) {
|
125
|
+
blueprint.report.error = error;
|
126
|
+
}
|
127
|
+
|
128
|
+
if (blueprintRefract) {
|
129
|
+
parseResult->push_back(blueprintRefract);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
if (blueprint.report.error.code != snowcrash::Error::OK) {
|
134
|
+
parseResult->push_back(helper::AnnotationToRefract(SerializeKey::Error)(blueprint.report.error));
|
135
|
+
}
|
136
|
+
|
137
|
+
snowcrash::Warnings& warnings = blueprint.report.warnings;
|
138
|
+
if (!context.warnings.empty()) {
|
139
|
+
warnings.insert(warnings.end(), context.warnings.begin(), context.warnings.end());
|
140
|
+
}
|
141
|
+
|
142
|
+
if (!warnings.empty()) {
|
143
|
+
std::transform(warnings.begin(), warnings.end(),
|
144
|
+
refract::ElementInserter(*parseResult),
|
145
|
+
helper::AnnotationToRefract(SerializeKey::Warning));
|
146
|
+
}
|
147
|
+
|
148
|
+
return parseResult;
|
149
|
+
}
|
150
|
+
|
151
|
+
sos::Object drafter::WrapResult(snowcrash::ParseResult<snowcrash::Blueprint>& blueprint,
|
152
|
+
const WrapperOptions& options)
|
153
|
+
{
|
154
|
+
ConversionContext context(options);
|
155
|
+
|
156
|
+
if (options.astType == RefractASTType) {
|
157
|
+
refract::IElement* parseResult = WrapParseResultRefract(blueprint, context);
|
158
|
+
|
159
|
+
sos::Object result = SerializeRefract(parseResult, context);
|
160
|
+
|
161
|
+
if (parseResult) {
|
162
|
+
delete parseResult;
|
163
|
+
}
|
164
|
+
|
165
|
+
return result;
|
166
|
+
}
|
167
|
+
else {
|
168
|
+
return WrapParseResultAST(blueprint, context);
|
169
|
+
}
|
170
|
+
}
|