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,246 @@
|
|
1
|
+
//
|
2
|
+
// SectionParser.h
|
3
|
+
// snowcrash
|
4
|
+
//
|
5
|
+
// Created by Zdenek Nemec on 5/4/13.
|
6
|
+
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef SNOWCRASH_SECTIONPARSER_H
|
10
|
+
#define SNOWCRASH_SECTIONPARSER_H
|
11
|
+
|
12
|
+
#include <stdexcept>
|
13
|
+
#include "SignatureSectionProcessor.h"
|
14
|
+
|
15
|
+
namespace snowcrash {
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Blueprint section parser
|
19
|
+
*/
|
20
|
+
template<typename T, typename Adapter>
|
21
|
+
struct SectionParser {
|
22
|
+
|
23
|
+
|
24
|
+
/**
|
25
|
+
* \brief Parse a section of blueprint
|
26
|
+
* \param node Initial node to start parsing at
|
27
|
+
* \param siblings Siblings of the initial node
|
28
|
+
* \param pd Parser data
|
29
|
+
* \param T Parsed output
|
30
|
+
* \return Iterator to the first unparsed block
|
31
|
+
*/
|
32
|
+
static MarkdownNodeIterator parse(const MarkdownNodeIterator& node,
|
33
|
+
const MarkdownNodes& siblings,
|
34
|
+
SectionParserData& pd,
|
35
|
+
const ParseResultRef<T>& out) {
|
36
|
+
|
37
|
+
SectionLayout layout = DefaultSectionLayout;
|
38
|
+
MarkdownNodeIterator cur = Adapter::startingNode(node, pd);
|
39
|
+
const MarkdownNodes& collection = Adapter::startingNodeSiblings(node, siblings);
|
40
|
+
|
41
|
+
// Signature node
|
42
|
+
MarkdownNodeIterator lastCur = cur;
|
43
|
+
cur = SectionProcessor<T>::processSignature(cur, collection, pd, layout, out);
|
44
|
+
|
45
|
+
// Exclusive Nested Sections Layout
|
46
|
+
if (layout == ExclusiveNestedSectionLayout) {
|
47
|
+
|
48
|
+
cur = parseNestedSections(cur, collection, pd, out);
|
49
|
+
|
50
|
+
SectionProcessor<T>::finalize(node, pd, out);
|
51
|
+
|
52
|
+
return Adapter::nextStartingNode(node, siblings, cur);
|
53
|
+
}
|
54
|
+
|
55
|
+
// Parser redirect layout
|
56
|
+
if (layout == RedirectSectionLayout) {
|
57
|
+
SectionProcessor<T>::finalize(node, pd, out);
|
58
|
+
|
59
|
+
return Adapter::nextStartingNode(node, siblings, cur);
|
60
|
+
}
|
61
|
+
|
62
|
+
// Default layout
|
63
|
+
if (lastCur == cur)
|
64
|
+
return Adapter::nextStartingNode(node, siblings, cur);
|
65
|
+
|
66
|
+
// Description nodes
|
67
|
+
while(cur != collection.end() &&
|
68
|
+
SectionProcessor<T>::isDescriptionNode(cur, pd.sectionContext())) {
|
69
|
+
|
70
|
+
lastCur = cur;
|
71
|
+
cur = SectionProcessor<T>::processDescription(cur, collection, pd, out);
|
72
|
+
|
73
|
+
if (lastCur == cur)
|
74
|
+
return Adapter::nextStartingNode(node, siblings, cur);
|
75
|
+
}
|
76
|
+
|
77
|
+
// Content nodes
|
78
|
+
while(cur != collection.end() &&
|
79
|
+
SectionProcessor<T>::isContentNode(cur, pd.sectionContext())) {
|
80
|
+
|
81
|
+
lastCur = cur;
|
82
|
+
cur = SectionProcessor<T>::processContent(cur, collection, pd, out);
|
83
|
+
|
84
|
+
if (lastCur == cur)
|
85
|
+
return Adapter::nextStartingNode(node, siblings, cur);
|
86
|
+
}
|
87
|
+
|
88
|
+
// Nested Sections
|
89
|
+
cur = parseNestedSections(cur, collection, pd, out);
|
90
|
+
|
91
|
+
SectionProcessor<T>::finalize(node, pd, out);
|
92
|
+
|
93
|
+
return Adapter::nextStartingNode(node, siblings, cur);
|
94
|
+
}
|
95
|
+
|
96
|
+
|
97
|
+
/** Parse nested sections */
|
98
|
+
static MarkdownNodeIterator parseNestedSections(const MarkdownNodeIterator& node,
|
99
|
+
const MarkdownNodes& collection,
|
100
|
+
SectionParserData& pd,
|
101
|
+
const ParseResultRef<T>& out) {
|
102
|
+
|
103
|
+
MarkdownNodeIterator cur = node;
|
104
|
+
MarkdownNodeIterator lastCur = cur;
|
105
|
+
|
106
|
+
SectionType lastSectionType = UndefinedSectionType;
|
107
|
+
|
108
|
+
SectionProcessor<T>::preprocessNestedSections(node, collection, pd, out);
|
109
|
+
|
110
|
+
// Nested sections
|
111
|
+
while (cur != collection.end()) {
|
112
|
+
|
113
|
+
lastCur = cur;
|
114
|
+
SectionType nestedType = SectionProcessor<T>::nestedSectionType(cur);
|
115
|
+
|
116
|
+
pd.sectionsContext.push_back(nestedType);
|
117
|
+
|
118
|
+
if (nestedType != UndefinedSectionType) {
|
119
|
+
cur = SectionProcessor<T>::processNestedSection(cur, collection, pd, out);
|
120
|
+
}
|
121
|
+
else if (Adapter::nextSkipsUnexpected ||
|
122
|
+
SectionProcessor<T>::isUnexpectedNode(cur, pd.sectionContext())) {
|
123
|
+
|
124
|
+
cur = SectionProcessor<T>::processUnexpectedNode(cur, collection, pd, lastSectionType, out);
|
125
|
+
}
|
126
|
+
|
127
|
+
if (cur != collection.end() &&
|
128
|
+
(pd.sectionContext() != UndefinedSectionType ||
|
129
|
+
(cur->type != mdp::ParagraphMarkdownNodeType &&
|
130
|
+
cur->type != mdp::CodeMarkdownNodeType))) {
|
131
|
+
|
132
|
+
lastSectionType = pd.sectionContext();
|
133
|
+
}
|
134
|
+
|
135
|
+
pd.sectionsContext.pop_back();
|
136
|
+
|
137
|
+
if (lastCur == cur)
|
138
|
+
break;
|
139
|
+
}
|
140
|
+
|
141
|
+
return cur;
|
142
|
+
}
|
143
|
+
};
|
144
|
+
|
145
|
+
/** Parser Adapter for parsing header-defined sections */
|
146
|
+
struct HeaderSectionAdapter {
|
147
|
+
|
148
|
+
/** \return Node to start parsing with */
|
149
|
+
static const MarkdownNodeIterator startingNode(const MarkdownNodeIterator& seed,
|
150
|
+
const SectionParserData& pd) {
|
151
|
+
if (seed->type != mdp::HeaderMarkdownNodeType) {
|
152
|
+
// ERR: Expected header
|
153
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(seed->sourceMap, pd.sourceCharacterIndex);
|
154
|
+
throw Error("expected header block, e.g. '# <text>'", BusinessError, sourceMap);
|
155
|
+
}
|
156
|
+
|
157
|
+
return seed;
|
158
|
+
}
|
159
|
+
|
160
|
+
/** \return Collection of siblings to starting Node */
|
161
|
+
static const MarkdownNodes& startingNodeSiblings(const MarkdownNodeIterator& seed,
|
162
|
+
const MarkdownNodes& siblings) {
|
163
|
+
return siblings;
|
164
|
+
}
|
165
|
+
|
166
|
+
/** \return Starting node for next parsing */
|
167
|
+
static const MarkdownNodeIterator nextStartingNode(const MarkdownNodeIterator& seed,
|
168
|
+
const MarkdownNodes& siblings,
|
169
|
+
const MarkdownNodeIterator& cur) {
|
170
|
+
return cur;
|
171
|
+
}
|
172
|
+
|
173
|
+
/**
|
174
|
+
* \brief Adapter Markdown node skipping behavior trait.
|
175
|
+
*
|
176
|
+
* Adapter trait signalizing that the adapter can possibly skip some Markdown nodes on a nextStartingNode() call.
|
177
|
+
* If set to true, a call to nextStartingNode() can skip some nodes causing some information loss. False otherwise.
|
178
|
+
*/
|
179
|
+
static const bool nextSkipsUnexpected = false;
|
180
|
+
};
|
181
|
+
|
182
|
+
/** Parser Adapter for parsing list-defined sections */
|
183
|
+
struct ListSectionAdapter {
|
184
|
+
|
185
|
+
static const MarkdownNodeIterator startingNode(const MarkdownNodeIterator& seed,
|
186
|
+
const SectionParserData& pd) {
|
187
|
+
if (seed->type != mdp::ListItemMarkdownNodeType) {
|
188
|
+
// ERR: Expected list item
|
189
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(seed->sourceMap, pd.sourceCharacterIndex);
|
190
|
+
throw Error("expected list item block, e.g. '+ <text>'", BusinessError, sourceMap);
|
191
|
+
}
|
192
|
+
|
193
|
+
for (auto it = seed->children().begin() ; it != seed->children().end() ; ++it) {
|
194
|
+
if (it->sourceMap.begin()->length != 0) {
|
195
|
+
return it;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
// there are no parseable items, let it pass in old manner
|
200
|
+
return seed->children().begin();
|
201
|
+
}
|
202
|
+
|
203
|
+
static const MarkdownNodes& startingNodeSiblings(const MarkdownNodeIterator& seed,
|
204
|
+
const MarkdownNodes& siblings) {
|
205
|
+
return seed->children();
|
206
|
+
}
|
207
|
+
|
208
|
+
static const MarkdownNodeIterator nextStartingNode(const MarkdownNodeIterator& seed,
|
209
|
+
const MarkdownNodes& siblings,
|
210
|
+
const MarkdownNodeIterator& cur) {
|
211
|
+
if (seed == siblings.end())
|
212
|
+
return seed;
|
213
|
+
|
214
|
+
return ++MarkdownNodeIterator(seed);
|
215
|
+
}
|
216
|
+
|
217
|
+
static const bool nextSkipsUnexpected = true;
|
218
|
+
};
|
219
|
+
|
220
|
+
/** Parser Adapter for parsing blueprint sections */
|
221
|
+
struct BlueprintSectionAdapter {
|
222
|
+
|
223
|
+
/** \return Node to start parsing with */
|
224
|
+
static const MarkdownNodeIterator startingNode(const MarkdownNodeIterator& seed,
|
225
|
+
const SectionParserData& pd) {
|
226
|
+
return seed;
|
227
|
+
}
|
228
|
+
|
229
|
+
/** \return Collection of siblings to starting Node */
|
230
|
+
static const MarkdownNodes& startingNodeSiblings(const MarkdownNodeIterator& seed,
|
231
|
+
const MarkdownNodes& siblings) {
|
232
|
+
return siblings;
|
233
|
+
}
|
234
|
+
|
235
|
+
/** \return Starting node for next parsing */
|
236
|
+
static const MarkdownNodeIterator nextStartingNode(const MarkdownNodeIterator& seed,
|
237
|
+
const MarkdownNodes& siblings,
|
238
|
+
const MarkdownNodeIterator& cur) {
|
239
|
+
return cur;
|
240
|
+
}
|
241
|
+
|
242
|
+
static const bool nextSkipsUnexpected = false;
|
243
|
+
};
|
244
|
+
}
|
245
|
+
|
246
|
+
#endif
|
@@ -0,0 +1,109 @@
|
|
1
|
+
//
|
2
|
+
// SectionParserData.h
|
3
|
+
// snowcrash
|
4
|
+
//
|
5
|
+
// Created by Zdenek Nemec on 5/21/14.
|
6
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef SNOWCRASH_SECTIONPARSERDATA_H
|
10
|
+
#define SNOWCRASH_SECTIONPARSERDATA_H
|
11
|
+
|
12
|
+
#include "ModelTable.h"
|
13
|
+
#include "BlueprintSourcemap.h"
|
14
|
+
#include "Section.h"
|
15
|
+
|
16
|
+
namespace snowcrash {
|
17
|
+
|
18
|
+
/**
|
19
|
+
* \brief Blueprint Parser Options.
|
20
|
+
*
|
21
|
+
* Controls blueprint parser behavior.
|
22
|
+
*/
|
23
|
+
enum BlueprintParserOption {
|
24
|
+
RenderDescriptionsOption = (1 << 0), /// < Render Markdown in description.
|
25
|
+
RequireBlueprintNameOption = (1 << 1), /// < Treat missing blueprint name as error
|
26
|
+
ExportSourcemapOption = (1 << 2) /// < Export source maps AST
|
27
|
+
};
|
28
|
+
|
29
|
+
typedef unsigned int BlueprintParserOptions;
|
30
|
+
|
31
|
+
/**
|
32
|
+
* \brief Section Parser Data
|
33
|
+
*
|
34
|
+
* State of the parser.
|
35
|
+
*/
|
36
|
+
struct SectionParserData {
|
37
|
+
SectionParserData(BlueprintParserOptions opts,
|
38
|
+
const mdp::ByteBuffer& src,
|
39
|
+
const Blueprint& bp)
|
40
|
+
: options(opts), sourceData(src), blueprint(bp) {}
|
41
|
+
|
42
|
+
/** Parser Options */
|
43
|
+
BlueprintParserOptions options;
|
44
|
+
|
45
|
+
/** Named Types */
|
46
|
+
std::vector<mson::NamedType> msonTypesTable;
|
47
|
+
|
48
|
+
/** Table of named types and resolved base types */
|
49
|
+
mson::NamedTypeBaseTable namedTypeBaseTable;
|
50
|
+
|
51
|
+
/** Table mapping named type to sub types */
|
52
|
+
mson::NamedTypeInheritanceTable namedTypeInheritanceTable;
|
53
|
+
|
54
|
+
/** Table mapping named types to their dependent named types */
|
55
|
+
mson::NamedTypeDependencyTable namedTypeDependencyTable;
|
56
|
+
|
57
|
+
/** Variable to store the current named type */
|
58
|
+
mson::Literal namedTypeContext;
|
59
|
+
|
60
|
+
/** Model Table */
|
61
|
+
ModelTable modelTable;
|
62
|
+
|
63
|
+
/** Model Table Sourcemap */
|
64
|
+
ModelSourceMapTable modelSourceMapTable;
|
65
|
+
|
66
|
+
/** Source Data */
|
67
|
+
const mdp::ByteBuffer& sourceData;
|
68
|
+
|
69
|
+
/** Source - map of bytes to character position - performance optimalization */
|
70
|
+
mdp::ByteBufferCharacterIndex sourceCharacterIndex;
|
71
|
+
|
72
|
+
/** AST being parsed **/
|
73
|
+
const Blueprint& blueprint;
|
74
|
+
|
75
|
+
/** Sections Context */
|
76
|
+
typedef std::vector<SectionType> SectionsStack;
|
77
|
+
SectionsStack sectionsContext;
|
78
|
+
|
79
|
+
/** \returns Actual Section Context */
|
80
|
+
SectionType sectionContext() const {
|
81
|
+
return (sectionsContext.empty()) ? UndefinedSectionType : sectionsContext.back();
|
82
|
+
}
|
83
|
+
|
84
|
+
/** \returns Parent Section Context */
|
85
|
+
SectionType parentSectionContext() const {
|
86
|
+
if (sectionsContext.empty())
|
87
|
+
return UndefinedSectionType;
|
88
|
+
|
89
|
+
size_t size = sectionsContext.size();
|
90
|
+
|
91
|
+
if (size == 1)
|
92
|
+
return sectionsContext.back();
|
93
|
+
else
|
94
|
+
return sectionsContext[size-2];
|
95
|
+
}
|
96
|
+
|
97
|
+
/** \returns True if exporting source maps */
|
98
|
+
bool exportSourceMap() const {
|
99
|
+
return options & ExportSourcemapOption;
|
100
|
+
}
|
101
|
+
|
102
|
+
private:
|
103
|
+
SectionParserData();
|
104
|
+
SectionParserData(const SectionParserData&);
|
105
|
+
SectionParserData& operator=(const SectionParserData&);
|
106
|
+
};
|
107
|
+
}
|
108
|
+
|
109
|
+
#endif
|
@@ -0,0 +1,299 @@
|
|
1
|
+
//
|
2
|
+
// SectionProcessor.h
|
3
|
+
// snowcrash
|
4
|
+
//
|
5
|
+
// Created by Zdenek Nemec on 5/14/14.
|
6
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef SNOWCRASH_SECTIONPROCESSOR_H
|
10
|
+
#define SNOWCRASH_SECTIONPROCESSOR_H
|
11
|
+
|
12
|
+
#include "SectionParserData.h"
|
13
|
+
#include "SourceAnnotation.h"
|
14
|
+
#include "Signature.h"
|
15
|
+
|
16
|
+
// Use the following macro whenever a section doesn't have description
|
17
|
+
#define NO_SECTION_DESCRIPTION(T)\
|
18
|
+
static MarkdownNodeIterator processDescription(const MarkdownNodeIterator& node,\
|
19
|
+
const MarkdownNodes& siblings,\
|
20
|
+
SectionParserData& pd,\
|
21
|
+
const ParseResultRef<T>& out) {\
|
22
|
+
return node;\
|
23
|
+
}\
|
24
|
+
\
|
25
|
+
static bool isDescriptionNode(const MarkdownNodeIterator& node,\
|
26
|
+
SectionType sectionType) {\
|
27
|
+
return false;\
|
28
|
+
}\
|
29
|
+
|
30
|
+
namespace snowcrash {
|
31
|
+
|
32
|
+
using mdp::MarkdownNode;
|
33
|
+
using mdp::MarkdownNodes;
|
34
|
+
using mdp::MarkdownNodeIterator;
|
35
|
+
|
36
|
+
typedef Collection<SectionType>::type SectionTypes;
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Layout of the section being parsed
|
40
|
+
*/
|
41
|
+
enum SectionLayout {
|
42
|
+
DefaultSectionLayout, /// Default Section Layout: Signature > Description > Content > Nested
|
43
|
+
ExclusiveNestedSectionLayout, /// Section is composed of nested sections only
|
44
|
+
RedirectSectionLayout /// Section should be parsed by another parser as whole
|
45
|
+
};
|
46
|
+
|
47
|
+
/**
|
48
|
+
* \brief Complete compound product of parsing
|
49
|
+
*
|
50
|
+
* This structure owns all of the product data. As such
|
51
|
+
* it shouldn't be used internally unless there is a need
|
52
|
+
* for storing complete parser data. See %IntermediateParseResult.
|
53
|
+
*/
|
54
|
+
template<typename T>
|
55
|
+
struct ParseResult {
|
56
|
+
|
57
|
+
ParseResult(const Report& report_ = Report())
|
58
|
+
: report(report_) {}
|
59
|
+
|
60
|
+
Report report; /// Parser's report
|
61
|
+
T node; /// Parsed AST node
|
62
|
+
SourceMap<T> sourceMap; /// Parsed AST node source map
|
63
|
+
};
|
64
|
+
|
65
|
+
/**
|
66
|
+
* \brief Partial product of parsing.
|
67
|
+
*
|
68
|
+
* This structure owns the node being parsed and its source map.
|
69
|
+
* Unlike %ParseResult it relies on shared parser report data making it
|
70
|
+
* ideal for holding temporary results while parsing items of a collection.
|
71
|
+
*/
|
72
|
+
template<typename T>
|
73
|
+
struct IntermediateParseResult {
|
74
|
+
|
75
|
+
explicit IntermediateParseResult(Report& report_)
|
76
|
+
: report(report_) {}
|
77
|
+
|
78
|
+
Report& report;
|
79
|
+
T node;
|
80
|
+
SourceMap<T> sourceMap;
|
81
|
+
};
|
82
|
+
|
83
|
+
/**
|
84
|
+
* \brief Reference wrapper for parsing data product
|
85
|
+
*
|
86
|
+
* Reference wrapper for %ParseResult and %IntermediateParseResult.
|
87
|
+
*/
|
88
|
+
template<typename T>
|
89
|
+
struct ParseResultRef {
|
90
|
+
|
91
|
+
ParseResultRef(ParseResult<T>& parseResult)
|
92
|
+
: report(parseResult.report), node(parseResult.node), sourceMap(parseResult.sourceMap) {}
|
93
|
+
|
94
|
+
ParseResultRef(IntermediateParseResult<T>& parseResult)
|
95
|
+
: report(parseResult.report), node(parseResult.node), sourceMap(parseResult.sourceMap) {}
|
96
|
+
|
97
|
+
ParseResultRef(Report& report_, T& node_, SourceMap<T>& sourceMap_)
|
98
|
+
: report(report_), node(node_), sourceMap(sourceMap_) {}
|
99
|
+
|
100
|
+
Report& report;
|
101
|
+
T& node;
|
102
|
+
SourceMap<T>& sourceMap;
|
103
|
+
|
104
|
+
private:
|
105
|
+
ParseResultRef();
|
106
|
+
};
|
107
|
+
|
108
|
+
/*
|
109
|
+
* Forward Declarations
|
110
|
+
*/
|
111
|
+
template<typename T>
|
112
|
+
struct SectionProcessor;
|
113
|
+
|
114
|
+
/**
|
115
|
+
* \brief Section Processor Base
|
116
|
+
*
|
117
|
+
* Defines section processor interface alongised with its default
|
118
|
+
* behavior.
|
119
|
+
*/
|
120
|
+
template<typename T>
|
121
|
+
struct SectionProcessorBase {
|
122
|
+
|
123
|
+
/**
|
124
|
+
* \brief Process section signature Markdown node
|
125
|
+
* \param node Node to process
|
126
|
+
* \param siblings Siblings of the node being processed
|
127
|
+
* \param pd Section parser state
|
128
|
+
* \param report Process log report
|
129
|
+
* \param out Processed output
|
130
|
+
* \return Result of the process operation
|
131
|
+
*/
|
132
|
+
static MarkdownNodeIterator processSignature(const MarkdownNodeIterator& node,
|
133
|
+
const MarkdownNodes& siblings,
|
134
|
+
SectionParserData& pd,
|
135
|
+
SectionLayout& layout,
|
136
|
+
const ParseResultRef<T>& out) {
|
137
|
+
|
138
|
+
return ++MarkdownNodeIterator(node);
|
139
|
+
}
|
140
|
+
|
141
|
+
/** Process section description Markdown node */
|
142
|
+
static MarkdownNodeIterator processDescription(const MarkdownNodeIterator& node,
|
143
|
+
const MarkdownNodes& siblings,
|
144
|
+
SectionParserData& pd,
|
145
|
+
const ParseResultRef<T>& out) {
|
146
|
+
|
147
|
+
if (!out.node.description.empty()) {
|
148
|
+
TwoNewLines(out.node.description);
|
149
|
+
}
|
150
|
+
|
151
|
+
mdp::ByteBuffer content = mdp::MapBytesRangeSet(node->sourceMap, pd.sourceData);
|
152
|
+
|
153
|
+
if (pd.exportSourceMap() && !content.empty()) {
|
154
|
+
out.sourceMap.description.sourceMap.append(node->sourceMap);
|
155
|
+
}
|
156
|
+
|
157
|
+
TrimString(content);
|
158
|
+
out.node.description += content;
|
159
|
+
|
160
|
+
return ++MarkdownNodeIterator(node);
|
161
|
+
}
|
162
|
+
|
163
|
+
/** Process section-specific content Markdown node */
|
164
|
+
static MarkdownNodeIterator processContent(const MarkdownNodeIterator& node,
|
165
|
+
const MarkdownNodes& siblings,
|
166
|
+
SectionParserData& pd,
|
167
|
+
const ParseResultRef<T>& out) {
|
168
|
+
|
169
|
+
return ++MarkdownNodeIterator(node);
|
170
|
+
}
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Pre-process for nested sections, basically a look-ahead before processing nested sections
|
174
|
+
* Only used by BlueprintParser for now
|
175
|
+
*/
|
176
|
+
static void preprocessNestedSections(const MarkdownNodeIterator& node,
|
177
|
+
const MarkdownNodes& siblings,
|
178
|
+
SectionParserData& pd,
|
179
|
+
const ParseResultRef<T>& out) {
|
180
|
+
}
|
181
|
+
|
182
|
+
/**
|
183
|
+
* \brief Process nested sections Markdown node(s)
|
184
|
+
* \param node Node to process
|
185
|
+
* \param siblings Siblings of the node being processed
|
186
|
+
* \param pd Section parser state
|
187
|
+
* \param report Process log report
|
188
|
+
* \param out Processed output
|
189
|
+
*/
|
190
|
+
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
|
191
|
+
const MarkdownNodes& siblings,
|
192
|
+
SectionParserData& pd,
|
193
|
+
const ParseResultRef<T>& out) {
|
194
|
+
|
195
|
+
return node;
|
196
|
+
}
|
197
|
+
|
198
|
+
/** Process unexpected Markdown node */
|
199
|
+
static MarkdownNodeIterator processUnexpectedNode(const MarkdownNodeIterator& node,
|
200
|
+
const MarkdownNodes& siblings,
|
201
|
+
SectionParserData& pd,
|
202
|
+
SectionType& lastSectionType,
|
203
|
+
const ParseResultRef<T>& out) {
|
204
|
+
|
205
|
+
// WARN: Ignoring unexpected node
|
206
|
+
std::stringstream ss;
|
207
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
208
|
+
|
209
|
+
if (node->type == mdp::HeaderMarkdownNodeType) {
|
210
|
+
ss << "unexpected header block, expected a group, resource or an action definition";
|
211
|
+
ss << ", e.g. '# Group <name>', '# <resource name> [<URI>]' or '# <HTTP method> <URI>'";
|
212
|
+
} else {
|
213
|
+
ss << "ignoring unrecognized block";
|
214
|
+
}
|
215
|
+
|
216
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
217
|
+
IgnoringWarning,
|
218
|
+
sourceMap));
|
219
|
+
|
220
|
+
return ++MarkdownNodeIterator(node);
|
221
|
+
}
|
222
|
+
|
223
|
+
/** Final validation after processing */
|
224
|
+
static void finalize(const MarkdownNodeIterator& node,
|
225
|
+
SectionParserData& pd,
|
226
|
+
const ParseResultRef<T>& out) {
|
227
|
+
}
|
228
|
+
|
229
|
+
/** \return True if the node is a section description node */
|
230
|
+
static bool isDescriptionNode(const MarkdownNodeIterator& node,
|
231
|
+
SectionType sectionType) {
|
232
|
+
|
233
|
+
if (SectionProcessor<T>::isContentNode(node, sectionType) ||
|
234
|
+
SectionProcessor<T>::nestedSectionType(node) != UndefinedSectionType) {
|
235
|
+
return false;
|
236
|
+
}
|
237
|
+
|
238
|
+
SectionType keywordSectionType = SectionKeywordSignature(node);
|
239
|
+
|
240
|
+
if (keywordSectionType == UndefinedSectionType) {
|
241
|
+
return true;
|
242
|
+
}
|
243
|
+
|
244
|
+
SectionTypes upperTypes = SectionProcessor<T>::upperSectionTypes();
|
245
|
+
|
246
|
+
if (std::find(upperTypes.begin(), upperTypes.end(), keywordSectionType) != upperTypes.end()) {
|
247
|
+
// Node is a keyword defined section defined in an upper level section
|
248
|
+
return false;
|
249
|
+
}
|
250
|
+
|
251
|
+
return true;
|
252
|
+
}
|
253
|
+
|
254
|
+
/** \return True if the node is a section-specific content node */
|
255
|
+
static bool isContentNode(const MarkdownNodeIterator& node,
|
256
|
+
SectionType sectionType) {
|
257
|
+
return false;
|
258
|
+
}
|
259
|
+
|
260
|
+
/** \return True if the node is unexpected in the current context */
|
261
|
+
static bool isUnexpectedNode(const MarkdownNodeIterator& node,
|
262
|
+
SectionType sectionType) {
|
263
|
+
|
264
|
+
SectionType keywordSectionType = SectionKeywordSignature(node);
|
265
|
+
SectionTypes upperTypes = SectionProcessor<T>::upperSectionTypes();
|
266
|
+
|
267
|
+
if (std::find(upperTypes.begin(), upperTypes.end(), keywordSectionType) == upperTypes.end()) {
|
268
|
+
// Node is not a section that is upper level
|
269
|
+
return true;
|
270
|
+
}
|
271
|
+
|
272
|
+
return (keywordSectionType == UndefinedSectionType);
|
273
|
+
}
|
274
|
+
|
275
|
+
/** \return All upper level sections of the section */
|
276
|
+
static SectionTypes upperSectionTypes() {
|
277
|
+
return SectionTypes();
|
278
|
+
}
|
279
|
+
|
280
|
+
/** \return %SectionType of the node */
|
281
|
+
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
282
|
+
return UndefinedSectionType;
|
283
|
+
}
|
284
|
+
|
285
|
+
/** \return Nested %SectionType of the node */
|
286
|
+
static SectionType nestedSectionType(const MarkdownNodeIterator& node) {
|
287
|
+
return UndefinedSectionType;
|
288
|
+
}
|
289
|
+
};
|
290
|
+
|
291
|
+
/**
|
292
|
+
* Default Section Processor
|
293
|
+
*/
|
294
|
+
template<typename T>
|
295
|
+
struct SectionProcessor : public SectionProcessorBase<T> {
|
296
|
+
};
|
297
|
+
}
|
298
|
+
|
299
|
+
#endif
|