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,90 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Blueprint.cc
|
|
3
|
+
// snowcrash
|
|
4
|
+
//
|
|
5
|
+
// Created by Pavan Kumar Sunkara on 26/01/15.
|
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#include "Blueprint.h"
|
|
10
|
+
|
|
11
|
+
using namespace snowcrash;
|
|
12
|
+
|
|
13
|
+
DataStructure& DataStructure::operator=(const mson::NamedType &rhs)
|
|
14
|
+
{
|
|
15
|
+
this->name = rhs.name;
|
|
16
|
+
this->typeDefinition = rhs.typeDefinition;
|
|
17
|
+
this->sections = rhs.sections;
|
|
18
|
+
|
|
19
|
+
return *this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Elements& Element::Content::elements()
|
|
23
|
+
{
|
|
24
|
+
if (!m_elements.get())
|
|
25
|
+
throw ELEMENTS_NOT_SET_ERR;
|
|
26
|
+
|
|
27
|
+
return *m_elements;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const Elements& Element::Content::elements() const
|
|
31
|
+
{
|
|
32
|
+
if (!m_elements.get())
|
|
33
|
+
throw ELEMENTS_NOT_SET_ERR;
|
|
34
|
+
|
|
35
|
+
return *m_elements;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Element::Content::Content()
|
|
39
|
+
{
|
|
40
|
+
m_elements.reset(::new Elements);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Element::Content::Content(const Element::Content& rhs)
|
|
44
|
+
{
|
|
45
|
+
this->copy = rhs.copy;
|
|
46
|
+
this->resource = rhs.resource;
|
|
47
|
+
this->dataStructure = rhs.dataStructure;
|
|
48
|
+
m_elements.reset(::new Elements(*rhs.m_elements.get()));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Element::Content& Element::Content::operator=(const Element::Content& rhs)
|
|
52
|
+
{
|
|
53
|
+
this->copy = rhs.copy;
|
|
54
|
+
this->resource = rhs.resource;
|
|
55
|
+
this->dataStructure = rhs.dataStructure;
|
|
56
|
+
m_elements.reset(::new Elements(*rhs.m_elements.get()));
|
|
57
|
+
|
|
58
|
+
return *this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Element::Content::~Content()
|
|
62
|
+
{
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
Element::Element(const Element::Class& element_)
|
|
66
|
+
: element(element_)
|
|
67
|
+
{
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
Element::Element(const Element& rhs)
|
|
71
|
+
{
|
|
72
|
+
this->element = rhs.element;
|
|
73
|
+
this->attributes = rhs.attributes;
|
|
74
|
+
this->content = rhs.content;
|
|
75
|
+
this->category = rhs.category;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
Element& Element::operator=(const Element& rhs)
|
|
79
|
+
{
|
|
80
|
+
this->element = rhs.element;
|
|
81
|
+
this->attributes = rhs.attributes;
|
|
82
|
+
this->content = rhs.content;
|
|
83
|
+
this->category = rhs.category;
|
|
84
|
+
|
|
85
|
+
return *this;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
Element::~Element()
|
|
89
|
+
{
|
|
90
|
+
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#include <utility>
|
|
15
15
|
#include "Platform.h"
|
|
16
16
|
#include "MarkdownNode.h"
|
|
17
|
+
#include "MSON.h"
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* API Blueprint Abstract Syntax Tree
|
|
@@ -53,18 +54,6 @@ namespace snowcrash {
|
|
|
53
54
|
/** A generic key - value pair */
|
|
54
55
|
typedef std::pair<std::string, std::string> KeyValuePair;
|
|
55
56
|
|
|
56
|
-
/**
|
|
57
|
-
* Default Container for collections.
|
|
58
|
-
*
|
|
59
|
-
* FIXME: Use C++11 template aliases when migrating to C++11.
|
|
60
|
-
*/
|
|
61
|
-
template<typename T>
|
|
62
|
-
struct Collection {
|
|
63
|
-
typedef std::vector<T> type;
|
|
64
|
-
typedef typename std::vector<T>::iterator iterator;
|
|
65
|
-
typedef typename std::vector<T>::const_iterator const_iterator;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
57
|
/** An asset data */
|
|
69
58
|
typedef std::string Asset;
|
|
70
59
|
|
|
@@ -82,6 +71,19 @@ namespace snowcrash {
|
|
|
82
71
|
*/
|
|
83
72
|
typedef KeyValuePair Header;
|
|
84
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Default Container for collections.
|
|
76
|
+
*
|
|
77
|
+
* FIXME: Use C++11 template aliases when migrating to C++11.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
template<typename T>
|
|
81
|
+
struct Collection {
|
|
82
|
+
typedef std::vector<T> type;
|
|
83
|
+
typedef typename std::vector<T>::iterator iterator;
|
|
84
|
+
typedef typename std::vector<T>::const_iterator const_iterator;
|
|
85
|
+
};
|
|
86
|
+
|
|
85
87
|
/** Metadata Collection */
|
|
86
88
|
typedef Collection<Metadata>::type MetadataCollection;
|
|
87
89
|
|
|
@@ -91,6 +93,13 @@ namespace snowcrash {
|
|
|
91
93
|
/** Collection of Parameter Values */
|
|
92
94
|
typedef Collection<Value>::type Values;
|
|
93
95
|
|
|
96
|
+
/** Role of an element */
|
|
97
|
+
enum AssetRole {
|
|
98
|
+
UndefinedAssetRole = 0, // Unknown
|
|
99
|
+
BodyExampleAssetRole, // Body example for asset
|
|
100
|
+
BodySchemaAssetRole // Body schema for asset
|
|
101
|
+
};
|
|
102
|
+
|
|
94
103
|
/** Parameter Use flag */
|
|
95
104
|
enum ParameterUse {
|
|
96
105
|
UndefinedParameterUse,
|
|
@@ -123,7 +132,11 @@ namespace snowcrash {
|
|
|
123
132
|
Values values;
|
|
124
133
|
};
|
|
125
134
|
|
|
126
|
-
/**
|
|
135
|
+
/** Parameter with MSON-like syntax */
|
|
136
|
+
struct MSONParameter : public Parameter {
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/** Collection of Parameters */
|
|
127
140
|
typedef Collection<Parameter>::type Parameters;
|
|
128
141
|
|
|
129
142
|
/** Identifier(name) of Reference */
|
|
@@ -141,7 +154,7 @@ namespace snowcrash {
|
|
|
141
154
|
|
|
142
155
|
/** Reference Type */
|
|
143
156
|
enum ReferenceType {
|
|
144
|
-
|
|
157
|
+
ModelReference // Resource Model as a reference
|
|
145
158
|
};
|
|
146
159
|
|
|
147
160
|
/** Identifier */
|
|
@@ -152,6 +165,10 @@ namespace snowcrash {
|
|
|
152
165
|
|
|
153
166
|
struct ReferenceMetadata {
|
|
154
167
|
|
|
168
|
+
/** Constructor */
|
|
169
|
+
ReferenceMetadata(State state_ = StateUnresolved)
|
|
170
|
+
: state(state_) {}
|
|
171
|
+
|
|
155
172
|
/** Markdown AST reference source node (for source map) */
|
|
156
173
|
mdp::MarkdownNodeIterator node;
|
|
157
174
|
|
|
@@ -162,7 +179,21 @@ namespace snowcrash {
|
|
|
162
179
|
/** Metadata for the reference */
|
|
163
180
|
ReferenceMetadata meta;
|
|
164
181
|
};
|
|
165
|
-
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Data Structure
|
|
185
|
+
*/
|
|
186
|
+
struct DataStructure : public mson::NamedType {
|
|
187
|
+
|
|
188
|
+
/** Assignment operator for Named Type */
|
|
189
|
+
DataStructure& operator=(const mson::NamedType& rhs);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Attributes
|
|
194
|
+
*/
|
|
195
|
+
typedef DataStructure Attributes;
|
|
196
|
+
|
|
166
197
|
/**
|
|
167
198
|
* Payload
|
|
168
199
|
*/
|
|
@@ -180,10 +211,13 @@ namespace snowcrash {
|
|
|
180
211
|
/** Payload-specific Headers */
|
|
181
212
|
Headers headers;
|
|
182
213
|
|
|
183
|
-
/**
|
|
214
|
+
/** Payload-specific Attributes (THIS SHOULD NOT BE HERE - should be under content) */
|
|
215
|
+
Attributes attributes;
|
|
216
|
+
|
|
217
|
+
/** Body (THIS SHOULD NOT BE HERE - should be under content) */
|
|
184
218
|
Asset body;
|
|
185
219
|
|
|
186
|
-
/** Schema */
|
|
220
|
+
/** Schema (THIS SHOULD NOT BE HERE - should be under content) */
|
|
187
221
|
Asset schema;
|
|
188
222
|
|
|
189
223
|
/** Reference */
|
|
@@ -231,6 +265,15 @@ namespace snowcrash {
|
|
|
231
265
|
/** Collection of Transaction examples */
|
|
232
266
|
typedef Collection<TransactionExample>::type TransactionExamples;
|
|
233
267
|
|
|
268
|
+
/**
|
|
269
|
+
* Link relation
|
|
270
|
+
*/
|
|
271
|
+
struct Relation {
|
|
272
|
+
|
|
273
|
+
/** String */
|
|
274
|
+
std::string str;
|
|
275
|
+
};
|
|
276
|
+
|
|
234
277
|
/**
|
|
235
278
|
* Action
|
|
236
279
|
*/
|
|
@@ -248,6 +291,15 @@ namespace snowcrash {
|
|
|
248
291
|
/** Action-specific Parameters */
|
|
249
292
|
Parameters parameters;
|
|
250
293
|
|
|
294
|
+
/** Action-specific Attributes (THIS SHOULD NOT BE HERE - should be under content) */
|
|
295
|
+
Attributes attributes;
|
|
296
|
+
|
|
297
|
+
/** URI Template (THIS SHOULD NOT BE HERE - should be under element attributes) */
|
|
298
|
+
URITemplate uriTemplate;
|
|
299
|
+
|
|
300
|
+
/** Link Relation (THIS SHOULD NOT BE HERE - should be under element attributes) */
|
|
301
|
+
Relation relation;
|
|
302
|
+
|
|
251
303
|
/**
|
|
252
304
|
* \brief Action-specific HTTP headers
|
|
253
305
|
*
|
|
@@ -286,6 +338,9 @@ namespace snowcrash {
|
|
|
286
338
|
/** Model representing this Resource */
|
|
287
339
|
ResourceModel model;
|
|
288
340
|
|
|
341
|
+
/** Resource-specific Attributes (THIS SHOULD NOT BE HERE - should be under content) */
|
|
342
|
+
Attributes attributes;
|
|
343
|
+
|
|
289
344
|
/** Parameters */
|
|
290
345
|
Parameters parameters;
|
|
291
346
|
|
|
@@ -310,23 +365,107 @@ namespace snowcrash {
|
|
|
310
365
|
/** Collection of Resources */
|
|
311
366
|
typedef Collection<Resource>::type Resources;
|
|
312
367
|
|
|
313
|
-
/**
|
|
314
|
-
|
|
315
|
-
*/
|
|
316
|
-
struct ResourceGroup {
|
|
368
|
+
/** Forward declaration of Element */
|
|
369
|
+
struct Element;
|
|
317
370
|
|
|
318
|
-
|
|
319
|
-
|
|
371
|
+
/** Collection of elements */
|
|
372
|
+
typedef std::vector<Element> Elements;
|
|
320
373
|
|
|
321
|
-
|
|
322
|
-
|
|
374
|
+
/** Element */
|
|
375
|
+
struct Element {
|
|
376
|
+
|
|
377
|
+
/** Class of an element */
|
|
378
|
+
enum Class {
|
|
379
|
+
UndefinedElement = 0, // Unknown
|
|
380
|
+
CategoryElement, // Group of other elements
|
|
381
|
+
CopyElement, // Human readable text
|
|
382
|
+
AssetElement, // Asset of API description
|
|
383
|
+
ResourceElement, // Resource
|
|
384
|
+
DataStructureElement // Data Structure
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
/** Attributes of an element */
|
|
388
|
+
struct Attributes {
|
|
389
|
+
|
|
390
|
+
/** Human readable name of the element */
|
|
391
|
+
Name name;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/** Content of an element */
|
|
395
|
+
struct Content {
|
|
396
|
+
|
|
397
|
+
/** EITHER Copy */
|
|
398
|
+
std::string copy;
|
|
399
|
+
|
|
400
|
+
/** OR Resource */
|
|
401
|
+
Resource resource;
|
|
402
|
+
|
|
403
|
+
/** OR Data Structure */
|
|
404
|
+
DataStructure dataStructure;
|
|
405
|
+
|
|
406
|
+
/** OR Collection of elements */
|
|
407
|
+
Elements& elements();
|
|
408
|
+
const Elements& elements() const;
|
|
409
|
+
|
|
410
|
+
/** Constructor */
|
|
411
|
+
Content();
|
|
412
|
+
|
|
413
|
+
/** Copy constructor */
|
|
414
|
+
Content(const Element::Content& rhs);
|
|
323
415
|
|
|
324
|
-
|
|
325
|
-
|
|
416
|
+
/** Assignment operator */
|
|
417
|
+
Content& operator=(const Element::Content& rhs);
|
|
418
|
+
|
|
419
|
+
/** Destructor */
|
|
420
|
+
~Content();
|
|
421
|
+
|
|
422
|
+
private:
|
|
423
|
+
std::auto_ptr<Elements> m_elements;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
/** Type of Category element (parser internal flag) */
|
|
427
|
+
enum Category {
|
|
428
|
+
UndefinedCategory = 0, // Unknown
|
|
429
|
+
ResourceGroupCategory, // Resource Group
|
|
430
|
+
DataStructureGroupCategory // Data Structure Group
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
/** Type of the element */
|
|
434
|
+
Element::Class element;
|
|
435
|
+
|
|
436
|
+
/** Attributes of the element */
|
|
437
|
+
Element::Attributes attributes;
|
|
438
|
+
|
|
439
|
+
/** Content of the element */
|
|
440
|
+
Element::Content content;
|
|
441
|
+
|
|
442
|
+
/** Type of Category element (to be used internally only) */
|
|
443
|
+
Element::Category category;
|
|
444
|
+
|
|
445
|
+
/** Constructor */
|
|
446
|
+
Element(const Element::Class& element_ = Element::UndefinedElement);
|
|
447
|
+
|
|
448
|
+
/** Copy constructor */
|
|
449
|
+
Element(const Element& rhs);
|
|
450
|
+
|
|
451
|
+
/** Assignment operator */
|
|
452
|
+
Element& operator=(const Element& rhs);
|
|
453
|
+
|
|
454
|
+
/** Destructor */
|
|
455
|
+
~Element();
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Group of API Resources (Category Element)
|
|
460
|
+
*/
|
|
461
|
+
struct ResourceGroup : public Element {
|
|
326
462
|
};
|
|
327
463
|
|
|
328
|
-
/**
|
|
329
|
-
|
|
464
|
+
/**
|
|
465
|
+
* Group of Data Structures (Category Element)
|
|
466
|
+
*/
|
|
467
|
+
struct DataStructureGroup : public Element {
|
|
468
|
+
};
|
|
330
469
|
|
|
331
470
|
/**
|
|
332
471
|
* \brief API Blueprint AST
|
|
@@ -334,7 +473,7 @@ namespace snowcrash {
|
|
|
334
473
|
* This is top-level (or root if you prefer) of API Blueprint abstract syntax tree.
|
|
335
474
|
* Start reading a parsed API here.
|
|
336
475
|
*/
|
|
337
|
-
struct Blueprint {
|
|
476
|
+
struct Blueprint : public Element {
|
|
338
477
|
|
|
339
478
|
/** Metadata */
|
|
340
479
|
MetadataCollection metadata;
|
|
@@ -344,9 +483,6 @@ namespace snowcrash {
|
|
|
344
483
|
|
|
345
484
|
/** An API Overview description */
|
|
346
485
|
Description description;
|
|
347
|
-
|
|
348
|
-
/** The set of API Resource Groups */
|
|
349
|
-
ResourceGroups resourceGroups;
|
|
350
486
|
};
|
|
351
487
|
}
|
|
352
488
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
#include "ResourceParser.h"
|
|
13
13
|
#include "ResourceGroupParser.h"
|
|
14
|
+
#include "DataStructureGroupParser.h"
|
|
14
15
|
#include "SectionParser.h"
|
|
15
16
|
#include "RegexMatch.h"
|
|
16
17
|
#include "CodeBlockUtility.h"
|
|
@@ -68,7 +69,7 @@ namespace snowcrash {
|
|
|
68
69
|
|
|
69
70
|
SectionType nestedType = nestedSectionType(cur);
|
|
70
71
|
|
|
71
|
-
//
|
|
72
|
+
// Nested Sections only, parse as exclusive nested sections
|
|
72
73
|
if (nestedType != UndefinedSectionType) {
|
|
73
74
|
layout = ExclusiveNestedSectionLayout;
|
|
74
75
|
return cur;
|
|
@@ -94,24 +95,23 @@ namespace snowcrash {
|
|
|
94
95
|
SectionParserData& pd,
|
|
95
96
|
const ParseResultRef<Blueprint>& out) {
|
|
96
97
|
|
|
98
|
+
MarkdownNodeIterator cur = node;
|
|
99
|
+
|
|
97
100
|
if (pd.sectionContext() == ResourceGroupSectionType ||
|
|
98
101
|
pd.sectionContext() == ResourceSectionType) {
|
|
99
102
|
|
|
100
103
|
IntermediateParseResult<ResourceGroup> resourceGroup(out.report);
|
|
104
|
+
cur = ResourceGroupParser::parse(node, siblings, pd, resourceGroup);
|
|
101
105
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
ResourceGroupIterator duplicate = findResourceGroup(out.node.resourceGroups, resourceGroup.node);
|
|
105
|
-
|
|
106
|
-
if (duplicate != out.node.resourceGroups.end()) {
|
|
106
|
+
if (isResourceGroupDuplicate(out.node, resourceGroup.node.attributes.name)) {
|
|
107
107
|
|
|
108
108
|
// WARN: duplicate resource group
|
|
109
109
|
std::stringstream ss;
|
|
110
110
|
|
|
111
|
-
if (resourceGroup.node.name.empty()) {
|
|
111
|
+
if (resourceGroup.node.attributes.name.empty()) {
|
|
112
112
|
ss << "anonymous group";
|
|
113
113
|
} else {
|
|
114
|
-
ss << "group '" << resourceGroup.node.name << "'";
|
|
114
|
+
ss << "group '" << resourceGroup.node.attributes.name << "'";
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
ss << " is already defined";
|
|
@@ -122,16 +122,103 @@ namespace snowcrash {
|
|
|
122
122
|
sourceMap));
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
out.node.
|
|
125
|
+
out.node.content.elements().push_back(resourceGroup.node);
|
|
126
126
|
|
|
127
127
|
if (pd.exportSourceMap()) {
|
|
128
|
-
out.sourceMap.
|
|
128
|
+
out.sourceMap.content.elements().collection.push_back(resourceGroup.sourceMap);
|
|
129
129
|
}
|
|
130
|
+
}
|
|
131
|
+
else if (pd.sectionContext() == DataStructureGroupSectionType) {
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
IntermediateParseResult<DataStructureGroup> dataStructureGroup(out.report);
|
|
134
|
+
cur = DataStructureGroupParser::parse(node, siblings, pd, dataStructureGroup);
|
|
135
|
+
|
|
136
|
+
out.node.content.elements().push_back(dataStructureGroup.node);
|
|
137
|
+
|
|
138
|
+
if (pd.exportSourceMap()) {
|
|
139
|
+
out.sourceMap.content.elements().collection.push_back(dataStructureGroup.sourceMap);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return cur;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Look ahead through all the nested sections and gather list of all
|
|
148
|
+
* named types along with their base types and the types they are sub-typed from
|
|
149
|
+
*/
|
|
150
|
+
static void preprocessNestedSections(const MarkdownNodeIterator& node,
|
|
151
|
+
const MarkdownNodes& siblings,
|
|
152
|
+
SectionParserData& pd,
|
|
153
|
+
const ParseResultRef<Blueprint>& out) {
|
|
154
|
+
|
|
155
|
+
MarkdownNodeIterator cur = node, contextCur;
|
|
156
|
+
SectionType sectionType = UndefinedSectionType;
|
|
157
|
+
SectionType contextSectionType = UndefinedSectionType;
|
|
158
|
+
|
|
159
|
+
// Iterate over nested sections
|
|
160
|
+
while (cur != siblings.end()) {
|
|
161
|
+
|
|
162
|
+
sectionType = SectionKeywordSignature(cur);
|
|
163
|
+
|
|
164
|
+
// Complete Action is recognized as resource section
|
|
165
|
+
if (sectionType == ResourceSectionType) {
|
|
166
|
+
|
|
167
|
+
ActionType actionType = SectionProcessor<Action>::actionType(cur);
|
|
168
|
+
|
|
169
|
+
if (actionType == CompleteActionType) {
|
|
170
|
+
sectionType = ActionSectionType;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (cur->type == mdp::HeaderMarkdownNodeType) {
|
|
175
|
+
|
|
176
|
+
// If the current node is a Resource or DataStructures section, assign it as context
|
|
177
|
+
// Otherwise, make sure the current context is not DataStructures section and remove the context
|
|
178
|
+
if (sectionType == ResourceSectionType ||
|
|
179
|
+
sectionType == DataStructureGroupSectionType) {
|
|
180
|
+
|
|
181
|
+
contextSectionType = sectionType;
|
|
182
|
+
contextCur = cur;
|
|
183
|
+
}
|
|
184
|
+
else if (contextSectionType != DataStructureGroupSectionType) {
|
|
185
|
+
|
|
186
|
+
contextSectionType = UndefinedSectionType;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// If context is DataStructures section, NamedTypes should be filled
|
|
190
|
+
if (contextSectionType == DataStructureGroupSectionType) {
|
|
191
|
+
|
|
192
|
+
if (sectionType != MSONSampleDefaultSectionType &&
|
|
193
|
+
sectionType != MSONPropertyMembersSectionType &&
|
|
194
|
+
sectionType != MSONValueMembersSectionType &&
|
|
195
|
+
sectionType != UndefinedSectionType &&
|
|
196
|
+
sectionType != DataStructureGroupSectionType) {
|
|
197
|
+
|
|
198
|
+
contextSectionType = UndefinedSectionType;
|
|
199
|
+
}
|
|
200
|
+
else if (sectionType == UndefinedSectionType) {
|
|
201
|
+
fillNamedTypeTables(cur, pd, cur->text, out.report);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else if (cur->type == mdp::ListItemMarkdownNodeType &&
|
|
206
|
+
contextSectionType == ResourceSectionType &&
|
|
207
|
+
sectionType == AttributesSectionType) {
|
|
208
|
+
|
|
209
|
+
Resource resource;
|
|
210
|
+
SectionProcessor<Resource>::matchNamedResourceHeader(contextCur, resource);
|
|
211
|
+
|
|
212
|
+
if (!resource.name.empty()) {
|
|
213
|
+
fillNamedTypeTables(cur, pd, cur->children().front().text, out.report, resource.name);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
cur++;
|
|
132
218
|
}
|
|
133
219
|
|
|
134
|
-
|
|
220
|
+
// Resolve all named type base table entries
|
|
221
|
+
resolveNamedTypeTables(pd, out.report);
|
|
135
222
|
}
|
|
136
223
|
|
|
137
224
|
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
|
@@ -157,6 +244,13 @@ namespace snowcrash {
|
|
|
157
244
|
return nestedType;
|
|
158
245
|
}
|
|
159
246
|
|
|
247
|
+
// Check if DataStructures section
|
|
248
|
+
nestedType = SectionProcessor<DataStructureGroup>::sectionType(node);
|
|
249
|
+
|
|
250
|
+
if (nestedType != UndefinedSectionType) {
|
|
251
|
+
return nestedType;
|
|
252
|
+
}
|
|
253
|
+
|
|
160
254
|
return UndefinedSectionType;
|
|
161
255
|
}
|
|
162
256
|
|
|
@@ -165,6 +259,7 @@ namespace snowcrash {
|
|
|
165
259
|
|
|
166
260
|
// Resource Group & descendants
|
|
167
261
|
nested.push_back(ResourceGroupSectionType);
|
|
262
|
+
nested.push_back(DataStructureGroupSectionType);
|
|
168
263
|
SectionTypes types = SectionProcessor<ResourceGroup>::nestedSectionTypes();
|
|
169
264
|
nested.insert(nested.end(), types.begin(), types.end());
|
|
170
265
|
|
|
@@ -174,8 +269,13 @@ namespace snowcrash {
|
|
|
174
269
|
static void finalize(const MarkdownNodeIterator& node,
|
|
175
270
|
SectionParserData& pd,
|
|
176
271
|
const ParseResultRef<Blueprint>& out) {
|
|
177
|
-
|
|
272
|
+
|
|
178
273
|
checkLazyReferencing(pd, out);
|
|
274
|
+
out.node.element = Element::CategoryElement;
|
|
275
|
+
|
|
276
|
+
if (pd.exportSourceMap()) {
|
|
277
|
+
out.sourceMap.element = out.node.element;
|
|
278
|
+
}
|
|
179
279
|
|
|
180
280
|
if (!out.node.name.empty())
|
|
181
281
|
return;
|
|
@@ -204,6 +304,144 @@ namespace snowcrash {
|
|
|
204
304
|
return true;
|
|
205
305
|
}
|
|
206
306
|
|
|
307
|
+
/**
|
|
308
|
+
* \brief Fill named type table entries from the signature information.
|
|
309
|
+
* Both base table and inheritance table.
|
|
310
|
+
*
|
|
311
|
+
* \param node Markdown node to process
|
|
312
|
+
* \param pd Section parser data
|
|
313
|
+
* \param subject Signature of the named type
|
|
314
|
+
* \param report Parse report
|
|
315
|
+
* \param name Name of the named type (only given in case of named resource)
|
|
316
|
+
*/
|
|
317
|
+
static void fillNamedTypeTables(const MarkdownNodeIterator& node,
|
|
318
|
+
SectionParserData& pd,
|
|
319
|
+
const mdp::ByteBuffer& subject,
|
|
320
|
+
Report& report,
|
|
321
|
+
const mdp::ByteBuffer& name = "") {
|
|
322
|
+
|
|
323
|
+
mdp::ByteBuffer buffer = subject;
|
|
324
|
+
mson::Literal identifier;
|
|
325
|
+
mson::TypeDefinition typeDefinition;
|
|
326
|
+
Report tmpReport;
|
|
327
|
+
|
|
328
|
+
SignatureTraits traits(SignatureTraits::IdentifierTrait |
|
|
329
|
+
SignatureTraits::AttributesTrait);
|
|
330
|
+
|
|
331
|
+
Signature signature = SignatureSectionProcessorBase<Blueprint>::parseSignature(node, pd, traits, tmpReport, buffer);
|
|
332
|
+
mson::parseTypeDefinition(node, pd, signature.attributes, tmpReport, typeDefinition);
|
|
333
|
+
|
|
334
|
+
// Name of the named types cannot be variable
|
|
335
|
+
if (!name.empty() && mson::checkVariable(signature.identifier)) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (!name.empty()) {
|
|
340
|
+
identifier = name;
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
identifier = signature.identifier;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// If named type already exists, do nothing
|
|
347
|
+
mson::NamedTypeBaseTable::iterator it = pd.namedTypeBaseTable.find(identifier);
|
|
348
|
+
|
|
349
|
+
if (it != pd.namedTypeBaseTable.end()) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// Otherwise, add the respective entries to the tables
|
|
354
|
+
if (typeDefinition.typeSpecification.name.base != mson::UndefinedTypeName) {
|
|
355
|
+
pd.namedTypeBaseTable[identifier] = mson::parseBaseType(typeDefinition.typeSpecification.name.base);
|
|
356
|
+
}
|
|
357
|
+
else if (!typeDefinition.typeSpecification.name.symbol.literal.empty() &&
|
|
358
|
+
!typeDefinition.typeSpecification.name.symbol.variable) {
|
|
359
|
+
|
|
360
|
+
pd.namedTypeInheritanceTable[identifier] = typeDefinition.typeSpecification.name.symbol.literal;
|
|
361
|
+
}
|
|
362
|
+
else if (typeDefinition.typeSpecification.name.empty()) {
|
|
363
|
+
|
|
364
|
+
// If there is no specification, an object is assumed
|
|
365
|
+
pd.namedTypeBaseTable[identifier] = mson::ImplicitObjectBaseType;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* \brief Resolve named type base table entries from the named type inheritance table
|
|
371
|
+
*
|
|
372
|
+
* \param pd Section parser data
|
|
373
|
+
* \param report Parse report
|
|
374
|
+
*/
|
|
375
|
+
static void resolveNamedTypeTables(SectionParserData& pd,
|
|
376
|
+
Report& report) {
|
|
377
|
+
|
|
378
|
+
mson::NamedTypeInheritanceTable::iterator it;
|
|
379
|
+
mson::NamedTypeBaseTable::iterator baseIt;
|
|
380
|
+
|
|
381
|
+
for (it = pd.namedTypeInheritanceTable.begin();
|
|
382
|
+
it != pd.namedTypeInheritanceTable.end();
|
|
383
|
+
it++) {
|
|
384
|
+
|
|
385
|
+
resolveNamedTypeTableEntry(pd, it->first, it->second, report);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* \brief For each entry in the named type inheritance table, resolve the sub-type's base type recursively
|
|
391
|
+
*
|
|
392
|
+
* \param pd Section parser data
|
|
393
|
+
* \param subType The sub named type between the two
|
|
394
|
+
* \param superType The super named type between the two
|
|
395
|
+
* \param report Parse report
|
|
396
|
+
*/
|
|
397
|
+
static void resolveNamedTypeTableEntry(SectionParserData& pd,
|
|
398
|
+
const mson::Literal& subType,
|
|
399
|
+
const mson::Literal& superType,
|
|
400
|
+
Report& report) {
|
|
401
|
+
|
|
402
|
+
mson::BaseType baseType;
|
|
403
|
+
mson::NamedTypeBaseTable::iterator it = pd.namedTypeBaseTable.find(subType);
|
|
404
|
+
|
|
405
|
+
// If the base table entry is already filled, nothing else to do
|
|
406
|
+
if (it != pd.namedTypeBaseTable.end()) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// Otherwise, get the base type from super type
|
|
411
|
+
it = pd.namedTypeBaseTable.find(superType);
|
|
412
|
+
|
|
413
|
+
// If super type is not already resolved, then it means that it is a sub type of something else
|
|
414
|
+
if (it == pd.namedTypeBaseTable.end()) {
|
|
415
|
+
|
|
416
|
+
// Try to get the super type of the current super type
|
|
417
|
+
mson::NamedTypeInheritanceTable::iterator inhIt = pd.namedTypeInheritanceTable.find(superType);
|
|
418
|
+
|
|
419
|
+
if (inhIt == pd.namedTypeInheritanceTable.end()) {
|
|
420
|
+
|
|
421
|
+
// We cannot find the super type in inheritance table at all
|
|
422
|
+
// and there is not base type table entry for it, so, the blueprint is wrong
|
|
423
|
+
std::stringstream ss;
|
|
424
|
+
ss << "unable to find named type '" << superType << "' in the whole document";
|
|
425
|
+
|
|
426
|
+
report.error = Error(ss.str(), BusinessError, mdp::CharactersRangeSet());
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Recursively, try to get a base type for the current super type
|
|
431
|
+
resolveNamedTypeTableEntry(pd, superType, inhIt->second, report);
|
|
432
|
+
|
|
433
|
+
if (report.error.code != Error::OK) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
baseType = pd.namedTypeBaseTable.find(superType)->second;
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
baseType = it->second;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
pd.namedTypeBaseTable[subType] = baseType;
|
|
444
|
+
}
|
|
207
445
|
|
|
208
446
|
static void parseMetadata(const MarkdownNodeIterator& node,
|
|
209
447
|
SectionParserData& pd,
|
|
@@ -274,13 +512,28 @@ namespace snowcrash {
|
|
|
274
512
|
}
|
|
275
513
|
}
|
|
276
514
|
|
|
277
|
-
/**
|
|
278
|
-
|
|
279
|
-
|
|
515
|
+
/**
|
|
516
|
+
* \brief Check if a resource group already exists with the given name
|
|
517
|
+
*
|
|
518
|
+
* \param blueprint The blueprint which is formed until now
|
|
519
|
+
* \param name The resource group name to be checked
|
|
520
|
+
*/
|
|
521
|
+
static bool isResourceGroupDuplicate(const Blueprint& blueprint,
|
|
522
|
+
mdp::ByteBuffer& name) {
|
|
523
|
+
|
|
524
|
+
for (Elements::const_iterator it = blueprint.content.elements().begin();
|
|
525
|
+
it != blueprint.content.elements().end();
|
|
526
|
+
++it) {
|
|
527
|
+
|
|
528
|
+
if (it->element == Element::CategoryElement &&
|
|
529
|
+
it->category == Element::ResourceGroupCategory &&
|
|
530
|
+
it->attributes.name == name) {
|
|
531
|
+
|
|
532
|
+
return true;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
280
535
|
|
|
281
|
-
return
|
|
282
|
-
resourceGroups.end(),
|
|
283
|
-
std::bind2nd(MatchName<ResourceGroup>(), resourceGroup));
|
|
536
|
+
return false;
|
|
284
537
|
}
|
|
285
538
|
|
|
286
539
|
/**
|
|
@@ -291,58 +544,62 @@ namespace snowcrash {
|
|
|
291
544
|
static void checkLazyReferencing(SectionParserData& pd,
|
|
292
545
|
const ParseResultRef<Blueprint>& out) {
|
|
293
546
|
|
|
294
|
-
Collection<SourceMap<
|
|
547
|
+
Collection<SourceMap<Element> >::iterator elementSourceMapIt;
|
|
295
548
|
|
|
296
549
|
if (pd.exportSourceMap()) {
|
|
297
|
-
|
|
550
|
+
elementSourceMapIt = out.sourceMap.content.elements().collection.begin();
|
|
298
551
|
}
|
|
299
552
|
|
|
300
|
-
for (
|
|
301
|
-
|
|
302
|
-
++
|
|
553
|
+
for (Elements::iterator elementIt = out.node.content.elements().begin();
|
|
554
|
+
elementIt != out.node.content.elements().end();
|
|
555
|
+
++elementIt) {
|
|
303
556
|
|
|
304
|
-
|
|
557
|
+
if (elementIt->element == Element::CategoryElement) {
|
|
558
|
+
checkResourceLazyReferencing(*elementIt, *elementSourceMapIt, pd, out);
|
|
559
|
+
}
|
|
305
560
|
|
|
306
561
|
if (pd.exportSourceMap()) {
|
|
307
|
-
|
|
562
|
+
elementSourceMapIt++;
|
|
308
563
|
}
|
|
309
564
|
}
|
|
310
565
|
}
|
|
311
566
|
|
|
312
567
|
/** Traverses Resource Collection to resolve references with `Pending` state (Lazy referencing) */
|
|
313
|
-
static void checkResourceLazyReferencing(
|
|
314
|
-
|
|
568
|
+
static void checkResourceLazyReferencing(Element& element,
|
|
569
|
+
SourceMap<Element>& elementSourceMap,
|
|
315
570
|
SectionParserData& pd,
|
|
316
571
|
const ParseResultRef<Blueprint>& out) {
|
|
317
572
|
|
|
318
|
-
Collection<SourceMap<
|
|
573
|
+
Collection<SourceMap<Element> >::iterator resourceElementSourceMapIt;
|
|
319
574
|
|
|
320
575
|
if (pd.exportSourceMap()) {
|
|
321
|
-
|
|
576
|
+
resourceElementSourceMapIt = elementSourceMap.content.elements().collection.begin();
|
|
322
577
|
}
|
|
323
578
|
|
|
324
|
-
for (
|
|
325
|
-
|
|
326
|
-
++
|
|
579
|
+
for (Elements::iterator resourceElementIt = element.content.elements().begin();
|
|
580
|
+
resourceElementIt != element.content.elements().end();
|
|
581
|
+
++resourceElementIt) {
|
|
327
582
|
|
|
328
|
-
|
|
583
|
+
if (resourceElementIt->element == Element::ResourceElement) {
|
|
584
|
+
checkActionLazyReferencing(resourceElementIt->content.resource, resourceElementSourceMapIt->content.resource, pd, out);
|
|
585
|
+
}
|
|
329
586
|
|
|
330
587
|
if (pd.exportSourceMap()) {
|
|
331
|
-
|
|
588
|
+
resourceElementSourceMapIt++;
|
|
332
589
|
}
|
|
333
590
|
}
|
|
334
591
|
}
|
|
335
592
|
|
|
336
593
|
/** Traverses Action Collection to resolve references with `Pending` state (Lazy referencing) */
|
|
337
594
|
static void checkActionLazyReferencing(Resource& resource,
|
|
338
|
-
|
|
595
|
+
SourceMap<Resource>& resourceSourceMap,
|
|
339
596
|
SectionParserData& pd,
|
|
340
597
|
const ParseResultRef<Blueprint>& out) {
|
|
341
598
|
|
|
342
599
|
Collection<SourceMap<Action> >::iterator actionSourceMapIt;
|
|
343
600
|
|
|
344
601
|
if (pd.exportSourceMap()) {
|
|
345
|
-
actionSourceMapIt =
|
|
602
|
+
actionSourceMapIt = resourceSourceMap.actions.collection.begin();
|
|
346
603
|
}
|
|
347
604
|
|
|
348
605
|
for (Actions::iterator actionIt = resource.actions.begin();
|
|
@@ -404,14 +661,14 @@ namespace snowcrash {
|
|
|
404
661
|
if (pd.exportSourceMap()) {
|
|
405
662
|
|
|
406
663
|
ParseResultRef<Payload> payload(out.report, *requestIt, *requestSourceMapIt);
|
|
407
|
-
|
|
664
|
+
resolvePendingModels(pd, payload);
|
|
408
665
|
SectionProcessor<Payload>::checkRequest(requestIt->reference.meta.node, pd, payload);
|
|
409
666
|
}
|
|
410
667
|
else {
|
|
411
668
|
|
|
412
669
|
SourceMap<Payload> tempSourceMap;
|
|
413
670
|
ParseResultRef<Payload> payload(out.report, *requestIt, tempSourceMap);
|
|
414
|
-
|
|
671
|
+
resolvePendingModels(pd, payload);
|
|
415
672
|
SectionProcessor<Payload>::checkRequest(requestIt->reference.meta.node, pd, payload);
|
|
416
673
|
}
|
|
417
674
|
}
|
|
@@ -444,14 +701,14 @@ namespace snowcrash {
|
|
|
444
701
|
if (pd.exportSourceMap()) {
|
|
445
702
|
|
|
446
703
|
ParseResultRef<Payload> payload(out.report, *responseIt, *responseSourceMapIt);
|
|
447
|
-
|
|
704
|
+
resolvePendingModels(pd, payload);
|
|
448
705
|
SectionProcessor<Payload>::checkResponse(responseIt->reference.meta.node, pd, payload);
|
|
449
706
|
}
|
|
450
707
|
else {
|
|
451
708
|
|
|
452
709
|
SourceMap<Payload> tempSourceMap;
|
|
453
710
|
ParseResultRef<Payload> payload(out.report, *responseIt, tempSourceMap);
|
|
454
|
-
|
|
711
|
+
resolvePendingModels(pd, payload);
|
|
455
712
|
SectionProcessor<Payload>::checkResponse(responseIt->reference.meta.node, pd, payload);
|
|
456
713
|
}
|
|
457
714
|
}
|
|
@@ -463,21 +720,21 @@ namespace snowcrash {
|
|
|
463
720
|
}
|
|
464
721
|
|
|
465
722
|
/**
|
|
466
|
-
* \brief Resolve pending references
|
|
467
|
-
* \param pd Section parser
|
|
723
|
+
* \brief Resolve pending model references
|
|
724
|
+
* \param pd Section parser data
|
|
468
725
|
* \param out Processed output
|
|
469
726
|
*/
|
|
470
|
-
static void
|
|
727
|
+
static void resolvePendingModels(SectionParserData& pd,
|
|
471
728
|
const ParseResultRef<Payload>& out) {
|
|
472
729
|
|
|
473
|
-
if (pd.
|
|
730
|
+
if (pd.modelTable.find(out.node.reference.id) == pd.modelTable.end()) {
|
|
474
731
|
|
|
475
|
-
// ERR: Undefined
|
|
732
|
+
// ERR: Undefined model reference
|
|
476
733
|
std::stringstream ss;
|
|
477
|
-
ss << "Undefined
|
|
734
|
+
ss << "Undefined resource model " << out.node.reference.id;
|
|
478
735
|
|
|
479
736
|
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(out.node.reference.meta.node->sourceMap, pd.sourceData);
|
|
480
|
-
out.report.error = Error(ss.str(),
|
|
737
|
+
out.report.error = Error(ss.str(), ModelError, sourceMap);
|
|
481
738
|
|
|
482
739
|
out.node.reference.meta.state = Reference::StateUnresolved;
|
|
483
740
|
}
|