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
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MSONNamedTypeParser.h
|
|
3
|
+
// snowcrash
|
|
4
|
+
//
|
|
5
|
+
// Created by Pavan Kumar Sunkara on 11/5/14.
|
|
6
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef SNOWCRASH_MSONNAMEDTYPEPARSER_H
|
|
10
|
+
#define SNOWCRASH_MSONNAMEDTYPEPARSER_H
|
|
11
|
+
|
|
12
|
+
#include "MSONValueMemberParser.h"
|
|
13
|
+
|
|
14
|
+
using namespace scpl;
|
|
15
|
+
|
|
16
|
+
namespace snowcrash {
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* MSON Named Type Section Processor
|
|
20
|
+
*/
|
|
21
|
+
template<>
|
|
22
|
+
struct SectionProcessor<mson::NamedType> : public SignatureSectionProcessorBase<mson::NamedType> {
|
|
23
|
+
|
|
24
|
+
static SignatureTraits signatureTraits() {
|
|
25
|
+
|
|
26
|
+
SignatureTraits signatureTraits(SignatureTraits::IdentifierTrait |
|
|
27
|
+
SignatureTraits::AttributesTrait);
|
|
28
|
+
|
|
29
|
+
return signatureTraits;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static MarkdownNodeIterator finalizeSignature(const MarkdownNodeIterator& node,
|
|
33
|
+
SectionParserData& pd,
|
|
34
|
+
const Signature& signature,
|
|
35
|
+
const ParseResultRef<mson::NamedType>& out) {
|
|
36
|
+
|
|
37
|
+
mson::parseTypeName(signature.identifier, out.node.name);
|
|
38
|
+
mson::parseTypeDefinition(node, pd, signature.attributes, out.report, out.node.typeDefinition);
|
|
39
|
+
|
|
40
|
+
if (pd.exportSourceMap()) {
|
|
41
|
+
|
|
42
|
+
if (!out.node.name.empty()) {
|
|
43
|
+
out.sourceMap.name.sourceMap = node->sourceMap;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!out.node.typeDefinition.empty()) {
|
|
47
|
+
out.sourceMap.typeDefinition.sourceMap = node->sourceMap;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Named types should have type specification when sub-typed from primitive types
|
|
52
|
+
if (out.node.typeDefinition.baseType == mson::UndefinedBaseType) {
|
|
53
|
+
out.node.typeDefinition.baseType = mson::ImplicitObjectBaseType;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return ++MarkdownNodeIterator(node);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static MarkdownNodeIterator processDescription(const MarkdownNodeIterator& node,
|
|
60
|
+
const MarkdownNodes& siblings,
|
|
61
|
+
SectionParserData& pd,
|
|
62
|
+
const ParseResultRef<mson::NamedType>& out) {
|
|
63
|
+
|
|
64
|
+
return SectionProcessor<mson::ValueMember>::blockDescription(node, pd, out.node.sections, out.sourceMap.sections);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
|
|
68
|
+
const MarkdownNodes& siblings,
|
|
69
|
+
SectionParserData& pd,
|
|
70
|
+
const ParseResultRef<mson::NamedType>& out) {
|
|
71
|
+
|
|
72
|
+
ParseResultRef<mson::TypeSections> typeSections(out.report, out.node.sections, out.sourceMap.sections);
|
|
73
|
+
|
|
74
|
+
return SectionProcessor<mson::ValueMember>
|
|
75
|
+
::processNestedMembers<MSONTypeSectionHeaderParser>(node, siblings, pd, typeSections,
|
|
76
|
+
out.node.typeDefinition.baseType);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static bool isDescriptionNode(const MarkdownNodeIterator& node,
|
|
80
|
+
SectionType sectionType) {
|
|
81
|
+
|
|
82
|
+
return SectionProcessor<mson::ValueMember>::isDescriptionNode(node, sectionType);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
|
86
|
+
|
|
87
|
+
SectionType sectionType = SectionKeywordSignature(node);
|
|
88
|
+
|
|
89
|
+
if (node->type == mdp::HeaderMarkdownNodeType &&
|
|
90
|
+
sectionType == UndefinedSectionType) {
|
|
91
|
+
|
|
92
|
+
return MSONNamedTypeSectionType;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return UndefinedSectionType;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
static SectionType nestedSectionType(const MarkdownNodeIterator& node) {
|
|
99
|
+
|
|
100
|
+
return SectionProcessor<mson::ValueMember>::nestedSectionType(node);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/** MSON Named Type Section Parser */
|
|
105
|
+
typedef SectionParser<mson::NamedType, HeaderSectionAdapter> MSONNamedTypeParser;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
#endif
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MSONOneOfParser.cc
|
|
3
|
+
// snowcrash
|
|
4
|
+
//
|
|
5
|
+
// Created by Pavan Kumar Sunkara on 11/12/14.
|
|
6
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#include "MSONOneOfParser.h"
|
|
10
|
+
#include "MSONTypeSectionParser.h"
|
|
11
|
+
#include "MSONPropertyMemberParser.h"
|
|
12
|
+
|
|
13
|
+
namespace snowcrash {
|
|
14
|
+
|
|
15
|
+
/** Implementation of processNestedSection */
|
|
16
|
+
MarkdownNodeIterator SectionProcessor<mson::OneOf>::processNestedSection(const MarkdownNodeIterator& node,
|
|
17
|
+
const MarkdownNodes& siblings,
|
|
18
|
+
SectionParserData& pd,
|
|
19
|
+
const ParseResultRef<mson::OneOf>& out) {
|
|
20
|
+
|
|
21
|
+
MarkdownNodeIterator cur = node;
|
|
22
|
+
mson::Element element;
|
|
23
|
+
SourceMap<mson::Element> elementSM;
|
|
24
|
+
|
|
25
|
+
switch (pd.sectionContext()) {
|
|
26
|
+
case MSONMixinSectionType:
|
|
27
|
+
{
|
|
28
|
+
IntermediateParseResult<mson::Mixin> mixin(out.report);
|
|
29
|
+
cur = MSONMixinParser::parse(node, siblings, pd, mixin);
|
|
30
|
+
|
|
31
|
+
element.build(mixin.node);
|
|
32
|
+
|
|
33
|
+
if (pd.exportSourceMap()) {
|
|
34
|
+
elementSM.mixin = mixin.sourceMap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
case MSONOneOfSectionType:
|
|
41
|
+
{
|
|
42
|
+
IntermediateParseResult<mson::OneOf> oneOf(out.report);
|
|
43
|
+
cur = MSONOneOfParser::parse(node, siblings, pd, oneOf);
|
|
44
|
+
|
|
45
|
+
element.build(oneOf.node);
|
|
46
|
+
|
|
47
|
+
if (pd.exportSourceMap()) {
|
|
48
|
+
elementSM = oneOf.sourceMap;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
case MSONPropertyMembersSectionType:
|
|
55
|
+
{
|
|
56
|
+
IntermediateParseResult<mson::TypeSection> typeSection(out.report);
|
|
57
|
+
typeSection.node.baseType = mson::ObjectBaseType;
|
|
58
|
+
|
|
59
|
+
cur = MSONTypeSectionListParser::parse(node, siblings, pd, typeSection);
|
|
60
|
+
|
|
61
|
+
element.buildFromElements(typeSection.node.content.elements());
|
|
62
|
+
|
|
63
|
+
if (pd.exportSourceMap()) {
|
|
64
|
+
elementSM = typeSection.sourceMap.elements();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
case MSONPropertyMemberSectionType:
|
|
71
|
+
{
|
|
72
|
+
IntermediateParseResult<mson::PropertyMember> propertyMember(out.report);
|
|
73
|
+
cur = MSONPropertyMemberParser::parse(node, siblings, pd, propertyMember);
|
|
74
|
+
|
|
75
|
+
element.build(propertyMember.node);
|
|
76
|
+
|
|
77
|
+
if (pd.exportSourceMap()) {
|
|
78
|
+
elementSM.property = propertyMember.sourceMap;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
default:
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (element.klass != mson::Element::UndefinedClass) {
|
|
89
|
+
out.node.push_back(element);
|
|
90
|
+
|
|
91
|
+
if (pd.exportSourceMap()) {
|
|
92
|
+
out.sourceMap.collection.push_back(elementSM);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return cur;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Implementation of nestedSectionType */
|
|
100
|
+
SectionType SectionProcessor<mson::OneOf>::nestedSectionType(const MarkdownNodeIterator& node) {
|
|
101
|
+
|
|
102
|
+
SectionType nestedType = UndefinedSectionType;
|
|
103
|
+
|
|
104
|
+
// Check if mson mixin section
|
|
105
|
+
nestedType = SectionProcessor<mson::Mixin>::sectionType(node);
|
|
106
|
+
|
|
107
|
+
if (nestedType != UndefinedSectionType) {
|
|
108
|
+
return nestedType;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Check if mson one of section
|
|
112
|
+
nestedType = SectionProcessor<mson::OneOf>::sectionType(node);
|
|
113
|
+
|
|
114
|
+
if (nestedType != UndefinedSectionType) {
|
|
115
|
+
return nestedType;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Check if mson member type section section
|
|
119
|
+
nestedType = SectionProcessor<mson::TypeSection>::sectionType(node);
|
|
120
|
+
|
|
121
|
+
if (nestedType != UndefinedSectionType) {
|
|
122
|
+
return nestedType;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Return property member type section if list item
|
|
126
|
+
if (node->type == mdp::ListItemMarkdownNodeType) {
|
|
127
|
+
return MSONPropertyMemberSectionType;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return UndefinedSectionType;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MSONOneOfParser.h
|
|
3
|
+
// snowcrash
|
|
4
|
+
//
|
|
5
|
+
// Created by Pavan Kumar Sunkara on 11/5/14.
|
|
6
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef SNOWCRASH_MSONONEOFPARSER_H
|
|
10
|
+
#define SNOWCRASH_MSONONEOFPARSER_H
|
|
11
|
+
|
|
12
|
+
#include "MSONMixinParser.h"
|
|
13
|
+
|
|
14
|
+
using namespace scpl;
|
|
15
|
+
|
|
16
|
+
namespace snowcrash {
|
|
17
|
+
|
|
18
|
+
/** MSON One Of matching regex */
|
|
19
|
+
const char* const MSONOneOfRegex = "^[[:blank:]]*[Oo]ne[[:blank:]]+[Oo]f[[:blank:]]*$";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* MSON One Of Section Processor
|
|
23
|
+
*/
|
|
24
|
+
template<>
|
|
25
|
+
struct SectionProcessor<mson::OneOf> : public SignatureSectionProcessorBase<mson::OneOf> {
|
|
26
|
+
|
|
27
|
+
static SignatureTraits signatureTraits() {
|
|
28
|
+
|
|
29
|
+
SignatureTraits signatureTraits(SignatureTraits::IdentifierTrait);
|
|
30
|
+
|
|
31
|
+
return signatureTraits;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
NO_SECTION_DESCRIPTION(mson::OneOf)
|
|
35
|
+
|
|
36
|
+
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator&,
|
|
37
|
+
const MarkdownNodes&,
|
|
38
|
+
SectionParserData&,
|
|
39
|
+
const ParseResultRef<mson::OneOf>&);
|
|
40
|
+
|
|
41
|
+
static void finalize(const MarkdownNodeIterator& node,
|
|
42
|
+
SectionParserData& pd,
|
|
43
|
+
const ParseResultRef<mson::OneOf>& out) {
|
|
44
|
+
|
|
45
|
+
if (out.node.empty()) {
|
|
46
|
+
|
|
47
|
+
// WARN: one of type do not have nested members
|
|
48
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
49
|
+
out.report.warnings.push_back(Warning("one of type must have nested members",
|
|
50
|
+
EmptyDefinitionWarning,
|
|
51
|
+
sourceMap));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
|
56
|
+
|
|
57
|
+
if (node->type == mdp::ListItemMarkdownNodeType
|
|
58
|
+
&& !node->children().empty()) {
|
|
59
|
+
|
|
60
|
+
mdp::ByteBuffer remaining, subject = node->children().front().text;
|
|
61
|
+
|
|
62
|
+
subject = GetFirstLine(subject, remaining);
|
|
63
|
+
TrimString(subject);
|
|
64
|
+
|
|
65
|
+
if (RegexMatch(subject, MSONOneOfRegex)) {
|
|
66
|
+
return MSONOneOfSectionType;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return UndefinedSectionType;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static SectionType nestedSectionType(const MarkdownNodeIterator&);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** MSON One Of Section Parser */
|
|
77
|
+
typedef SectionParser<mson::OneOf, ListSectionAdapter> MSONOneOfParser;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
#endif
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MSONParameterParser.h
|
|
3
|
+
// snowcrash
|
|
4
|
+
//
|
|
5
|
+
// Created by Pavan Kumar Sunkara on 12/03/15.
|
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef SNOWCRASH_MSONPARAMETERPARSER_H
|
|
10
|
+
#define SNOWCRASH_MSONPARAMETERPARSER_H
|
|
11
|
+
|
|
12
|
+
#include "ParameterParser.h"
|
|
13
|
+
#include "MSONValueMemberParser.h"
|
|
14
|
+
#include "MSONTypeSectionParser.h"
|
|
15
|
+
|
|
16
|
+
using namespace scpl;
|
|
17
|
+
|
|
18
|
+
namespace snowcrash {
|
|
19
|
+
|
|
20
|
+
/* We only allow at the maximum 2 attributes for new syntax parameters */
|
|
21
|
+
const size_t MAX_ATTRIBUTES = 2;
|
|
22
|
+
|
|
23
|
+
/* Type wrapped by enum matching regex */
|
|
24
|
+
const char* const EnumRegex = "^enum\\[([^][]+)]$";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* MSON Parameter Section Processor
|
|
28
|
+
*/
|
|
29
|
+
template<>
|
|
30
|
+
struct SectionProcessor<MSONParameter> : public SignatureSectionProcessorBase<MSONParameter> {
|
|
31
|
+
|
|
32
|
+
static SignatureTraits signatureTraits() {
|
|
33
|
+
|
|
34
|
+
SignatureTraits signatureTraits(SignatureTraits::IdentifierTrait |
|
|
35
|
+
SignatureTraits::ValuesTrait |
|
|
36
|
+
SignatureTraits::AttributesTrait |
|
|
37
|
+
SignatureTraits::ContentTrait);
|
|
38
|
+
|
|
39
|
+
return signatureTraits;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static MarkdownNodeIterator finalizeSignature(const MarkdownNodeIterator& node,
|
|
43
|
+
SectionParserData& pd,
|
|
44
|
+
const Signature& signature,
|
|
45
|
+
const ParseResultRef<MSONParameter>& out) {
|
|
46
|
+
|
|
47
|
+
out.node.name = signature.identifier;
|
|
48
|
+
out.node.description = signature.content;
|
|
49
|
+
out.node.exampleValue = signature.value;
|
|
50
|
+
|
|
51
|
+
if (!signature.remainingContent.empty()) {
|
|
52
|
+
out.node.description += "\n" + signature.remainingContent + "\n";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
parseAttributes(node, pd, signature.attributes, out);
|
|
56
|
+
|
|
57
|
+
if (pd.exportSourceMap()) {
|
|
58
|
+
if (!out.node.name.empty()) {
|
|
59
|
+
out.sourceMap.name.sourceMap = node->sourceMap;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!out.node.description.empty()) {
|
|
63
|
+
out.sourceMap.description.sourceMap = node->sourceMap;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!out.node.exampleValue.empty()) {
|
|
67
|
+
out.sourceMap.exampleValue.sourceMap = node->sourceMap;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return ++MarkdownNodeIterator(node);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
|
|
75
|
+
const MarkdownNodes& siblings,
|
|
76
|
+
SectionParserData& pd,
|
|
77
|
+
const ParseResultRef<MSONParameter>& out) {
|
|
78
|
+
|
|
79
|
+
SectionType sectionType = pd.sectionContext();
|
|
80
|
+
MarkdownNodeIterator cur = node;
|
|
81
|
+
IntermediateParseResult<mson::TypeSection> typeSection(out.report);
|
|
82
|
+
|
|
83
|
+
switch (sectionType) {
|
|
84
|
+
case MSONSampleDefaultSectionType:
|
|
85
|
+
{
|
|
86
|
+
typeSection.node.baseType = mson::ImplicitPrimitiveBaseType;
|
|
87
|
+
cur = MSONTypeSectionListParser::parse(node, siblings, pd, typeSection);
|
|
88
|
+
|
|
89
|
+
if (!typeSection.node.content.value.empty()) {
|
|
90
|
+
out.node.defaultValue = typeSection.node.content.value;
|
|
91
|
+
|
|
92
|
+
if (pd.exportSourceMap()) {
|
|
93
|
+
out.sourceMap.defaultValue.sourceMap = typeSection.sourceMap.value.sourceMap;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
case MSONValueMembersSectionType:
|
|
101
|
+
{
|
|
102
|
+
typeSection.node.baseType = mson::ImplicitValueBaseType;
|
|
103
|
+
cur = MSONTypeSectionListParser::parse(node, siblings, pd, typeSection);
|
|
104
|
+
|
|
105
|
+
out.node.values.clear();
|
|
106
|
+
|
|
107
|
+
if (pd.exportSourceMap()) {
|
|
108
|
+
out.sourceMap.values.collection.clear();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
for (size_t i = 0; i < typeSection.node.content.elements().size(); i++) {
|
|
112
|
+
mson::ValueMember valueMember = typeSection.node.content.elements().at(i).content.value;
|
|
113
|
+
SourceMap<mson::ValueMember> valueMemberSM;
|
|
114
|
+
|
|
115
|
+
if (pd.exportSourceMap()) {
|
|
116
|
+
valueMemberSM = typeSection.sourceMap.elements().collection.at(i).value;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (valueMember.valueDefinition.values.size() == 1) {
|
|
120
|
+
out.node.values.push_back(valueMember.valueDefinition.values[0].literal);
|
|
121
|
+
|
|
122
|
+
if (pd.exportSourceMap()) {
|
|
123
|
+
SourceMap<Value> valueSM;
|
|
124
|
+
valueSM.sourceMap = valueMemberSM.valueDefinition.sourceMap;
|
|
125
|
+
|
|
126
|
+
out.sourceMap.values.collection.push_back(valueSM);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
default:
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return cur;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
static void finalize(const MarkdownNodeIterator& node,
|
|
142
|
+
SectionParserData& pd,
|
|
143
|
+
const ParseResultRef<MSONParameter>& out) {
|
|
144
|
+
|
|
145
|
+
SectionProcessor<Parameter>::checkDefaultAndRequiredClash<MSONParameter>(node, pd, out);
|
|
146
|
+
|
|
147
|
+
if ((!out.node.exampleValue.empty() || !out.node.defaultValue.empty()) &&
|
|
148
|
+
!out.node.values.empty()) {
|
|
149
|
+
|
|
150
|
+
SectionProcessor<Parameter>::checkExampleAndDefaultValue<MSONParameter>(node, pd, out);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
static SectionType nestedSectionType(const MarkdownNodeIterator& node) {
|
|
155
|
+
|
|
156
|
+
SectionType nestedType = UndefinedSectionType;
|
|
157
|
+
|
|
158
|
+
// Recognize `Default` and `Members` sections
|
|
159
|
+
nestedType = SectionProcessor<mson::TypeSection>::sectionType(node);
|
|
160
|
+
|
|
161
|
+
return nestedType;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
static void parseAttributes(const MarkdownNodeIterator& node,
|
|
165
|
+
SectionParserData& pd,
|
|
166
|
+
const std::vector<mdp::ByteBuffer>& attributes,
|
|
167
|
+
const ParseResultRef<MSONParameter>& out) {
|
|
168
|
+
|
|
169
|
+
out.node.use = UndefinedParameterUse;
|
|
170
|
+
|
|
171
|
+
if (attributes.size() <= MAX_ATTRIBUTES) {
|
|
172
|
+
size_t i = 0;
|
|
173
|
+
bool definedUse = false;
|
|
174
|
+
|
|
175
|
+
// Traverse over parameter's traits
|
|
176
|
+
while (i < attributes.size()) {
|
|
177
|
+
if (attributes[i] == "optional" && !definedUse) {
|
|
178
|
+
out.node.use = OptionalParameterUse;
|
|
179
|
+
definedUse = true;
|
|
180
|
+
}
|
|
181
|
+
else if (attributes[i] == "required" && !definedUse) {
|
|
182
|
+
out.node.use = RequiredParameterUse;
|
|
183
|
+
definedUse = true;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
|
|
187
|
+
// Retrieve the type which is wrapped by enum[]
|
|
188
|
+
std::string typeInsideEnum = RegexCaptureFirst(attributes[i], EnumRegex);
|
|
189
|
+
TrimString(typeInsideEnum);
|
|
190
|
+
|
|
191
|
+
if (!typeInsideEnum.empty()) {
|
|
192
|
+
out.node.type = typeInsideEnum;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
out.node.type = attributes[i];
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
i++;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (pd.exportSourceMap()) {
|
|
203
|
+
if (!out.node.type.empty()) {
|
|
204
|
+
out.sourceMap.type.sourceMap = node->sourceMap;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (definedUse) {
|
|
208
|
+
out.sourceMap.use.sourceMap = node->sourceMap;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
// WARN: Additional parameters traits warning
|
|
214
|
+
std::stringstream ss;
|
|
215
|
+
|
|
216
|
+
ss << "unable to parse additional parameter traits";
|
|
217
|
+
ss << ", expected '([required | optional], [<type> | enum[<type>])'";
|
|
218
|
+
ss << ", e.g. '(optional, string)'";
|
|
219
|
+
|
|
220
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
221
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
222
|
+
FormattingWarning,
|
|
223
|
+
sourceMap));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/** MSON Parameter Section Parser */
|
|
229
|
+
typedef SectionParser<MSONParameter, ListSectionAdapter> MSONParameterParser;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
#endif
|