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,560 @@
|
|
1
|
+
//
|
2
|
+
// ActionParser.h
|
3
|
+
// snowcrash
|
4
|
+
//
|
5
|
+
// Created by Zdenek Nemec on 5/4/13.
|
6
|
+
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef SNOWCRASH_ACTIONPARSER_H
|
10
|
+
#define SNOWCRASH_ACTIONPARSER_H
|
11
|
+
|
12
|
+
#include "HTTP.h"
|
13
|
+
#include "SectionParser.h"
|
14
|
+
#include "ParametersParser.h"
|
15
|
+
#include "PayloadParser.h"
|
16
|
+
#include "RelationParser.h"
|
17
|
+
#include "RegexMatch.h"
|
18
|
+
|
19
|
+
namespace snowcrash {
|
20
|
+
|
21
|
+
/** Nameless action matching regex */
|
22
|
+
const char* const ActionHeaderRegex = "^[[:blank:]]*" HTTP_REQUEST_METHOD "[[:blank:]]*" URI_TEMPLATE "?$";
|
23
|
+
|
24
|
+
/** Named action matching regex */
|
25
|
+
const char* const NamedActionHeaderRegex = "^[[:blank:]]*" SYMBOL_IDENTIFIER "\\[" HTTP_REQUEST_METHOD "[[:blank:]]*" URI_TEMPLATE "?]$";
|
26
|
+
|
27
|
+
/** Miss leading slash in URI */
|
28
|
+
const char* const NamedActionNonAbsoluteURIRegex = "^[[:blank:]]*" SYMBOL_IDENTIFIER "\\[" HTTP_REQUEST_METHOD "[[:blank:]]+[^/]+]$";
|
29
|
+
|
30
|
+
/** Internal type alias for Collection iterator of Action */
|
31
|
+
typedef Collection<Action>::const_iterator ActionIterator;
|
32
|
+
|
33
|
+
/** Action Definition Type */
|
34
|
+
enum ActionType {
|
35
|
+
NotActionType = 0,
|
36
|
+
DependentActionType, /// Action isn't fully defined, depends on parents resource URI
|
37
|
+
CompleteActionType, /// Action is fully defined including its URI
|
38
|
+
UndefinedActionType = -1
|
39
|
+
};
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Action Section processor
|
43
|
+
*/
|
44
|
+
template<>
|
45
|
+
struct SectionProcessor<Action> : public SectionProcessorBase<Action> {
|
46
|
+
|
47
|
+
static MarkdownNodeIterator processSignature(const MarkdownNodeIterator& node,
|
48
|
+
const MarkdownNodes& siblings,
|
49
|
+
SectionParserData& pd,
|
50
|
+
SectionLayout& layout,
|
51
|
+
const ParseResultRef<Action>& out) {
|
52
|
+
|
53
|
+
actionHTTPMethodAndName(node, out.node.method, out.node.name, out.node.uriTemplate);
|
54
|
+
TrimString(out.node.name);
|
55
|
+
|
56
|
+
mdp::ByteBuffer remainingContent;
|
57
|
+
GetFirstLine(node->text, remainingContent);
|
58
|
+
|
59
|
+
if (pd.exportSourceMap()) {
|
60
|
+
if (!out.node.method.empty()) {
|
61
|
+
out.sourceMap.method.sourceMap = node->sourceMap;
|
62
|
+
}
|
63
|
+
|
64
|
+
if (!out.node.name.empty()) {
|
65
|
+
out.sourceMap.name.sourceMap = node->sourceMap;
|
66
|
+
}
|
67
|
+
|
68
|
+
if (!out.node.uriTemplate.empty()) {
|
69
|
+
out.sourceMap.uriTemplate.sourceMap = node->sourceMap;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
if (!remainingContent.empty()) {
|
74
|
+
out.node.description += remainingContent;
|
75
|
+
|
76
|
+
if (pd.exportSourceMap()) {
|
77
|
+
out.sourceMap.description.sourceMap.append(node->sourceMap);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
return ++MarkdownNodeIterator(node);
|
82
|
+
}
|
83
|
+
|
84
|
+
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
|
85
|
+
const MarkdownNodes& siblings,
|
86
|
+
SectionParserData& pd,
|
87
|
+
const ParseResultRef<Action>& out) {
|
88
|
+
|
89
|
+
SectionType sectionType = pd.sectionContext();
|
90
|
+
MarkdownNodeIterator cur = node;
|
91
|
+
std::stringstream ss;
|
92
|
+
|
93
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
94
|
+
|
95
|
+
switch (sectionType) {
|
96
|
+
case RelationSectionType:
|
97
|
+
{
|
98
|
+
ParseResultRef<Relation> relation(out.report, out.node.relation, out.sourceMap.relation);
|
99
|
+
return RelationParser::parse(node, siblings, pd, relation);
|
100
|
+
}
|
101
|
+
|
102
|
+
case ParametersSectionType:
|
103
|
+
{
|
104
|
+
ParseResultRef<Parameters> parameters(out.report, out.node.parameters, out.sourceMap.parameters);
|
105
|
+
return ParametersParser::parse(node, siblings, pd, parameters);
|
106
|
+
}
|
107
|
+
|
108
|
+
case RequestSectionType:
|
109
|
+
case RequestBodySectionType:
|
110
|
+
{
|
111
|
+
IntermediateParseResult<Payload> payload(out.report);
|
112
|
+
|
113
|
+
cur = PayloadParser::parse(node, siblings, pd, payload);
|
114
|
+
|
115
|
+
if (out.node.examples.empty() || !out.node.examples.back().responses.empty()) {
|
116
|
+
TransactionExample transaction;
|
117
|
+
SourceMap<TransactionExample> transactionSM;
|
118
|
+
|
119
|
+
out.node.examples.push_back(transaction);
|
120
|
+
|
121
|
+
if (pd.exportSourceMap()) {
|
122
|
+
out.sourceMap.examples.collection.push_back(transactionSM);
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
checkPayload(sectionType, sourceMap, payload.node, out);
|
127
|
+
|
128
|
+
out.node.examples.back().requests.push_back(payload.node);
|
129
|
+
|
130
|
+
if (pd.exportSourceMap()) {
|
131
|
+
out.sourceMap.examples.collection.back().requests.collection.push_back(payload.sourceMap);
|
132
|
+
}
|
133
|
+
|
134
|
+
break;
|
135
|
+
}
|
136
|
+
|
137
|
+
case ResponseSectionType:
|
138
|
+
case ResponseBodySectionType:
|
139
|
+
{
|
140
|
+
IntermediateParseResult<Payload> payload(out.report);
|
141
|
+
|
142
|
+
cur = PayloadParser::parse(node, siblings, pd, payload);
|
143
|
+
|
144
|
+
if (out.node.examples.empty()) {
|
145
|
+
TransactionExample transaction;
|
146
|
+
SourceMap<TransactionExample> transactionSM;
|
147
|
+
|
148
|
+
out.node.examples.push_back(transaction);
|
149
|
+
|
150
|
+
if (pd.exportSourceMap()) {
|
151
|
+
out.sourceMap.examples.collection.push_back(transactionSM);
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
checkPayload(sectionType, sourceMap, payload.node, out);
|
156
|
+
|
157
|
+
out.node.examples.back().responses.push_back(payload.node);
|
158
|
+
|
159
|
+
if (pd.exportSourceMap()) {
|
160
|
+
out.sourceMap.examples.collection.back().responses.collection.push_back(payload.sourceMap);
|
161
|
+
}
|
162
|
+
|
163
|
+
break;
|
164
|
+
}
|
165
|
+
|
166
|
+
case HeadersSectionType:
|
167
|
+
{
|
168
|
+
ParseResultRef<Headers> headers(out.report, out.node.headers, out.sourceMap.headers);
|
169
|
+
return SectionProcessor<Action>::handleDeprecatedHeaders(node, siblings, pd, headers);
|
170
|
+
}
|
171
|
+
|
172
|
+
case AttributesSectionType:
|
173
|
+
{
|
174
|
+
ParseResultRef<Attributes> attributes(out.report, out.node.attributes, out.sourceMap.attributes);
|
175
|
+
return AttributesParser::parse(node, siblings, pd, attributes);
|
176
|
+
}
|
177
|
+
|
178
|
+
default:
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
|
182
|
+
return cur;
|
183
|
+
}
|
184
|
+
|
185
|
+
static bool isUnexpectedNode(const MarkdownNodeIterator& node,
|
186
|
+
SectionType sectionType) {
|
187
|
+
|
188
|
+
if (SectionProcessor<Asset>::sectionType(node) != UndefinedSectionType) {
|
189
|
+
return true;
|
190
|
+
}
|
191
|
+
|
192
|
+
return SectionProcessorBase<Action>::isUnexpectedNode(node, sectionType);
|
193
|
+
}
|
194
|
+
|
195
|
+
static MarkdownNodeIterator processUnexpectedNode(const MarkdownNodeIterator& node,
|
196
|
+
const MarkdownNodes& siblings,
|
197
|
+
SectionParserData& pd,
|
198
|
+
SectionType& sectionType,
|
199
|
+
const ParseResultRef<Action>& out) {
|
200
|
+
|
201
|
+
if ((node->type == mdp::ParagraphMarkdownNodeType ||
|
202
|
+
node->type == mdp::CodeMarkdownNodeType) &&
|
203
|
+
(sectionType == ResponseBodySectionType ||
|
204
|
+
sectionType == ResponseSectionType) &&
|
205
|
+
!out.node.examples.empty() &&
|
206
|
+
!out.node.examples.back().responses.empty()) {
|
207
|
+
|
208
|
+
mdp::ByteBuffer content = CodeBlockUtility::addDanglingAsset(node, pd, sectionType, out.report, out.node.examples.back().responses.back().body);
|
209
|
+
|
210
|
+
if (pd.exportSourceMap() && !content.empty()) {
|
211
|
+
out.sourceMap.examples.collection.back().responses.collection.back().body.sourceMap.append(node->sourceMap);
|
212
|
+
}
|
213
|
+
|
214
|
+
return ++MarkdownNodeIterator(node);
|
215
|
+
}
|
216
|
+
|
217
|
+
if ((node->type == mdp::ParagraphMarkdownNodeType ||
|
218
|
+
node->type == mdp::CodeMarkdownNodeType) &&
|
219
|
+
(sectionType == RequestBodySectionType ||
|
220
|
+
sectionType == RequestSectionType) &&
|
221
|
+
!out.node.examples.empty() &&
|
222
|
+
!out.node.examples.back().requests.empty()) {
|
223
|
+
|
224
|
+
mdp::ByteBuffer content = CodeBlockUtility::addDanglingAsset(node, pd, sectionType, out.report, out.node.examples.back().requests.back().body);
|
225
|
+
|
226
|
+
if (pd.exportSourceMap() && !content.empty()) {
|
227
|
+
out.sourceMap.examples.collection.back().requests.collection.back().body.sourceMap.append(node->sourceMap);
|
228
|
+
}
|
229
|
+
|
230
|
+
return ++MarkdownNodeIterator(node);
|
231
|
+
}
|
232
|
+
|
233
|
+
SectionType assetType = SectionProcessor<Asset>::sectionType(node);
|
234
|
+
|
235
|
+
if (assetType != UndefinedSectionType) {
|
236
|
+
|
237
|
+
// WARN: Ignoring section
|
238
|
+
std::stringstream ss;
|
239
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
240
|
+
|
241
|
+
ss << "Ignoring " << SectionName(assetType) << " list item, ";
|
242
|
+
ss << SectionName(assetType) << " list item is expected to be indented by 4 spaces or 1 tab";
|
243
|
+
|
244
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
245
|
+
IgnoringWarning,
|
246
|
+
sourceMap));
|
247
|
+
|
248
|
+
return ++MarkdownNodeIterator(node);
|
249
|
+
}
|
250
|
+
|
251
|
+
return SectionProcessorBase<Action>::processUnexpectedNode(node, siblings, pd, sectionType, out);
|
252
|
+
}
|
253
|
+
|
254
|
+
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
255
|
+
|
256
|
+
if (node->type == mdp::HeaderMarkdownNodeType
|
257
|
+
&& !node->text.empty()) {
|
258
|
+
|
259
|
+
mdp::ByteBuffer subject = node->text;
|
260
|
+
TrimString(subject);
|
261
|
+
|
262
|
+
if (RegexMatch(subject, ActionHeaderRegex) ||
|
263
|
+
RegexMatch(subject, NamedActionHeaderRegex)) {
|
264
|
+
|
265
|
+
return ActionSectionType;
|
266
|
+
}
|
267
|
+
}
|
268
|
+
|
269
|
+
return UndefinedSectionType;
|
270
|
+
}
|
271
|
+
|
272
|
+
static SectionType nestedSectionType(const MarkdownNodeIterator& node) {
|
273
|
+
|
274
|
+
SectionType nestedType = UndefinedSectionType;
|
275
|
+
|
276
|
+
// Check if relation section
|
277
|
+
nestedType = SectionProcessor<Relation>::sectionType(node);
|
278
|
+
|
279
|
+
if (nestedType != UndefinedSectionType) {
|
280
|
+
return nestedType;
|
281
|
+
}
|
282
|
+
|
283
|
+
// Check if parameters section
|
284
|
+
nestedType = SectionProcessor<Parameters>::sectionType(node);
|
285
|
+
|
286
|
+
if (nestedType != UndefinedSectionType) {
|
287
|
+
return nestedType;
|
288
|
+
}
|
289
|
+
|
290
|
+
// Check if headers section
|
291
|
+
nestedType = SectionProcessor<Headers>::sectionType(node);
|
292
|
+
|
293
|
+
if (nestedType != UndefinedSectionType) {
|
294
|
+
return nestedType;
|
295
|
+
}
|
296
|
+
|
297
|
+
// Check if attributes section
|
298
|
+
nestedType = SectionProcessor<Attributes>::sectionType(node);
|
299
|
+
|
300
|
+
if (nestedType != UndefinedSectionType) {
|
301
|
+
return nestedType;
|
302
|
+
}
|
303
|
+
|
304
|
+
// Check if payload section
|
305
|
+
nestedType = SectionProcessor<Payload>::sectionType(node);
|
306
|
+
|
307
|
+
if (nestedType != UndefinedSectionType) {
|
308
|
+
return nestedType;
|
309
|
+
}
|
310
|
+
|
311
|
+
return UndefinedSectionType;
|
312
|
+
}
|
313
|
+
|
314
|
+
static SectionTypes upperSectionTypes() {
|
315
|
+
return {ActionSectionType, ResourceSectionType, ResourceGroupSectionType, DataStructureGroupSectionType};
|
316
|
+
}
|
317
|
+
|
318
|
+
static void finalize(const MarkdownNodeIterator& node,
|
319
|
+
SectionParserData& pd,
|
320
|
+
const ParseResultRef<Action>& out) {
|
321
|
+
|
322
|
+
if (!out.node.uriTemplate.empty()) {
|
323
|
+
checkParametersEligibility<Action>(node, pd, out.node.parameters, out);
|
324
|
+
}
|
325
|
+
|
326
|
+
if (!out.node.headers.empty()) {
|
327
|
+
|
328
|
+
SectionProcessor<Headers>::injectDeprecatedHeaders(pd, out.node.headers, out.sourceMap.headers, out.node.examples, out.sourceMap.examples);
|
329
|
+
out.node.headers.clear();
|
330
|
+
|
331
|
+
if (pd.exportSourceMap()) {
|
332
|
+
out.sourceMap.headers.collection.clear();
|
333
|
+
}
|
334
|
+
}
|
335
|
+
|
336
|
+
if (out.node.examples.empty()) {
|
337
|
+
|
338
|
+
// WARN: No response for action
|
339
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
340
|
+
out.report.warnings.push_back(Warning("action is missing a response",
|
341
|
+
EmptyDefinitionWarning,
|
342
|
+
sourceMap));
|
343
|
+
} else if (!out.node.examples.empty() &&
|
344
|
+
!out.node.examples.back().requests.empty() &&
|
345
|
+
out.node.examples.back().responses.empty()) {
|
346
|
+
|
347
|
+
// WARN: No response for request
|
348
|
+
std::stringstream ss;
|
349
|
+
ss << "action is missing a response for ";
|
350
|
+
|
351
|
+
if (out.node.examples.back().requests.back().name.empty()) {
|
352
|
+
ss << "a request";
|
353
|
+
} else {
|
354
|
+
ss << "the '" << out.node.examples.back().requests.back().name << "' request";
|
355
|
+
}
|
356
|
+
|
357
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
358
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
359
|
+
EmptyDefinitionWarning,
|
360
|
+
sourceMap));
|
361
|
+
}
|
362
|
+
}
|
363
|
+
|
364
|
+
/**
|
365
|
+
* \brief Check & report payload validity.
|
366
|
+
* \param sectionType A section of the payload.
|
367
|
+
* \param sourceMap Payload signature source map.
|
368
|
+
* \param payload The payload to be checked.
|
369
|
+
* \param action The Action to which payload belongs to.
|
370
|
+
* \param report Parser report.
|
371
|
+
*/
|
372
|
+
static void checkPayload(SectionType sectionType,
|
373
|
+
const mdp::CharactersRangeSet sourceMap,
|
374
|
+
const Payload& payload,
|
375
|
+
const ParseResultRef<Action>& out) {
|
376
|
+
|
377
|
+
if (isPayloadDuplicate(sectionType, payload, out.node.examples.back())) {
|
378
|
+
|
379
|
+
// WARN: Duplicate payload
|
380
|
+
std::stringstream ss;
|
381
|
+
ss << SectionName(sectionType) << " payload `" << payload.name << "`";
|
382
|
+
ss << " already defined for `" << out.node.method << "` method";
|
383
|
+
|
384
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
385
|
+
DuplicateWarning,
|
386
|
+
sourceMap));
|
387
|
+
}
|
388
|
+
|
389
|
+
if (sectionType == ResponseSectionType || sectionType == ResponseBodySectionType) {
|
390
|
+
|
391
|
+
HTTPStatusCode code;
|
392
|
+
|
393
|
+
if (!payload.name.empty()) {
|
394
|
+
std::stringstream(payload.name) >> code;
|
395
|
+
}
|
396
|
+
|
397
|
+
HTTPMethodTraits methodTraits = GetMethodTrait(out.node.method);
|
398
|
+
|
399
|
+
if (!methodTraits.allowBody && !payload.body.empty()) {
|
400
|
+
|
401
|
+
// WARN: Edge case for 2xx CONNECT
|
402
|
+
if (out.node.method == HTTPMethodName::Connect && code/100 == 2) {
|
403
|
+
|
404
|
+
std::stringstream ss;
|
405
|
+
ss << "the response for " << code << " " << out.node.method << " request MUST NOT include a " << SectionName(BodySectionType);
|
406
|
+
|
407
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
408
|
+
EmptyDefinitionWarning,
|
409
|
+
sourceMap));
|
410
|
+
} else if (out.node.method != HTTPMethodName::Connect && !methodTraits.allowBody) {
|
411
|
+
|
412
|
+
std::stringstream ss;
|
413
|
+
ss << "the response for " << out.node.method << " request MUST NOT include a " << SectionName(BodySectionType);
|
414
|
+
|
415
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
416
|
+
EmptyDefinitionWarning,
|
417
|
+
sourceMap));
|
418
|
+
}
|
419
|
+
|
420
|
+
return;
|
421
|
+
}
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
/**
|
426
|
+
* Checks whether given section payload has duplicate within its transaction examples
|
427
|
+
* \return True when a duplicate is found, false otherwise.
|
428
|
+
*/
|
429
|
+
static bool isPayloadDuplicate(SectionType& sectionType,
|
430
|
+
const Payload& payload,
|
431
|
+
const TransactionExample& example) {
|
432
|
+
|
433
|
+
if (sectionType == RequestSectionType) {
|
434
|
+
|
435
|
+
RequestIterator duplicate = SectionProcessor<Payload>::findRequest(example, payload);
|
436
|
+
return duplicate != example.requests.end();
|
437
|
+
} else if (sectionType == ResponseSectionType) {
|
438
|
+
|
439
|
+
ResponseIterator duplicate = SectionProcessor<Payload>::findResponse(example, payload);
|
440
|
+
return duplicate != example.responses.end();
|
441
|
+
}
|
442
|
+
|
443
|
+
return false;
|
444
|
+
}
|
445
|
+
|
446
|
+
/** Warn about deprecated headers */
|
447
|
+
static MarkdownNodeIterator handleDeprecatedHeaders(const MarkdownNodeIterator& node,
|
448
|
+
const MarkdownNodes& siblings,
|
449
|
+
SectionParserData& pd,
|
450
|
+
const ParseResultRef<Headers>& out) {
|
451
|
+
|
452
|
+
MarkdownNodeIterator cur = HeadersParser::parse(node, siblings, pd, out);
|
453
|
+
|
454
|
+
// WARN: Deprecated header sections
|
455
|
+
std::stringstream ss;
|
456
|
+
ss << "the 'headers' section at this level is deprecated and will be removed in a future, use respective payload header section(s) instead";
|
457
|
+
|
458
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
459
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
460
|
+
DeprecatedWarning,
|
461
|
+
sourceMap));
|
462
|
+
|
463
|
+
return cur;
|
464
|
+
}
|
465
|
+
|
466
|
+
/** \return %ActionType of a node */
|
467
|
+
static ActionType actionType(const MarkdownNodeIterator& node) {
|
468
|
+
|
469
|
+
if (node->type != mdp::HeaderMarkdownNodeType || node->text.empty())
|
470
|
+
return NotActionType;
|
471
|
+
|
472
|
+
mdp::ByteBuffer subject = node->text;
|
473
|
+
TrimString(subject);
|
474
|
+
|
475
|
+
if (RegexMatch(subject, NamedActionHeaderRegex)) {
|
476
|
+
return DependentActionType;
|
477
|
+
}
|
478
|
+
|
479
|
+
CaptureGroups captureGroups;
|
480
|
+
|
481
|
+
if (RegexCapture(subject, ActionHeaderRegex, captureGroups, 3)) {
|
482
|
+
|
483
|
+
if (captureGroups[2].empty()) {
|
484
|
+
return DependentActionType;
|
485
|
+
}
|
486
|
+
else {
|
487
|
+
return CompleteActionType;
|
488
|
+
}
|
489
|
+
}
|
490
|
+
|
491
|
+
return NotActionType;
|
492
|
+
}
|
493
|
+
|
494
|
+
/** \return HTTP request method and name of an action */
|
495
|
+
static void actionHTTPMethodAndName(const MarkdownNodeIterator& node,
|
496
|
+
mdp::ByteBuffer& method,
|
497
|
+
mdp::ByteBuffer& name,
|
498
|
+
mdp::ByteBuffer& uriTemplate) {
|
499
|
+
|
500
|
+
CaptureGroups captureGroups;
|
501
|
+
mdp::ByteBuffer subject, remaining;
|
502
|
+
|
503
|
+
subject = GetFirstLine(node->text, remaining);
|
504
|
+
TrimString(subject);
|
505
|
+
|
506
|
+
if (RegexCapture(subject, ActionHeaderRegex, captureGroups, 3)) {
|
507
|
+
method = captureGroups[1];
|
508
|
+
} else if (RegexCapture(subject, NamedActionHeaderRegex, captureGroups, 4)) {
|
509
|
+
name = captureGroups[1];
|
510
|
+
method = captureGroups[2];
|
511
|
+
uriTemplate = captureGroups[3];
|
512
|
+
}
|
513
|
+
|
514
|
+
return;
|
515
|
+
}
|
516
|
+
|
517
|
+
/** Finds an action inside an actions collection */
|
518
|
+
static ActionIterator findAction(const Actions& actions,
|
519
|
+
const Action& action) {
|
520
|
+
|
521
|
+
return std::find_if(actions.begin(),
|
522
|
+
actions.end(),
|
523
|
+
std::bind2nd(MatchAction(), action));
|
524
|
+
}
|
525
|
+
|
526
|
+
/** Finds a relation identifier inside an actions collection */
|
527
|
+
static ActionIterator findRelation(const Actions& actions,
|
528
|
+
const Relation& relation) {
|
529
|
+
|
530
|
+
return std::find_if(actions.begin(),
|
531
|
+
actions.end(),
|
532
|
+
std::bind2nd(MatchRelation(), relation));
|
533
|
+
}
|
534
|
+
|
535
|
+
|
536
|
+
static void checkForTypoMistake(const MarkdownNodeIterator& node, SectionParserData& pd, Report& report) {
|
537
|
+
|
538
|
+
if (node->type != mdp::HeaderMarkdownNodeType) {
|
539
|
+
return;
|
540
|
+
}
|
541
|
+
|
542
|
+
if (RegexMatch(node->text, NamedActionNonAbsoluteURIRegex)) {
|
543
|
+
std::stringstream ss;
|
544
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
545
|
+
|
546
|
+
ss << "URI path in '" << node->text << "' is not absolute, it should have a leading forward slash";
|
547
|
+
|
548
|
+
report.warnings.push_back(Warning(ss.str(),
|
549
|
+
URIWarning,
|
550
|
+
sourceMap));
|
551
|
+
|
552
|
+
}
|
553
|
+
}
|
554
|
+
};
|
555
|
+
|
556
|
+
/** Action Section Parser */
|
557
|
+
typedef SectionParser<Action, HeaderSectionAdapter> ActionParser;
|
558
|
+
}
|
559
|
+
|
560
|
+
#endif
|
@@ -0,0 +1,123 @@
|
|
1
|
+
//
|
2
|
+
// AssetParser.h
|
3
|
+
// snowcrash
|
4
|
+
//
|
5
|
+
// Created by Zdenek Nemec on 5/17/13.
|
6
|
+
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef SNOWCRASH_ASSETPARSER_H
|
10
|
+
#define SNOWCRASH_ASSETPARSER_H
|
11
|
+
|
12
|
+
#include "SectionParser.h"
|
13
|
+
#include "RegexMatch.h"
|
14
|
+
#include "CodeBlockUtility.h"
|
15
|
+
|
16
|
+
namespace snowcrash {
|
17
|
+
|
18
|
+
/// Asset signature
|
19
|
+
enum AssetSignature {
|
20
|
+
NoAssetSignature = 0,
|
21
|
+
BodyAssetSignature, /// < Explicit body asset
|
22
|
+
ImplicitBodyAssetSignature, /// < Body asset using abbreviated syntax
|
23
|
+
SchemaAssetSignature, /// < Explicit Schema asset
|
24
|
+
UndefinedAssetSignature = -1
|
25
|
+
};
|
26
|
+
|
27
|
+
/** Body matching regex */
|
28
|
+
const char* const BodyRegex = "^[[:blank:]]*[Bb]ody[[:blank:]]*$";
|
29
|
+
|
30
|
+
/** Schema matching regex */
|
31
|
+
const char* const SchemaRegex = "^[[:blank:]]*[Ss]chema[[:blank:]]*$";
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Asset Section Processor
|
35
|
+
*/
|
36
|
+
template<>
|
37
|
+
struct SectionProcessor<Asset> : public SectionProcessorBase<Asset> {
|
38
|
+
|
39
|
+
static MarkdownNodeIterator processSignature(const MarkdownNodeIterator& node,
|
40
|
+
const MarkdownNodes& siblings,
|
41
|
+
SectionParserData& pd,
|
42
|
+
SectionLayout& layout,
|
43
|
+
const ParseResultRef<Asset>& out) {
|
44
|
+
|
45
|
+
out.node = "";
|
46
|
+
CodeBlockUtility::signatureContentAsCodeBlock(node, pd, out.report, out.node);
|
47
|
+
|
48
|
+
if (pd.exportSourceMap() && !out.node.empty()) {
|
49
|
+
out.sourceMap.sourceMap.append(node->sourceMap);
|
50
|
+
}
|
51
|
+
|
52
|
+
return ++MarkdownNodeIterator(node);
|
53
|
+
}
|
54
|
+
|
55
|
+
NO_SECTION_DESCRIPTION(Asset)
|
56
|
+
|
57
|
+
static MarkdownNodeIterator processContent(const MarkdownNodeIterator& node,
|
58
|
+
const MarkdownNodes& siblings,
|
59
|
+
SectionParserData& pd,
|
60
|
+
const ParseResultRef<Asset>& out) {
|
61
|
+
|
62
|
+
mdp::ByteBuffer content;
|
63
|
+
CodeBlockUtility::contentAsCodeBlock(node, pd, out.report, content);
|
64
|
+
|
65
|
+
out.node += content;
|
66
|
+
|
67
|
+
if (pd.exportSourceMap() && !content.empty()) {
|
68
|
+
out.sourceMap.sourceMap.append(node->sourceMap);
|
69
|
+
}
|
70
|
+
|
71
|
+
return ++MarkdownNodeIterator(node);
|
72
|
+
}
|
73
|
+
|
74
|
+
static bool isContentNode(const MarkdownNodeIterator& node,
|
75
|
+
SectionType sectionType) {
|
76
|
+
|
77
|
+
return (SectionKeywordSignature(node) == UndefinedSectionType);
|
78
|
+
}
|
79
|
+
|
80
|
+
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
81
|
+
if (node->type == mdp::ListItemMarkdownNodeType
|
82
|
+
&& !node->children().empty()) {
|
83
|
+
|
84
|
+
AssetSignature signature = assetSignature(node);
|
85
|
+
|
86
|
+
switch (signature) {
|
87
|
+
case BodyAssetSignature:
|
88
|
+
case ImplicitBodyAssetSignature:
|
89
|
+
return BodySectionType;
|
90
|
+
|
91
|
+
case SchemaAssetSignature:
|
92
|
+
return SchemaSectionType;
|
93
|
+
|
94
|
+
default:
|
95
|
+
return UndefinedSectionType;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
return UndefinedSectionType;
|
100
|
+
}
|
101
|
+
|
102
|
+
/** Resolve asset signature */
|
103
|
+
static AssetSignature assetSignature(const MarkdownNodeIterator& node) {
|
104
|
+
|
105
|
+
mdp::ByteBuffer remaining, subject = node->children().front().text;
|
106
|
+
subject = GetFirstLine(subject, remaining);
|
107
|
+
TrimString(subject);
|
108
|
+
|
109
|
+
if (RegexMatch(subject, BodyRegex))
|
110
|
+
return BodyAssetSignature;
|
111
|
+
|
112
|
+
if (RegexMatch(subject, SchemaRegex))
|
113
|
+
return SchemaAssetSignature;
|
114
|
+
|
115
|
+
return NoAssetSignature;
|
116
|
+
}
|
117
|
+
};
|
118
|
+
|
119
|
+
/** Asset Section Parser */
|
120
|
+
typedef SectionParser<Asset, ListSectionAdapter> AssetParser;
|
121
|
+
}
|
122
|
+
|
123
|
+
#endif
|