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,59 @@
|
|
|
1
|
+
//
|
|
2
|
+
// refract/ElementInserter.h
|
|
3
|
+
// librefract
|
|
4
|
+
//
|
|
5
|
+
// Created by Jiri Kratochvil on 17/06/15.
|
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
#ifndef REFRACT_ELEMENTINSERTER_H
|
|
9
|
+
#define REFRACT_ELEMENTINSERTER_H
|
|
10
|
+
|
|
11
|
+
#include <iterator>
|
|
12
|
+
|
|
13
|
+
namespace refract
|
|
14
|
+
{
|
|
15
|
+
|
|
16
|
+
// Forward declarations of Elements
|
|
17
|
+
struct IElement;
|
|
18
|
+
|
|
19
|
+
template <typename T>
|
|
20
|
+
struct ElementInsertIterator : public std::iterator<std::output_iterator_tag, void, void, void, void> {
|
|
21
|
+
T& element;
|
|
22
|
+
|
|
23
|
+
ElementInsertIterator(T& element) : element(element) {}
|
|
24
|
+
|
|
25
|
+
ElementInsertIterator(const ElementInsertIterator& other) : element(other.element) {}
|
|
26
|
+
|
|
27
|
+
ElementInsertIterator& operator=(const ElementInsertIterator& other) {
|
|
28
|
+
element = other.element;
|
|
29
|
+
return *this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
ElementInsertIterator& operator=(refract::IElement* e) {
|
|
33
|
+
element.push_back(e);
|
|
34
|
+
return *this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ElementInsertIterator& operator=(const refract::IElement* e) {
|
|
38
|
+
element.push_back(e);
|
|
39
|
+
return *this;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ElementInsertIterator& operator++() {
|
|
43
|
+
return *this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
ElementInsertIterator& operator*() {
|
|
47
|
+
return *this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
template <typename T>
|
|
53
|
+
ElementInsertIterator<T> ElementInserter(T& element) {
|
|
54
|
+
return ElementInsertIterator<T>(element);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
}; // namespace refract
|
|
58
|
+
|
|
59
|
+
#endif // #ifndef REFRACT_ELEMENTINSERTER_H
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// refract/Exception.h
|
|
3
|
+
// librefract
|
|
4
|
+
//
|
|
5
|
+
// Created by Jiri Kratochvil on 21/05/15.
|
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
#ifndef REFRACT_EXCEPTION_H
|
|
9
|
+
#define REFRACT_EXCEPTION_H
|
|
10
|
+
|
|
11
|
+
#include <stdexcept>
|
|
12
|
+
|
|
13
|
+
namespace refract
|
|
14
|
+
{
|
|
15
|
+
|
|
16
|
+
struct LogicError : std::logic_error {
|
|
17
|
+
explicit LogicError(const std::string& msg) : std::logic_error(msg) {}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// will be removed in future
|
|
21
|
+
struct NotImplemented : std::runtime_error {
|
|
22
|
+
explicit NotImplemented(const std::string& msg) : std::runtime_error(msg) {}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
struct Deprecated : std::logic_error {
|
|
26
|
+
explicit Deprecated(const std::string& msg) : std::logic_error(msg) {}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
}; // namespace refract
|
|
30
|
+
|
|
31
|
+
#endif // #ifndef REFRACT_EXCEPTION_H
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
//
|
|
2
|
+
// refract/ExpandVisitor.cc
|
|
3
|
+
// librefract
|
|
4
|
+
//
|
|
5
|
+
// Created by Jiri Kratochvil on 21/05/15.
|
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#include "Element.h"
|
|
10
|
+
#include "Registry.h"
|
|
11
|
+
#include <stack>
|
|
12
|
+
|
|
13
|
+
#include <functional>
|
|
14
|
+
|
|
15
|
+
#include <sstream>
|
|
16
|
+
|
|
17
|
+
#include"SourceAnnotation.h"
|
|
18
|
+
|
|
19
|
+
#include "IsExpandableVisitor.h"
|
|
20
|
+
#include "ExpandVisitor.h"
|
|
21
|
+
#include "TypeQueryVisitor.h"
|
|
22
|
+
#include "VisitorUtils.h"
|
|
23
|
+
|
|
24
|
+
#define VISIT_IMPL( ELEMENT ) void ExpandVisitor::operator()(const ELEMENT ## Element& e) { result = Expand(e, context); }
|
|
25
|
+
|
|
26
|
+
namespace refract
|
|
27
|
+
{
|
|
28
|
+
|
|
29
|
+
namespace
|
|
30
|
+
{
|
|
31
|
+
|
|
32
|
+
bool Expandable(const IElement& e)
|
|
33
|
+
{
|
|
34
|
+
IsExpandableVisitor v;
|
|
35
|
+
VisitBy(e, v);
|
|
36
|
+
return v.get();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void CopyMetaId(IElement& dst, const IElement& src)
|
|
40
|
+
{
|
|
41
|
+
IElement::MemberElementCollection::const_iterator name = src.meta.find("id");
|
|
42
|
+
if (name != src.meta.end() && (*name)->value.second && !(*name)->value.second->empty()) {
|
|
43
|
+
dst.meta["id"] = (*name)->value.second->clone();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
void MetaIdToRef(IElement& e)
|
|
48
|
+
{
|
|
49
|
+
IElement::MemberElementCollection::const_iterator name = e.meta.find("id");
|
|
50
|
+
if (name != e.meta.end() && (*name)->value.second && !(*name)->value.second->empty()) {
|
|
51
|
+
IElement* clone = (*name)->value.second->clone();
|
|
52
|
+
e.meta["ref"] = clone;
|
|
53
|
+
e.meta.erase("id");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
template <typename T>
|
|
58
|
+
struct ExpandValueImpl {
|
|
59
|
+
|
|
60
|
+
template <typename Functor>
|
|
61
|
+
T operator()(const T& value, Functor&) {
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
template <>
|
|
67
|
+
struct ExpandValueImpl<RefractElements> {
|
|
68
|
+
|
|
69
|
+
template <typename Functor>
|
|
70
|
+
RefractElements operator()(const RefractElements& value, Functor& expand) {
|
|
71
|
+
RefractElements members;
|
|
72
|
+
|
|
73
|
+
for (RefractElements::const_iterator it = value.begin() ; it != value.end() ; ++it) {
|
|
74
|
+
members.push_back(expand(*it));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return members;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
ExtendElement* GetInheritanceTree(const std::string& name, const Registry& registry)
|
|
82
|
+
{
|
|
83
|
+
std::stack<IElement*> inheritance;
|
|
84
|
+
std::string en = name;
|
|
85
|
+
|
|
86
|
+
// FIXME: add check against recursive inheritance
|
|
87
|
+
// walk recursive in registry and expand inheritance tree
|
|
88
|
+
for (const IElement* parent = registry.find(en)
|
|
89
|
+
; parent && !isReserved(en)
|
|
90
|
+
; en = parent->element(), parent = registry.find(en)) {
|
|
91
|
+
|
|
92
|
+
inheritance.push(parent->clone((IElement::cAll ^ IElement::cElement) | IElement::cNoMetaId));
|
|
93
|
+
inheritance.top()->meta["ref"] = IElement::Create(en);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
ExtendElement* e = new ExtendElement;
|
|
97
|
+
|
|
98
|
+
while (!inheritance.empty()) {
|
|
99
|
+
e->push_back(inheritance.top());
|
|
100
|
+
inheritance.pop();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// FIXME: posible solution while referenced type is not found in regisry
|
|
104
|
+
// \see test/fixtures/mson-resource-unresolved-reference.apib
|
|
105
|
+
//
|
|
106
|
+
//if (e->value.empty()) {
|
|
107
|
+
// e->meta["ref"] = IElement::Create(name);
|
|
108
|
+
//}
|
|
109
|
+
|
|
110
|
+
return e;
|
|
111
|
+
}
|
|
112
|
+
} // anonymous namespace
|
|
113
|
+
|
|
114
|
+
struct ExpandVisitor::Context {
|
|
115
|
+
|
|
116
|
+
const Registry& registry;
|
|
117
|
+
ExpandVisitor* expand;
|
|
118
|
+
|
|
119
|
+
Context(const Registry& registry, ExpandVisitor* expand) : registry(registry), expand(expand) {}
|
|
120
|
+
|
|
121
|
+
IElement* ExpandOrClone(const IElement* e)
|
|
122
|
+
{
|
|
123
|
+
IElement* result = NULL;
|
|
124
|
+
if (!e) {
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
VisitBy(*e, *expand);
|
|
129
|
+
result = expand->get();
|
|
130
|
+
|
|
131
|
+
if (!result) {
|
|
132
|
+
result = e->clone();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
template <typename V>
|
|
139
|
+
V ExpandValue(const V& v) {
|
|
140
|
+
auto expandOrClone = std::bind(&ExpandVisitor::Context::ExpandOrClone, this, std::placeholders::_1);
|
|
141
|
+
return ExpandValueImpl<V>()(v, expandOrClone);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
template<typename T>
|
|
145
|
+
T* ExpandMembers(const T& e)
|
|
146
|
+
{
|
|
147
|
+
T* o = new T;
|
|
148
|
+
o->attributes.clone(e.attributes);
|
|
149
|
+
o->meta.clone(e.meta);
|
|
150
|
+
|
|
151
|
+
if (!e.empty()) {
|
|
152
|
+
o->set(ExpandValue(e.value));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return o;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
std::deque<std::string> members;
|
|
159
|
+
|
|
160
|
+
template <typename T>
|
|
161
|
+
IElement* ExpandNamedType(const T& e)
|
|
162
|
+
{
|
|
163
|
+
|
|
164
|
+
// Look for Circular Reference thro members
|
|
165
|
+
if (std::find(members.begin(), members.end(), e.element()) != members.end()) {
|
|
166
|
+
// To avoid unfinised recursion just clone
|
|
167
|
+
const IElement* root = FindRootAncestor(e.element(), registry);
|
|
168
|
+
// FIXME: if not found root
|
|
169
|
+
IElement* result = root->clone(IElement::cMeta | IElement::cAttributes | IElement::cNoMetaId);
|
|
170
|
+
result->meta["ref"] = IElement::Create(e.element());
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
members.push_back(e.element());
|
|
175
|
+
|
|
176
|
+
ExtendElement* tree = GetInheritanceTree(e.element(), registry);
|
|
177
|
+
ExtendElement* extend = ExpandMembers(*tree);
|
|
178
|
+
delete tree;
|
|
179
|
+
|
|
180
|
+
CopyMetaId(*extend, e);
|
|
181
|
+
|
|
182
|
+
members.pop_back();
|
|
183
|
+
|
|
184
|
+
T* origin = ExpandMembers(e);
|
|
185
|
+
origin->meta.erase("id");
|
|
186
|
+
|
|
187
|
+
extend->push_back(origin);
|
|
188
|
+
|
|
189
|
+
return extend;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
template <typename T>
|
|
193
|
+
T* ExpandReference(const T& e)
|
|
194
|
+
{
|
|
195
|
+
|
|
196
|
+
T* ref = static_cast<T*>(e.clone());
|
|
197
|
+
|
|
198
|
+
MemberElement *m = FindMemberByKey(e, "href");
|
|
199
|
+
if (!m) {
|
|
200
|
+
return NULL;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
StringElement* href = TypeQueryVisitor::as<StringElement>(m->value.second);
|
|
204
|
+
if (!href || href->value.empty()) {
|
|
205
|
+
return ref;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (std::find(members.begin(), members.end(), href->value) != members.end()) {
|
|
209
|
+
|
|
210
|
+
std::stringstream msg;
|
|
211
|
+
msg << "named type '";
|
|
212
|
+
msg << href->value;
|
|
213
|
+
msg << "' is circularly referencing itself by mixin";
|
|
214
|
+
|
|
215
|
+
throw snowcrash::Error(msg.str(), snowcrash::MSONError);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
members.push_back(href->value);
|
|
219
|
+
|
|
220
|
+
if (IElement* referenced = registry.find(href->value)) {
|
|
221
|
+
referenced = ExpandOrClone(referenced);
|
|
222
|
+
MetaIdToRef(*referenced);
|
|
223
|
+
referenced->renderType(IElement::rFull);
|
|
224
|
+
ref->attributes["resolved"] = referenced;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
members.pop_back();
|
|
228
|
+
|
|
229
|
+
return ref;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
template <typename T, typename V = typename T::ValueType>
|
|
235
|
+
struct ExpandElement {
|
|
236
|
+
IElement* result;
|
|
237
|
+
|
|
238
|
+
ExpandElement(const T& e, ExpandVisitor::Context* context) : result(NULL) {
|
|
239
|
+
|
|
240
|
+
if (!isReserved(e.element())) { // expand named type
|
|
241
|
+
result = context->ExpandNamedType(e);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
operator IElement* () {
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
template <typename T>
|
|
251
|
+
struct ExpandElement<T, SelectElement::ValueType> {
|
|
252
|
+
IElement* result;
|
|
253
|
+
|
|
254
|
+
ExpandElement(const T& e, ExpandVisitor::Context* context) : result(NULL) {
|
|
255
|
+
|
|
256
|
+
if (!Expandable(e)) { // do we have some expandable members?
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
T* o = new T;
|
|
261
|
+
o->meta.clone(e.meta);
|
|
262
|
+
|
|
263
|
+
for (std::vector<OptionElement*>::const_iterator it = e.value.begin(); it != e.value.end(); ++it) {
|
|
264
|
+
o->push_back(static_cast<OptionElement*>(context->ExpandOrClone(*it)));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
result = o;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
operator IElement* () {
|
|
271
|
+
return result;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
template <typename T>
|
|
276
|
+
struct ExpandElement<T, RefractElements> {
|
|
277
|
+
IElement* result;
|
|
278
|
+
|
|
279
|
+
ExpandElement(const T& e, ExpandVisitor::Context* context) : result(NULL) {
|
|
280
|
+
|
|
281
|
+
if (!Expandable(e)) { // do we have some expandable members?
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
std::string en = e.element();
|
|
286
|
+
|
|
287
|
+
if (!isReserved(en)) { // expand named type
|
|
288
|
+
result = context->ExpandNamedType(e);
|
|
289
|
+
}
|
|
290
|
+
else if (en == "ref") { // expand reference
|
|
291
|
+
result = context->ExpandReference(e);
|
|
292
|
+
}
|
|
293
|
+
else { // walk throught members and expand them
|
|
294
|
+
result = context->ExpandMembers(e);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
operator IElement* () {
|
|
299
|
+
return result;
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
template <typename T>
|
|
304
|
+
struct ExpandElement<T, MemberElement::ValueType> {
|
|
305
|
+
IElement* result;
|
|
306
|
+
|
|
307
|
+
ExpandElement(const T& e, ExpandVisitor::Context* context) : result(NULL) {
|
|
308
|
+
|
|
309
|
+
if (!Expandable(e)) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
MemberElement* expanded = static_cast<MemberElement*>(e.clone(IElement::cAll ^ IElement::cValue));
|
|
314
|
+
expanded->set(context->ExpandOrClone(e.value.first), context->ExpandOrClone(e.value.second));
|
|
315
|
+
|
|
316
|
+
result = expanded;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
operator IElement* () {
|
|
320
|
+
return result;
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
template <typename T>
|
|
325
|
+
inline IElement* Expand(const T& e, ExpandVisitor::Context* context) {
|
|
326
|
+
return ExpandElement<T>(e, context);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
ExpandVisitor::ExpandVisitor(const Registry& registry) : result(NULL), context(new Context(registry, this)) {};
|
|
330
|
+
|
|
331
|
+
ExpandVisitor::~ExpandVisitor() {
|
|
332
|
+
delete context;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
void ExpandVisitor::operator()(const IElement& e) {
|
|
336
|
+
VisitBy(e, *this);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// do nothing, NullElements are not expandable
|
|
340
|
+
void ExpandVisitor::operator()(const NullElement& e) {}
|
|
341
|
+
|
|
342
|
+
VISIT_IMPL(String)
|
|
343
|
+
VISIT_IMPL(Number)
|
|
344
|
+
VISIT_IMPL(Boolean)
|
|
345
|
+
VISIT_IMPL(Member)
|
|
346
|
+
VISIT_IMPL(Array)
|
|
347
|
+
VISIT_IMPL(Enum)
|
|
348
|
+
VISIT_IMPL(Object)
|
|
349
|
+
VISIT_IMPL(Extend)
|
|
350
|
+
VISIT_IMPL(Option)
|
|
351
|
+
VISIT_IMPL(Select)
|
|
352
|
+
|
|
353
|
+
IElement* ExpandVisitor::get() const {
|
|
354
|
+
return result;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
}; // namespace refract
|
|
358
|
+
|
|
359
|
+
#undef VISIT_IMPL
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//
|
|
2
|
+
// refract/ExpandVisitor.h
|
|
3
|
+
// librefract
|
|
4
|
+
//
|
|
5
|
+
// Created by Jiri Kratochvil on 17/06/15.
|
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef REFRACT_EXPANDVISITOR_H
|
|
10
|
+
#define REFRACT_EXPANDVISITOR_H
|
|
11
|
+
|
|
12
|
+
#include "ElementFwd.h"
|
|
13
|
+
|
|
14
|
+
namespace refract
|
|
15
|
+
{
|
|
16
|
+
|
|
17
|
+
class Registry;
|
|
18
|
+
|
|
19
|
+
class ExpandVisitor {
|
|
20
|
+
|
|
21
|
+
public:
|
|
22
|
+
struct Context;
|
|
23
|
+
|
|
24
|
+
ExpandVisitor(const Registry& registry);
|
|
25
|
+
~ExpandVisitor();
|
|
26
|
+
|
|
27
|
+
void operator()(const IElement& e);
|
|
28
|
+
|
|
29
|
+
void operator()(const NullElement& e);
|
|
30
|
+
|
|
31
|
+
void operator()(const StringElement& e);
|
|
32
|
+
void operator()(const NumberElement& e);
|
|
33
|
+
void operator()(const BooleanElement& e);
|
|
34
|
+
|
|
35
|
+
void operator()(const MemberElement& e);
|
|
36
|
+
|
|
37
|
+
void operator()(const ArrayElement& e);
|
|
38
|
+
void operator()(const EnumElement& e);
|
|
39
|
+
void operator()(const ObjectElement& e);
|
|
40
|
+
|
|
41
|
+
void operator()(const ExtendElement& e);
|
|
42
|
+
|
|
43
|
+
void operator()(const OptionElement& e);
|
|
44
|
+
void operator()(const SelectElement& e);
|
|
45
|
+
|
|
46
|
+
// return expanded elemnt or NULL if expansion is not needed
|
|
47
|
+
// caller responsibility is to delete returned Element
|
|
48
|
+
IElement* get() const;
|
|
49
|
+
|
|
50
|
+
private:
|
|
51
|
+
|
|
52
|
+
IElement* result;
|
|
53
|
+
Context* context;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
}; // namespace refract
|
|
57
|
+
|
|
58
|
+
#endif // #ifndef REFRACT_EXPANVISITOR_H
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// refract/FilterVisitor.h
|
|
3
|
+
// librefract
|
|
4
|
+
//
|
|
5
|
+
// Created by Jiri Kratochvil on 10/06/16.
|
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
#ifndef REFRACT_FILTERVISITOR_H
|
|
9
|
+
#define REFRACT_FILTERVISITOR_H
|
|
10
|
+
|
|
11
|
+
#include "ElementFwd.h"
|
|
12
|
+
#include "Visitor.h"
|
|
13
|
+
|
|
14
|
+
#include "Query.h"
|
|
15
|
+
#include <vector>
|
|
16
|
+
|
|
17
|
+
namespace refract
|
|
18
|
+
{
|
|
19
|
+
|
|
20
|
+
class FilterVisitor
|
|
21
|
+
{
|
|
22
|
+
typedef std::vector<const IElement*> Elements;
|
|
23
|
+
|
|
24
|
+
Elements selected;
|
|
25
|
+
query::Query query;
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
|
|
29
|
+
template <typename Predicate>
|
|
30
|
+
FilterVisitor(Predicate predicate) : query(predicate) {};
|
|
31
|
+
|
|
32
|
+
template <typename T>
|
|
33
|
+
void operator()(const T& e){
|
|
34
|
+
|
|
35
|
+
if(query(e)) {
|
|
36
|
+
selected.push_back(&e);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
bool empty() const {
|
|
41
|
+
return selected.empty();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const Elements& elements() const {
|
|
45
|
+
return selected;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
}; // namespace refract
|
|
51
|
+
|
|
52
|
+
#endif // #ifndef REFRACT_FILTERVISITOR_H
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
//
|
|
2
|
+
// refract/IsExpandableVisitor.cc
|
|
3
|
+
// librefract
|
|
4
|
+
//
|
|
5
|
+
// Created by Jiri Kratochvil on 21/05/15.
|
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
#include "Element.h"
|
|
9
|
+
#include "IsExpandableVisitor.h"
|
|
10
|
+
|
|
11
|
+
namespace refract
|
|
12
|
+
{
|
|
13
|
+
|
|
14
|
+
namespace
|
|
15
|
+
{
|
|
16
|
+
struct CheckElement {
|
|
17
|
+
bool checkElement(const IElement* e) const {
|
|
18
|
+
std::string type;
|
|
19
|
+
|
|
20
|
+
if (e) {
|
|
21
|
+
type = e->element();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return !isReserved(type) || type == "ref" ;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
template <typename T, typename V = typename T::ValueType>
|
|
29
|
+
struct IsExpandable : public CheckElement {
|
|
30
|
+
bool operator()(const T* e) const {
|
|
31
|
+
|
|
32
|
+
if (checkElement(e)) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
template <typename T>
|
|
41
|
+
struct IsExpandable<T, SelectElement::ValueType> : public CheckElement {
|
|
42
|
+
bool operator()(const T* e) const {
|
|
43
|
+
|
|
44
|
+
if (checkElement(e)) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
for (std::vector<OptionElement*>::const_iterator i = e->value.begin() ; i != e->value.end() ; ++i ) {
|
|
49
|
+
IsExpandableVisitor v;
|
|
50
|
+
VisitBy(*(*i), v);
|
|
51
|
+
|
|
52
|
+
if (v.get()) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
template <typename T>
|
|
62
|
+
struct IsExpandable<T, MemberElement::ValueType> : public CheckElement {
|
|
63
|
+
bool operator()(const T* e) const {
|
|
64
|
+
|
|
65
|
+
if (checkElement(e)) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (e->value.first) {
|
|
70
|
+
IsExpandableVisitor v;
|
|
71
|
+
VisitBy(*e->value.first, v);
|
|
72
|
+
if (v.get()) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (e->value.second) {
|
|
78
|
+
IsExpandableVisitor v;
|
|
79
|
+
VisitBy(*e->value.second, v);
|
|
80
|
+
if (v.get()) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
template <typename T>
|
|
90
|
+
struct IsExpandable<T, RefractElements> : public CheckElement {
|
|
91
|
+
bool operator()(const T* e) const {
|
|
92
|
+
|
|
93
|
+
if (checkElement(e)) {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
for (std::vector<IElement*>::const_iterator i = e->value.begin() ; i != e->value.end() ; ++i ) {
|
|
98
|
+
IsExpandableVisitor v;
|
|
99
|
+
VisitBy(*(*i), v);
|
|
100
|
+
|
|
101
|
+
if (v.get()) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
} // anonymous namespace
|
|
110
|
+
|
|
111
|
+
IsExpandableVisitor::IsExpandableVisitor() : result(false) {}
|
|
112
|
+
|
|
113
|
+
template<typename T>
|
|
114
|
+
void IsExpandableVisitor::operator()(const T& e) {
|
|
115
|
+
result = IsExpandable<T>()(&e);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
template<>
|
|
119
|
+
void IsExpandableVisitor::operator()(const IElement& e) {
|
|
120
|
+
VisitBy(e, *this);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Explicit instantioning of templates to avoid Linker Error
|
|
124
|
+
template void IsExpandableVisitor::operator()<NullElement>(const NullElement&);
|
|
125
|
+
template void IsExpandableVisitor::operator()<StringElement>(const StringElement&);
|
|
126
|
+
template void IsExpandableVisitor::operator()<NumberElement>(const NumberElement&);
|
|
127
|
+
template void IsExpandableVisitor::operator()<BooleanElement>(const BooleanElement&);
|
|
128
|
+
template void IsExpandableVisitor::operator()<ArrayElement>(const ArrayElement&);
|
|
129
|
+
template void IsExpandableVisitor::operator()<EnumElement>(const EnumElement&);
|
|
130
|
+
template void IsExpandableVisitor::operator()<MemberElement>(const MemberElement&);
|
|
131
|
+
template void IsExpandableVisitor::operator()<ObjectElement>(const ObjectElement&);
|
|
132
|
+
template void IsExpandableVisitor::operator()<ExtendElement>(const ExtendElement&);
|
|
133
|
+
template void IsExpandableVisitor::operator()<OptionElement>(const OptionElement&);
|
|
134
|
+
template void IsExpandableVisitor::operator()<SelectElement>(const SelectElement&);
|
|
135
|
+
|
|
136
|
+
bool IsExpandableVisitor::get() const {
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}; // namespace refract
|