redsnow 0.3.7 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,81 @@
|
|
1
|
+
//
|
2
|
+
// BlueprintSourcemap.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 "BlueprintSourcemap.h"
|
10
|
+
|
11
|
+
using namespace snowcrash;
|
12
|
+
|
13
|
+
SourceMap<Elements>& SourceMap<Element>::Content::elements()
|
14
|
+
{
|
15
|
+
if (!m_elements.get())
|
16
|
+
throw ELEMENTS_NOT_SET_ERR;
|
17
|
+
|
18
|
+
return *m_elements;
|
19
|
+
}
|
20
|
+
|
21
|
+
const SourceMap<Elements>& SourceMap<Element>::Content::elements() const
|
22
|
+
{
|
23
|
+
if (!m_elements.get())
|
24
|
+
throw ELEMENTS_NOT_SET_ERR;
|
25
|
+
|
26
|
+
return *m_elements;
|
27
|
+
}
|
28
|
+
|
29
|
+
SourceMap<Element>::Content::Content()
|
30
|
+
{
|
31
|
+
m_elements.reset(::new SourceMap<Elements>);
|
32
|
+
}
|
33
|
+
|
34
|
+
SourceMap<Element>::Content::Content(const SourceMap<Element>::Content& rhs)
|
35
|
+
{
|
36
|
+
this->copy = rhs.copy;
|
37
|
+
this->resource = rhs.resource;
|
38
|
+
this->dataStructure = rhs.dataStructure;
|
39
|
+
m_elements.reset(::new SourceMap<Elements>(*rhs.m_elements.get()));
|
40
|
+
}
|
41
|
+
|
42
|
+
SourceMap<Element>::Content& SourceMap<Element>::Content::operator=(const SourceMap<Element>::Content& rhs)
|
43
|
+
{
|
44
|
+
this->copy = rhs.copy;
|
45
|
+
this->resource = rhs.resource;
|
46
|
+
this->dataStructure = rhs.dataStructure;
|
47
|
+
m_elements.reset(::new SourceMap<Elements>(*rhs.m_elements.get()));
|
48
|
+
|
49
|
+
return *this;
|
50
|
+
}
|
51
|
+
|
52
|
+
SourceMap<Element>::Content::~Content()
|
53
|
+
{
|
54
|
+
}
|
55
|
+
|
56
|
+
SourceMap<Element>::SourceMap(const Element::Class& element_)
|
57
|
+
: element(element_)
|
58
|
+
{
|
59
|
+
}
|
60
|
+
|
61
|
+
SourceMap<Element>::SourceMap(const SourceMap<Element>& rhs)
|
62
|
+
{
|
63
|
+
this->element = rhs.element;
|
64
|
+
this->attributes = rhs.attributes;
|
65
|
+
this->content = rhs.content;
|
66
|
+
this->category = rhs.category;
|
67
|
+
}
|
68
|
+
|
69
|
+
SourceMap<Element>& SourceMap<Element>::operator=(const SourceMap<Element>& rhs)
|
70
|
+
{
|
71
|
+
this->element = rhs.element;
|
72
|
+
this->attributes = rhs.attributes;
|
73
|
+
this->content = rhs.content;
|
74
|
+
this->category = rhs.category;
|
75
|
+
|
76
|
+
return *this;
|
77
|
+
}
|
78
|
+
|
79
|
+
SourceMap<Element>::~SourceMap()
|
80
|
+
{
|
81
|
+
}
|
@@ -10,8 +10,7 @@
|
|
10
10
|
#define SNOWCRASH_BLUEPRINT_SOURCEMAP_H
|
11
11
|
|
12
12
|
#include "Blueprint.h"
|
13
|
-
#include "
|
14
|
-
|
13
|
+
#include "MSONSourcemap.h"
|
15
14
|
/**
|
16
15
|
* API Blueprint Sourcemap Abstract Syntax Tree
|
17
16
|
* ---------------------------------------------
|
@@ -19,21 +18,8 @@
|
|
19
18
|
* Data types in this documents define the API Blueprint Sourcemap AST.
|
20
19
|
*/
|
21
20
|
|
22
|
-
#define SOURCE_MAP_COLLECTION(T, TC) template<>\
|
23
|
-
struct SourceMap<TC> {\
|
24
|
-
Collection<SourceMap<T> >::type collection;\
|
25
|
-
};\
|
26
|
-
|
27
21
|
namespace snowcrash {
|
28
22
|
|
29
|
-
struct SourceMapBase {
|
30
|
-
mdp::BytesRangeSet sourceMap;
|
31
|
-
};
|
32
|
-
|
33
|
-
template<typename T>
|
34
|
-
struct SourceMap : public SourceMapBase {
|
35
|
-
};
|
36
|
-
|
37
23
|
/** Source Map of Metadata Collection */
|
38
24
|
SOURCE_MAP_COLLECTION(Metadata, MetadataCollection)
|
39
25
|
|
@@ -43,7 +29,9 @@ namespace snowcrash {
|
|
43
29
|
/** Source Map of Collection of Parameter values */
|
44
30
|
SOURCE_MAP_COLLECTION(Value, Values)
|
45
31
|
|
46
|
-
/**
|
32
|
+
/**
|
33
|
+
* Source Map Structure for Parameter
|
34
|
+
*/
|
47
35
|
template<>
|
48
36
|
struct SourceMap<Parameter> : public SourceMapBase {
|
49
37
|
|
@@ -69,9 +57,26 @@ namespace snowcrash {
|
|
69
57
|
SourceMap<Values> values;
|
70
58
|
};
|
71
59
|
|
60
|
+
/**
|
61
|
+
* Source Map Structure for MSON Parameter
|
62
|
+
*/
|
63
|
+
template<>
|
64
|
+
struct SourceMap<MSONParameter> : public SourceMap<Parameter> {
|
65
|
+
};
|
66
|
+
|
72
67
|
/** Source Map of Collection of Parameters */
|
73
68
|
SOURCE_MAP_COLLECTION(Parameter, Parameters)
|
74
69
|
|
70
|
+
/**
|
71
|
+
* Source Map Structure for DataStructure
|
72
|
+
*/
|
73
|
+
template<>
|
74
|
+
struct SourceMap<DataStructure> : public SourceMap<mson::NamedType> {
|
75
|
+
};
|
76
|
+
|
77
|
+
/** Source Map Structure for Attributes */
|
78
|
+
// 'Attributes' is the same as 'DataStructure'
|
79
|
+
|
75
80
|
/**
|
76
81
|
* Source Map Structure for Payload
|
77
82
|
*/
|
@@ -84,19 +89,22 @@ namespace snowcrash {
|
|
84
89
|
/** Source Map of Payload Description */
|
85
90
|
SourceMap<Description> description;
|
86
91
|
|
87
|
-
/** Payload-specific Parameters */
|
92
|
+
/** Source Map of Payload-specific Parameters */
|
88
93
|
SourceMap<Parameters> parameters;
|
89
94
|
|
90
|
-
/** Payload-specific Headers */
|
95
|
+
/** Source Map of Payload-specific Headers */
|
91
96
|
SourceMap<Headers> headers;
|
92
97
|
|
93
|
-
/** Source Map of
|
98
|
+
/** Source Map of Payload-specific Attributes (THIS SHOULD NOT BE HERE - should be under content) */
|
99
|
+
SourceMap<Attributes> attributes;
|
100
|
+
|
101
|
+
/** Source Map of Body (THIS SHOULD NOT BE HERE - should be under content) */
|
94
102
|
SourceMap<Asset> body;
|
95
103
|
|
96
|
-
/** Source Map of Schema */
|
104
|
+
/** Source Map of Schema (THIS SHOULD NOT BE HERE - should be under content) */
|
97
105
|
SourceMap<Asset> schema;
|
98
106
|
|
99
|
-
/** Source Map of
|
107
|
+
/** Source Map of Model Reference */
|
100
108
|
SourceMap<Reference> reference;
|
101
109
|
};
|
102
110
|
|
@@ -146,6 +154,15 @@ namespace snowcrash {
|
|
146
154
|
/** Action-specific Parameters */
|
147
155
|
SourceMap<Parameters> parameters;
|
148
156
|
|
157
|
+
/** Action-specific Attributes (THIS SHOULD NOT BE HERE - should be under content) */
|
158
|
+
SourceMap<Attributes> attributes;
|
159
|
+
|
160
|
+
/** Source Map of URI Template (THIS SHOULD NOT BE HERE - should be under element attributes) */
|
161
|
+
SourceMap<URITemplate> uriTemplate;
|
162
|
+
|
163
|
+
/** Source Map of Link Relation (THIS SHOULD NOT BE HERE - should be under element attributes) */
|
164
|
+
SourceMap<Relation> relation;
|
165
|
+
|
149
166
|
/**
|
150
167
|
* \brief Action-specific HTTP headers
|
151
168
|
*
|
@@ -171,7 +188,7 @@ namespace snowcrash {
|
|
171
188
|
* Source Map Structure for API Resource
|
172
189
|
*/
|
173
190
|
template<>
|
174
|
-
struct SourceMap<Resource>
|
191
|
+
struct SourceMap<Resource> {
|
175
192
|
|
176
193
|
/** Source Map of URI template */
|
177
194
|
SourceMap<URITemplate> uriTemplate;
|
@@ -185,6 +202,9 @@ namespace snowcrash {
|
|
185
202
|
/** Model representing this Resource */
|
186
203
|
SourceMap<ResourceModel> model;
|
187
204
|
|
205
|
+
/** Source Map of Resource-specific Attributes (THIS SHOULD NOT BE HERE - should be under content) */
|
206
|
+
SourceMap<Attributes> attributes;
|
207
|
+
|
188
208
|
/** Parameters */
|
189
209
|
SourceMap<Parameters> parameters;
|
190
210
|
|
@@ -209,24 +229,96 @@ namespace snowcrash {
|
|
209
229
|
/** Source Map of Collection of Resources */
|
210
230
|
SOURCE_MAP_COLLECTION(Resource, Resources)
|
211
231
|
|
232
|
+
/** Forward Declaration for Source Map of Element */
|
233
|
+
template<>
|
234
|
+
struct SourceMap<Element>;
|
235
|
+
|
236
|
+
/** Source Map of Collection of Elements */
|
237
|
+
SOURCE_MAP_COLLECTION(Element, Elements)
|
238
|
+
|
212
239
|
/**
|
213
|
-
*
|
240
|
+
* Source Map Structure for Element
|
214
241
|
*/
|
215
242
|
template<>
|
216
|
-
struct SourceMap<
|
243
|
+
struct SourceMap<Element> : public SourceMapBase {
|
217
244
|
|
218
|
-
/** Source Map of
|
219
|
-
|
245
|
+
/** Source Map Structure for Attributes of the Element */
|
246
|
+
struct Attributes {
|
220
247
|
|
221
|
-
|
222
|
-
|
248
|
+
/** Source Map of a Element Name */
|
249
|
+
SourceMap<Name> name;
|
250
|
+
};
|
251
|
+
|
252
|
+
/** Source Map Structure for Content of the Element */
|
253
|
+
struct Content {
|
254
|
+
|
255
|
+
/** EITHER Source Map of Copy */
|
256
|
+
SourceMap<std::string> copy;
|
223
257
|
|
224
|
-
|
225
|
-
|
258
|
+
/** OR Source Map of Resource */
|
259
|
+
SourceMap<Resource> resource;
|
260
|
+
|
261
|
+
/** OR Source Map of Data Structure */
|
262
|
+
SourceMap<DataStructure> dataStructure;
|
263
|
+
|
264
|
+
/** OR Source Map of Collection of elements */
|
265
|
+
SourceMap<Elements>& elements();
|
266
|
+
const SourceMap<Elements>& elements() const;
|
267
|
+
|
268
|
+
/** Constructor */
|
269
|
+
Content();
|
270
|
+
|
271
|
+
/** Copy constructor */
|
272
|
+
Content(const SourceMap<Element>::Content& rhs);
|
273
|
+
|
274
|
+
/** Assignment operator */
|
275
|
+
SourceMap<Element>::Content& operator=(const SourceMap<Element>::Content& rhs);
|
276
|
+
|
277
|
+
/** Destructor */
|
278
|
+
~Content();
|
279
|
+
|
280
|
+
private:
|
281
|
+
std::auto_ptr<SourceMap<Elements> > m_elements;
|
282
|
+
};
|
283
|
+
|
284
|
+
/** Class of the Element (to be used internally only) */
|
285
|
+
Element::Class element;
|
286
|
+
|
287
|
+
/** Source Map of Attributes of the Element */
|
288
|
+
Attributes attributes;
|
289
|
+
|
290
|
+
/** Source Map of Content of the Element */
|
291
|
+
Content content;
|
292
|
+
|
293
|
+
/** Type of the Category element (to be used internally only) */
|
294
|
+
Element::Category category;
|
295
|
+
|
296
|
+
/** Constructor */
|
297
|
+
SourceMap(const Element::Class& element_ = Element::UndefinedElement);
|
298
|
+
|
299
|
+
/** Copy constructor */
|
300
|
+
SourceMap(const SourceMap<Element>& rhs);
|
301
|
+
|
302
|
+
/** Assignment operator */
|
303
|
+
SourceMap<Element>& operator=(const SourceMap<Element>& rhs);
|
304
|
+
|
305
|
+
/** Destructor */
|
306
|
+
~SourceMap();
|
307
|
+
};
|
308
|
+
|
309
|
+
/**
|
310
|
+
* Source Map Structure for Group of API Resources (Category Element)
|
311
|
+
*/
|
312
|
+
template<>
|
313
|
+
struct SourceMap<ResourceGroup> : public SourceMap<Element> {
|
226
314
|
};
|
227
315
|
|
228
|
-
/**
|
229
|
-
|
316
|
+
/**
|
317
|
+
* Source Map Structure for Group of Data Structures (Category Element)
|
318
|
+
*/
|
319
|
+
template<>
|
320
|
+
struct SourceMap<DataStructureGroup> : public SourceMap<Element> {
|
321
|
+
};
|
230
322
|
|
231
323
|
/**
|
232
324
|
* \brief API Blueprint Sourcemap AST
|
@@ -235,20 +327,19 @@ namespace snowcrash {
|
|
235
327
|
* Start reading a parsed API here.
|
236
328
|
*/
|
237
329
|
template<>
|
238
|
-
struct SourceMap<Blueprint> : public
|
239
|
-
|
240
|
-
/** Source Map of API Blueprint metadata */
|
241
|
-
SourceMap<MetadataCollection> metadata;
|
330
|
+
struct SourceMap<Blueprint> : public SourceMap<Element> {
|
242
331
|
|
243
332
|
/** Source Map of the API Name */
|
244
333
|
SourceMap<Name> name;
|
245
334
|
|
335
|
+
/** Source Map of API Blueprint metadata */
|
336
|
+
SourceMap<MetadataCollection> metadata;
|
337
|
+
|
246
338
|
/** Source Map of an API Overview description */
|
247
339
|
SourceMap<Description> description;
|
248
|
-
|
249
|
-
/** The set of API Resource Groups */
|
250
|
-
SourceMap<ResourceGroups> resourceGroups;
|
251
340
|
};
|
252
341
|
}
|
253
342
|
|
343
|
+
#undef SOURCE_MAP_COLLECTION
|
344
|
+
|
254
345
|
#endif
|
@@ -94,10 +94,16 @@ namespace snowcrash {
|
|
94
94
|
};
|
95
95
|
|
96
96
|
/** Action matching predicate. */
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
struct MatchAction : std::binary_function<Action, Action, bool> {
|
98
|
+
bool operator()(const first_argument_type& first, const second_argument_type& second) const {
|
99
|
+
return first.uriTemplate == second.uriTemplate && first.method == second.method;
|
100
|
+
}
|
101
|
+
};
|
102
|
+
|
103
|
+
/** Relation matching predicate. */
|
104
|
+
struct MatchRelation : std::binary_function<Action, Relation, bool> {
|
105
|
+
bool operator()(const first_argument_type& first, const second_argument_type& second) const {
|
106
|
+
return !first.relation.str.empty() && !second.str.empty() && first.relation.str == second.str;
|
101
107
|
}
|
102
108
|
};
|
103
109
|
}
|
@@ -0,0 +1,154 @@
|
|
1
|
+
//
|
2
|
+
// DataStructureGroupParser.h
|
3
|
+
// snowcrash
|
4
|
+
//
|
5
|
+
// Created by Pavan Kumar Sunkara on 02/12/14.
|
6
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef SNOWCRASH_DATASTRUCTUREGROUPPARSER_H
|
10
|
+
#define SNOWCRASH_DATASTRUCTUREGROUPPARSER_H
|
11
|
+
|
12
|
+
#include "MSONNamedTypeParser.h"
|
13
|
+
|
14
|
+
using namespace scpl;
|
15
|
+
|
16
|
+
namespace snowcrash {
|
17
|
+
|
18
|
+
/** Data structure group matching regex */
|
19
|
+
const char* const DataStructureGroupRegex = "^[[:blank:]]*[Dd]ata[[:blank:]]+[Ss]tructures?[[:blank:]]*$";
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Data structure group section processor
|
23
|
+
*/
|
24
|
+
template<>
|
25
|
+
struct SectionProcessor<DataStructureGroup> : public SectionProcessorBase<DataStructureGroup> {
|
26
|
+
|
27
|
+
NO_SECTION_DESCRIPTION(DataStructureGroup)
|
28
|
+
|
29
|
+
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
|
30
|
+
const MarkdownNodes& siblings,
|
31
|
+
SectionParserData& pd,
|
32
|
+
const ParseResultRef<DataStructureGroup>& out) {
|
33
|
+
|
34
|
+
MarkdownNodeIterator cur = node;
|
35
|
+
|
36
|
+
if (pd.sectionContext() == MSONNamedTypeSectionType) {
|
37
|
+
|
38
|
+
IntermediateParseResult<mson::NamedType> namedType(out.report);
|
39
|
+
cur = MSONNamedTypeParser::parse(node, siblings, pd, namedType);
|
40
|
+
|
41
|
+
if (isNamedTypeDuplicate(pd.blueprint, namedType.node.name.symbol.literal)) {
|
42
|
+
|
43
|
+
// WARN: duplicate named type
|
44
|
+
std::stringstream ss;
|
45
|
+
ss << "named type with name '" << namedType.node.name.symbol.literal << "' already exists";
|
46
|
+
|
47
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
48
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
49
|
+
DuplicateWarning,
|
50
|
+
sourceMap));
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
|
54
|
+
Element element(Element::DataStructureElement);
|
55
|
+
element.content.dataStructure = namedType.node;
|
56
|
+
|
57
|
+
out.node.content.elements().push_back(element);
|
58
|
+
|
59
|
+
if (pd.exportSourceMap()) {
|
60
|
+
|
61
|
+
SourceMap<Element> elementSM(Element::DataStructureElement);
|
62
|
+
|
63
|
+
elementSM.content.dataStructure.name = namedType.sourceMap.name;
|
64
|
+
elementSM.content.dataStructure.typeDefinition = namedType.sourceMap.typeDefinition;
|
65
|
+
elementSM.content.dataStructure.sections = namedType.sourceMap.sections;
|
66
|
+
|
67
|
+
out.sourceMap.content.elements().collection.push_back(elementSM);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
return cur;
|
73
|
+
}
|
74
|
+
|
75
|
+
static void finalize(const MarkdownNodeIterator& node,
|
76
|
+
SectionParserData& pd,
|
77
|
+
const ParseResultRef<DataStructureGroup>& out) {
|
78
|
+
|
79
|
+
out.node.element = Element::CategoryElement;
|
80
|
+
out.node.category = Element::DataStructureGroupCategory;
|
81
|
+
|
82
|
+
if (pd.exportSourceMap()) {
|
83
|
+
|
84
|
+
out.sourceMap.element = out.node.element;
|
85
|
+
out.sourceMap.category = out.node.category;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
90
|
+
|
91
|
+
if (node->type == mdp::HeaderMarkdownNodeType &&
|
92
|
+
!node->text.empty()) {
|
93
|
+
|
94
|
+
mdp::ByteBuffer remaining, subject = node->text;
|
95
|
+
|
96
|
+
subject = GetFirstLine(subject, remaining);
|
97
|
+
TrimString(subject);
|
98
|
+
|
99
|
+
if (RegexMatch(subject, DataStructureGroupRegex)) {
|
100
|
+
return DataStructureGroupSectionType;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
return UndefinedSectionType;
|
105
|
+
}
|
106
|
+
|
107
|
+
static SectionType nestedSectionType(const MarkdownNodeIterator& node) {
|
108
|
+
|
109
|
+
return SectionProcessor<mson::NamedType>::sectionType(node);
|
110
|
+
}
|
111
|
+
|
112
|
+
/**
|
113
|
+
* \brief Check if a named type already exists with the given name
|
114
|
+
*
|
115
|
+
* \param blueprint The blueprint which is formed until now
|
116
|
+
* \param name The named type name to be checked
|
117
|
+
*/
|
118
|
+
static bool isNamedTypeDuplicate(const Blueprint& blueprint,
|
119
|
+
mdp::ByteBuffer& name) {
|
120
|
+
|
121
|
+
for (Elements::const_iterator it = blueprint.content.elements().begin();
|
122
|
+
it != blueprint.content.elements().end();
|
123
|
+
++it) {
|
124
|
+
|
125
|
+
if (it->element == Element::CategoryElement) {
|
126
|
+
|
127
|
+
for (Elements::const_iterator subIt = it->content.elements().begin();
|
128
|
+
subIt != it->content.elements().end();
|
129
|
+
++subIt) {
|
130
|
+
|
131
|
+
if (subIt->element == Element::ResourceElement &&
|
132
|
+
subIt->content.resource.attributes.name.symbol.literal == name) {
|
133
|
+
|
134
|
+
return true;
|
135
|
+
}
|
136
|
+
|
137
|
+
if (subIt->element == Element::DataStructureElement &&
|
138
|
+
subIt->content.dataStructure.name.symbol.literal == name) {
|
139
|
+
|
140
|
+
return true;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
return false;
|
147
|
+
}
|
148
|
+
};
|
149
|
+
|
150
|
+
/** Data Structures Parser */
|
151
|
+
typedef SectionParser<DataStructureGroup, HeaderSectionAdapter> DataStructureGroupParser;
|
152
|
+
}
|
153
|
+
|
154
|
+
#endif
|