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,87 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ModelTable.h
|
|
3
|
+
// snowcrash
|
|
4
|
+
//
|
|
5
|
+
// Created by Zdenek Nemec on 6/9/13.
|
|
6
|
+
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef SNOWCRASH_MODELTABLE_H
|
|
10
|
+
#define SNOWCRASH_MODELTABLE_H
|
|
11
|
+
|
|
12
|
+
#include <string>
|
|
13
|
+
#include <map>
|
|
14
|
+
#include "ByteBuffer.h"
|
|
15
|
+
#include "RegexMatch.h"
|
|
16
|
+
|
|
17
|
+
#ifdef DEBUG
|
|
18
|
+
#include <iostream>
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#include "BlueprintSourcemap.h"
|
|
22
|
+
#include "StringUtility.h"
|
|
23
|
+
|
|
24
|
+
// Symbol identifier regex
|
|
25
|
+
#define SYMBOL_IDENTIFIER "([^][()]+)"
|
|
26
|
+
|
|
27
|
+
namespace snowcrash {
|
|
28
|
+
|
|
29
|
+
/** Symbol reference matching regex */
|
|
30
|
+
const char* const ModelReferenceRegex("^[[:blank:]]*\\[" SYMBOL_IDENTIFIER "]\\[][[:blank:]]*$");
|
|
31
|
+
|
|
32
|
+
// Resource Object Model Table
|
|
33
|
+
typedef std::map<Identifier, ResourceModel> ModelTable;
|
|
34
|
+
|
|
35
|
+
// Resource Object Model Table source map
|
|
36
|
+
typedef std::map<Identifier, SourceMap<ResourceModel> > ModelSourceMapTable;
|
|
37
|
+
|
|
38
|
+
// Checks whether given source data represents reference to a symbol returning true if so,
|
|
39
|
+
// false otherwise. If source data is represent reference referred symbol name is filled in.
|
|
40
|
+
inline bool GetModelReference(const mdp::ByteBuffer& sourceData,
|
|
41
|
+
Identifier& referredModel) {
|
|
42
|
+
|
|
43
|
+
CaptureGroups captureGroups;
|
|
44
|
+
|
|
45
|
+
if (RegexCapture(sourceData, ModelReferenceRegex, captureGroups, 3)) {
|
|
46
|
+
referredModel = captureGroups[1];
|
|
47
|
+
TrimString(referredModel);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#ifdef DEBUG
|
|
55
|
+
// Escape new lines
|
|
56
|
+
inline std::string EscapeNewlines(const std::string &input) {
|
|
57
|
+
|
|
58
|
+
size_t pos = 0;
|
|
59
|
+
std::string target(input);
|
|
60
|
+
|
|
61
|
+
while ((pos = target.find("\n", pos)) != std::string::npos) {
|
|
62
|
+
target.replace(pos, 1, "\\n");
|
|
63
|
+
pos += 2;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return target;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Prints markdown block recursively to stdout
|
|
70
|
+
inline void PrintModelTable(const ModelTable& modelTable) {
|
|
71
|
+
|
|
72
|
+
std::cout << "Resource Model Symbols:\n";
|
|
73
|
+
|
|
74
|
+
for (ModelTable::const_iterator it = modelTable.begin();
|
|
75
|
+
it != modelTable.end();
|
|
76
|
+
++it) {
|
|
77
|
+
|
|
78
|
+
std::cout << "- " << it->first << " - body: '" << EscapeNewlines(it->second.body) << "'\n";
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
std::cout << std::endl;
|
|
82
|
+
}
|
|
83
|
+
#endif
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#endif
|
|
@@ -49,6 +49,14 @@ namespace snowcrash {
|
|
|
49
49
|
/** Parameter description delimiter */
|
|
50
50
|
const std::string DescriptionIdentifier = "...";
|
|
51
51
|
|
|
52
|
+
/** Parameter Definition Type */
|
|
53
|
+
enum ParameterType {
|
|
54
|
+
NotParameterType = 0,
|
|
55
|
+
OldParameterType, /// Parameter defined using the old syntax
|
|
56
|
+
NewParameterType, /// Parameter defined using the new MSON-like syntax
|
|
57
|
+
UndefinedParameterType = -1
|
|
58
|
+
};
|
|
59
|
+
|
|
52
60
|
/**
|
|
53
61
|
* Parameter section processor
|
|
54
62
|
*/
|
|
@@ -124,7 +132,7 @@ namespace snowcrash {
|
|
|
124
132
|
if ((!out.node.exampleValue.empty() || !out.node.defaultValue.empty()) &&
|
|
125
133
|
!out.node.values.empty()) {
|
|
126
134
|
|
|
127
|
-
checkExampleAndDefaultValue(node, pd, out);
|
|
135
|
+
checkExampleAndDefaultValue<Parameter>(node, pd, out);
|
|
128
136
|
}
|
|
129
137
|
|
|
130
138
|
return ++MarkdownNodeIterator(node);
|
|
@@ -139,9 +147,15 @@ namespace snowcrash {
|
|
|
139
147
|
subject = GetFirstLine(node->children().front().text, remainingContent);
|
|
140
148
|
TrimString(subject);
|
|
141
149
|
|
|
142
|
-
|
|
150
|
+
ParameterType parameterType = getParameterType(subject);
|
|
151
|
+
|
|
152
|
+
if (parameterType == OldParameterType) {
|
|
143
153
|
return ParameterSectionType;
|
|
144
154
|
}
|
|
155
|
+
|
|
156
|
+
if (parameterType == NewParameterType) {
|
|
157
|
+
return MSONParameterSectionType;
|
|
158
|
+
}
|
|
145
159
|
}
|
|
146
160
|
|
|
147
161
|
return UndefinedSectionType;
|
|
@@ -166,12 +180,9 @@ namespace snowcrash {
|
|
|
166
180
|
const ParseResultRef<Parameter>& out) {
|
|
167
181
|
|
|
168
182
|
out.node.use = UndefinedParameterUse;
|
|
169
|
-
|
|
170
183
|
TrimString(signature);
|
|
171
184
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (isValidParameterSignature(signature)) {
|
|
185
|
+
if (pd.sectionContext() == ParameterSectionType) {
|
|
175
186
|
|
|
176
187
|
mdp::ByteBuffer innerSignature = signature;
|
|
177
188
|
innerSignature = TrimString(innerSignature);
|
|
@@ -238,21 +249,9 @@ namespace snowcrash {
|
|
|
238
249
|
}
|
|
239
250
|
}
|
|
240
251
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
// WARN: Required vs default clash
|
|
246
|
-
std::stringstream ss;
|
|
247
|
-
ss << "specifying parameter '" << out.node.name << "' as required supersedes its default value"\
|
|
248
|
-
", declare the parameter as 'optional' to specify its default value";
|
|
249
|
-
|
|
250
|
-
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
251
|
-
out.report.warnings.push_back(Warning(ss.str(),
|
|
252
|
-
LogicalErrorWarning,
|
|
253
|
-
sourceMap));
|
|
254
|
-
}
|
|
255
|
-
} else {
|
|
252
|
+
checkDefaultAndRequiredClash<Parameter>(node, pd, out);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
256
255
|
// ERR: unable to parse
|
|
257
256
|
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
258
257
|
out.report.error = Error("unable to parse parameter specification",
|
|
@@ -349,9 +348,31 @@ namespace snowcrash {
|
|
|
349
348
|
}
|
|
350
349
|
}
|
|
351
350
|
|
|
351
|
+
template<typename T>
|
|
352
|
+
static void checkDefaultAndRequiredClash(const mdp::MarkdownNodeIterator& node,
|
|
353
|
+
SectionParserData& pd,
|
|
354
|
+
const ParseResultRef<T>& out) {
|
|
355
|
+
|
|
356
|
+
// Check possible required vs default clash
|
|
357
|
+
if (out.node.use != OptionalParameterUse &&
|
|
358
|
+
!out.node.defaultValue.empty()) {
|
|
359
|
+
|
|
360
|
+
// WARN: Required vs default clash
|
|
361
|
+
std::stringstream ss;
|
|
362
|
+
ss << "specifying parameter '" << out.node.name << "' as required supersedes its default value"\
|
|
363
|
+
", declare the parameter as 'optional' to specify its default value";
|
|
364
|
+
|
|
365
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
366
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
367
|
+
LogicalErrorWarning,
|
|
368
|
+
sourceMap));
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
template<typename T>
|
|
352
373
|
static void checkExampleAndDefaultValue(const mdp::MarkdownNodeIterator& node,
|
|
353
374
|
SectionParserData& pd,
|
|
354
|
-
const ParseResultRef<
|
|
375
|
+
const ParseResultRef<T>& out) {
|
|
355
376
|
|
|
356
377
|
bool isExampleFound = false;
|
|
357
378
|
bool isDefaultFound = false;
|
|
@@ -396,72 +417,110 @@ namespace snowcrash {
|
|
|
396
417
|
}
|
|
397
418
|
}
|
|
398
419
|
|
|
399
|
-
/**
|
|
400
|
-
|
|
420
|
+
/**
|
|
421
|
+
* \brief Determine the type of parameter using the signature
|
|
422
|
+
*/
|
|
423
|
+
static ParameterType getParameterType(const mdp::ByteBuffer& signature) {
|
|
401
424
|
|
|
402
425
|
mdp::ByteBuffer innerSignature = signature;
|
|
403
|
-
|
|
426
|
+
CaptureGroups captureGroups;
|
|
427
|
+
|
|
428
|
+
TrimString(innerSignature);
|
|
404
429
|
|
|
405
|
-
if (innerSignature.
|
|
406
|
-
return
|
|
430
|
+
if (innerSignature.empty()) {
|
|
431
|
+
return NotParameterType; // Empty string, invalid
|
|
407
432
|
}
|
|
408
433
|
|
|
409
|
-
|
|
434
|
+
if (RegexCapture(innerSignature, "^" PARAMETER_IDENTIFIER "[[:blank:]]*:?", captureGroups) &&
|
|
435
|
+
!captureGroups[0].empty()) {
|
|
410
436
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
437
|
+
innerSignature = innerSignature.substr(captureGroups[0].size());
|
|
438
|
+
|
|
439
|
+
// If last char is ':', don't strip it from signature
|
|
440
|
+
if (captureGroups[0].substr(captureGroups[0].size() - 1) == ":") {
|
|
441
|
+
innerSignature = ":" + innerSignature;
|
|
442
|
+
}
|
|
414
443
|
|
|
415
|
-
|
|
444
|
+
TrimString(innerSignature);
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
return NotParameterType;
|
|
448
|
+
}
|
|
416
449
|
|
|
417
|
-
|
|
418
|
-
|
|
450
|
+
// If contains only parameter name
|
|
451
|
+
if (innerSignature.empty()) {
|
|
452
|
+
return OldParameterType;
|
|
419
453
|
}
|
|
420
454
|
|
|
421
|
-
|
|
422
|
-
innerSignature = innerSignature.substr(firstSpace + 1);
|
|
423
|
-
size_t descriptionPos = innerSignature.find(snowcrash::DescriptionIdentifier);
|
|
455
|
+
std::string firstChar = innerSignature.substr(0, 1);
|
|
424
456
|
|
|
425
|
-
//
|
|
426
|
-
if (
|
|
427
|
-
|
|
428
|
-
innerSignature =
|
|
457
|
+
// If first char is ':' or `=`
|
|
458
|
+
if (firstChar == ":" || firstChar == "=") {
|
|
459
|
+
|
|
460
|
+
innerSignature = innerSignature.substr(1);
|
|
461
|
+
TrimString(innerSignature);
|
|
462
|
+
|
|
463
|
+
if (innerSignature.empty()) {
|
|
464
|
+
return NotParameterType; // No sample or default value
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Traverse over the value
|
|
468
|
+
while (!innerSignature.empty()) {
|
|
469
|
+
|
|
470
|
+
std::string first = innerSignature.substr(0, 1);
|
|
471
|
+
|
|
472
|
+
if (first == "`") {
|
|
473
|
+
RetrieveEscaped(innerSignature);
|
|
474
|
+
TrimString(innerSignature);
|
|
475
|
+
}
|
|
476
|
+
else if (first == "(") {
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
innerSignature = innerSignature.substr(1);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
return firstChar == ":" ? NewParameterType : OldParameterType;
|
|
429
485
|
}
|
|
430
486
|
|
|
431
|
-
|
|
487
|
+
if (innerSignature.substr(0, 1) == "(") {
|
|
432
488
|
|
|
433
|
-
|
|
489
|
+
// We should use `matchBrackets` if the parameters are supported to be more complex
|
|
434
490
|
size_t endOfAttributesPos = innerSignature.find_last_of(")");
|
|
435
491
|
|
|
436
492
|
if (endOfAttributesPos == std::string::npos) {
|
|
437
|
-
return
|
|
493
|
+
return NotParameterType; // Expecting close of attributes
|
|
438
494
|
}
|
|
439
495
|
|
|
440
|
-
|
|
441
|
-
innerSignature = innerSignature.substr(0, attributesPos);
|
|
442
|
-
innerSignature = TrimString(innerSignature);
|
|
443
|
-
}
|
|
496
|
+
std::string attributes = innerSignature.substr(1, endOfAttributesPos);
|
|
444
497
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
if (innerSignature.substr(0,1) == "=") {
|
|
450
|
-
innerSignature = innerSignature.substr(1);
|
|
451
|
-
innerSignature = TrimString(innerSignature);
|
|
498
|
+
if (RegexMatch(attributes, "enum\\[[^][]+]")) {
|
|
499
|
+
return NewParameterType;
|
|
500
|
+
}
|
|
452
501
|
|
|
453
|
-
if (
|
|
454
|
-
return
|
|
502
|
+
if (RegexMatch(attributes, "`")) {
|
|
503
|
+
return OldParameterType;
|
|
455
504
|
}
|
|
456
505
|
|
|
457
|
-
|
|
458
|
-
|
|
506
|
+
innerSignature = innerSignature.substr(endOfAttributesPos + 1);
|
|
507
|
+
TrimString(innerSignature);
|
|
508
|
+
|
|
509
|
+
if (innerSignature.empty()) {
|
|
510
|
+
return OldParameterType;
|
|
459
511
|
}
|
|
460
512
|
}
|
|
461
513
|
|
|
462
|
-
|
|
463
|
-
|
|
514
|
+
if (innerSignature.substr(0, 1) == "-") {
|
|
515
|
+
return NewParameterType;
|
|
516
|
+
}
|
|
464
517
|
|
|
518
|
+
if (innerSignature.substr(0, 3) == "...") {
|
|
519
|
+
return OldParameterType;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
return NotParameterType;
|
|
523
|
+
}
|
|
465
524
|
};
|
|
466
525
|
|
|
467
526
|
/** Parameter Section Parser */
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
#include "SectionParser.h"
|
|
13
13
|
#include "ParameterParser.h"
|
|
14
|
+
#include "MSONParameterParser.h"
|
|
14
15
|
#include "RegexMatch.h"
|
|
15
16
|
#include "StringUtility.h"
|
|
16
17
|
#include "BlueprintUtility.h"
|
|
@@ -58,26 +59,30 @@ namespace snowcrash {
|
|
|
58
59
|
return ++MarkdownNodeIterator(node);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
const MarkdownNodes& siblings,
|
|
63
|
-
SectionParserData& pd,
|
|
64
|
-
const ParseResultRef<Parameters>& out) {
|
|
65
|
-
|
|
66
|
-
return node;
|
|
67
|
-
}
|
|
62
|
+
NO_SECTION_DESCRIPTION(Parameters)
|
|
68
63
|
|
|
69
64
|
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
|
|
70
65
|
const MarkdownNodes& siblings,
|
|
71
66
|
SectionParserData& pd,
|
|
72
67
|
const ParseResultRef<Parameters>& out) {
|
|
73
68
|
|
|
74
|
-
if (pd.sectionContext() != ParameterSectionType) {
|
|
75
|
-
return node;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
69
|
IntermediateParseResult<Parameter> parameter(out.report);
|
|
70
|
+
IntermediateParseResult<MSONParameter> msonParameter(out.report);
|
|
79
71
|
|
|
80
|
-
|
|
72
|
+
if (pd.sectionContext() == ParameterSectionType) {
|
|
73
|
+
ParameterParser::parse(node, siblings, pd, parameter);
|
|
74
|
+
}
|
|
75
|
+
else if (pd.sectionContext() == MSONParameterSectionType) {
|
|
76
|
+
MSONParameterParser::parse(node, siblings, pd, msonParameter);
|
|
77
|
+
|
|
78
|
+
// Copy values from MSON Parameter to normal parameter
|
|
79
|
+
parameter.report = msonParameter.report;
|
|
80
|
+
parameter.node = msonParameter.node;
|
|
81
|
+
parameter.sourceMap = msonParameter.sourceMap;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return node;
|
|
85
|
+
}
|
|
81
86
|
|
|
82
87
|
if (!out.node.empty()) {
|
|
83
88
|
|
|
@@ -105,12 +110,6 @@ namespace snowcrash {
|
|
|
105
110
|
return ++MarkdownNodeIterator(node);
|
|
106
111
|
}
|
|
107
112
|
|
|
108
|
-
static bool isDescriptionNode(const MarkdownNodeIterator& node,
|
|
109
|
-
SectionType sectionType) {
|
|
110
|
-
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
113
|
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
|
115
114
|
|
|
116
115
|
if (node->type == mdp::ListItemMarkdownNodeType
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#include "AssetParser.h"
|
|
15
15
|
#include "HeadersParser.h"
|
|
16
16
|
#include "ParametersParser.h"
|
|
17
|
+
#include "AttributesParser.h"
|
|
17
18
|
|
|
18
19
|
/** Media type in brackets regex */
|
|
19
20
|
#define MEDIA_TYPE "([[:blank:]]*\\(([^\\)]*)\\))"
|
|
@@ -77,7 +78,7 @@ namespace snowcrash {
|
|
|
77
78
|
if (pd.exportSourceMap() && !out.node.description.empty()) {
|
|
78
79
|
out.sourceMap.description.sourceMap.append(node->sourceMap);
|
|
79
80
|
}
|
|
80
|
-
} else if (!
|
|
81
|
+
} else if (!parseModelReference(node, pd, remainingContent, out)) {
|
|
81
82
|
|
|
82
83
|
// NOTE: NOT THE CORRECT WAY TO DO THIS
|
|
83
84
|
// https://github.com/apiaryio/snowcrash/commit/a7c5868e62df0048a85e2f9aeeb42c3b3e0a2f07#commitcomment-7322085
|
|
@@ -102,11 +103,11 @@ namespace snowcrash {
|
|
|
102
103
|
mdp::ByteBuffer content;
|
|
103
104
|
|
|
104
105
|
if (!out.node.reference.id.empty()) {
|
|
105
|
-
//WARN: ignoring extraneous content after
|
|
106
|
+
//WARN: ignoring extraneous content after model reference
|
|
106
107
|
std::stringstream ss;
|
|
107
108
|
|
|
108
|
-
ss << "ignoring extraneous content after
|
|
109
|
-
ss << ", expected
|
|
109
|
+
ss << "ignoring extraneous content after model reference";
|
|
110
|
+
ss << ", expected model reference only e.g. '[" << out.node.reference.id << "][]'";
|
|
110
111
|
|
|
111
112
|
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
112
113
|
out.report.warnings.push_back(Warning(ss.str(),
|
|
@@ -116,7 +117,7 @@ namespace snowcrash {
|
|
|
116
117
|
|
|
117
118
|
if (!out.node.body.empty() ||
|
|
118
119
|
node->type != mdp::ParagraphMarkdownNodeType ||
|
|
119
|
-
!
|
|
120
|
+
!parseModelReference(node, pd, node->text, out)) {
|
|
120
121
|
|
|
121
122
|
// NOTE: NOT THE CORRECT WAY TO DO THIS
|
|
122
123
|
// https://github.com/apiaryio/snowcrash/commit/a7c5868e62df0048a85e2f9aeeb42c3b3e0a2f07#commitcomment-7322085
|
|
@@ -147,6 +148,12 @@ namespace snowcrash {
|
|
|
147
148
|
return HeadersParser::parse(node, siblings, pd, headers);
|
|
148
149
|
}
|
|
149
150
|
|
|
151
|
+
case AttributesSectionType:
|
|
152
|
+
{
|
|
153
|
+
ParseResultRef<Attributes> attributes(out.report, out.node.attributes, out.sourceMap.attributes);
|
|
154
|
+
return AttributesParser::parse(node, siblings, pd, attributes);
|
|
155
|
+
}
|
|
156
|
+
|
|
150
157
|
case BodySectionType:
|
|
151
158
|
{
|
|
152
159
|
if (!out.node.body.empty()) {
|
|
@@ -276,6 +283,13 @@ namespace snowcrash {
|
|
|
276
283
|
return nestedType;
|
|
277
284
|
}
|
|
278
285
|
|
|
286
|
+
// Check if attributes section
|
|
287
|
+
nestedType = SectionProcessor<Attributes>::sectionType(node);
|
|
288
|
+
|
|
289
|
+
if (nestedType != UndefinedSectionType) {
|
|
290
|
+
return nestedType;
|
|
291
|
+
}
|
|
292
|
+
|
|
279
293
|
return UndefinedSectionType;
|
|
280
294
|
}
|
|
281
295
|
|
|
@@ -285,6 +299,7 @@ namespace snowcrash {
|
|
|
285
299
|
nested.push_back(HeadersSectionType);
|
|
286
300
|
nested.push_back(BodySectionType);
|
|
287
301
|
nested.push_back(SchemaSectionType);
|
|
302
|
+
nested.push_back(AttributesSectionType);
|
|
288
303
|
|
|
289
304
|
// Parameters & descendants
|
|
290
305
|
nested.push_back(ParametersSectionType);
|
|
@@ -303,7 +318,8 @@ namespace snowcrash {
|
|
|
303
318
|
if (sectionType == RequestSectionType || sectionType == RequestBodySectionType) {
|
|
304
319
|
|
|
305
320
|
checkRequest(node, pd, out);
|
|
306
|
-
}
|
|
321
|
+
}
|
|
322
|
+
else if (sectionType == ResponseSectionType || sectionType == ResponseBodySectionType) {
|
|
307
323
|
|
|
308
324
|
checkResponse(node, pd, out);
|
|
309
325
|
}
|
|
@@ -467,28 +483,28 @@ namespace snowcrash {
|
|
|
467
483
|
return true;
|
|
468
484
|
}
|
|
469
485
|
|
|
470
|
-
/** Given the reference id(name), initializes reference of the payload accordingly(if possible resolve it) */
|
|
471
|
-
static bool
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
486
|
+
/** Given the reference id(name), initializes reference of the payload accordingly (if possible resolve it) */
|
|
487
|
+
static bool parseModelReference(const MarkdownNodeIterator& node,
|
|
488
|
+
SectionParserData& pd,
|
|
489
|
+
mdp::ByteBuffer& source,
|
|
490
|
+
const ParseResultRef<Payload>& out) {
|
|
475
491
|
|
|
476
492
|
Identifier symbol;
|
|
477
493
|
|
|
478
494
|
TrimString(source);
|
|
479
495
|
|
|
480
|
-
if (
|
|
496
|
+
if (GetModelReference(source, symbol)) {
|
|
481
497
|
|
|
482
498
|
out.node.reference.id = symbol;
|
|
483
499
|
out.node.reference.meta.node = node;
|
|
484
|
-
out.node.reference.type = Reference::
|
|
500
|
+
out.node.reference.type = Reference::ModelReference;
|
|
485
501
|
|
|
486
502
|
if (pd.exportSourceMap() && !symbol.empty()) {
|
|
487
503
|
out.sourceMap.reference.sourceMap = node->sourceMap;
|
|
488
504
|
}
|
|
489
505
|
|
|
490
|
-
// If
|
|
491
|
-
if (pd.
|
|
506
|
+
// If model has not been defined yet in model table
|
|
507
|
+
if (pd.modelTable.find(symbol) == pd.modelTable.end()) {
|
|
492
508
|
|
|
493
509
|
out.node.reference.meta.state = Reference::StatePending;
|
|
494
510
|
|
|
@@ -514,7 +530,7 @@ namespace snowcrash {
|
|
|
514
530
|
const ParseResultRef<Payload>& out) {
|
|
515
531
|
|
|
516
532
|
SourceMap<ResourceModel> modelSM;
|
|
517
|
-
ResourceModel model = pd.
|
|
533
|
+
ResourceModel model = pd.modelTable.find(out.node.reference.id)->second;
|
|
518
534
|
|
|
519
535
|
|
|
520
536
|
out.node.description = model.description;
|
|
@@ -553,7 +569,7 @@ namespace snowcrash {
|
|
|
553
569
|
|
|
554
570
|
if (pd.exportSourceMap()) {
|
|
555
571
|
|
|
556
|
-
modelSM = pd.
|
|
572
|
+
modelSM = pd.modelSourceMapTable.at(out.node.reference.id);
|
|
557
573
|
|
|
558
574
|
out.sourceMap.description = modelSM.description;
|
|
559
575
|
out.sourceMap.parameters = modelSM.parameters;
|
|
@@ -596,7 +612,9 @@ namespace snowcrash {
|
|
|
596
612
|
}
|
|
597
613
|
}
|
|
598
614
|
|
|
599
|
-
|
|
615
|
+
|
|
616
|
+
if (out.node.body.empty() && out.node.attributes.empty() &&
|
|
617
|
+
out.node.reference.meta.state != Reference::StatePending) {
|
|
600
618
|
|
|
601
619
|
// Warn when content-length or transfer-encoding is specified or both headers and body are empty
|
|
602
620
|
if (out.node.headers.empty()) {
|