lounge_lizard 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,733 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PayloadParser.h
|
|
3
|
+
// snowcrash
|
|
4
|
+
//
|
|
5
|
+
// Created by Zdenek Nemec on 5/7/13.
|
|
6
|
+
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef SNOWCRASH_PARSEPAYLOAD_H
|
|
10
|
+
#define SNOWCRASH_PARSEPAYLOAD_H
|
|
11
|
+
|
|
12
|
+
#include "SectionParser.h"
|
|
13
|
+
#include "RegexMatch.h"
|
|
14
|
+
#include "AssetParser.h"
|
|
15
|
+
#include "HeadersParser.h"
|
|
16
|
+
#include "ParametersParser.h"
|
|
17
|
+
#include "AttributesParser.h"
|
|
18
|
+
|
|
19
|
+
/** Media type in brackets regex */
|
|
20
|
+
#define MEDIA_TYPE "([[:blank:]]*\\(([^\\)]*)\\))"
|
|
21
|
+
|
|
22
|
+
namespace snowcrash {
|
|
23
|
+
|
|
24
|
+
/** Internal type alias for Collection iterator of Response */
|
|
25
|
+
typedef Collection<Response>::const_iterator ResponseIterator;
|
|
26
|
+
typedef Collection<Request>::const_iterator RequestIterator;
|
|
27
|
+
|
|
28
|
+
/// Payload signature
|
|
29
|
+
enum PayloadSignature {
|
|
30
|
+
NoPayloadSignature = 0,
|
|
31
|
+
RequestPayloadSignature, /// < Request payload.
|
|
32
|
+
ResponsePayloadSignature, /// < Response payload.
|
|
33
|
+
ModelPayloadSignature, /// < Resource Model payload.
|
|
34
|
+
UndefinedPayloadSignature = -1
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Request matching regex */
|
|
38
|
+
const char* const RequestRegex = "^[[:blank:]]*[Rr]equest([[:blank:]]" SYMBOL_IDENTIFIER ")?" MEDIA_TYPE "?[[:blank:]]*";
|
|
39
|
+
|
|
40
|
+
/** Response matching regex */
|
|
41
|
+
const char* const ResponseRegex = "^[[:blank:]]*[Rr]esponse([[:blank:][:digit:]]+)?" MEDIA_TYPE "?[[:blank:]]*";
|
|
42
|
+
|
|
43
|
+
/** Model matching regex */
|
|
44
|
+
const char* const ModelRegex = "^[[:blank:]]*(" SYMBOL_IDENTIFIER "[[:blank:]]+)?[Mm]odel" MEDIA_TYPE "?[[:blank:]]*$";
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Payload Section Processor
|
|
48
|
+
*/
|
|
49
|
+
template<>
|
|
50
|
+
struct SectionProcessor<Payload> : public SectionProcessorBase<Payload> {
|
|
51
|
+
|
|
52
|
+
static MarkdownNodeIterator processSignature(const MarkdownNodeIterator& node,
|
|
53
|
+
const MarkdownNodes& siblings,
|
|
54
|
+
SectionParserData& pd,
|
|
55
|
+
SectionLayout& layout,
|
|
56
|
+
const ParseResultRef<Payload>& out) {
|
|
57
|
+
|
|
58
|
+
mdp::ByteBuffer signature, remainingContent;
|
|
59
|
+
signature = GetFirstLine(node->text, remainingContent);
|
|
60
|
+
|
|
61
|
+
parseSignature(node, pd, signature, out);
|
|
62
|
+
|
|
63
|
+
// WARN: missing status code
|
|
64
|
+
if (out.node.name.empty() &&
|
|
65
|
+
(pd.sectionContext() == ResponseSectionType || pd.sectionContext() == ResponseBodySectionType)) {
|
|
66
|
+
|
|
67
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
|
68
|
+
out.report.warnings.push_back(Warning("missing response HTTP status code, assuming 'Response 200'",
|
|
69
|
+
EmptyDefinitionWarning,
|
|
70
|
+
sourceMap));
|
|
71
|
+
out.node.name = "200";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!remainingContent.empty()) {
|
|
75
|
+
if (!isAbbreviated(pd.sectionContext())) {
|
|
76
|
+
out.node.description = remainingContent;
|
|
77
|
+
|
|
78
|
+
if (pd.exportSourceMap() && !out.node.description.empty()) {
|
|
79
|
+
out.sourceMap.description.sourceMap.append(node->sourceMap);
|
|
80
|
+
}
|
|
81
|
+
} else if (!parseModelReference(node, pd, remainingContent, out)) {
|
|
82
|
+
|
|
83
|
+
// NOTE: NOT THE CORRECT WAY TO DO THIS
|
|
84
|
+
// https://github.com/apiaryio/snowcrash/commit/a7c5868e62df0048a85e2f9aeeb42c3b3e0a2f07#commitcomment-7322085
|
|
85
|
+
pd.sectionsContext.push_back(BodySectionType);
|
|
86
|
+
CodeBlockUtility::signatureContentAsCodeBlock(node, pd, out.report, out.node.body);
|
|
87
|
+
TwoNewLines(out.node.body);
|
|
88
|
+
pd.sectionsContext.pop_back();
|
|
89
|
+
|
|
90
|
+
if (pd.exportSourceMap() && !out.node.body.empty()) {
|
|
91
|
+
out.sourceMap.body.sourceMap.append(node->sourceMap);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (pd.exportSourceMap()) {
|
|
97
|
+
out.sourceMap.sourceMap = node->sourceMap;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return ++MarkdownNodeIterator(node);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static MarkdownNodeIterator processContent(const MarkdownNodeIterator& node,
|
|
104
|
+
const MarkdownNodes& siblings,
|
|
105
|
+
SectionParserData& pd,
|
|
106
|
+
const ParseResultRef<Payload>& out) {
|
|
107
|
+
|
|
108
|
+
mdp::ByteBuffer content;
|
|
109
|
+
|
|
110
|
+
if (!out.node.reference.id.empty()) {
|
|
111
|
+
//WARN: ignoring extraneous content after model reference
|
|
112
|
+
std::stringstream ss;
|
|
113
|
+
|
|
114
|
+
ss << "ignoring extraneous content after model reference";
|
|
115
|
+
ss << ", expected model reference only e.g. '[" << out.node.reference.id << "][]'";
|
|
116
|
+
|
|
117
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
|
118
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
119
|
+
IgnoringWarning,
|
|
120
|
+
sourceMap));
|
|
121
|
+
} else {
|
|
122
|
+
|
|
123
|
+
if (!out.node.body.empty() ||
|
|
124
|
+
node->type != mdp::ParagraphMarkdownNodeType ||
|
|
125
|
+
!parseModelReference(node, pd, node->text, out)) {
|
|
126
|
+
|
|
127
|
+
// NOTE: NOT THE CORRECT WAY TO DO THIS
|
|
128
|
+
// https://github.com/apiaryio/snowcrash/commit/a7c5868e62df0048a85e2f9aeeb42c3b3e0a2f07#commitcomment-7322085
|
|
129
|
+
pd.sectionsContext.push_back(BodySectionType);
|
|
130
|
+
CodeBlockUtility::contentAsCodeBlock(node, pd, out.report, content);
|
|
131
|
+
pd.sectionsContext.pop_back();
|
|
132
|
+
|
|
133
|
+
out.node.body += content;
|
|
134
|
+
|
|
135
|
+
if (pd.exportSourceMap() && !content.empty()) {
|
|
136
|
+
out.sourceMap.body.sourceMap.append(node->sourceMap);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return ++MarkdownNodeIterator(node);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
|
|
145
|
+
const MarkdownNodes& siblings,
|
|
146
|
+
SectionParserData& pd,
|
|
147
|
+
const ParseResultRef<Payload>& out) {
|
|
148
|
+
|
|
149
|
+
switch (pd.sectionContext()) {
|
|
150
|
+
case HeadersSectionType:
|
|
151
|
+
{
|
|
152
|
+
ParseResultRef<Headers> headers(out.report, out.node.headers, out.sourceMap.headers);
|
|
153
|
+
return HeadersParser::parse(node, siblings, pd, headers);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
case AttributesSectionType:
|
|
157
|
+
{
|
|
158
|
+
ParseResultRef<Attributes> attributes(out.report, out.node.attributes, out.sourceMap.attributes);
|
|
159
|
+
return AttributesParser::parse(node, siblings, pd, attributes);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
case ParametersSectionType:
|
|
163
|
+
{
|
|
164
|
+
if (pd.parentSectionContext() != RequestSectionType) {
|
|
165
|
+
// WARN: Only request section can have parameters section
|
|
166
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
|
167
|
+
out.report.warnings.push_back(Warning("ignoring parameters section in a non request payload section",
|
|
168
|
+
IgnoringWarning,
|
|
169
|
+
sourceMap));
|
|
170
|
+
|
|
171
|
+
return ++MarkdownNodeIterator(node);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
ParseResultRef<Parameters> parameters(out.report, out.node.parameters, out.sourceMap.parameters);
|
|
175
|
+
return ParametersParser::parse(node, siblings, pd, parameters);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
case BodySectionType:
|
|
179
|
+
{
|
|
180
|
+
if (!out.node.body.empty()) {
|
|
181
|
+
// WARN: Multiple body section
|
|
182
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
|
183
|
+
out.report.warnings.push_back(Warning("ignoring additional 'body' content, it is already defined",
|
|
184
|
+
RedefinitionWarning,
|
|
185
|
+
sourceMap));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
ParseResultRef<Asset> asset(out.report, out.node.body, out.sourceMap.body);
|
|
189
|
+
return AssetParser::parse(node, siblings, pd, asset);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
case SchemaSectionType:
|
|
193
|
+
{
|
|
194
|
+
if (!out.node.schema.empty()) {
|
|
195
|
+
// WARN: Multiple schema section
|
|
196
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
|
197
|
+
out.report.warnings.push_back(Warning("ignoring additional 'schema' content, it is already defined",
|
|
198
|
+
RedefinitionWarning,
|
|
199
|
+
sourceMap));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
ParseResultRef<Asset> asset(out.report, out.node.schema, out.sourceMap.schema);
|
|
203
|
+
return AssetParser::parse(node, siblings, pd, asset);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
default:
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return node;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
static MarkdownNodeIterator processUnexpectedNode(const MarkdownNodeIterator& node,
|
|
214
|
+
const MarkdownNodes& siblings,
|
|
215
|
+
SectionParserData& pd,
|
|
216
|
+
SectionType& sectionType,
|
|
217
|
+
const ParseResultRef<Payload>& out) {
|
|
218
|
+
|
|
219
|
+
if ((node->type == mdp::ParagraphMarkdownNodeType ||
|
|
220
|
+
node->type == mdp::CodeMarkdownNodeType) &&
|
|
221
|
+
sectionType == BodySectionType) {
|
|
222
|
+
|
|
223
|
+
mdp::ByteBuffer content = CodeBlockUtility::addDanglingAsset(node, pd, sectionType, out.report, out.node.body);
|
|
224
|
+
|
|
225
|
+
if (pd.exportSourceMap() && !content.empty()) {
|
|
226
|
+
out.sourceMap.body.sourceMap.append(node->sourceMap);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return ++MarkdownNodeIterator(node);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return SectionProcessorBase<Payload>::processUnexpectedNode(node, siblings, pd, sectionType, out);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
static bool isDescriptionNode(const MarkdownNodeIterator& node,
|
|
236
|
+
SectionType sectionType) {
|
|
237
|
+
|
|
238
|
+
if (!isAbbreviated(sectionType) &&
|
|
239
|
+
SectionProcessorBase<Payload>::isDescriptionNode(node, sectionType)) {
|
|
240
|
+
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
static bool isContentNode(const MarkdownNodeIterator& node,
|
|
248
|
+
SectionType sectionType) {
|
|
249
|
+
|
|
250
|
+
if (isAbbreviated(sectionType) &&
|
|
251
|
+
(SectionKeywordSignature(node) == UndefinedSectionType)) {
|
|
252
|
+
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
|
260
|
+
|
|
261
|
+
if (node->type == mdp::ListItemMarkdownNodeType
|
|
262
|
+
&& !node->children().empty()) {
|
|
263
|
+
|
|
264
|
+
SectionType nestedType = UndefinedSectionType;
|
|
265
|
+
PayloadSignature signature = payloadSignature(node);
|
|
266
|
+
|
|
267
|
+
if (signature == NoPayloadSignature) {
|
|
268
|
+
return UndefinedSectionType;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
for (MarkdownNodeIterator child = node->children().begin();
|
|
272
|
+
child != node->children().end();
|
|
273
|
+
++child) {
|
|
274
|
+
|
|
275
|
+
nestedType = nestedSectionType(child);
|
|
276
|
+
|
|
277
|
+
if (nestedType != UndefinedSectionType) {
|
|
278
|
+
return getSectionType(signature, nestedType);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Return abbreviated signature
|
|
283
|
+
return getSectionType(signature, nestedType);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return UndefinedSectionType;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
static SectionType nestedSectionType(const MarkdownNodeIterator& node) {
|
|
290
|
+
|
|
291
|
+
SectionType nestedType = UndefinedSectionType;
|
|
292
|
+
|
|
293
|
+
// Check if headers section
|
|
294
|
+
nestedType = SectionProcessor<Headers>::sectionType(node);
|
|
295
|
+
|
|
296
|
+
if (nestedType != UndefinedSectionType) {
|
|
297
|
+
return nestedType;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Check if asset section
|
|
301
|
+
nestedType = SectionProcessor<Asset>::sectionType(node);
|
|
302
|
+
|
|
303
|
+
if (nestedType != UndefinedSectionType) {
|
|
304
|
+
return nestedType;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Check if attributes section
|
|
308
|
+
nestedType = SectionProcessor<Attributes>::sectionType(node);
|
|
309
|
+
|
|
310
|
+
if (nestedType != UndefinedSectionType) {
|
|
311
|
+
return nestedType;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Check if parameters section
|
|
315
|
+
nestedType = SectionProcessor<Parameters>::sectionType(node);
|
|
316
|
+
|
|
317
|
+
if (nestedType != UndefinedSectionType) {
|
|
318
|
+
return nestedType;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return UndefinedSectionType;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
static void finalize(const MarkdownNodeIterator& node,
|
|
325
|
+
SectionParserData& pd,
|
|
326
|
+
const ParseResultRef<Payload>& out) {
|
|
327
|
+
|
|
328
|
+
SectionType sectionType = pd.sectionContext();
|
|
329
|
+
|
|
330
|
+
if (sectionType == RequestSectionType || sectionType == RequestBodySectionType) {
|
|
331
|
+
|
|
332
|
+
checkRequest(node, pd, out);
|
|
333
|
+
}
|
|
334
|
+
else if (sectionType == ResponseSectionType || sectionType == ResponseBodySectionType) {
|
|
335
|
+
|
|
336
|
+
checkResponse(node, pd, out);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Resolve payload signature */
|
|
341
|
+
static PayloadSignature payloadSignature(const MarkdownNodeIterator& node) {
|
|
342
|
+
|
|
343
|
+
mdp::ByteBuffer subject = node->children().front().text;
|
|
344
|
+
mdp::ByteBuffer signature;
|
|
345
|
+
mdp::ByteBuffer remainingContent;
|
|
346
|
+
|
|
347
|
+
signature = GetFirstLine(subject, remainingContent);
|
|
348
|
+
TrimString(signature);
|
|
349
|
+
|
|
350
|
+
if (RegexMatch(signature, RequestRegex))
|
|
351
|
+
return RequestPayloadSignature;
|
|
352
|
+
|
|
353
|
+
if (RegexMatch(signature, ResponseRegex))
|
|
354
|
+
return ResponsePayloadSignature;
|
|
355
|
+
|
|
356
|
+
if (RegexMatch(signature, ModelRegex))
|
|
357
|
+
return ModelPayloadSignature;
|
|
358
|
+
|
|
359
|
+
return NoPayloadSignature;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/** Get SectionType from PayloadSignature and nestedSectionType */
|
|
363
|
+
static SectionType getSectionType(PayloadSignature signature,
|
|
364
|
+
SectionType nestedType) {
|
|
365
|
+
|
|
366
|
+
switch (signature) {
|
|
367
|
+
case RequestPayloadSignature:
|
|
368
|
+
return (nestedType != UndefinedSectionType) ? RequestSectionType : RequestBodySectionType;
|
|
369
|
+
|
|
370
|
+
case ResponsePayloadSignature:
|
|
371
|
+
return (nestedType != UndefinedSectionType) ? ResponseSectionType : ResponseBodySectionType;
|
|
372
|
+
|
|
373
|
+
case ModelPayloadSignature:
|
|
374
|
+
return (nestedType != UndefinedSectionType) ? ModelSectionType : ModelBodySectionType;
|
|
375
|
+
|
|
376
|
+
default:
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return UndefinedSectionType;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** True if abbreviated section type */
|
|
384
|
+
static bool isAbbreviated(SectionType sectionType) {
|
|
385
|
+
|
|
386
|
+
return (sectionType == RequestBodySectionType ||
|
|
387
|
+
sectionType == ResponseBodySectionType ||
|
|
388
|
+
sectionType == ModelBodySectionType);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/** Given the signature, parse it */
|
|
392
|
+
static bool parseSignature(const MarkdownNodeIterator& node,
|
|
393
|
+
SectionParserData& pd,
|
|
394
|
+
const mdp::ByteBuffer& signature,
|
|
395
|
+
const ParseResultRef<Payload>& out) {
|
|
396
|
+
|
|
397
|
+
const char* regex;
|
|
398
|
+
mdp::ByteBuffer mediaType;
|
|
399
|
+
CaptureGroups captureGroups;
|
|
400
|
+
|
|
401
|
+
switch (pd.sectionContext()) {
|
|
402
|
+
case RequestSectionType:
|
|
403
|
+
case RequestBodySectionType:
|
|
404
|
+
regex = RequestRegex;
|
|
405
|
+
break;
|
|
406
|
+
|
|
407
|
+
case ResponseSectionType:
|
|
408
|
+
case ResponseBodySectionType:
|
|
409
|
+
regex = ResponseRegex;
|
|
410
|
+
break;
|
|
411
|
+
|
|
412
|
+
case ModelSectionType:
|
|
413
|
+
case ModelBodySectionType:
|
|
414
|
+
regex = ModelRegex;
|
|
415
|
+
break;
|
|
416
|
+
|
|
417
|
+
default:
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
if (RegexCapture(signature, regex, captureGroups, 5) &&
|
|
422
|
+
!captureGroups.empty()) {
|
|
423
|
+
|
|
424
|
+
mdp::ByteBuffer target = signature;
|
|
425
|
+
mdp::ByteBuffer::size_type pos = target.find(captureGroups[0]);
|
|
426
|
+
|
|
427
|
+
if (pos != mdp::ByteBuffer::npos) {
|
|
428
|
+
target.replace(pos, captureGroups[0].length(), mdp::ByteBuffer());
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
TrimString(target);
|
|
432
|
+
|
|
433
|
+
if (!target.empty()) {
|
|
434
|
+
// WARN: unable to parse payload signature
|
|
435
|
+
std::stringstream ss;
|
|
436
|
+
ss << "unable to parse " << SectionName(pd.sectionContext()) << " signature, expected ";
|
|
437
|
+
|
|
438
|
+
switch (pd.sectionContext()) {
|
|
439
|
+
case RequestSectionType:
|
|
440
|
+
case RequestBodySectionType:
|
|
441
|
+
ss << "'request [<identifier>] [(<media type>)]'";
|
|
442
|
+
break;
|
|
443
|
+
|
|
444
|
+
case ResponseBodySectionType:
|
|
445
|
+
case ResponseSectionType:
|
|
446
|
+
ss << "'response [<HTTP status code>] [(<media type>)]'";
|
|
447
|
+
break;
|
|
448
|
+
|
|
449
|
+
case ModelSectionType:
|
|
450
|
+
case ModelBodySectionType:
|
|
451
|
+
ss << "'model [(<media type>)]'";
|
|
452
|
+
break;
|
|
453
|
+
|
|
454
|
+
default:
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
|
459
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
460
|
+
FormattingWarning,
|
|
461
|
+
sourceMap));
|
|
462
|
+
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (pd.sectionContext() == ModelSectionType ||
|
|
467
|
+
pd.sectionContext() == ModelBodySectionType) {
|
|
468
|
+
|
|
469
|
+
out.node.name = captureGroups[2];
|
|
470
|
+
mediaType = captureGroups[4];
|
|
471
|
+
} else if (pd.sectionContext() == RequestSectionType ||
|
|
472
|
+
pd.sectionContext() == RequestBodySectionType) {
|
|
473
|
+
|
|
474
|
+
out.node.name = captureGroups[1];
|
|
475
|
+
mediaType = captureGroups[4];
|
|
476
|
+
} else {
|
|
477
|
+
out.node.name = captureGroups[1];
|
|
478
|
+
mediaType = captureGroups[3];
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
TrimString(out.node.name);
|
|
482
|
+
TrimString(mediaType);
|
|
483
|
+
|
|
484
|
+
if (pd.exportSourceMap() && !out.node.name.empty()) {
|
|
485
|
+
out.sourceMap.name.sourceMap = node->sourceMap;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (!mediaType.empty()) {
|
|
489
|
+
Header header = std::make_pair(HTTPHeaderName::ContentType, mediaType);
|
|
490
|
+
out.node.headers.push_back(header);
|
|
491
|
+
|
|
492
|
+
if (pd.exportSourceMap()) {
|
|
493
|
+
SourceMap<Header> headerSM;
|
|
494
|
+
headerSM.sourceMap = node->sourceMap;
|
|
495
|
+
out.sourceMap.headers.collection.push_back(headerSM);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (pd.exportSourceMap()) {
|
|
500
|
+
out.sourceMap.sourceMap = node->sourceMap;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
return true;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/** Given the reference id(name), initializes reference of the payload accordingly (if possible resolve it) */
|
|
508
|
+
static bool parseModelReference(const MarkdownNodeIterator& node,
|
|
509
|
+
SectionParserData& pd,
|
|
510
|
+
mdp::ByteBuffer& source,
|
|
511
|
+
const ParseResultRef<Payload>& out) {
|
|
512
|
+
|
|
513
|
+
Identifier symbol;
|
|
514
|
+
|
|
515
|
+
TrimString(source);
|
|
516
|
+
|
|
517
|
+
if (GetModelReference(source, symbol)) {
|
|
518
|
+
|
|
519
|
+
out.node.reference.id = symbol;
|
|
520
|
+
out.node.reference.meta.node = node;
|
|
521
|
+
out.node.reference.type = Reference::ModelReference;
|
|
522
|
+
|
|
523
|
+
if (pd.exportSourceMap() && !symbol.empty()) {
|
|
524
|
+
out.sourceMap.reference.sourceMap = node->sourceMap;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// If model has not been defined yet in model table
|
|
528
|
+
if (pd.modelTable.find(symbol) == pd.modelTable.end()) {
|
|
529
|
+
|
|
530
|
+
out.node.reference.meta.state = Reference::StatePending;
|
|
531
|
+
|
|
532
|
+
return true;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
out.node.reference.meta.state = Reference::StateResolved;
|
|
536
|
+
|
|
537
|
+
assingReferredPayload(pd, out);
|
|
538
|
+
|
|
539
|
+
return true;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* \brief Assigns the reference, referred as reference id(name), into the payload
|
|
547
|
+
* \param pd Section parser state
|
|
548
|
+
* \param out Processed output
|
|
549
|
+
*/
|
|
550
|
+
static void assingReferredPayload(SectionParserData& pd,
|
|
551
|
+
const ParseResultRef<Payload>& out) {
|
|
552
|
+
|
|
553
|
+
SourceMap<ResourceModel> modelSM;
|
|
554
|
+
ResourceModel model = pd.modelTable.find(out.node.reference.id)->second;
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
out.node.description = model.description;
|
|
558
|
+
out.node.parameters = model.parameters;
|
|
559
|
+
|
|
560
|
+
HeaderIterator modelContentTypeIt = std::find_if(model.headers.begin(),
|
|
561
|
+
model.headers.end(),
|
|
562
|
+
std::bind2nd(MatchFirstWith<Header, std::string>(),
|
|
563
|
+
HTTPHeaderName::ContentType));
|
|
564
|
+
|
|
565
|
+
bool isPayloadContentType = !out.node.headers.empty();
|
|
566
|
+
bool isModelContentType = modelContentTypeIt != model.headers.end();
|
|
567
|
+
|
|
568
|
+
if (isPayloadContentType && isModelContentType) {
|
|
569
|
+
|
|
570
|
+
// WARN: Ignoring payload content-type, when referencing a model with headers
|
|
571
|
+
std::stringstream ss;
|
|
572
|
+
|
|
573
|
+
ss << "ignoring additional " << SectionName(pd.sectionContext()) << " header(s), ";
|
|
574
|
+
ss << "specify this header(s) in the referenced model definition instead";
|
|
575
|
+
|
|
576
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(out.node.reference.meta.node->sourceMap, pd.sourceCharacterIndex);
|
|
577
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
578
|
+
IgnoringWarning,
|
|
579
|
+
sourceMap));
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
if (isPayloadContentType && !isModelContentType) {
|
|
583
|
+
out.node.headers.insert(out.node.headers.end(), model.headers.begin(), model.headers.end());
|
|
584
|
+
} else {
|
|
585
|
+
out.node.headers = model.headers;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
out.node.body = model.body;
|
|
589
|
+
out.node.schema = model.schema;
|
|
590
|
+
|
|
591
|
+
if (pd.exportSourceMap()) {
|
|
592
|
+
|
|
593
|
+
modelSM = pd.modelSourceMapTable.at(out.node.reference.id);
|
|
594
|
+
|
|
595
|
+
out.sourceMap.description = modelSM.description;
|
|
596
|
+
out.sourceMap.parameters = modelSM.parameters;
|
|
597
|
+
out.sourceMap.body = modelSM.body;
|
|
598
|
+
out.sourceMap.schema = modelSM.schema;
|
|
599
|
+
|
|
600
|
+
if (isPayloadContentType && !isModelContentType) {
|
|
601
|
+
out.sourceMap.headers.collection.insert(out.sourceMap.headers.collection.end(), modelSM.headers.collection.begin(), modelSM.headers.collection.end());
|
|
602
|
+
} else {
|
|
603
|
+
out.sourceMap.headers = modelSM.headers;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* \brief Checks request given as out
|
|
610
|
+
* \param node Markdown node
|
|
611
|
+
* \param pd Section parser state
|
|
612
|
+
* \param out Processed output
|
|
613
|
+
*/
|
|
614
|
+
static void checkRequest(const MarkdownNodeIterator& node,
|
|
615
|
+
SectionParserData& pd,
|
|
616
|
+
const ParseResultRef<Payload>& out) {
|
|
617
|
+
|
|
618
|
+
bool warnEmptyBody = false;
|
|
619
|
+
|
|
620
|
+
mdp::ByteBuffer contentLength;
|
|
621
|
+
mdp::ByteBuffer transferEncoding;
|
|
622
|
+
|
|
623
|
+
for (HeaderIterator it = out.node.headers.begin();
|
|
624
|
+
it != out.node.headers.end();
|
|
625
|
+
++it) {
|
|
626
|
+
|
|
627
|
+
if (it->first == HTTPHeaderName::ContentLength) {
|
|
628
|
+
contentLength = it->second;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if (it->first == HTTPHeaderName::TransferEncoding) {
|
|
632
|
+
transferEncoding = it->second;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
if (out.node.body.empty() && out.node.attributes.empty() &&
|
|
638
|
+
out.node.reference.meta.state != Reference::StatePending) {
|
|
639
|
+
|
|
640
|
+
// Warn when content-length or transfer-encoding is specified or headers, parameters and body are empty
|
|
641
|
+
if (out.node.headers.empty() && out.node.parameters.empty()) {
|
|
642
|
+
warnEmptyBody = true;
|
|
643
|
+
} else {
|
|
644
|
+
warnEmptyBody = !contentLength.empty() || !transferEncoding.empty();
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
if (warnEmptyBody) {
|
|
648
|
+
|
|
649
|
+
// WARN: empty body
|
|
650
|
+
std::stringstream ss;
|
|
651
|
+
ss << "empty " << SectionName(RequestSectionType) << " " << SectionName(BodySectionType);
|
|
652
|
+
|
|
653
|
+
if (!contentLength.empty()) {
|
|
654
|
+
ss << ", expected " << SectionName(BodySectionType) << " for '" << contentLength << "' Content-Length";
|
|
655
|
+
} else if (!transferEncoding.empty()) {
|
|
656
|
+
ss << ", expected " << SectionName(BodySectionType) << " for '" << transferEncoding << "' Transfer-Encoding";
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
|
660
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
661
|
+
EmptyDefinitionWarning,
|
|
662
|
+
sourceMap));
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* \brief Checks response given as out
|
|
669
|
+
* \param node Markdown node
|
|
670
|
+
* \param pd Section parser state
|
|
671
|
+
* \param out Processed output
|
|
672
|
+
*/
|
|
673
|
+
static void checkResponse(const MarkdownNodeIterator& node,
|
|
674
|
+
SectionParserData& pd,
|
|
675
|
+
const ParseResultRef<Payload>& out) {
|
|
676
|
+
|
|
677
|
+
HTTPStatusCode code = 200;
|
|
678
|
+
|
|
679
|
+
if (!out.node.name.empty()) {
|
|
680
|
+
std::stringstream(out.node.name) >> code;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
StatusCodeTraits statusCodeTraits = GetStatusCodeTrait(code);
|
|
684
|
+
|
|
685
|
+
if (!statusCodeTraits.allowBody &&
|
|
686
|
+
!out.node.body.empty() &&
|
|
687
|
+
out.node.reference.meta.state != Reference::StatePending) {
|
|
688
|
+
|
|
689
|
+
// WARN: not empty body
|
|
690
|
+
std::stringstream ss;
|
|
691
|
+
ss << "the " << code << " response MUST NOT include a " << SectionName(BodySectionType);
|
|
692
|
+
|
|
693
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
|
694
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
695
|
+
EmptyDefinitionWarning,
|
|
696
|
+
sourceMap));
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* \brief Find a request within given action.
|
|
702
|
+
* \param transaction A transaction to check.
|
|
703
|
+
* \param request A request to look for.
|
|
704
|
+
* \return Iterator pointing to the matching request within given method requests.
|
|
705
|
+
*/
|
|
706
|
+
static RequestIterator findRequest(const TransactionExample& example,
|
|
707
|
+
const Request& request) {
|
|
708
|
+
|
|
709
|
+
return std::find_if(example.requests.begin(),
|
|
710
|
+
example.requests.end(),
|
|
711
|
+
std::bind2nd(MatchPayload(), request));
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* \brief Find a response within responses of a given action.
|
|
716
|
+
* \param transaction A transaction to check.
|
|
717
|
+
* \param response A response to look for.
|
|
718
|
+
* \return Iterator pointing to the matching response within given method requests.
|
|
719
|
+
*/
|
|
720
|
+
static ResponseIterator findResponse(const TransactionExample& example,
|
|
721
|
+
const Response& response) {
|
|
722
|
+
|
|
723
|
+
return std::find_if(example.responses.begin(),
|
|
724
|
+
example.responses.end(),
|
|
725
|
+
std::bind2nd(MatchPayload(), response));
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
/** Payload Section Parser */
|
|
730
|
+
typedef SectionParser<Payload, ListSectionAdapter> PayloadParser;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
#endif
|