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,75 @@
|
|
1
|
+
//
|
2
|
+
// Signature.cc
|
3
|
+
// snowcrash
|
4
|
+
//
|
5
|
+
// Created by Zdenek Nemec on 6/20/14.
|
6
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#include "Signature.h"
|
10
|
+
#include "SectionParser.h"
|
11
|
+
#include "ActionParser.h"
|
12
|
+
#include "AssetParser.h"
|
13
|
+
#include "HeadersParser.h"
|
14
|
+
#include "PayloadParser.h"
|
15
|
+
#include "ParametersParser.h"
|
16
|
+
#include "ResourceParser.h"
|
17
|
+
#include "ResourceGroupParser.h"
|
18
|
+
#include "MSONTypeSectionParser.h"
|
19
|
+
#include "DataStructureGroupParser.h"
|
20
|
+
|
21
|
+
using namespace snowcrash;
|
22
|
+
|
23
|
+
#define TYPECHECK(T)\
|
24
|
+
if ((type = SectionProcessor<T>::sectionType(node)) != UndefinedSectionType) {\
|
25
|
+
return type;\
|
26
|
+
}
|
27
|
+
|
28
|
+
SectionType snowcrash::SectionKeywordSignature(const mdp::MarkdownNodeIterator& node)
|
29
|
+
{
|
30
|
+
// Note: Every-keyword defined section should be listed here...
|
31
|
+
SectionType type = UndefinedSectionType;
|
32
|
+
|
33
|
+
TYPECHECK(mson::TypeSection)
|
34
|
+
TYPECHECK(mson::Mixin)
|
35
|
+
TYPECHECK(mson::OneOf)
|
36
|
+
TYPECHECK(Headers)
|
37
|
+
TYPECHECK(Asset)
|
38
|
+
TYPECHECK(Attributes)
|
39
|
+
TYPECHECK(Payload)
|
40
|
+
TYPECHECK(Values)
|
41
|
+
TYPECHECK(Parameters)
|
42
|
+
TYPECHECK(Relation)
|
43
|
+
|
44
|
+
/*
|
45
|
+
* NOTE: Order is important. Resource MUST preceed the Action.
|
46
|
+
*
|
47
|
+
* This is because an HTTP Request Method + URI is recognized as both %ActionSectionType and %ResourceSectionType.
|
48
|
+
* This is not optimal and should be addressed in the future.
|
49
|
+
*/
|
50
|
+
TYPECHECK(Resource)
|
51
|
+
TYPECHECK(Action)
|
52
|
+
TYPECHECK(ResourceGroup)
|
53
|
+
TYPECHECK(DataStructureGroup)
|
54
|
+
|
55
|
+
return type;
|
56
|
+
}
|
57
|
+
|
58
|
+
SectionType snowcrash::RecognizeCodeBlockFirstLine(const mdp::ByteBuffer& subject)
|
59
|
+
{
|
60
|
+
SectionType type = UndefinedSectionType;
|
61
|
+
|
62
|
+
if (RegexMatch(subject, HeadersRegex)) {
|
63
|
+
return HeadersSectionType;
|
64
|
+
}
|
65
|
+
else if (RegexMatch(subject, BodyRegex)) {
|
66
|
+
return BodySectionType;
|
67
|
+
}
|
68
|
+
else if (RegexMatch(subject, SchemaRegex)) {
|
69
|
+
return SchemaSectionType;
|
70
|
+
}
|
71
|
+
|
72
|
+
return type;
|
73
|
+
}
|
74
|
+
|
75
|
+
#undef TYPECHECK
|
@@ -0,0 +1,103 @@
|
|
1
|
+
//
|
2
|
+
// Signature.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_SIGNATURE_H
|
10
|
+
#define SNOWCRASH_SIGNATURE_H
|
11
|
+
|
12
|
+
#include "MarkdownNode.h"
|
13
|
+
#include "Section.h"
|
14
|
+
|
15
|
+
namespace snowcrash {
|
16
|
+
|
17
|
+
/**
|
18
|
+
* \brief Query whether a node has keyword-defined signature.
|
19
|
+
* \param node A Markdown AST node to check.
|
20
|
+
* \return Type of the node if it has a recognized keyword signature, UndefinedType otherwise
|
21
|
+
*/
|
22
|
+
extern SectionType SectionKeywordSignature(const mdp::MarkdownNodeIterator& node);
|
23
|
+
|
24
|
+
/**
|
25
|
+
* \brief Recognize the type of section given the first line from a code block
|
26
|
+
* \param subject The first line that needs to be recognized
|
27
|
+
* \return SectionType Type of the section if the line contains a keyword
|
28
|
+
*/
|
29
|
+
extern SectionType RecognizeCodeBlockFirstLine(const mdp::ByteBuffer& subject);
|
30
|
+
}
|
31
|
+
|
32
|
+
namespace scpl {
|
33
|
+
|
34
|
+
/**
|
35
|
+
* \brief Signature data after parsing section using signature traits
|
36
|
+
*/
|
37
|
+
struct Signature {
|
38
|
+
|
39
|
+
mdp::ByteBuffer identifier; // Signature Identifier
|
40
|
+
mdp::ByteBuffer value; // Signature Value (unparsed values)
|
41
|
+
|
42
|
+
std::vector<mdp::ByteBuffer> values; // Signature Values
|
43
|
+
std::vector<mdp::ByteBuffer> attributes; // Signature Attributes
|
44
|
+
|
45
|
+
mdp::ByteBuffer content; // Signature content before newline character
|
46
|
+
mdp::ByteBuffer remainingContent; // Signature content after newline character
|
47
|
+
};
|
48
|
+
|
49
|
+
/**
|
50
|
+
* \brief Customisable Delimiters for the section signature
|
51
|
+
*/
|
52
|
+
struct Delimiters {
|
53
|
+
const char valuesDelimiter;
|
54
|
+
const std::string contentDelimiter;
|
55
|
+
|
56
|
+
// These are not customizable for now
|
57
|
+
static const char ValueDelimiter = ',';
|
58
|
+
static const char AttributesBeginDelimiter = '(';
|
59
|
+
static const char AttributesEndDelimiter = ')';
|
60
|
+
static const char AttributeDelimiter = ',';
|
61
|
+
|
62
|
+
Delimiters(char valuesDelimiter_ = ':', std::string contentDelimiter_ = "-")
|
63
|
+
:
|
64
|
+
valuesDelimiter(valuesDelimiter_),
|
65
|
+
contentDelimiter(contentDelimiter_)
|
66
|
+
{}
|
67
|
+
};
|
68
|
+
|
69
|
+
/**
|
70
|
+
* \brief Traits characteristics of a section signature
|
71
|
+
*
|
72
|
+
* Traits describe identifier defined or value/type defined signatures.
|
73
|
+
*/
|
74
|
+
struct SignatureTraits {
|
75
|
+
|
76
|
+
enum Trait {
|
77
|
+
IdentifierTrait = (1 << 0), // Expect an identifier in the signature
|
78
|
+
ValuesTrait = (1 << 1), // Expect a (list of) value in the signature
|
79
|
+
AttributesTrait = (1 << 2), // Expect a list of attributes in the signature
|
80
|
+
ContentTrait = (1 << 3) // Expect inline description in the signature
|
81
|
+
};
|
82
|
+
|
83
|
+
typedef unsigned int Traits;
|
84
|
+
|
85
|
+
const bool identifierTrait;
|
86
|
+
const bool valuesTrait;
|
87
|
+
const bool attributesTrait;
|
88
|
+
const bool contentTrait;
|
89
|
+
|
90
|
+
Delimiters delimiters;
|
91
|
+
|
92
|
+
SignatureTraits(Traits traits_ = 0, Delimiters delimiters_ = Delimiters())
|
93
|
+
:
|
94
|
+
identifierTrait(traits_ & IdentifierTrait),
|
95
|
+
valuesTrait(traits_ & ValuesTrait),
|
96
|
+
attributesTrait(traits_ & AttributesTrait),
|
97
|
+
contentTrait(traits_ & ContentTrait),
|
98
|
+
delimiters(delimiters_)
|
99
|
+
{}
|
100
|
+
};
|
101
|
+
}
|
102
|
+
|
103
|
+
#endif
|
@@ -0,0 +1,442 @@
|
|
1
|
+
//
|
2
|
+
// SignatureSectionProcessor.h
|
3
|
+
// snowcrash
|
4
|
+
//
|
5
|
+
// Created by Pavan Kumar Sunkara on 10/14/14.
|
6
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef SNOWCRASH_SIGNATURESECTIONPROCESSOR_H
|
10
|
+
#define SNOWCRASH_SIGNATURESECTIONPROCESSOR_H
|
11
|
+
|
12
|
+
#include "SectionProcessor.h"
|
13
|
+
|
14
|
+
namespace scpl {
|
15
|
+
|
16
|
+
using mdp::MarkdownNode;
|
17
|
+
using mdp::MarkdownNodes;
|
18
|
+
using mdp::MarkdownNodeIterator;
|
19
|
+
|
20
|
+
const char EscapeCharacter = '`';
|
21
|
+
|
22
|
+
/**
|
23
|
+
* \brief Signature Section Processor Base
|
24
|
+
*
|
25
|
+
* Defines default behaviours for Section Processor interface for Signature sections
|
26
|
+
*/
|
27
|
+
template<typename T>
|
28
|
+
struct SignatureSectionProcessorBase : public snowcrash::SectionProcessorBase<T> {
|
29
|
+
|
30
|
+
/**
|
31
|
+
* \brief Signature traits of the section
|
32
|
+
*
|
33
|
+
* \return Signature traits given for section
|
34
|
+
*/
|
35
|
+
static SignatureTraits signatureTraits() {
|
36
|
+
|
37
|
+
SignatureTraits signatureTraits;
|
38
|
+
return signatureTraits;
|
39
|
+
};
|
40
|
+
|
41
|
+
/**
|
42
|
+
* \brief Process section signature markdown node (Default)
|
43
|
+
*/
|
44
|
+
static MarkdownNodeIterator processSignature(const MarkdownNodeIterator& node,
|
45
|
+
const MarkdownNodes& siblings,
|
46
|
+
snowcrash::SectionParserData& pd,
|
47
|
+
snowcrash::SectionLayout& layout,
|
48
|
+
const snowcrash::ParseResultRef<T>& out) {
|
49
|
+
|
50
|
+
// Get the signature traits of the section
|
51
|
+
SignatureTraits signatureTraits = snowcrash::SectionProcessor<T>::signatureTraits();
|
52
|
+
|
53
|
+
// Parse Signature
|
54
|
+
Signature signature = snowcrash::SectionProcessor<T>::parseSignature(node, pd, signatureTraits, out.report);
|
55
|
+
|
56
|
+
// Do section specific logic using the signature data
|
57
|
+
return snowcrash::SectionProcessor<T>::finalizeSignature(node, pd, signature, out);
|
58
|
+
};
|
59
|
+
|
60
|
+
/**
|
61
|
+
* \brief Parse section signature markdown node
|
62
|
+
*
|
63
|
+
* \param node Markdown node
|
64
|
+
* \param pd Section Parser data
|
65
|
+
* \param traits Signature traits of the section signature
|
66
|
+
* \param report Parse result report of the section
|
67
|
+
* \param subjectOrig The string that needs to be parsed
|
68
|
+
*
|
69
|
+
* \return Signature data
|
70
|
+
*/
|
71
|
+
static Signature parseSignature(const MarkdownNodeIterator& node,
|
72
|
+
snowcrash::SectionParserData& pd,
|
73
|
+
const SignatureTraits& traits,
|
74
|
+
snowcrash::Report& report,
|
75
|
+
const mdp::ByteBuffer& subjectOrig = "") {
|
76
|
+
|
77
|
+
Signature signature;
|
78
|
+
mdp::ByteBuffer subject = subjectOrig;
|
79
|
+
|
80
|
+
if (subject.empty()) {
|
81
|
+
|
82
|
+
subject = snowcrash::GetFirstLine(node->text, signature.remainingContent);
|
83
|
+
snowcrash::TrimString(subject);
|
84
|
+
}
|
85
|
+
|
86
|
+
if (traits.identifierTrait &&
|
87
|
+
!subject.empty()) {
|
88
|
+
|
89
|
+
parseSignatureIdentifier(traits, report, subject, signature);
|
90
|
+
|
91
|
+
if (signature.identifier.empty()) {
|
92
|
+
|
93
|
+
// WARN: Empty identifier
|
94
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
95
|
+
report.warnings.push_back(snowcrash::Warning("no identifier specified",
|
96
|
+
snowcrash::EmptyDefinitionWarning,
|
97
|
+
sourceMap));
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
// Make sure values exist
|
102
|
+
if (traits.valuesTrait &&
|
103
|
+
!subject.empty() &&
|
104
|
+
subject[0] != Delimiters::AttributesBeginDelimiter) {
|
105
|
+
|
106
|
+
|
107
|
+
// When subject starts with values, add a ':' for easier processing
|
108
|
+
if (!traits.identifierTrait) {
|
109
|
+
subject = traits.delimiters.valuesDelimiter + subject;
|
110
|
+
}
|
111
|
+
|
112
|
+
if (subject[0] == traits.delimiters.valuesDelimiter) {
|
113
|
+
|
114
|
+
parseSignatureValues(traits, report, subject, signature);
|
115
|
+
|
116
|
+
if (signature.values.empty()) {
|
117
|
+
|
118
|
+
// WARN: Empty values
|
119
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
|
120
|
+
report.warnings.push_back(snowcrash::Warning("no value(s) specified",
|
121
|
+
snowcrash::EmptyDefinitionWarning,
|
122
|
+
sourceMap));
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
if (traits.attributesTrait &&
|
128
|
+
!subject.empty() &&
|
129
|
+
subject.substr(0, traits.delimiters.contentDelimiter.length()) != traits.delimiters.contentDelimiter) {
|
130
|
+
|
131
|
+
parseSignatureAttributes(report, subject, signature);
|
132
|
+
}
|
133
|
+
|
134
|
+
if (traits.contentTrait &&
|
135
|
+
!subject.empty() &&
|
136
|
+
subject.substr(0, traits.delimiters.contentDelimiter.length()) == traits.delimiters.contentDelimiter) {
|
137
|
+
|
138
|
+
subject = subject.substr(traits.delimiters.contentDelimiter.length());
|
139
|
+
snowcrash::TrimString(subject);
|
140
|
+
|
141
|
+
signature.content = subject;
|
142
|
+
}
|
143
|
+
|
144
|
+
return signature;
|
145
|
+
};
|
146
|
+
|
147
|
+
/**
|
148
|
+
* \brief Use the signature data to do section specific logic
|
149
|
+
*
|
150
|
+
* \param node Markdown node
|
151
|
+
* \param pd Section Parser data
|
152
|
+
* \param signature Signature data
|
153
|
+
* \param out Parse result of the section
|
154
|
+
*
|
155
|
+
* \return Result of process operation
|
156
|
+
*/
|
157
|
+
static MarkdownNodeIterator finalizeSignature(const MarkdownNodeIterator& node,
|
158
|
+
snowcrash::SectionParserData& pd,
|
159
|
+
const Signature& signature,
|
160
|
+
const snowcrash::ParseResultRef<T>& out) {
|
161
|
+
|
162
|
+
return ++MarkdownNodeIterator(node);
|
163
|
+
};
|
164
|
+
|
165
|
+
/**
|
166
|
+
* \brief Parse the identifier from the signature
|
167
|
+
*
|
168
|
+
* \param traits Signature traits of the section signature
|
169
|
+
* \param report Parse Report
|
170
|
+
* \param subject String that needs to be parsed
|
171
|
+
* (which will be stripped of the parsed characters)
|
172
|
+
* \param out Signature data structure
|
173
|
+
*/
|
174
|
+
static void parseSignatureIdentifier(const SignatureTraits& traits,
|
175
|
+
snowcrash::Report& report,
|
176
|
+
mdp::ByteBuffer& subject,
|
177
|
+
Signature& out) {
|
178
|
+
|
179
|
+
snowcrash::TrimString(subject);
|
180
|
+
|
181
|
+
// `*` and `_` are markdown characters for emphasis
|
182
|
+
std::string escapeCharacters = "*_`";
|
183
|
+
|
184
|
+
size_t i = 0;
|
185
|
+
mdp::ByteBuffer identifier;
|
186
|
+
|
187
|
+
// Traverse over the string
|
188
|
+
while (i < subject.length()) {
|
189
|
+
|
190
|
+
if (escapeCharacters.find(subject[i]) != std::string::npos) {
|
191
|
+
|
192
|
+
// If escaped string, retrieve it and strip it from the subject
|
193
|
+
mdp::ByteBuffer escapedString = snowcrash::RetrieveEscaped(subject, i);
|
194
|
+
|
195
|
+
if (!escapedString.empty()) {
|
196
|
+
identifier += escapedString;
|
197
|
+
i = 0;
|
198
|
+
} else {
|
199
|
+
identifier += subject[i];
|
200
|
+
i++;
|
201
|
+
}
|
202
|
+
} else if ((traits.valuesTrait && subject[i] == traits.delimiters.valuesDelimiter) ||
|
203
|
+
(traits.attributesTrait && subject[i] == Delimiters::AttributesBeginDelimiter) ||
|
204
|
+
(traits.contentTrait &&
|
205
|
+
subject.substr(i, traits.delimiters.contentDelimiter.length()) == traits.delimiters.contentDelimiter)) {
|
206
|
+
|
207
|
+
// If identifier ends, strip it from the subject
|
208
|
+
subject = subject.substr(i);
|
209
|
+
i = 0;
|
210
|
+
break;
|
211
|
+
} else {
|
212
|
+
|
213
|
+
identifier += subject[i];
|
214
|
+
i++;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
// Assign the identifier
|
219
|
+
snowcrash::TrimString(identifier);
|
220
|
+
|
221
|
+
if (!identifier.empty()) {
|
222
|
+
out.identifier = identifier;
|
223
|
+
}
|
224
|
+
|
225
|
+
// If the subject ended with the identifier, strip it from the subject
|
226
|
+
if (i == subject.length()) {
|
227
|
+
subject = "";
|
228
|
+
}
|
229
|
+
|
230
|
+
snowcrash::TrimString(subject);
|
231
|
+
};
|
232
|
+
|
233
|
+
/**
|
234
|
+
* \brief Parse the values from the signature
|
235
|
+
*
|
236
|
+
* \param traits Signature traits of the section signature
|
237
|
+
* \param report Parse Report
|
238
|
+
* \param subject String that needs to be parsed
|
239
|
+
* (which will be stripped of the parsed characters)
|
240
|
+
* \param out Signature data structure
|
241
|
+
*/
|
242
|
+
static void parseSignatureValues(const SignatureTraits& traits,
|
243
|
+
snowcrash::Report& report,
|
244
|
+
mdp::ByteBuffer& subject,
|
245
|
+
Signature& out) {
|
246
|
+
|
247
|
+
// Remove leading delimiter
|
248
|
+
subject = subject.substr(1);
|
249
|
+
snowcrash::TrimString(subject);
|
250
|
+
|
251
|
+
size_t i = 0;
|
252
|
+
mdp::ByteBuffer value;
|
253
|
+
|
254
|
+
out.value = subject;
|
255
|
+
|
256
|
+
// Traverse over the string
|
257
|
+
while (i < subject.length()) {
|
258
|
+
|
259
|
+
if (subject[i] == EscapeCharacter) {
|
260
|
+
|
261
|
+
// If escaped string, retrieve it and strip it from subject
|
262
|
+
mdp::ByteBuffer escapedString = snowcrash::RetrieveEscaped(subject, i);
|
263
|
+
|
264
|
+
if (!escapedString.empty()) {
|
265
|
+
value += escapedString;
|
266
|
+
i = 0;
|
267
|
+
} else {
|
268
|
+
value += subject[i];
|
269
|
+
i++;
|
270
|
+
}
|
271
|
+
} else if (subject[i] == Delimiters::ValueDelimiter) {
|
272
|
+
|
273
|
+
// If found value delimiter, add the value and strip it from subject
|
274
|
+
subject = subject.substr(i + 1);
|
275
|
+
snowcrash::TrimString(subject);
|
276
|
+
|
277
|
+
snowcrash::TrimString(value);
|
278
|
+
out.values.push_back(snowcrash::StripBackticks(value));
|
279
|
+
|
280
|
+
value = "";
|
281
|
+
i = 0;
|
282
|
+
} else if ((traits.attributesTrait && subject[i] == Delimiters::AttributesBeginDelimiter) ||
|
283
|
+
(traits.contentTrait &&
|
284
|
+
subject.substr(i, traits.delimiters.contentDelimiter.length()) == traits.delimiters.contentDelimiter)) {
|
285
|
+
|
286
|
+
// If values section ends, strip it from subject
|
287
|
+
subject = subject.substr(i);
|
288
|
+
i = 0;
|
289
|
+
break;
|
290
|
+
} else {
|
291
|
+
|
292
|
+
value += subject[i];
|
293
|
+
i++;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
// Add the value at the end of values section if present
|
298
|
+
snowcrash::TrimString(value);
|
299
|
+
|
300
|
+
if (!value.empty()) {
|
301
|
+
out.values.push_back(value);
|
302
|
+
}
|
303
|
+
|
304
|
+
// If the subject ended with the values, strip the last value from the subject
|
305
|
+
if (i == subject.length()) {
|
306
|
+
subject = "";
|
307
|
+
}
|
308
|
+
|
309
|
+
snowcrash::TrimString(subject);
|
310
|
+
|
311
|
+
// Fill signature value with the string which was stripped from subject
|
312
|
+
out.value = out.value.substr(0, out.value.length() - subject.length());
|
313
|
+
|
314
|
+
snowcrash::TrimString(out.value);
|
315
|
+
out.value = snowcrash::StripBackticks(out.value);
|
316
|
+
};
|
317
|
+
|
318
|
+
/**
|
319
|
+
* \brief Parse the attributes from the signature
|
320
|
+
*
|
321
|
+
* \param report Parse Report
|
322
|
+
* \param subject String that needs to be parsed
|
323
|
+
* (which will be stripped of the parsed characters)
|
324
|
+
* \param out Signature data structure
|
325
|
+
*/
|
326
|
+
static void parseSignatureAttributes(snowcrash::Report& report,
|
327
|
+
mdp::ByteBuffer& subject,
|
328
|
+
Signature& out) {
|
329
|
+
|
330
|
+
if (subject[0] != Delimiters::AttributesBeginDelimiter) {
|
331
|
+
return;
|
332
|
+
}
|
333
|
+
|
334
|
+
bool attributesNotFinished = true;
|
335
|
+
|
336
|
+
// While there are attributes still left
|
337
|
+
while (attributesNotFinished) {
|
338
|
+
|
339
|
+
// Retrieve attribute
|
340
|
+
mdp::ByteBuffer attribute = matchBrackets(subject, 0, Delimiters::AttributesEndDelimiter, true);
|
341
|
+
size_t length = attribute.size();
|
342
|
+
|
343
|
+
// If the last char is not an attribute delimiter, attributes are finished
|
344
|
+
if (attribute[length - 1] != Delimiters::AttributeDelimiter) {
|
345
|
+
attributesNotFinished = false;
|
346
|
+
} else {
|
347
|
+
attribute = attribute.substr(0, length - 1);
|
348
|
+
|
349
|
+
// For easier processing
|
350
|
+
subject = Delimiters::AttributesBeginDelimiter + subject;
|
351
|
+
}
|
352
|
+
|
353
|
+
snowcrash::TrimString(attribute);
|
354
|
+
|
355
|
+
if (!attribute.empty()) {
|
356
|
+
out.attributes.push_back(attribute);
|
357
|
+
}
|
358
|
+
};
|
359
|
+
|
360
|
+
snowcrash::TrimString(subject);
|
361
|
+
};
|
362
|
+
|
363
|
+
/**
|
364
|
+
* \brief Find the matching bracket while ignoring any nested brackets and return the string
|
365
|
+
* enclosed by them, while also stripping the string that needs to be parsed
|
366
|
+
*
|
367
|
+
* \param subject The string that needs to be parsed
|
368
|
+
* \param begin Character index representing the beginning of the bracket that needs to be matched
|
369
|
+
* \param endBracket The type of bracket that needs to be matched
|
370
|
+
* \param splitByAttribute If this is true, we need to return when we find a top-level attribute delimiter
|
371
|
+
* \param clearAtEnd If this is true, the string will be cleared at the end of parsing
|
372
|
+
*
|
373
|
+
* \return String inside the given brackets. If not splitting by comma, append the brackets too
|
374
|
+
*/
|
375
|
+
static mdp::ByteBuffer matchBrackets(mdp::ByteBuffer& subject,
|
376
|
+
size_t begin,
|
377
|
+
const char endBracket,
|
378
|
+
const bool splitByAttribute = false,
|
379
|
+
const bool clearAtEnd = false) {
|
380
|
+
|
381
|
+
size_t i = begin + 1;
|
382
|
+
mdp::ByteBuffer returnString;
|
383
|
+
|
384
|
+
// Append the beginning bracket
|
385
|
+
if (!splitByAttribute) {
|
386
|
+
returnString += subject[begin];
|
387
|
+
}
|
388
|
+
|
389
|
+
while (i < subject.length()) {
|
390
|
+
|
391
|
+
if (subject[i] == EscapeCharacter) {
|
392
|
+
|
393
|
+
// If escaped string, retrieve it and strip it from subject
|
394
|
+
mdp::ByteBuffer escapedString = snowcrash::RetrieveEscaped(subject, i);
|
395
|
+
|
396
|
+
if (!escapedString.empty()) {
|
397
|
+
returnString += escapedString;
|
398
|
+
i = 0;
|
399
|
+
} else {
|
400
|
+
returnString += subject[i];
|
401
|
+
i++;
|
402
|
+
}
|
403
|
+
} else if (subject[i] == '[') {
|
404
|
+
|
405
|
+
returnString += matchBrackets(subject, i, ']', false, true);
|
406
|
+
i = 0;
|
407
|
+
} else if (subject[i] == '(') {
|
408
|
+
|
409
|
+
returnString += matchBrackets(subject, i, ')', false, true);
|
410
|
+
i = 0;
|
411
|
+
} else if (subject[i] == endBracket) {
|
412
|
+
|
413
|
+
// Append the ending bracket
|
414
|
+
if (!splitByAttribute) {
|
415
|
+
returnString += subject[i];
|
416
|
+
}
|
417
|
+
|
418
|
+
subject = subject.substr(i + 1);
|
419
|
+
break;
|
420
|
+
} else if (splitByAttribute && subject[i] == Delimiters::AttributeDelimiter) {
|
421
|
+
|
422
|
+
// Return when encountering comma
|
423
|
+
returnString += subject[i];
|
424
|
+
subject = subject.substr(i + 1);
|
425
|
+
break;
|
426
|
+
} else {
|
427
|
+
|
428
|
+
returnString += subject[i];
|
429
|
+
i++;
|
430
|
+
}
|
431
|
+
}
|
432
|
+
|
433
|
+
if (i == subject.length() && clearAtEnd) {
|
434
|
+
subject.clear();
|
435
|
+
}
|
436
|
+
|
437
|
+
return returnString;
|
438
|
+
}
|
439
|
+
};
|
440
|
+
}
|
441
|
+
|
442
|
+
#endif
|