redsnow 0.3.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +4 -4
- data/ext/drafter/Makefile +54 -0
- data/ext/drafter/appveyor.yml +10 -0
- data/ext/drafter/bin/drafter +0 -0
- data/ext/{snowcrash → drafter}/build/Makefile +29 -14
- data/ext/{snowcrash/build/snowcrash.Makefile → drafter/build/drafter.Makefile} +1 -1
- data/ext/{snowcrash/build/snowcrash.target.mk → drafter/build/drafter.target.mk} +25 -23
- data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/libmarkdownparser.target.mk +7 -7
- data/ext/drafter/build/ext/snowcrash/libsnowcrash.target.mk +152 -0
- data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/libsundown.target.mk +13 -13
- data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/perf-libsnowcrash.target.mk +14 -20
- data/ext/drafter/build/ext/snowcrash/snowcrash.Makefile +6 -0
- data/ext/{snowcrash → drafter}/build/gyp-mac-tool +0 -0
- data/ext/{snowcrash/build/libsnowcrash.target.mk → drafter/build/libdrafter.target.mk} +29 -36
- data/ext/drafter/build/libsos.target.mk +133 -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/{snowcrash → drafter}/build/out/Release/libsundown.a +0 -0
- data/ext/{snowcrash → drafter}/build/out/Release/linker.lock +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/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/cdrafter.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/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/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html_smartypants.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → 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 +12 -0
- data/ext/{snowcrash → drafter}/config.gypi +1 -1
- data/ext/{snowcrash → drafter}/config.mk +0 -0
- data/ext/{snowcrash → drafter}/configure +16 -5
- data/ext/drafter/drafter.gyp +118 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/Makefile +4 -12
- data/ext/{snowcrash → drafter/ext/snowcrash}/Vagrantfile +14 -4
- data/ext/drafter/ext/snowcrash/appveyor.yml +7 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/common.gypi +0 -0
- data/ext/drafter/ext/snowcrash/configure +197 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/Makefile +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/CONTRIBUTING.md +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/Makefile +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/Makefile.win +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/examples/smartypants.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/examples/sundown.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini_href_e.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini_html_e.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html_smartypants.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html_block_names.txt +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/html_blocks.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/stack.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/stack.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/sundown.def +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/markdown/markdown.vcproj +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/msvc.sln +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/sundown/sundown.vcproj +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/ByteBuffer.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/ByteBuffer.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownNode.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownNode.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownParser.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownParser.h +10 -2
- data/ext/{snowcrash → drafter/ext/snowcrash}/provisioning.sh +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/snowcrash.gyp +41 -39
- data/ext/{snowcrash → drafter/ext/snowcrash}/snowcrash.xcworkspace/contents.xcworkspacedata +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ActionParser.h +50 -6
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/AssetParser.h +1 -12
- data/ext/drafter/ext/snowcrash/src/AttributesParser.h +121 -0
- data/ext/drafter/ext/snowcrash/src/Blueprint.cc +90 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Blueprint.h +169 -33
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintParser.h +305 -48
- data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.cc +81 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintSourcemap.h +130 -39
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintUtility.h +10 -4
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/CodeBlockUtility.h +1 -1
- data/ext/drafter/ext/snowcrash/src/DataStructureGroupParser.h +154 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/HTTP.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/HTTP.h +0 -0
- data/ext/drafter/ext/snowcrash/src/HeadersParser.cc +110 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/HeadersParser.h +123 -54
- data/ext/drafter/ext/snowcrash/src/MSON.cc +272 -0
- data/ext/drafter/ext/snowcrash/src/MSON.h +399 -0
- data/ext/drafter/ext/snowcrash/src/MSONMixinParser.h +95 -0
- data/ext/drafter/ext/snowcrash/src/MSONNamedTypeParser.h +108 -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 +232 -0
- data/ext/drafter/ext/snowcrash/src/MSONPropertyMemberParser.h +91 -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 +423 -0
- data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.cc +179 -0
- data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.h +346 -0
- data/ext/drafter/ext/snowcrash/src/ModelTable.h +87 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ParameterParser.h +120 -61
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ParametersParser.h +17 -18
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/PayloadParser.h +36 -18
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Platform.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/RegexMatch.h +0 -0
- data/ext/drafter/ext/snowcrash/src/RelationParser.h +75 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ResourceGroupParser.h +127 -33
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ResourceParser.h +126 -33
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Section.cc +6 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Section.h +15 -2
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionParser.h +3 -1
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionParserData.h +15 -5
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionProcessor.h +24 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Signature.cc +14 -0
- data/ext/drafter/ext/snowcrash/src/Signature.h +80 -0
- data/ext/drafter/ext/snowcrash/src/SignatureSectionProcessor.h +439 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SourceAnnotation.h +3 -2
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/StringUtility.h +103 -6
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/UriTemplateParser.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/UriTemplateParser.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ValuesParser.h +1 -13
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/posix/RegexMatch.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/snowcrash.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/snowcrash.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/win/RegexMatch.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/AUTHORS +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/DEPS +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/OWNERS +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/PRESUBMIT.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/buildbot/buildbot_run.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/codereview.settings +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/data/win/large-pdb-shim.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp.bat +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp_main.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSNew.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSProject.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSSettings.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSToolFile.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSUserFile.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSUtil.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSVersion.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/__init__.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/__init__.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/common.py +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/easy_xml.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/flock_tool.py +0 -0
- data/ext/{snowcrash → 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/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/android.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/cmake.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/eclipse.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/gypd.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/gypsh.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/make.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/msvs.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/ninja.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/xcode.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/input.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/input.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/mac_tool.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/msvs_emulation.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/ninja_syntax.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/ordered_dict.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/win_tool.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcode_emulation.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcodeproj_file.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xml_fix.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylintrc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/samples/samples +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/samples/samples.bat +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/setup.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/emacs/gyp.el +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/graphviz.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_gyp.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_sln.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_vcproj.py +0 -0
- data/ext/drafter/ext/snowcrash/vcbuild.bat +139 -0
- data/ext/drafter/ext/sos/Makefile +57 -0
- data/ext/drafter/ext/sos/src/sos.cc +200 -0
- data/ext/drafter/ext/sos/src/sos.h +179 -0
- data/ext/drafter/ext/sos/src/sosJSON.h +105 -0
- data/ext/drafter/ext/sos/src/sosYAML.h +104 -0
- data/ext/{snowcrash → drafter}/src/Serialize.cc +30 -15
- data/ext/drafter/src/Serialize.h +135 -0
- data/ext/drafter/src/SerializeAST.cc +775 -0
- data/ext/drafter/src/SerializeAST.h +19 -0
- data/ext/drafter/src/SerializeResult.cc +67 -0
- data/ext/drafter/src/SerializeResult.h +26 -0
- data/ext/drafter/src/SerializeSourcemap.cc +446 -0
- data/ext/drafter/src/SerializeSourcemap.h +19 -0
- data/ext/drafter/src/Version.h +38 -0
- data/ext/drafter/src/cdrafter.cc +44 -0
- data/ext/drafter/src/cdrafter.h +55 -0
- data/ext/drafter/src/config.cc +80 -0
- data/ext/drafter/src/config.h +35 -0
- data/ext/drafter/src/drafter.cc +22 -0
- data/ext/drafter/src/drafter.h +38 -0
- data/ext/drafter/src/main.cc +91 -0
- data/ext/drafter/src/reporting.cc +162 -0
- data/ext/drafter/src/reporting.h +28 -0
- data/ext/drafter/src/stream.h +146 -0
- data/ext/drafter/tools/homebrew/drafter.rb +12 -0
- data/ext/{snowcrash → drafter}/vcbuild.bat +3 -3
- data/lib/redsnow.rb +6 -11
- data/lib/redsnow/binding.rb +11 -201
- data/lib/redsnow/blueprint.rb +104 -169
- data/lib/redsnow/parseresult.rb +28 -42
- data/lib/redsnow/sourcemap.rb +92 -177
- data/lib/redsnow/version.rb +1 -1
- data/redsnow.gemspec +1 -1
- metadata +249 -197
- data/ext/snowcrash/bin/snowcrash +0 -0
- data/ext/snowcrash/build/out/Release/libmarkdownparser.a +0 -0
- data/ext/snowcrash/build/out/Release/libsnowcrash.dylib +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/ByteBuffer.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownNode.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownParser.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprint.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprintSourcemap.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CSourceAnnotation.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/HTTP.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Section.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Serialize.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeJSON.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeYAML.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Signature.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/UriTemplateParser.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/csnowcrash.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/posix/RegexMatch.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/snowcrash.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/snowcrash/src/snowcrash/snowcrash.o +0 -0
- data/ext/snowcrash/build/out/Release/snowcrash +0 -0
- data/ext/snowcrash/src/CBlueprint.cc +0 -628
- data/ext/snowcrash/src/CBlueprint.h +0 -366
- data/ext/snowcrash/src/CBlueprintSourcemap.cc +0 -630
- data/ext/snowcrash/src/CBlueprintSourcemap.h +0 -351
- data/ext/snowcrash/src/CSourceAnnotation.cc +0 -154
- data/ext/snowcrash/src/CSourceAnnotation.h +0 -106
- data/ext/snowcrash/src/Serialize.h +0 -71
- data/ext/snowcrash/src/SerializeJSON.cc +0 -1221
- data/ext/snowcrash/src/SerializeJSON.h +0 -24
- data/ext/snowcrash/src/SerializeYAML.cc +0 -702
- data/ext/snowcrash/src/SerializeYAML.h +0 -24
- data/ext/snowcrash/src/Signature.h +0 -32
- data/ext/snowcrash/src/SymbolTable.h +0 -94
- data/ext/snowcrash/src/Version.h +0 -39
- data/ext/snowcrash/src/csnowcrash.cc +0 -29
- data/ext/snowcrash/src/csnowcrash.h +0 -40
- data/ext/snowcrash/src/snowcrash/snowcrash.cc +0 -200
- data/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
- data/ext/snowcrash/tools/homebrew/snowcrash.rb +0 -12
|
@@ -36,6 +36,12 @@ std::string snowcrash::SectionName(const SectionType& section) {
|
|
|
36
36
|
case HeadersSectionType:
|
|
37
37
|
return "headers";
|
|
38
38
|
|
|
39
|
+
case MSONMixinSectionType:
|
|
40
|
+
return "mixin";
|
|
41
|
+
|
|
42
|
+
case MSONOneOfSectionType:
|
|
43
|
+
return "one of";
|
|
44
|
+
|
|
39
45
|
default:
|
|
40
46
|
return "section";
|
|
41
47
|
}
|
|
@@ -17,15 +17,18 @@ namespace snowcrash {
|
|
|
17
17
|
* API Blueprint Sections Types.
|
|
18
18
|
*/
|
|
19
19
|
enum SectionType {
|
|
20
|
-
UndefinedSectionType,
|
|
20
|
+
UndefinedSectionType = 0, /// < Undefined section
|
|
21
21
|
BlueprintSectionType, /// < Blueprint overview
|
|
22
|
+
DataStructureGroupSectionType, /// < Data Structure Group
|
|
22
23
|
ResourceGroupSectionType, /// < Resource group
|
|
23
24
|
ResourceSectionType, /// < Resource
|
|
24
25
|
ActionSectionType, /// < Action
|
|
26
|
+
RelationSectionType, /// < Link Relation
|
|
25
27
|
RequestSectionType, /// < Request
|
|
26
28
|
RequestBodySectionType, /// < Request & Payload body combined (abbrev)
|
|
27
29
|
ResponseSectionType, /// < Response
|
|
28
30
|
ResponseBodySectionType, /// < Response & Body combined (abbrev)
|
|
31
|
+
AttributesSectionType, /// < Attributes
|
|
29
32
|
ModelSectionType, /// < Model
|
|
30
33
|
ModelBodySectionType, /// < Model & Body combined (abbrev)
|
|
31
34
|
BodySectionType, /// < Payload Body
|
|
@@ -36,8 +39,18 @@ namespace snowcrash {
|
|
|
36
39
|
ForeignSectionType, /// < Foreign, unexpected section
|
|
37
40
|
ParametersSectionType, /// < Parameters
|
|
38
41
|
ParameterSectionType, /// < One Parameter definition
|
|
42
|
+
MSONParameterSectionType, /// < One Parameter definition using the MSON syntax
|
|
39
43
|
ValuesSectionType, /// < Value enumeration
|
|
40
|
-
ValueSectionType
|
|
44
|
+
ValueSectionType, /// < One Value
|
|
45
|
+
MSONMixinSectionType, /// < MSON Mixin
|
|
46
|
+
MSONNamedTypeSectionType, /// < MSON Named Type
|
|
47
|
+
MSONOneOfSectionType, /// < MSON One Of
|
|
48
|
+
MSONPropertyMemberSectionType, /// < MSON Property Member Type
|
|
49
|
+
MSONSampleDefaultSectionType, /// < MSON Sample/Default Type Section
|
|
50
|
+
MSONPropertyMembersSectionType, /// < MSON Property Members Type Section
|
|
51
|
+
MSONValueMembersSectionType, /// < MSON Value Members Type Section
|
|
52
|
+
MSONValueMemberSectionType, /// < MSON Value Member Type
|
|
53
|
+
MSONSectionType /// < MSON Property Member or Value Member
|
|
41
54
|
};
|
|
42
55
|
|
|
43
56
|
/** \return Human readable name for given %SectionType */
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#define SNOWCRASH_SECTIONPARSER_H
|
|
11
11
|
|
|
12
12
|
#include <stdexcept>
|
|
13
|
-
#include "
|
|
13
|
+
#include "SignatureSectionProcessor.h"
|
|
14
14
|
|
|
15
15
|
#define ADAPTER_MISMATCH_ERR std::logic_error("mismatched adapter and node type")
|
|
16
16
|
|
|
@@ -107,6 +107,8 @@ namespace snowcrash {
|
|
|
107
107
|
|
|
108
108
|
SectionType lastSectionType = UndefinedSectionType;
|
|
109
109
|
|
|
110
|
+
SectionProcessor<T>::preprocessNestedSections(node, collection, pd, out);
|
|
111
|
+
|
|
110
112
|
// Nested sections
|
|
111
113
|
while(cur != collection.end()) {
|
|
112
114
|
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
#ifndef SNOWCRASH_SECTIONPARSERDATA_H
|
|
10
10
|
#define SNOWCRASH_SECTIONPARSERDATA_H
|
|
11
11
|
|
|
12
|
+
#include "ModelTable.h"
|
|
12
13
|
#include "BlueprintSourcemap.h"
|
|
13
14
|
#include "Section.h"
|
|
14
|
-
#include "SymbolTable.h"
|
|
15
15
|
|
|
16
16
|
namespace snowcrash {
|
|
17
17
|
|
|
@@ -42,11 +42,20 @@ namespace snowcrash {
|
|
|
42
42
|
/** Parser Options */
|
|
43
43
|
BlueprintParserOptions options;
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
|
|
45
|
+
/** Named Types */
|
|
46
|
+
std::vector<mson::NamedType> msonTypesTable;
|
|
47
47
|
|
|
48
|
-
/**
|
|
49
|
-
|
|
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
|
+
/** Model Table */
|
|
55
|
+
ModelTable modelTable;
|
|
56
|
+
|
|
57
|
+
/** Model Table Sourcemap */
|
|
58
|
+
ModelSourceMapTable modelSourceMapTable;
|
|
50
59
|
|
|
51
60
|
/** Source Data */
|
|
52
61
|
const mdp::ByteBuffer& sourceData;
|
|
@@ -69,6 +78,7 @@ namespace snowcrash {
|
|
|
69
78
|
return UndefinedSectionType;
|
|
70
79
|
|
|
71
80
|
size_t size = sectionsContext.size();
|
|
81
|
+
|
|
72
82
|
if (size == 1)
|
|
73
83
|
return sectionsContext.back();
|
|
74
84
|
else
|
|
@@ -13,6 +13,20 @@
|
|
|
13
13
|
#include "SourceAnnotation.h"
|
|
14
14
|
#include "Signature.h"
|
|
15
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
|
+
|
|
16
30
|
namespace snowcrash {
|
|
17
31
|
|
|
18
32
|
using mdp::MarkdownNode;
|
|
@@ -154,6 +168,16 @@ namespace snowcrash {
|
|
|
154
168
|
return ++MarkdownNodeIterator(node);
|
|
155
169
|
}
|
|
156
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Pre-process for nested sections, basically a look-ahead before processing nested sections
|
|
173
|
+
* Only used by BlueprintParser for now
|
|
174
|
+
*/
|
|
175
|
+
static void preprocessNestedSections(const MarkdownNodeIterator& node,
|
|
176
|
+
const MarkdownNodes& siblings,
|
|
177
|
+
SectionParserData& pd,
|
|
178
|
+
const ParseResultRef<T>& out) {
|
|
179
|
+
}
|
|
180
|
+
|
|
157
181
|
/**
|
|
158
182
|
* \brief Process nested sections Markdown node(s)
|
|
159
183
|
* \param node Node to process
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
#include "ParametersParser.h"
|
|
16
16
|
#include "ResourceParser.h"
|
|
17
17
|
#include "ResourceGroupParser.h"
|
|
18
|
+
#include "MSONTypeSectionParser.h"
|
|
19
|
+
#include "DataStructureGroupParser.h"
|
|
18
20
|
|
|
19
21
|
using namespace snowcrash;
|
|
20
22
|
|
|
@@ -23,12 +25,18 @@ SectionType snowcrash::SectionKeywordSignature(const mdp::MarkdownNodeIterator&
|
|
|
23
25
|
// Note: Every-keyword defined section should be listed here...
|
|
24
26
|
SectionType type = UndefinedSectionType;
|
|
25
27
|
|
|
28
|
+
if ((type = SectionProcessor<mson::TypeSection>::sectionType(node)) != UndefinedSectionType)
|
|
29
|
+
return type;
|
|
30
|
+
|
|
26
31
|
if ((type = SectionProcessor<Headers>::sectionType(node)) != UndefinedSectionType)
|
|
27
32
|
return type;
|
|
28
33
|
|
|
29
34
|
if ((type = SectionProcessor<Asset>::sectionType(node)) != UndefinedSectionType)
|
|
30
35
|
return type;
|
|
31
36
|
|
|
37
|
+
if ((type = SectionProcessor<Attributes>::sectionType(node)) != UndefinedSectionType)
|
|
38
|
+
return type;
|
|
39
|
+
|
|
32
40
|
if ((type = SectionProcessor<Payload>::sectionType(node)) != UndefinedSectionType)
|
|
33
41
|
return type;
|
|
34
42
|
|
|
@@ -38,6 +46,9 @@ SectionType snowcrash::SectionKeywordSignature(const mdp::MarkdownNodeIterator&
|
|
|
38
46
|
if ((type = SectionProcessor<Parameters>::sectionType(node)) != UndefinedSectionType)
|
|
39
47
|
return type;
|
|
40
48
|
|
|
49
|
+
if ((type = SectionProcessor<Relation>::sectionType(node)) != UndefinedSectionType)
|
|
50
|
+
return type;
|
|
51
|
+
|
|
41
52
|
/*
|
|
42
53
|
* NOTE: Order is important. Resource MUST preceed the Action.
|
|
43
54
|
*
|
|
@@ -53,6 +64,9 @@ SectionType snowcrash::SectionKeywordSignature(const mdp::MarkdownNodeIterator&
|
|
|
53
64
|
if ((type = SectionProcessor<ResourceGroup>::sectionType(node)) != UndefinedSectionType)
|
|
54
65
|
return type;
|
|
55
66
|
|
|
67
|
+
if ((type = SectionProcessor<DataStructureGroup>::sectionType(node)) != UndefinedSectionType)
|
|
68
|
+
return type;
|
|
69
|
+
|
|
56
70
|
return type;
|
|
57
71
|
}
|
|
58
72
|
|
|
@@ -0,0 +1,80 @@
|
|
|
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 Traits characteristics of a section signature
|
|
51
|
+
*
|
|
52
|
+
* Traits describe identifier defined or value/type defined signatures.
|
|
53
|
+
*/
|
|
54
|
+
struct SignatureTraits {
|
|
55
|
+
|
|
56
|
+
enum Trait {
|
|
57
|
+
IdentifierTrait = (1 << 0), // Expect an identifier in the signature
|
|
58
|
+
ValuesTrait = (1 << 1), // Expect a (list of) value in the signature
|
|
59
|
+
AttributesTrait = (1 << 2), // Expect a list of attributes in the signature
|
|
60
|
+
ContentTrait = (1 << 3) // Expect inline description in the signature
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
typedef unsigned int Traits;
|
|
64
|
+
|
|
65
|
+
const bool identifierTrait;
|
|
66
|
+
const bool valuesTrait;
|
|
67
|
+
const bool attributesTrait;
|
|
68
|
+
const bool contentTrait;
|
|
69
|
+
|
|
70
|
+
SignatureTraits(Traits traits_ = 0)
|
|
71
|
+
:
|
|
72
|
+
identifierTrait(traits_ & IdentifierTrait),
|
|
73
|
+
valuesTrait(traits_ & ValuesTrait),
|
|
74
|
+
attributesTrait(traits_ & AttributesTrait),
|
|
75
|
+
contentTrait(traits_ & ContentTrait)
|
|
76
|
+
{}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#endif
|
|
@@ -0,0 +1,439 @@
|
|
|
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
|
+
const char ValuesDelimiter = ':';
|
|
22
|
+
const char ValueDelimiter = ',';
|
|
23
|
+
const char AttributesBeginDelimiter = '(';
|
|
24
|
+
const char AttributesEndDelimiter = ')';
|
|
25
|
+
const char AttributeDelimiter = ',';
|
|
26
|
+
const char ContentDelimiter = '-';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* \brief Signature Section Processor Base
|
|
30
|
+
*
|
|
31
|
+
* Defines default behaviours for Section Processor interface for Signature sections
|
|
32
|
+
*/
|
|
33
|
+
template<typename T>
|
|
34
|
+
struct SignatureSectionProcessorBase : public snowcrash::SectionProcessorBase<T> {
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* \brief Signature traits of the section
|
|
38
|
+
*
|
|
39
|
+
* \return Signature traits given for section
|
|
40
|
+
*/
|
|
41
|
+
static SignatureTraits signatureTraits() {
|
|
42
|
+
|
|
43
|
+
SignatureTraits signatureTraits;
|
|
44
|
+
return signatureTraits;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* \brief Process section signature markdown node (Default)
|
|
49
|
+
*/
|
|
50
|
+
static MarkdownNodeIterator processSignature(const MarkdownNodeIterator& node,
|
|
51
|
+
const MarkdownNodes& siblings,
|
|
52
|
+
snowcrash::SectionParserData& pd,
|
|
53
|
+
snowcrash::SectionLayout& layout,
|
|
54
|
+
const snowcrash::ParseResultRef<T>& out) {
|
|
55
|
+
|
|
56
|
+
// Get the signature traits of the section
|
|
57
|
+
SignatureTraits signatureTraits = snowcrash::SectionProcessor<T>::signatureTraits();
|
|
58
|
+
|
|
59
|
+
// Parse Signature
|
|
60
|
+
Signature signature = snowcrash::SectionProcessor<T>::parseSignature(node, pd, signatureTraits, out.report);
|
|
61
|
+
|
|
62
|
+
// Do section specific logic using the signature data
|
|
63
|
+
return snowcrash::SectionProcessor<T>::finalizeSignature(node, pd, signature, out);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* \brief Parse section signature markdown node
|
|
68
|
+
*
|
|
69
|
+
* \param node Markdown node
|
|
70
|
+
* \param pd Section Parser data
|
|
71
|
+
* \param traits Signature traits of the section signature
|
|
72
|
+
* \param report Parse result report of the section
|
|
73
|
+
* \param subjectOrig The string that needs to be parsed
|
|
74
|
+
*
|
|
75
|
+
* \return Signature data
|
|
76
|
+
*/
|
|
77
|
+
static Signature parseSignature(const MarkdownNodeIterator& node,
|
|
78
|
+
snowcrash::SectionParserData& pd,
|
|
79
|
+
const SignatureTraits& traits,
|
|
80
|
+
snowcrash::Report& report,
|
|
81
|
+
const mdp::ByteBuffer& subjectOrig = "") {
|
|
82
|
+
|
|
83
|
+
Signature signature;
|
|
84
|
+
mdp::ByteBuffer subject = subjectOrig;
|
|
85
|
+
|
|
86
|
+
if (subject.empty()) {
|
|
87
|
+
|
|
88
|
+
subject = snowcrash::GetFirstLine(node->text, signature.remainingContent);
|
|
89
|
+
snowcrash::TrimString(subject);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (traits.identifierTrait &&
|
|
93
|
+
!subject.empty()) {
|
|
94
|
+
|
|
95
|
+
parseSignatureIdentifier(traits, report, subject, signature);
|
|
96
|
+
|
|
97
|
+
if (signature.identifier.empty()) {
|
|
98
|
+
|
|
99
|
+
// WARN: Empty identifier
|
|
100
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
101
|
+
report.warnings.push_back(snowcrash::Warning("no identifier specified",
|
|
102
|
+
snowcrash::EmptyDefinitionWarning,
|
|
103
|
+
sourceMap));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Make sure values exist
|
|
108
|
+
if (traits.valuesTrait &&
|
|
109
|
+
!subject.empty() &&
|
|
110
|
+
subject[0] != AttributesBeginDelimiter) {
|
|
111
|
+
|
|
112
|
+
// When subject starts with values, add a ':' for easier processing
|
|
113
|
+
if (!traits.identifierTrait) {
|
|
114
|
+
subject = ValuesDelimiter + subject;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (subject[0] == ValuesDelimiter) {
|
|
118
|
+
|
|
119
|
+
parseSignatureValues(traits, report, subject, signature);
|
|
120
|
+
|
|
121
|
+
if (signature.values.empty()) {
|
|
122
|
+
|
|
123
|
+
// WARN: Empty values
|
|
124
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
125
|
+
report.warnings.push_back(snowcrash::Warning("no value(s) specified",
|
|
126
|
+
snowcrash::EmptyDefinitionWarning,
|
|
127
|
+
sourceMap));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (traits.attributesTrait &&
|
|
133
|
+
!subject.empty() &&
|
|
134
|
+
subject[0] != ContentDelimiter) {
|
|
135
|
+
|
|
136
|
+
parseSignatureAttributes(report, subject, signature);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (traits.contentTrait &&
|
|
140
|
+
!subject.empty() &&
|
|
141
|
+
subject[0] == ContentDelimiter) {
|
|
142
|
+
|
|
143
|
+
subject = subject.substr(1);
|
|
144
|
+
snowcrash::TrimString(subject);
|
|
145
|
+
|
|
146
|
+
signature.content = subject;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return signature;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* \brief Use the signature data to do section specific logic
|
|
154
|
+
*
|
|
155
|
+
* \param node Markdown node
|
|
156
|
+
* \param pd Section Parser data
|
|
157
|
+
* \param signature Signature data
|
|
158
|
+
* \param out Parse result of the section
|
|
159
|
+
*
|
|
160
|
+
* \return Result of process operation
|
|
161
|
+
*/
|
|
162
|
+
static MarkdownNodeIterator finalizeSignature(const MarkdownNodeIterator& node,
|
|
163
|
+
snowcrash::SectionParserData& pd,
|
|
164
|
+
const Signature& signature,
|
|
165
|
+
const snowcrash::ParseResultRef<T>& out) {
|
|
166
|
+
|
|
167
|
+
return ++MarkdownNodeIterator(node);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* \brief Parse the identifier from the signature
|
|
172
|
+
*
|
|
173
|
+
* \param traits Signature traits of the section signature
|
|
174
|
+
* \param report Parse Report
|
|
175
|
+
* \param subject String that needs to be parsed
|
|
176
|
+
* (which will be stripped of the parsed characters)
|
|
177
|
+
* \param out Signature data structure
|
|
178
|
+
*/
|
|
179
|
+
static void parseSignatureIdentifier(const SignatureTraits& traits,
|
|
180
|
+
snowcrash::Report& report,
|
|
181
|
+
mdp::ByteBuffer& subject,
|
|
182
|
+
Signature& out) {
|
|
183
|
+
|
|
184
|
+
snowcrash::TrimString(subject);
|
|
185
|
+
|
|
186
|
+
// `*` and `_` are markdown characters for emphasis
|
|
187
|
+
std::string escapeCharacters = "*_`";
|
|
188
|
+
|
|
189
|
+
size_t i = 0;
|
|
190
|
+
mdp::ByteBuffer identifier;
|
|
191
|
+
|
|
192
|
+
// Traverse over the string
|
|
193
|
+
while (i < subject.length()) {
|
|
194
|
+
|
|
195
|
+
if (escapeCharacters.find(subject[i]) != std::string::npos) {
|
|
196
|
+
|
|
197
|
+
// If escaped string, retrieve it and strip it from the subject
|
|
198
|
+
mdp::ByteBuffer escapedString = snowcrash::RetrieveEscaped(subject, i);
|
|
199
|
+
|
|
200
|
+
if (!escapedString.empty()) {
|
|
201
|
+
identifier += escapedString;
|
|
202
|
+
i = 0;
|
|
203
|
+
} else {
|
|
204
|
+
identifier += subject[i];
|
|
205
|
+
i++;
|
|
206
|
+
}
|
|
207
|
+
} else if ((traits.valuesTrait && subject[i] == ValuesDelimiter) ||
|
|
208
|
+
(traits.attributesTrait && subject[i] == AttributesBeginDelimiter) ||
|
|
209
|
+
(traits.contentTrait && subject[i] == ContentDelimiter)) {
|
|
210
|
+
|
|
211
|
+
// If identifier ends, strip it from the subject
|
|
212
|
+
subject = subject.substr(i);
|
|
213
|
+
i = 0;
|
|
214
|
+
break;
|
|
215
|
+
} else {
|
|
216
|
+
|
|
217
|
+
identifier += subject[i];
|
|
218
|
+
i++;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Assign the identifier
|
|
223
|
+
snowcrash::TrimString(identifier);
|
|
224
|
+
|
|
225
|
+
if (!identifier.empty()) {
|
|
226
|
+
out.identifier = snowcrash::StripBackticks(identifier);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// If the subject ended with the identifier, strip it from the subject
|
|
230
|
+
if (i == subject.length()) {
|
|
231
|
+
subject = "";
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
snowcrash::TrimString(subject);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* \brief Parse the values from the signature
|
|
239
|
+
*
|
|
240
|
+
* \param traits Signature traits of the section signature
|
|
241
|
+
* \param report Parse Report
|
|
242
|
+
* \param subject String that needs to be parsed
|
|
243
|
+
* (which will be stripped of the parsed characters)
|
|
244
|
+
* \param out Signature data structure
|
|
245
|
+
*/
|
|
246
|
+
static void parseSignatureValues(const SignatureTraits& traits,
|
|
247
|
+
snowcrash::Report& report,
|
|
248
|
+
mdp::ByteBuffer& subject,
|
|
249
|
+
Signature& out) {
|
|
250
|
+
|
|
251
|
+
// Remove leading delimiter
|
|
252
|
+
subject = subject.substr(1);
|
|
253
|
+
snowcrash::TrimString(subject);
|
|
254
|
+
|
|
255
|
+
size_t i = 0;
|
|
256
|
+
mdp::ByteBuffer value;
|
|
257
|
+
|
|
258
|
+
out.value = subject;
|
|
259
|
+
|
|
260
|
+
// Traverse over the string
|
|
261
|
+
while (i < subject.length()) {
|
|
262
|
+
|
|
263
|
+
if (subject[i] == EscapeCharacter) {
|
|
264
|
+
|
|
265
|
+
// If escaped string, retrieve it and strip it from subject
|
|
266
|
+
mdp::ByteBuffer escapedString = snowcrash::RetrieveEscaped(subject, i);
|
|
267
|
+
|
|
268
|
+
if (!escapedString.empty()) {
|
|
269
|
+
value += escapedString;
|
|
270
|
+
i = 0;
|
|
271
|
+
} else {
|
|
272
|
+
value += subject[i];
|
|
273
|
+
i++;
|
|
274
|
+
}
|
|
275
|
+
} else if (subject[i] == ValueDelimiter) {
|
|
276
|
+
|
|
277
|
+
// If found value delimiter, add the value and strip it from subject
|
|
278
|
+
subject = subject.substr(i + 1);
|
|
279
|
+
snowcrash::TrimString(subject);
|
|
280
|
+
|
|
281
|
+
snowcrash::TrimString(value);
|
|
282
|
+
out.values.push_back(snowcrash::StripBackticks(value));
|
|
283
|
+
|
|
284
|
+
value = "";
|
|
285
|
+
i = 0;
|
|
286
|
+
} else if ((traits.attributesTrait && subject[i] == AttributesBeginDelimiter) ||
|
|
287
|
+
(traits.contentTrait && subject[i] == ContentDelimiter)) {
|
|
288
|
+
|
|
289
|
+
// If values section ends, strip it from subject
|
|
290
|
+
subject = subject.substr(i);
|
|
291
|
+
i = 0;
|
|
292
|
+
break;
|
|
293
|
+
} else {
|
|
294
|
+
|
|
295
|
+
value += subject[i];
|
|
296
|
+
i++;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Add the value at the end of values section if present
|
|
301
|
+
snowcrash::TrimString(value);
|
|
302
|
+
|
|
303
|
+
if (!value.empty()) {
|
|
304
|
+
out.values.push_back(snowcrash::StripBackticks(value));
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// If the subject ended with the values, strip the last value from the subject
|
|
308
|
+
if (i == subject.length()) {
|
|
309
|
+
subject = "";
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
snowcrash::TrimString(subject);
|
|
313
|
+
|
|
314
|
+
// Fill signature value with the string which was stripped from subject
|
|
315
|
+
out.value = out.value.substr(0, out.value.length() - subject.length());
|
|
316
|
+
|
|
317
|
+
snowcrash::TrimString(out.value);
|
|
318
|
+
out.value = snowcrash::StripBackticks(out.value);
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* \brief Parse the attributes from the signature
|
|
323
|
+
*
|
|
324
|
+
* \param report Parse Report
|
|
325
|
+
* \param subject String that needs to be parsed
|
|
326
|
+
* (which will be stripped of the parsed characters)
|
|
327
|
+
* \param out Signature data structure
|
|
328
|
+
*/
|
|
329
|
+
static void parseSignatureAttributes(snowcrash::Report& report,
|
|
330
|
+
mdp::ByteBuffer& subject,
|
|
331
|
+
Signature& out) {
|
|
332
|
+
|
|
333
|
+
if (subject[0] != AttributesBeginDelimiter) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
bool attributesNotFinished = true;
|
|
338
|
+
|
|
339
|
+
// While there are attributes still left
|
|
340
|
+
while (attributesNotFinished) {
|
|
341
|
+
|
|
342
|
+
// Retrieve attribute
|
|
343
|
+
mdp::ByteBuffer attribute = matchBrackets(subject, 0, AttributesEndDelimiter, true);
|
|
344
|
+
size_t length = attribute.size();
|
|
345
|
+
|
|
346
|
+
// If the last char is not an attribute delimiter, attributes are finished
|
|
347
|
+
if (attribute[length - 1] != AttributeDelimiter) {
|
|
348
|
+
attributesNotFinished = false;
|
|
349
|
+
} else {
|
|
350
|
+
attribute = attribute.substr(0, length - 1);
|
|
351
|
+
|
|
352
|
+
// For easier processing
|
|
353
|
+
subject = AttributesBeginDelimiter + subject;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
snowcrash::TrimString(attribute);
|
|
357
|
+
|
|
358
|
+
if (!attribute.empty()) {
|
|
359
|
+
out.attributes.push_back(attribute);
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
snowcrash::TrimString(subject);
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* \brief Find the matching bracket while ignoring any nested brackets and return the string
|
|
368
|
+
* enclosed by them, while also stripping the string that needs to be parsed
|
|
369
|
+
*
|
|
370
|
+
* \param subject The string that needs to be parsed
|
|
371
|
+
* \param begin Character index representing the beginning of the bracket that needs to be matched
|
|
372
|
+
* \param endBracket The type of bracket that needs to be matched
|
|
373
|
+
* \param splitByAttribute If this is true, we need to return when we find a top-level attribute delimiter
|
|
374
|
+
*
|
|
375
|
+
* \return String inside the given brackets. If not splitting by comma, append the brackets too
|
|
376
|
+
*/
|
|
377
|
+
static mdp::ByteBuffer matchBrackets(mdp::ByteBuffer& subject,
|
|
378
|
+
size_t begin,
|
|
379
|
+
const char endBracket,
|
|
380
|
+
const bool splitByAttribute = false) {
|
|
381
|
+
|
|
382
|
+
size_t i = begin + 1;
|
|
383
|
+
mdp::ByteBuffer returnString;
|
|
384
|
+
|
|
385
|
+
// Append the beginning bracket
|
|
386
|
+
if (!splitByAttribute) {
|
|
387
|
+
returnString += subject[begin];
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
while (i < subject.length()) {
|
|
391
|
+
|
|
392
|
+
if (subject[i] == EscapeCharacter) {
|
|
393
|
+
|
|
394
|
+
// If escaped string, retrieve it and strip it from subject
|
|
395
|
+
mdp::ByteBuffer escapedString = snowcrash::RetrieveEscaped(subject, i);
|
|
396
|
+
|
|
397
|
+
if (!escapedString.empty()) {
|
|
398
|
+
returnString += escapedString;
|
|
399
|
+
i = 0;
|
|
400
|
+
} else {
|
|
401
|
+
returnString += subject[i];
|
|
402
|
+
i++;
|
|
403
|
+
}
|
|
404
|
+
} else if (subject[i] == '[') {
|
|
405
|
+
|
|
406
|
+
returnString += matchBrackets(subject, i, ']');
|
|
407
|
+
i = 0;
|
|
408
|
+
} else if (subject[i] == '(') {
|
|
409
|
+
|
|
410
|
+
returnString += matchBrackets(subject, i, ')');
|
|
411
|
+
i = 0;
|
|
412
|
+
} else if (subject[i] == endBracket) {
|
|
413
|
+
|
|
414
|
+
// Append the ending bracket
|
|
415
|
+
if (!splitByAttribute) {
|
|
416
|
+
returnString += subject[i];
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
subject = subject.substr(i + 1);
|
|
420
|
+
break;
|
|
421
|
+
} else if (splitByAttribute && subject[i] == AttributeDelimiter) {
|
|
422
|
+
|
|
423
|
+
// Return when encountering comma
|
|
424
|
+
returnString += subject[i];
|
|
425
|
+
subject = subject.substr(i + 1);
|
|
426
|
+
break;
|
|
427
|
+
} else {
|
|
428
|
+
|
|
429
|
+
returnString += subject[i];
|
|
430
|
+
i++;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return returnString;
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
#endif
|