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
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RelationParser.h
|
|
3
|
+
// snowcrash
|
|
4
|
+
//
|
|
5
|
+
// Created by Pavan Kumar Sunkara on 04/03/15.
|
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef SNOWCRASH_RELATIONPARSER_H
|
|
10
|
+
#define SNOWCRASH_RELATIONPARSER_H
|
|
11
|
+
|
|
12
|
+
#include "SectionParser.h"
|
|
13
|
+
#include "RegexMatch.h"
|
|
14
|
+
|
|
15
|
+
namespace snowcrash {
|
|
16
|
+
|
|
17
|
+
/** Link Relation matching regex */
|
|
18
|
+
const char* const RelationRegex = "^[[:blank:]]*[Rr]elation[[:blank:]]*:[[:blank:]]*([a-z][a-z0-9.-]*)?[[:blank:]]*$";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Relation Section Processor
|
|
22
|
+
*/
|
|
23
|
+
template<>
|
|
24
|
+
struct SectionProcessor<Relation> : public SectionProcessorBase<Relation> {
|
|
25
|
+
|
|
26
|
+
static MarkdownNodeIterator processSignature(const MarkdownNodeIterator& node,
|
|
27
|
+
const MarkdownNodes& siblings,
|
|
28
|
+
SectionParserData& pd,
|
|
29
|
+
SectionLayout& layout,
|
|
30
|
+
const ParseResultRef<Relation>& out) {
|
|
31
|
+
|
|
32
|
+
mdp::ByteBuffer signature, remainingContent;
|
|
33
|
+
CaptureGroups captureGroups;
|
|
34
|
+
|
|
35
|
+
signature = GetFirstLine(node->text, remainingContent);
|
|
36
|
+
TrimString(signature);
|
|
37
|
+
|
|
38
|
+
if (RegexCapture(signature, RelationRegex, captureGroups, 3)) {
|
|
39
|
+
out.node.str = captureGroups[1];
|
|
40
|
+
TrimString(out.node.str);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (pd.exportSourceMap() && !out.node.str.empty()) {
|
|
44
|
+
out.sourceMap.sourceMap.append(node->sourceMap);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return ++MarkdownNodeIterator(node);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
NO_SECTION_DESCRIPTION(Relation)
|
|
51
|
+
|
|
52
|
+
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
|
53
|
+
|
|
54
|
+
if (node->type == mdp::ListItemMarkdownNodeType
|
|
55
|
+
&& !node->children().empty()) {
|
|
56
|
+
|
|
57
|
+
mdp::ByteBuffer remaining, subject = node->children().front().text;
|
|
58
|
+
|
|
59
|
+
subject = GetFirstLine(subject, remaining);
|
|
60
|
+
TrimString(subject);
|
|
61
|
+
|
|
62
|
+
if (RegexMatch(subject, RelationRegex)) {
|
|
63
|
+
return RelationSectionType;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return UndefinedSectionType;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** Relation Section Parser */
|
|
72
|
+
typedef SectionParser<Relation, ListSectionAdapter> RelationParser;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#endif
|
|
@@ -47,37 +47,72 @@ namespace snowcrash {
|
|
|
47
47
|
CaptureGroups captureGroups;
|
|
48
48
|
|
|
49
49
|
if (RegexCapture(node->text, GroupHeaderRegex, captureGroups, 3)) {
|
|
50
|
-
out.node.name = captureGroups[1];
|
|
51
|
-
TrimString(out.node.name);
|
|
50
|
+
out.node.attributes.name = captureGroups[1];
|
|
51
|
+
TrimString(out.node.attributes.name);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
if (pd.exportSourceMap() && !out.node.name.empty()) {
|
|
55
|
-
out.sourceMap.name.sourceMap = node->sourceMap;
|
|
54
|
+
if (pd.exportSourceMap() && !out.node.attributes.name.empty()) {
|
|
55
|
+
out.sourceMap.attributes.name.sourceMap = node->sourceMap;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
return ++MarkdownNodeIterator(node);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
static MarkdownNodeIterator processDescription(const MarkdownNodeIterator& node,
|
|
62
|
+
const MarkdownNodes& siblings,
|
|
63
|
+
SectionParserData& pd,
|
|
64
|
+
const ParseResultRef<ResourceGroup>& out) {
|
|
65
|
+
|
|
66
|
+
// Check for a description child element
|
|
67
|
+
if (out.node.content.elements().empty() ||
|
|
68
|
+
(!out.node.content.elements().empty() &&
|
|
69
|
+
out.node.content.elements().back().element != Element::CopyElement)) {
|
|
70
|
+
|
|
71
|
+
Element description(Element::CopyElement);
|
|
72
|
+
out.node.content.elements().push_back(description);
|
|
73
|
+
|
|
74
|
+
if (pd.exportSourceMap()) {
|
|
75
|
+
|
|
76
|
+
SourceMap<Element> descriptionSM(Element::CopyElement);
|
|
77
|
+
out.sourceMap.content.elements().collection.push_back(descriptionSM);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!out.node.content.elements().back().content.copy.empty()) {
|
|
82
|
+
TwoNewLines(out.node.content.elements().back().content.copy);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
mdp::ByteBuffer content = mdp::MapBytesRangeSet(node->sourceMap, pd.sourceData);
|
|
86
|
+
|
|
87
|
+
if (pd.exportSourceMap() && !content.empty()) {
|
|
88
|
+
out.sourceMap.content.elements().collection.back().content.copy.sourceMap.append(node->sourceMap);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
out.node.content.elements().back().content.copy += content;
|
|
92
|
+
|
|
93
|
+
return ++MarkdownNodeIterator(node);
|
|
94
|
+
}
|
|
95
|
+
|
|
61
96
|
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
|
|
62
97
|
const MarkdownNodes& siblings,
|
|
63
98
|
SectionParserData& pd,
|
|
64
99
|
const ParseResultRef<ResourceGroup>& out) {
|
|
65
100
|
|
|
101
|
+
MarkdownNodeIterator cur = node;
|
|
102
|
+
|
|
66
103
|
if (pd.sectionContext() == ResourceSectionType) {
|
|
67
104
|
|
|
68
105
|
IntermediateParseResult<Resource> resource(out.report);
|
|
106
|
+
cur = ResourceParser::parse(node, siblings, pd, resource);
|
|
69
107
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
ResourceIterator duplicate = SectionProcessor<Resource>::findResource(out.node.resources, resource.node);
|
|
73
|
-
ResourceIteratorPair globalDuplicate;
|
|
108
|
+
bool duplicate = SectionProcessor<Resource>::isResourceDuplicate(out.node.content.elements(), resource.node.uriTemplate);
|
|
109
|
+
bool globalDuplicate;
|
|
74
110
|
|
|
75
|
-
if (duplicate
|
|
76
|
-
globalDuplicate =
|
|
111
|
+
if (!duplicate) {
|
|
112
|
+
globalDuplicate = isResourceDuplicate(pd.blueprint, resource.node.uriTemplate);
|
|
77
113
|
}
|
|
78
114
|
|
|
79
|
-
if (duplicate
|
|
80
|
-
globalDuplicate.first != pd.blueprint.resourceGroups.end()) {
|
|
115
|
+
if (duplicate || globalDuplicate) {
|
|
81
116
|
|
|
82
117
|
// WARN: Duplicate resource
|
|
83
118
|
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
@@ -86,16 +121,21 @@ namespace snowcrash {
|
|
|
86
121
|
sourceMap));
|
|
87
122
|
}
|
|
88
123
|
|
|
89
|
-
|
|
124
|
+
Element resourceElement(Element::ResourceElement);
|
|
125
|
+
resourceElement.content.resource = resource.node;
|
|
126
|
+
|
|
127
|
+
out.node.content.elements().push_back(resourceElement);
|
|
90
128
|
|
|
91
129
|
if (pd.exportSourceMap()) {
|
|
92
|
-
out.sourceMap.resources.collection.push_back(resource.sourceMap);
|
|
93
|
-
}
|
|
94
130
|
|
|
95
|
-
|
|
131
|
+
SourceMap<Element> resourceElementSM(Element::ResourceElement);
|
|
132
|
+
resourceElementSM.content.resource = resource.sourceMap;
|
|
133
|
+
|
|
134
|
+
out.sourceMap.content.elements().collection.push_back(resourceElementSM);
|
|
135
|
+
}
|
|
96
136
|
}
|
|
97
137
|
|
|
98
|
-
return
|
|
138
|
+
return cur;
|
|
99
139
|
}
|
|
100
140
|
|
|
101
141
|
static MarkdownNodeIterator processUnexpectedNode(const MarkdownNodeIterator& node,
|
|
@@ -105,17 +145,16 @@ namespace snowcrash {
|
|
|
105
145
|
const ParseResultRef<ResourceGroup>& out) {
|
|
106
146
|
|
|
107
147
|
if (SectionProcessor<Action>::actionType(node) == DependentActionType &&
|
|
108
|
-
|
|
148
|
+
isResourcePresent(out.node.content.elements())) {
|
|
109
149
|
|
|
110
|
-
mdp::ByteBuffer method;
|
|
111
|
-
mdp::ByteBuffer name;
|
|
150
|
+
mdp::ByteBuffer method, name, uriTemplate;
|
|
112
151
|
|
|
113
|
-
SectionProcessor<Action>::actionHTTPMethodAndName(node, method, name);
|
|
152
|
+
SectionProcessor<Action>::actionHTTPMethodAndName(node, method, name, uriTemplate);
|
|
114
153
|
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
115
154
|
|
|
116
155
|
// WARN: Unexpected action
|
|
117
156
|
std::stringstream ss;
|
|
118
|
-
ss << "unexpected action '" << method << "', to define multiple actions for the '" << out.node.
|
|
157
|
+
ss << "unexpected action '" << method << "', to define multiple actions for the '" << lastResource(out.node.content.elements()).uriTemplate;
|
|
119
158
|
ss << "' resource omit the HTTP method in its definition, e.g. '# /resource'";
|
|
120
159
|
|
|
121
160
|
out.report.warnings.push_back(Warning(ss.str(),
|
|
@@ -128,6 +167,20 @@ namespace snowcrash {
|
|
|
128
167
|
return SectionProcessorBase<ResourceGroup>::processUnexpectedNode(node, siblings, pd, lastSectionType, out);
|
|
129
168
|
}
|
|
130
169
|
|
|
170
|
+
static void finalize(const MarkdownNodeIterator& node,
|
|
171
|
+
SectionParserData& pd,
|
|
172
|
+
const ParseResultRef<ResourceGroup>& out) {
|
|
173
|
+
|
|
174
|
+
out.node.element = Element::CategoryElement;
|
|
175
|
+
out.node.category = Element::ResourceGroupCategory;
|
|
176
|
+
|
|
177
|
+
if (pd.exportSourceMap()) {
|
|
178
|
+
|
|
179
|
+
out.sourceMap.element = out.node.element;
|
|
180
|
+
out.sourceMap.category = out.node.category;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
131
184
|
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
|
132
185
|
|
|
133
186
|
if (node->type == mdp::HeaderMarkdownNodeType
|
|
@@ -183,22 +236,63 @@ namespace snowcrash {
|
|
|
183
236
|
return SectionProcessorBase<ResourceGroup>::isUnexpectedNode(node, sectionType);
|
|
184
237
|
}
|
|
185
238
|
|
|
186
|
-
/**
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
239
|
+
/**
|
|
240
|
+
* \brief Given a blueprint, Check if a resource already exists with the given uri template
|
|
241
|
+
*
|
|
242
|
+
* \param blueprint The blueprint which is formed until now
|
|
243
|
+
* \param uri The resource uri template to be checked
|
|
244
|
+
*/
|
|
245
|
+
static bool isResourceDuplicate(const Blueprint& blueprint,
|
|
246
|
+
const URITemplate& uri) {
|
|
247
|
+
|
|
248
|
+
for (Elements::const_iterator it = blueprint.content.elements().begin();
|
|
249
|
+
it != blueprint.content.elements().end();
|
|
192
250
|
++it) {
|
|
193
251
|
|
|
194
|
-
|
|
252
|
+
if (it->element == Element::CategoryElement &&
|
|
253
|
+
SectionProcessor<Resource>::isResourceDuplicate(it->content.elements(), uri)) {
|
|
254
|
+
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* \brief Given list of elements, return true if none of them is a resource element
|
|
264
|
+
*
|
|
265
|
+
* \param elements Collection of elements
|
|
266
|
+
*/
|
|
267
|
+
static bool isResourcePresent(const Elements& elements) {
|
|
268
|
+
|
|
269
|
+
for (Elements::const_iterator it = elements.begin(); it != elements.end(); ++it) {
|
|
270
|
+
|
|
271
|
+
if (it->element == Element::ResourceElement) {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
195
275
|
|
|
196
|
-
|
|
197
|
-
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* \brief Given list of elements, get the last resource
|
|
281
|
+
*
|
|
282
|
+
* \param elements Collection fo elements
|
|
283
|
+
*/
|
|
284
|
+
static Resource lastResource(const Elements& elements) {
|
|
285
|
+
|
|
286
|
+
Resource last;
|
|
287
|
+
|
|
288
|
+
for (Elements::const_iterator it = elements.begin(); it != elements.end(); ++it) {
|
|
289
|
+
|
|
290
|
+
if (it->element == Element::ResourceElement) {
|
|
291
|
+
last = it->content.resource;
|
|
198
292
|
}
|
|
199
|
-
|
|
293
|
+
}
|
|
200
294
|
|
|
201
|
-
|
|
295
|
+
return last;
|
|
202
296
|
}
|
|
203
297
|
};
|
|
204
298
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
#include "SectionParser.h"
|
|
13
13
|
#include "ActionParser.h"
|
|
14
|
+
#include "DataStructureGroupParser.h"
|
|
14
15
|
#include "HeadersParser.h"
|
|
15
16
|
#include "ParametersParser.h"
|
|
16
17
|
#include "UriTemplateParser.h"
|
|
@@ -63,11 +64,8 @@ namespace snowcrash {
|
|
|
63
64
|
|
|
64
65
|
return cur;
|
|
65
66
|
}
|
|
66
|
-
} else
|
|
67
|
-
|
|
68
|
-
out.node.name = captureGroups[1];
|
|
69
|
-
TrimString(out.node.name);
|
|
70
|
-
out.node.uriTemplate = captureGroups[2];
|
|
67
|
+
} else {
|
|
68
|
+
matchNamedResourceHeader(node, out.node);
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
if (pd.exportSourceMap()) {
|
|
@@ -105,6 +103,40 @@ namespace snowcrash {
|
|
|
105
103
|
return SectionProcessor<Action>::handleDeprecatedHeaders(node, siblings, pd, headers);
|
|
106
104
|
}
|
|
107
105
|
|
|
106
|
+
case AttributesSectionType:
|
|
107
|
+
{
|
|
108
|
+
ParseResultRef<Attributes> attributes(out.report, out.node.attributes, out.sourceMap.attributes);
|
|
109
|
+
MarkdownNodeIterator cur = AttributesParser::parse(node, siblings, pd, attributes);
|
|
110
|
+
|
|
111
|
+
if (!out.node.name.empty()) {
|
|
112
|
+
|
|
113
|
+
if (SectionProcessor<DataStructureGroup>::isNamedTypeDuplicate(pd.blueprint, out.node.name)) {
|
|
114
|
+
|
|
115
|
+
// WARN: duplicate named type
|
|
116
|
+
std::stringstream ss;
|
|
117
|
+
ss << "named type with name '" << out.node.name << "' already exists";
|
|
118
|
+
|
|
119
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
120
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
121
|
+
DuplicateWarning,
|
|
122
|
+
sourceMap));
|
|
123
|
+
|
|
124
|
+
// Remove the attributes data from the AST since we are ignoring this
|
|
125
|
+
out.node.attributes = mson::NamedType();
|
|
126
|
+
|
|
127
|
+
return cur;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
attributes.node.name.symbol.literal = out.node.name;
|
|
131
|
+
|
|
132
|
+
if (pd.exportSourceMap()) {
|
|
133
|
+
attributes.sourceMap.name.sourceMap = out.sourceMap.name.sourceMap;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return cur;
|
|
138
|
+
}
|
|
139
|
+
|
|
108
140
|
default:
|
|
109
141
|
break;
|
|
110
142
|
}
|
|
@@ -129,14 +161,14 @@ namespace snowcrash {
|
|
|
129
161
|
out.sourceMap.model.body.sourceMap.append(node->sourceMap);
|
|
130
162
|
}
|
|
131
163
|
|
|
132
|
-
// Update model in the
|
|
133
|
-
|
|
164
|
+
// Update model in the model table as well
|
|
165
|
+
ModelTable::iterator it = pd.modelTable.find(out.node.model.name);
|
|
134
166
|
|
|
135
|
-
if (it != pd.
|
|
167
|
+
if (it != pd.modelTable.end()) {
|
|
136
168
|
it->second.body = out.node.model.body;
|
|
137
169
|
|
|
138
170
|
if (pd.exportSourceMap()) {
|
|
139
|
-
pd.
|
|
171
|
+
pd.modelSourceMapTable[out.node.model.name].body = out.sourceMap.model.body;
|
|
140
172
|
}
|
|
141
173
|
}
|
|
142
174
|
|
|
@@ -189,7 +221,7 @@ namespace snowcrash {
|
|
|
189
221
|
// Check if headers section
|
|
190
222
|
nestedType = SectionProcessor<Headers>::sectionType(node);
|
|
191
223
|
|
|
192
|
-
if (nestedType
|
|
224
|
+
if (nestedType != UndefinedSectionType) {
|
|
193
225
|
return nestedType;
|
|
194
226
|
}
|
|
195
227
|
|
|
@@ -202,6 +234,13 @@ namespace snowcrash {
|
|
|
202
234
|
return nestedType;
|
|
203
235
|
}
|
|
204
236
|
|
|
237
|
+
// Check if attributes section
|
|
238
|
+
nestedType = SectionProcessor<Attributes>::sectionType(node);
|
|
239
|
+
|
|
240
|
+
if (nestedType != UndefinedSectionType) {
|
|
241
|
+
return nestedType;
|
|
242
|
+
}
|
|
243
|
+
|
|
205
244
|
// Check if action section
|
|
206
245
|
nestedType = SectionProcessor<Action>::sectionType(node);
|
|
207
246
|
|
|
@@ -252,14 +291,14 @@ namespace snowcrash {
|
|
|
252
291
|
// Consolidate deprecated headers into subsequent payloads
|
|
253
292
|
if (!out.node.headers.empty()) {
|
|
254
293
|
|
|
255
|
-
Collection<Action>::iterator
|
|
256
|
-
Collection<SourceMap<Action> >::iterator
|
|
294
|
+
Collection<Action>::iterator actionIt = out.node.actions.begin();
|
|
295
|
+
Collection<SourceMap<Action> >::iterator actionSMIt = out.sourceMap.actions.collection.begin();
|
|
257
296
|
|
|
258
297
|
for (;
|
|
259
|
-
|
|
260
|
-
++
|
|
298
|
+
actionIt != out.node.actions.end();
|
|
299
|
+
++actionIt, ++actionSMIt) {
|
|
261
300
|
|
|
262
|
-
SectionProcessor<Headers>::injectDeprecatedHeaders(pd, out.node.headers, out.sourceMap.headers,
|
|
301
|
+
SectionProcessor<Headers>::injectDeprecatedHeaders(pd, out.node.headers, out.sourceMap.headers, actionIt->examples, actionSMIt->examples);
|
|
263
302
|
}
|
|
264
303
|
|
|
265
304
|
out.node.headers.clear();
|
|
@@ -270,6 +309,25 @@ namespace snowcrash {
|
|
|
270
309
|
}
|
|
271
310
|
}
|
|
272
311
|
|
|
312
|
+
/**
|
|
313
|
+
* \brief Given a named resource header, retrieve the name and uriTemplate
|
|
314
|
+
*
|
|
315
|
+
* \param node Markdown node to process
|
|
316
|
+
* \param resource Resource data structure
|
|
317
|
+
*/
|
|
318
|
+
static void matchNamedResourceHeader(const MarkdownNodeIterator& node,
|
|
319
|
+
Resource& resource) {
|
|
320
|
+
|
|
321
|
+
CaptureGroups captureGroups;
|
|
322
|
+
|
|
323
|
+
if (RegexCapture(node->text, NamedResourceHeaderRegex, captureGroups, 4)) {
|
|
324
|
+
|
|
325
|
+
resource.name = captureGroups[1];
|
|
326
|
+
TrimString(resource.name);
|
|
327
|
+
resource.uriTemplate = captureGroups[2];
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
273
331
|
/** Process Action section */
|
|
274
332
|
static MarkdownNodeIterator processAction(const MarkdownNodeIterator& node,
|
|
275
333
|
const MarkdownNodes& siblings,
|
|
@@ -277,7 +335,6 @@ namespace snowcrash {
|
|
|
277
335
|
const ParseResultRef<Resource>& out) {
|
|
278
336
|
|
|
279
337
|
IntermediateParseResult<Action> action(out.report);
|
|
280
|
-
|
|
281
338
|
MarkdownNodeIterator cur = ActionParser::parse(node, siblings, pd, action);
|
|
282
339
|
|
|
283
340
|
ActionIterator duplicate = SectionProcessor<Action>::findAction(out.node.actions, action.node);
|
|
@@ -295,9 +352,28 @@ namespace snowcrash {
|
|
|
295
352
|
sourceMap));
|
|
296
353
|
}
|
|
297
354
|
|
|
355
|
+
ActionIterator relationDuplicate = SectionProcessor<Action>::findRelation(out.node.actions, action.node.relation);
|
|
356
|
+
|
|
357
|
+
if (relationDuplicate != out.node.actions.end()) {
|
|
358
|
+
|
|
359
|
+
// WARN: duplicate relation identifier
|
|
360
|
+
std::stringstream ss;
|
|
361
|
+
ss << "relation identifier '" << action.node.relation.str << "' already defined for resource '" << out.node.uriTemplate << "'";
|
|
362
|
+
|
|
363
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
364
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
365
|
+
DuplicateWarning,
|
|
366
|
+
sourceMap));
|
|
367
|
+
}
|
|
368
|
+
|
|
298
369
|
if (!action.node.parameters.empty()) {
|
|
299
370
|
|
|
300
|
-
|
|
371
|
+
if (!action.node.uriTemplate.empty()) {
|
|
372
|
+
checkParametersEligibility<Action>(node, pd, action.node.parameters, action);
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
checkParametersEligibility<Resource>(node, pd, action.node.parameters, out);
|
|
376
|
+
}
|
|
301
377
|
}
|
|
302
378
|
|
|
303
379
|
out.node.actions.push_back(action.node);
|
|
@@ -321,7 +397,7 @@ namespace snowcrash {
|
|
|
321
397
|
|
|
322
398
|
if (!parameters.node.empty()) {
|
|
323
399
|
|
|
324
|
-
checkParametersEligibility(node, pd, parameters.node, out);
|
|
400
|
+
checkParametersEligibility<Resource>(node, pd, parameters.node, out);
|
|
325
401
|
out.node.parameters.insert(out.node.parameters.end(), parameters.node.begin(), parameters.node.end());
|
|
326
402
|
|
|
327
403
|
if (pd.exportSourceMap()) {
|
|
@@ -382,29 +458,29 @@ namespace snowcrash {
|
|
|
382
458
|
|
|
383
459
|
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
384
460
|
out.report.error = Error(ss.str(),
|
|
385
|
-
|
|
461
|
+
ModelError,
|
|
386
462
|
sourceMap);
|
|
387
463
|
}
|
|
388
464
|
}
|
|
389
465
|
|
|
390
|
-
|
|
466
|
+
ModelTable::iterator it = pd.modelTable.find(model.node.name);
|
|
391
467
|
|
|
392
|
-
if (it == pd.
|
|
468
|
+
if (it == pd.modelTable.end()) {
|
|
393
469
|
|
|
394
|
-
pd.
|
|
470
|
+
pd.modelTable[model.node.name] = model.node;
|
|
395
471
|
|
|
396
472
|
if (pd.exportSourceMap()) {
|
|
397
|
-
pd.
|
|
473
|
+
pd.modelSourceMapTable[model.node.name] = model.sourceMap;
|
|
398
474
|
}
|
|
399
475
|
} else {
|
|
400
476
|
|
|
401
|
-
// ERR:
|
|
477
|
+
// ERR: Model already defined
|
|
402
478
|
std::stringstream ss;
|
|
403
479
|
ss << "symbol '" << model.node.name << "' already defined";
|
|
404
480
|
|
|
405
481
|
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
406
482
|
out.report.error = Error(ss.str(),
|
|
407
|
-
|
|
483
|
+
ModelError,
|
|
408
484
|
sourceMap);
|
|
409
485
|
}
|
|
410
486
|
|
|
@@ -417,11 +493,16 @@ namespace snowcrash {
|
|
|
417
493
|
return cur;
|
|
418
494
|
}
|
|
419
495
|
|
|
420
|
-
/**
|
|
496
|
+
/**
|
|
497
|
+
* \brief Check Parameters eligibility in URI template
|
|
498
|
+
*
|
|
499
|
+
* \warning Do not specialise this.
|
|
500
|
+
*/
|
|
501
|
+
template<typename T>
|
|
421
502
|
static void checkParametersEligibility(const MarkdownNodeIterator& node,
|
|
422
503
|
const SectionParserData& pd,
|
|
423
504
|
Parameters& parameters,
|
|
424
|
-
const ParseResultRef<
|
|
505
|
+
const ParseResultRef<T>& out) {
|
|
425
506
|
|
|
426
507
|
for (ParameterIterator it = parameters.begin();
|
|
427
508
|
it != parameters.end();
|
|
@@ -448,13 +529,25 @@ namespace snowcrash {
|
|
|
448
529
|
}
|
|
449
530
|
}
|
|
450
531
|
|
|
451
|
-
/**
|
|
452
|
-
|
|
453
|
-
|
|
532
|
+
/**
|
|
533
|
+
* \brief Given a list of elements, Check if a resource already exists with the given uri template
|
|
534
|
+
*
|
|
535
|
+
* \param elements Collection of elements
|
|
536
|
+
* \param uri The resource uri template to be checked
|
|
537
|
+
*/
|
|
538
|
+
static bool isResourceDuplicate(const Elements& elements,
|
|
539
|
+
const URITemplate& uri) {
|
|
540
|
+
|
|
541
|
+
for (Elements::const_iterator it = elements.begin(); it != elements.end(); ++it) {
|
|
542
|
+
|
|
543
|
+
if (it->element == Element::ResourceElement &&
|
|
544
|
+
it->content.resource.uriTemplate == uri) {
|
|
545
|
+
|
|
546
|
+
return true;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
454
549
|
|
|
455
|
-
return
|
|
456
|
-
resources.end(),
|
|
457
|
-
std::bind2nd(MatchResource(), resource));
|
|
550
|
+
return false;
|
|
458
551
|
}
|
|
459
552
|
};
|
|
460
553
|
|