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,231 @@
|
|
1
|
+
//
|
2
|
+
// refract/VisitorUtils.h
|
3
|
+
// librefract
|
4
|
+
//
|
5
|
+
// Created by Vilibald Wanča on 09/11/15.
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
#ifndef REFRACT_VISITORUTILS_H
|
9
|
+
#define REFRACT_VISITORUTILS_H
|
10
|
+
|
11
|
+
#include "Element.h"
|
12
|
+
#include "Visitor.h"
|
13
|
+
|
14
|
+
#include "TypeQueryVisitor.h"
|
15
|
+
#include "ComparableVisitor.h"
|
16
|
+
|
17
|
+
// this will be removed, refract should not contain reference to other libraries
|
18
|
+
#include "SourceAnnotation.h"
|
19
|
+
|
20
|
+
namespace refract
|
21
|
+
{
|
22
|
+
template<typename T>
|
23
|
+
bool IsTypeAttribute(const T& e, std::string typeAttribute) {
|
24
|
+
IElement::MemberElementCollection::const_iterator ta = e.attributes.find("typeAttributes");
|
25
|
+
|
26
|
+
if (ta == e.attributes.end()) {
|
27
|
+
return false;
|
28
|
+
}
|
29
|
+
|
30
|
+
ArrayElement* attrs = TypeQueryVisitor::as<ArrayElement>((*ta)->value.second);
|
31
|
+
|
32
|
+
if (!attrs) {
|
33
|
+
return false;
|
34
|
+
}
|
35
|
+
|
36
|
+
for (ArrayElement::ValueType::const_iterator it = attrs->value.begin() ; it != attrs->value.end() ; ++it ) {
|
37
|
+
StringElement* attr = TypeQueryVisitor::as<StringElement>(*it);
|
38
|
+
if (!attr) {
|
39
|
+
continue;
|
40
|
+
}
|
41
|
+
if (attr->value == typeAttribute) {
|
42
|
+
return true;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
return false;
|
47
|
+
}
|
48
|
+
|
49
|
+
template<typename T>
|
50
|
+
bool IsVariableProperty(const T& e) {
|
51
|
+
IElement::MemberElementCollection::const_iterator i = e.attributes.find("variable");
|
52
|
+
|
53
|
+
if (i == e.attributes.end()) {
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
|
57
|
+
BooleanElement* b = TypeQueryVisitor::as<BooleanElement>((*i)->value.second);
|
58
|
+
return b ? b->value : false;
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
template<typename T>
|
63
|
+
const T* GetDefault(const T& e) {
|
64
|
+
IElement::MemberElementCollection::const_iterator i = e.attributes.find("default");
|
65
|
+
|
66
|
+
if (i == e.attributes.end()) {
|
67
|
+
return NULL;
|
68
|
+
}
|
69
|
+
|
70
|
+
return TypeQueryVisitor::as<T>((*i)->value.second);
|
71
|
+
}
|
72
|
+
|
73
|
+
template<typename T>
|
74
|
+
const T* GetSample(const T& e) {
|
75
|
+
IElement::MemberElementCollection::const_iterator i = e.attributes.find("samples");
|
76
|
+
|
77
|
+
if (i == e.attributes.end()) {
|
78
|
+
return NULL;
|
79
|
+
}
|
80
|
+
|
81
|
+
ArrayElement* a = TypeQueryVisitor::as<ArrayElement>((*i)->value.second);
|
82
|
+
|
83
|
+
if (!a || a->value.empty()) {
|
84
|
+
return NULL;
|
85
|
+
}
|
86
|
+
|
87
|
+
return TypeQueryVisitor::as<T>(*(a->value.begin()));
|
88
|
+
}
|
89
|
+
|
90
|
+
template<typename T, typename R = typename T::ValueType>
|
91
|
+
struct GetValue {
|
92
|
+
const T& element;
|
93
|
+
|
94
|
+
GetValue(const T& e) : element(e) {}
|
95
|
+
|
96
|
+
operator const R*() {
|
97
|
+
// FIXME: if value is propageted as first
|
98
|
+
// following example will be rendered w/ empty members
|
99
|
+
// ```
|
100
|
+
// - o
|
101
|
+
// - m1
|
102
|
+
// - m2
|
103
|
+
// - sample
|
104
|
+
// - m1: a
|
105
|
+
// - m2: b
|
106
|
+
// ```
|
107
|
+
// because `o` has members `m1` and `m2` , but members has no sed value
|
108
|
+
if (!element.empty()) {
|
109
|
+
return &element.value;
|
110
|
+
}
|
111
|
+
|
112
|
+
if (const T* s = GetSample(element)) {
|
113
|
+
return &s->value;
|
114
|
+
}
|
115
|
+
|
116
|
+
if (const T* d = GetDefault(element)) {
|
117
|
+
return &d->value;
|
118
|
+
}
|
119
|
+
|
120
|
+
if (element.empty() && IsTypeAttribute(element, "nullable")) {
|
121
|
+
return NULL;
|
122
|
+
}
|
123
|
+
|
124
|
+
return &element.value;
|
125
|
+
}
|
126
|
+
};
|
127
|
+
|
128
|
+
struct GetEnumValue {
|
129
|
+
const EnumElement& element;
|
130
|
+
|
131
|
+
GetEnumValue(const EnumElement& e) : element(e) {}
|
132
|
+
|
133
|
+
operator const EnumElement::ValueType*() {
|
134
|
+
if (const EnumElement* s = GetSample(element)) {
|
135
|
+
return &s->value;
|
136
|
+
}
|
137
|
+
|
138
|
+
if (const EnumElement* d = GetDefault(element)) {
|
139
|
+
return &d->value;
|
140
|
+
}
|
141
|
+
|
142
|
+
if (!element.empty()) {
|
143
|
+
return &element.value;
|
144
|
+
}
|
145
|
+
|
146
|
+
if (element.empty() && IsTypeAttribute(element, "nullable")) {
|
147
|
+
return NULL;
|
148
|
+
}
|
149
|
+
|
150
|
+
return &element.value;
|
151
|
+
}
|
152
|
+
};
|
153
|
+
|
154
|
+
// will be moved into different header (as part of drafter instead of refract)
|
155
|
+
template <typename T>
|
156
|
+
void CheckMixinParent(refract::IElement* element)
|
157
|
+
{
|
158
|
+
const T* resolved = TypeQueryVisitor::as<T>(element);
|
159
|
+
|
160
|
+
if (!resolved) {
|
161
|
+
throw snowcrash::Error("mixin base type should be the same as parent base type. objects should contain object mixins. arrays should contain array mixins", snowcrash::MSONError);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
// will be moved into different header (as part of drafter instead of refract)
|
166
|
+
template<typename T, typename Functor>
|
167
|
+
void HandleRefWhenFetchingMembers(const refract::IElement* e, typename T::ValueType& members, const Functor& functor)
|
168
|
+
{
|
169
|
+
IElement::MemberElementCollection::const_iterator found = e->attributes.find("resolved");
|
170
|
+
|
171
|
+
if (found == e->attributes.end()) {
|
172
|
+
return;
|
173
|
+
}
|
174
|
+
|
175
|
+
const ExtendElement* extended = TypeQueryVisitor::as<ExtendElement>((*found)->value.second);
|
176
|
+
|
177
|
+
if (!extended) {
|
178
|
+
CheckMixinParent<T>((*found)->value.second);
|
179
|
+
// We can safely cast it because we are already checking the type in the above line.
|
180
|
+
functor(static_cast<const T&>(*(*found)->value.second), members);
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
|
184
|
+
for (RefractElements::const_iterator it = extended->value.begin();
|
185
|
+
it != extended->value.end();
|
186
|
+
++it) {
|
187
|
+
|
188
|
+
CheckMixinParent<T>(*it);
|
189
|
+
// We can safely cast it because we are already checking the type in the above line.
|
190
|
+
functor(static_cast<const T&>(**it), members);
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
template <typename T>
|
195
|
+
MemberElement* FindMemberByKey(const T& e,
|
196
|
+
const std::string& name)
|
197
|
+
{
|
198
|
+
for (typename T::ValueType::const_iterator it = e.value.begin()
|
199
|
+
; it != e.value.end()
|
200
|
+
; ++it ) {
|
201
|
+
|
202
|
+
ComparableVisitor cmp(name, ComparableVisitor::key);
|
203
|
+
VisitBy(*(*it), cmp);
|
204
|
+
|
205
|
+
if (cmp.get()) { // key was recognized - it is save to cast to MemberElement
|
206
|
+
return static_cast<MemberElement*>(*it);
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
return NULL;
|
211
|
+
}
|
212
|
+
|
213
|
+
template <typename T>
|
214
|
+
T* FindCollectionMemberValue(const IElement::MemberElementCollection& collection, const std::string& key) {
|
215
|
+
IElement::MemberElementCollection::const_iterator i = collection.find(key);
|
216
|
+
if (i == collection.end()) {
|
217
|
+
return NULL;
|
218
|
+
}
|
219
|
+
|
220
|
+
return TypeQueryVisitor::as<T>((*i)->value.second);
|
221
|
+
}
|
222
|
+
|
223
|
+
std::string GetKeyAsString(const MemberElement& e);
|
224
|
+
|
225
|
+
StringElement* GetDescription(const IElement& e);
|
226
|
+
|
227
|
+
void SetRenderFlag(RefractElements& elements, const IElement::renderFlags flag);
|
228
|
+
|
229
|
+
}
|
230
|
+
|
231
|
+
#endif /* REFRACT_VISITORUTILS_H */
|
@@ -0,0 +1,263 @@
|
|
1
|
+
//
|
2
|
+
// reporting.cc
|
3
|
+
// drafter
|
4
|
+
//
|
5
|
+
// Created by Jiri Kratochvil on 2015-02-13
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#include "reporting.h"
|
10
|
+
|
11
|
+
#include <algorithm>
|
12
|
+
#include <iostream>
|
13
|
+
|
14
|
+
#include "refract/Element.h"
|
15
|
+
#include "refract/FilterVisitor.h"
|
16
|
+
#include "refract/Query.h"
|
17
|
+
#include "refract/Iterate.h"
|
18
|
+
#include "refract/TypeQueryVisitor.h"
|
19
|
+
|
20
|
+
#include "refract/VisitorUtils.h"
|
21
|
+
|
22
|
+
namespace sc = snowcrash;
|
23
|
+
|
24
|
+
/** structure contains starting and ending position of a error/warning. */
|
25
|
+
struct AnnotationPosition {
|
26
|
+
size_t fromLine;
|
27
|
+
size_t fromColumn;
|
28
|
+
size_t toLine;
|
29
|
+
size_t toColumn;
|
30
|
+
};
|
31
|
+
|
32
|
+
/**
|
33
|
+
* \brief Convert character index mapping to line and column number
|
34
|
+
* \param linesEndIndex Vector containing indexes of end line characters
|
35
|
+
* \param range Character index mapping as input
|
36
|
+
* \param out Position of the given range as output
|
37
|
+
*/
|
38
|
+
void GetLineFromMap(const std::vector<size_t>& linesEndIndex,
|
39
|
+
const mdp::Range& range,
|
40
|
+
AnnotationPosition& out)
|
41
|
+
{
|
42
|
+
|
43
|
+
std::vector<size_t>::const_iterator annotationPositionIt;
|
44
|
+
|
45
|
+
out.fromLine = 0;
|
46
|
+
out.fromColumn = 0;
|
47
|
+
out.toLine = 0;
|
48
|
+
out.toColumn = 0;
|
49
|
+
|
50
|
+
// Finds starting line and column position
|
51
|
+
annotationPositionIt = std::upper_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location) - 1;
|
52
|
+
|
53
|
+
if (annotationPositionIt != linesEndIndex.end()) {
|
54
|
+
|
55
|
+
out.fromLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1;
|
56
|
+
out.fromColumn = range.location - *annotationPositionIt + 1;
|
57
|
+
}
|
58
|
+
|
59
|
+
// Finds ending line and column position
|
60
|
+
annotationPositionIt = std::lower_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location + range.length) - 1;
|
61
|
+
|
62
|
+
if (annotationPositionIt != linesEndIndex.end()) {
|
63
|
+
|
64
|
+
out.toLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1;
|
65
|
+
out.toColumn = (range.location + range.length) - *annotationPositionIt + 1;
|
66
|
+
|
67
|
+
if (*(annotationPositionIt + 1) == (range.location + range.length)) {
|
68
|
+
out.toColumn--;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* \brief Given the source returns the length of all the lines in source as a vector
|
75
|
+
* \param source Source data
|
76
|
+
* \param out Vector containing indexes of all end line character in source
|
77
|
+
*/
|
78
|
+
void GetLinesEndIndex(const std::string& source,
|
79
|
+
std::vector<size_t>& out)
|
80
|
+
{
|
81
|
+
|
82
|
+
out.push_back(0);
|
83
|
+
|
84
|
+
for (size_t i = 0; i < source.length(); i++) {
|
85
|
+
|
86
|
+
if (source[i] == '\n') {
|
87
|
+
out.push_back(i + 1);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
void PrintAnnotation(const std::string& prefix,
|
93
|
+
const snowcrash::SourceAnnotation& annotation,
|
94
|
+
const std::string& source,
|
95
|
+
const bool useLineNumbers)
|
96
|
+
{
|
97
|
+
|
98
|
+
std::cerr << prefix;
|
99
|
+
|
100
|
+
if (annotation.code != sc::SourceAnnotation::OK) {
|
101
|
+
std::cerr << " (" << annotation.code << ") ";
|
102
|
+
}
|
103
|
+
|
104
|
+
if (!annotation.message.empty()) {
|
105
|
+
std::cerr << " " << annotation.message;
|
106
|
+
}
|
107
|
+
|
108
|
+
std::vector<size_t> linesEndIndex;
|
109
|
+
|
110
|
+
if (useLineNumbers) {
|
111
|
+
GetLinesEndIndex(source, linesEndIndex);
|
112
|
+
}
|
113
|
+
|
114
|
+
if (!annotation.location.empty()) {
|
115
|
+
|
116
|
+
for (mdp::CharactersRangeSet::const_iterator it = annotation.location.begin();
|
117
|
+
it != annotation.location.end();
|
118
|
+
++it) {
|
119
|
+
|
120
|
+
if (useLineNumbers) {
|
121
|
+
|
122
|
+
AnnotationPosition annotationPosition;
|
123
|
+
GetLineFromMap(linesEndIndex, *it, annotationPosition);
|
124
|
+
|
125
|
+
std::cerr << "; line " << annotationPosition.fromLine << ", column " << annotationPosition.fromColumn;
|
126
|
+
std::cerr << " - line " << annotationPosition.toLine << ", column " << annotationPosition.toColumn;
|
127
|
+
}
|
128
|
+
else {
|
129
|
+
|
130
|
+
std::cerr << ((it == annotation.location.begin()) ? " :" : ";");
|
131
|
+
std::cerr << it->location << ":" << it->length;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
std::cerr << std::endl;
|
137
|
+
}
|
138
|
+
|
139
|
+
/**
|
140
|
+
* \brief Print parser report to stderr.
|
141
|
+
* \param report A parser report to print
|
142
|
+
* \param source Source data
|
143
|
+
* \param isUseLineNumbers True if the annotations needs to be printed by line and column number
|
144
|
+
*/
|
145
|
+
void PrintReport(const snowcrash::Report& report,
|
146
|
+
const std::string& source,
|
147
|
+
const bool isUseLineNumbers)
|
148
|
+
{
|
149
|
+
|
150
|
+
std::cerr << std::endl;
|
151
|
+
|
152
|
+
if (report.error.code == sc::Error::OK) {
|
153
|
+
std::cerr << "OK.\n";
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
PrintAnnotation("error:", report.error, source, isUseLineNumbers);
|
157
|
+
}
|
158
|
+
|
159
|
+
for (snowcrash::Warnings::const_iterator it = report.warnings.begin(); it != report.warnings.end(); ++it) {
|
160
|
+
PrintAnnotation("warning:", *it, source, isUseLineNumbers);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
struct AnnotationToString {
|
165
|
+
|
166
|
+
std::vector<size_t> linesEndIndex;
|
167
|
+
const bool useLineNumbers;
|
168
|
+
|
169
|
+
AnnotationToString(const std::string& source, const bool useLineNumbers) : useLineNumbers(useLineNumbers) {
|
170
|
+
if (useLineNumbers) {
|
171
|
+
GetLinesEndIndex(source, linesEndIndex);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
const std::string location(const refract::IElement* sourceMap) {
|
176
|
+
std::stringstream output;
|
177
|
+
const refract::ArrayElement* map = refract::TypeQueryVisitor::as<refract::ArrayElement>(sourceMap);
|
178
|
+
if (map && map->value.size() == 2) {
|
179
|
+
refract::NumberElement* loc = refract::TypeQueryVisitor::as<refract::NumberElement>(map->value[0]);
|
180
|
+
refract::NumberElement* len = refract::TypeQueryVisitor::as<refract::NumberElement>(map->value[1]);
|
181
|
+
if (loc && len) {
|
182
|
+
if (useLineNumbers) {
|
183
|
+
|
184
|
+
AnnotationPosition annotationPosition;
|
185
|
+
mdp::Range pos(loc->value, len->value);
|
186
|
+
GetLineFromMap(linesEndIndex, pos, annotationPosition);
|
187
|
+
|
188
|
+
output << "; line " << annotationPosition.fromLine << ", column " << annotationPosition.fromColumn;
|
189
|
+
output << " - line " << annotationPosition.toLine << ", column " << annotationPosition.toColumn;
|
190
|
+
}
|
191
|
+
else {
|
192
|
+
output << loc->value << ":" << len->value;
|
193
|
+
}
|
194
|
+
}
|
195
|
+
}
|
196
|
+
return output.str();
|
197
|
+
}
|
198
|
+
|
199
|
+
const std::string operator()(const refract::IElement* annotation) {
|
200
|
+
std::stringstream output;
|
201
|
+
|
202
|
+
if (!annotation || annotation->element() != "annotation") {
|
203
|
+
return output.str();
|
204
|
+
}
|
205
|
+
|
206
|
+
if (const refract::ArrayElement* classes = refract::FindCollectionMemberValue<refract::ArrayElement>(annotation->meta, "classes")) {
|
207
|
+
if (classes->value.size() == 1) {
|
208
|
+
refract::StringElement* type = refract::TypeQueryVisitor::as<refract::StringElement>(classes->value.front());
|
209
|
+
if (type) {
|
210
|
+
output << type->value << ": ";
|
211
|
+
}
|
212
|
+
}
|
213
|
+
};
|
214
|
+
|
215
|
+
if (const refract::NumberElement* code = refract::FindCollectionMemberValue<refract::NumberElement>(annotation->attributes, "code")) {
|
216
|
+
output << "(" <<code->value << ") ";
|
217
|
+
}
|
218
|
+
|
219
|
+
if (const refract::StringElement* message = refract::TypeQueryVisitor::as<refract::StringElement>(annotation)) {
|
220
|
+
output << message->value;
|
221
|
+
}
|
222
|
+
|
223
|
+
if (refract::ArrayElement* sourceMap = refract::FindCollectionMemberValue<refract::ArrayElement>(annotation->attributes, "sourceMap")) {
|
224
|
+
if (sourceMap->value.size() == 1) {
|
225
|
+
sourceMap = refract::TypeQueryVisitor::as<refract::ArrayElement>(sourceMap->value.front());
|
226
|
+
if (sourceMap) {
|
227
|
+
for (refract::IElement* array : sourceMap->value) {
|
228
|
+
if (!useLineNumbers) {
|
229
|
+
const char* prefix = array == (*sourceMap->value.begin()) ? " :" :";";
|
230
|
+
output << prefix;
|
231
|
+
}
|
232
|
+
output << location(array);
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
};
|
237
|
+
|
238
|
+
return output.str();
|
239
|
+
}
|
240
|
+
};
|
241
|
+
|
242
|
+
void PrintReport(const drafter_result* result,
|
243
|
+
const std::string& source,
|
244
|
+
const bool useLineNumbers,
|
245
|
+
const int error)
|
246
|
+
{
|
247
|
+
std::cerr << std::endl;
|
248
|
+
|
249
|
+
refract::FilterVisitor filter(refract::query::Element("annotation"));
|
250
|
+
refract::Iterate<refract::Children> iterate(filter);
|
251
|
+
iterate(*result);
|
252
|
+
|
253
|
+
refract::RefractElements elements;
|
254
|
+
|
255
|
+
if (error == sc::Error::OK) {
|
256
|
+
std::cerr << "OK.\n";
|
257
|
+
}
|
258
|
+
|
259
|
+
std::transform(filter.elements().begin(), filter.elements().end(),
|
260
|
+
std::ostream_iterator<std::string>(std::cerr, "\n"),
|
261
|
+
AnnotationToString(source, useLineNumbers));
|
262
|
+
|
263
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
//
|
2
|
+
// reporting.h
|
3
|
+
// drafter
|
4
|
+
//
|
5
|
+
// Created by Jiri Kratochvil on 2015-02-13
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef DRAFTER_REPORTING_H
|
10
|
+
#define DRAFTER_REPORTING_H
|
11
|
+
|
12
|
+
#include "drafter.h"
|
13
|
+
#include "SourceAnnotation.h"
|
14
|
+
|
15
|
+
/**
|
16
|
+
* \brief Print parser report to stderr.
|
17
|
+
*
|
18
|
+
* \param report A parser report to print
|
19
|
+
* \param source Source data
|
20
|
+
* \param useLineNumbers True if the annotations needs to be printed by line and column number
|
21
|
+
*/
|
22
|
+
void PrintReport(const snowcrash::Report& report,
|
23
|
+
const std::string& source,
|
24
|
+
const bool useLineNumbers);
|
25
|
+
|
26
|
+
/**
|
27
|
+
* \brief Print parser report to stderr.
|
28
|
+
*
|
29
|
+
* \param report A parser report to print
|
30
|
+
* \param source Source data
|
31
|
+
* \param useLineNumbers True if the annotations needs to be printed by line and column number
|
32
|
+
* \param error - code form parsing
|
33
|
+
*/
|
34
|
+
void PrintReport(const drafter_result*,
|
35
|
+
const std::string& source,
|
36
|
+
const bool useLineNumbers,
|
37
|
+
const int error);
|
38
|
+
|
39
|
+
#endif // #ifndef DRAFTER_REPORTING_H
|
@@ -0,0 +1,148 @@
|
|
1
|
+
//
|
2
|
+
// stream.h
|
3
|
+
// drafter
|
4
|
+
//
|
5
|
+
// Created by Jiri Kratochvil on 2015-03-03
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef DRAFTER_STREAM_H
|
10
|
+
#define DRAFTER_STREAM_H
|
11
|
+
|
12
|
+
#include <memory>
|
13
|
+
|
14
|
+
#include <string>
|
15
|
+
|
16
|
+
#include <iostream>
|
17
|
+
#include <sstream>
|
18
|
+
#include <fstream>
|
19
|
+
|
20
|
+
/**
|
21
|
+
* \brief proxy redirect i/o operations to stdin/stdout
|
22
|
+
* and avoid close stdin/stdout while delete
|
23
|
+
*/
|
24
|
+
template <typename T> struct std_io_proxy;
|
25
|
+
|
26
|
+
template <> struct std_io_proxy<std::ostream> : public std::ostream {
|
27
|
+
//std::streambuf dummy;
|
28
|
+
std::stringbuf dummy;
|
29
|
+
|
30
|
+
std_io_proxy() : std::ostream(std::cout.rdbuf())
|
31
|
+
{
|
32
|
+
//rdbuf(std::cout.rdbuf());
|
33
|
+
}
|
34
|
+
|
35
|
+
virtual ~std_io_proxy()
|
36
|
+
{
|
37
|
+
rdbuf(&dummy);
|
38
|
+
}
|
39
|
+
};
|
40
|
+
|
41
|
+
template <> struct std_io_proxy<std::istream> : public std::istream {
|
42
|
+
//std::streambuf dummy;
|
43
|
+
std::stringbuf dummy;
|
44
|
+
|
45
|
+
std_io_proxy() : std::istream(std::cin.rdbuf())
|
46
|
+
{
|
47
|
+
//saved = rdbuf(std::cin.rdbuf());
|
48
|
+
}
|
49
|
+
|
50
|
+
virtual ~std_io_proxy()
|
51
|
+
{
|
52
|
+
rdbuf(&dummy);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
|
56
|
+
/**
|
57
|
+
* \brief functor returns cin/cout ptr in based on istream or ostream
|
58
|
+
*/
|
59
|
+
template<typename T> struct std_io {
|
60
|
+
T* operator()() const
|
61
|
+
{
|
62
|
+
return new std_io_proxy<T>();
|
63
|
+
}
|
64
|
+
};
|
65
|
+
|
66
|
+
/**
|
67
|
+
* \brief functor returns appropriate cin/cout based on istream/ostream
|
68
|
+
*/
|
69
|
+
template<typename T> struct std_io_selector {
|
70
|
+
typedef T stream_type;
|
71
|
+
typedef stream_type* return_type;
|
72
|
+
|
73
|
+
return_type operator()() const
|
74
|
+
{
|
75
|
+
return return_type(std_io<T>()());
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
/**
|
80
|
+
* \brief functor select fstream based on iostream
|
81
|
+
*/
|
82
|
+
template <typename T> struct to_fstream;
|
83
|
+
|
84
|
+
template<>
|
85
|
+
struct to_fstream<std::istream>{
|
86
|
+
typedef std::ifstream stream_type;
|
87
|
+
static std::ios_base::openmode open_flags() { return std::ios_base::in | std::ios_base::binary; }
|
88
|
+
};
|
89
|
+
|
90
|
+
template<>
|
91
|
+
struct to_fstream<std::ostream>{
|
92
|
+
typedef std::ofstream stream_type;
|
93
|
+
static std::ios_base::openmode open_flags() { return std::ios_base::out | std::ios_base::binary; }
|
94
|
+
};
|
95
|
+
|
96
|
+
/**
|
97
|
+
* \brief functor select return appropriate opened fstream based on type of stream
|
98
|
+
*/
|
99
|
+
template<typename T> struct fstream_io_selector{
|
100
|
+
typedef typename to_fstream<T>::stream_type stream_type;
|
101
|
+
typedef stream_type* return_type;
|
102
|
+
|
103
|
+
return_type operator()(const char* name) const
|
104
|
+
{
|
105
|
+
return return_type(new stream_type(name, to_fstream<T>::open_flags()));
|
106
|
+
}
|
107
|
+
};
|
108
|
+
|
109
|
+
/**
|
110
|
+
* \brief return pointer to readable/writable stream or report error and exit()
|
111
|
+
*
|
112
|
+
* free allocated memory must be released by calling `delete`
|
113
|
+
* optionaly you can use std::unique_ptr<>
|
114
|
+
*
|
115
|
+
* return is based on \template param T (must be std::ostream or std::istream)
|
116
|
+
*
|
117
|
+
* For std::istream it return opened std::ifstream with filename as in \param `file`
|
118
|
+
* if \param `file` is empty it will return std::cin
|
119
|
+
*
|
120
|
+
* In similar way it work for std::ostream
|
121
|
+
*
|
122
|
+
* \param template<T> type of returned stream
|
123
|
+
* \param file - name of file to open for read/write if empty use standart input/output
|
124
|
+
*
|
125
|
+
*/
|
126
|
+
|
127
|
+
template<typename T>
|
128
|
+
T* CreateStreamFromName(const std::string& file)
|
129
|
+
{
|
130
|
+
if (file.empty()) {
|
131
|
+
return std_io_selector<T>()();
|
132
|
+
}
|
133
|
+
|
134
|
+
typedef typename fstream_io_selector<T>::return_type return_type;
|
135
|
+
|
136
|
+
return_type stream = fstream_io_selector<T>()(file.c_str());
|
137
|
+
|
138
|
+
if (!stream->is_open()) {
|
139
|
+
std::cerr << "fatal: unable to open file '" << file << "'\n";
|
140
|
+
delete stream;
|
141
|
+
exit(EXIT_FAILURE);
|
142
|
+
}
|
143
|
+
|
144
|
+
return stream;
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
#endif // #ifndef DRAFTER_STREAM_H
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'formula'
|
2
|
+
|
3
|
+
class Drafter < Formula
|
4
|
+
homepage 'http://apiblueprint.org'
|
5
|
+
head 'https://github.com/apiaryio/drafter.git', :tag => 'v3.2.2'
|
6
|
+
|
7
|
+
def install
|
8
|
+
system "./configure", "--shared"
|
9
|
+
system "make", "drafter"
|
10
|
+
bin.install Dir["bin/drafter"]
|
11
|
+
(include + "drafter").install Dir["src/drafter.h"]
|
12
|
+
lib.install Dir["build/out/Release/libdrafter.dylib"]
|
13
|
+
end
|
14
|
+
|
15
|
+
test do
|
16
|
+
system bin/"drafter", "--help"
|
17
|
+
end
|
18
|
+
end
|