redsnow 0.3.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +4 -4
- data/ext/drafter/Makefile +54 -0
- data/ext/drafter/appveyor.yml +10 -0
- data/ext/drafter/bin/drafter +0 -0
- data/ext/{snowcrash → drafter}/build/Makefile +29 -14
- data/ext/{snowcrash/build/snowcrash.Makefile → drafter/build/drafter.Makefile} +1 -1
- data/ext/{snowcrash/build/snowcrash.target.mk → drafter/build/drafter.target.mk} +25 -23
- data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/libmarkdownparser.target.mk +7 -7
- data/ext/drafter/build/ext/snowcrash/libsnowcrash.target.mk +152 -0
- data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/libsundown.target.mk +13 -13
- data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/perf-libsnowcrash.target.mk +14 -20
- data/ext/drafter/build/ext/snowcrash/snowcrash.Makefile +6 -0
- data/ext/{snowcrash → drafter}/build/gyp-mac-tool +0 -0
- data/ext/{snowcrash/build/libsnowcrash.target.mk → drafter/build/libdrafter.target.mk} +29 -36
- data/ext/drafter/build/libsos.target.mk +133 -0
- data/ext/drafter/build/out/Release/drafter +0 -0
- data/ext/drafter/build/out/Release/libdrafter.dylib +0 -0
- data/ext/drafter/build/out/Release/libmarkdownparser.a +0 -0
- data/ext/drafter/build/out/Release/libsnowcrash.a +0 -0
- data/ext/drafter/build/out/Release/libsos.a +0 -0
- data/ext/{snowcrash → drafter}/build/out/Release/libsundown.a +0 -0
- data/ext/{snowcrash → drafter}/build/out/Release/linker.lock +0 -0
- data/ext/drafter/build/out/Release/obj.target/drafter/src/config.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/drafter/src/main.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/drafter/src/reporting.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Serialize.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeAST.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeResult.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeSourcemap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/cdrafter.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Blueprint.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/BlueprintSourcemap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HTTP.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HeadersParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSON.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONOneOfParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONSourcemap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONTypeSectionParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONValueMemberParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Section.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Signature.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/UriTemplateParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/posix/RegexMatch.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/snowcrash.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsos/ext/sos/src/sos.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html_smartypants.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.o +0 -0
- data/ext/{snowcrash/build/out/Release/obj.target/libsundown → drafter/build/out/Release/obj.target/libsundown/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
- data/ext/drafter/circle.yml +12 -0
- data/ext/{snowcrash → drafter}/config.gypi +1 -1
- data/ext/{snowcrash → drafter}/config.mk +0 -0
- data/ext/{snowcrash → drafter}/configure +16 -5
- data/ext/drafter/drafter.gyp +118 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/Makefile +4 -12
- data/ext/{snowcrash → drafter/ext/snowcrash}/Vagrantfile +14 -4
- data/ext/drafter/ext/snowcrash/appveyor.yml +7 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/common.gypi +0 -0
- data/ext/drafter/ext/snowcrash/configure +197 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/Makefile +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/CONTRIBUTING.md +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/Makefile +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/Makefile.win +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/examples/smartypants.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/examples/sundown.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini_href_e.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini_html_e.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html_smartypants.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html_block_names.txt +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/html_blocks.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/stack.c +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/stack.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/sundown.def +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/markdown/markdown.vcproj +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/msvc.sln +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/sundown/sundown.vcproj +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/ByteBuffer.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/ByteBuffer.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownNode.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownNode.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownParser.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownParser.h +10 -2
- data/ext/{snowcrash → drafter/ext/snowcrash}/provisioning.sh +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/snowcrash.gyp +41 -39
- data/ext/{snowcrash → drafter/ext/snowcrash}/snowcrash.xcworkspace/contents.xcworkspacedata +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ActionParser.h +50 -6
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/AssetParser.h +1 -12
- data/ext/drafter/ext/snowcrash/src/AttributesParser.h +121 -0
- data/ext/drafter/ext/snowcrash/src/Blueprint.cc +90 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Blueprint.h +169 -33
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintParser.h +305 -48
- data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.cc +81 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintSourcemap.h +130 -39
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintUtility.h +10 -4
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/CodeBlockUtility.h +1 -1
- data/ext/drafter/ext/snowcrash/src/DataStructureGroupParser.h +154 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/HTTP.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/HTTP.h +0 -0
- data/ext/drafter/ext/snowcrash/src/HeadersParser.cc +110 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/HeadersParser.h +123 -54
- data/ext/drafter/ext/snowcrash/src/MSON.cc +272 -0
- data/ext/drafter/ext/snowcrash/src/MSON.h +399 -0
- data/ext/drafter/ext/snowcrash/src/MSONMixinParser.h +95 -0
- data/ext/drafter/ext/snowcrash/src/MSONNamedTypeParser.h +108 -0
- data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.cc +132 -0
- data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.h +80 -0
- data/ext/drafter/ext/snowcrash/src/MSONParameterParser.h +232 -0
- data/ext/drafter/ext/snowcrash/src/MSONPropertyMemberParser.h +91 -0
- data/ext/drafter/ext/snowcrash/src/MSONSourcemap.cc +141 -0
- data/ext/drafter/ext/snowcrash/src/MSONSourcemap.h +181 -0
- data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.cc +209 -0
- data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.h +213 -0
- data/ext/drafter/ext/snowcrash/src/MSONUtility.h +423 -0
- data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.cc +179 -0
- data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.h +346 -0
- data/ext/drafter/ext/snowcrash/src/ModelTable.h +87 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ParameterParser.h +120 -61
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ParametersParser.h +17 -18
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/PayloadParser.h +36 -18
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Platform.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/RegexMatch.h +0 -0
- data/ext/drafter/ext/snowcrash/src/RelationParser.h +75 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ResourceGroupParser.h +127 -33
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ResourceParser.h +126 -33
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Section.cc +6 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Section.h +15 -2
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionParser.h +3 -1
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionParserData.h +15 -5
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionProcessor.h +24 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/Signature.cc +14 -0
- data/ext/drafter/ext/snowcrash/src/Signature.h +80 -0
- data/ext/drafter/ext/snowcrash/src/SignatureSectionProcessor.h +439 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/SourceAnnotation.h +3 -2
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/StringUtility.h +103 -6
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/UriTemplateParser.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/UriTemplateParser.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/ValuesParser.h +1 -13
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/posix/RegexMatch.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/snowcrash.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/snowcrash.h +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/src/win/RegexMatch.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/AUTHORS +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/DEPS +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/OWNERS +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/PRESUBMIT.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/buildbot/buildbot_run.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/codereview.settings +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/data/win/large-pdb-shim.cc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp.bat +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp_main.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSNew.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSProject.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSSettings.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSToolFile.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSUserFile.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSUtil.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSVersion.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/__init__.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/__init__.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/common.py +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/easy_xml.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/flock_tool.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/__init__.py +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/android.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/cmake.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/eclipse.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/gypd.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/gypsh.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/make.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/msvs.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/ninja.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/xcode.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/input.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/input.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/mac_tool.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/msvs_emulation.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/ninja_syntax.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/ordered_dict.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/win_tool.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcode_emulation.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcodeproj_file.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xml_fix.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylintrc +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/samples/samples +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/samples/samples.bat +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/setup.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/emacs/gyp.el +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/graphviz.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_gyp.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_sln.py +0 -0
- data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_vcproj.py +0 -0
- data/ext/drafter/ext/snowcrash/vcbuild.bat +139 -0
- data/ext/drafter/ext/sos/Makefile +57 -0
- data/ext/drafter/ext/sos/src/sos.cc +200 -0
- data/ext/drafter/ext/sos/src/sos.h +179 -0
- data/ext/drafter/ext/sos/src/sosJSON.h +105 -0
- data/ext/drafter/ext/sos/src/sosYAML.h +104 -0
- data/ext/{snowcrash → drafter}/src/Serialize.cc +30 -15
- data/ext/drafter/src/Serialize.h +135 -0
- data/ext/drafter/src/SerializeAST.cc +775 -0
- data/ext/drafter/src/SerializeAST.h +19 -0
- data/ext/drafter/src/SerializeResult.cc +67 -0
- data/ext/drafter/src/SerializeResult.h +26 -0
- data/ext/drafter/src/SerializeSourcemap.cc +446 -0
- data/ext/drafter/src/SerializeSourcemap.h +19 -0
- data/ext/drafter/src/Version.h +38 -0
- data/ext/drafter/src/cdrafter.cc +44 -0
- data/ext/drafter/src/cdrafter.h +55 -0
- data/ext/drafter/src/config.cc +80 -0
- data/ext/drafter/src/config.h +35 -0
- data/ext/drafter/src/drafter.cc +22 -0
- data/ext/drafter/src/drafter.h +38 -0
- data/ext/drafter/src/main.cc +91 -0
- data/ext/drafter/src/reporting.cc +162 -0
- data/ext/drafter/src/reporting.h +28 -0
- data/ext/drafter/src/stream.h +146 -0
- data/ext/drafter/tools/homebrew/drafter.rb +12 -0
- data/ext/{snowcrash → drafter}/vcbuild.bat +3 -3
- data/lib/redsnow.rb +6 -11
- data/lib/redsnow/binding.rb +11 -201
- data/lib/redsnow/blueprint.rb +104 -169
- data/lib/redsnow/parseresult.rb +28 -42
- data/lib/redsnow/sourcemap.rb +92 -177
- data/lib/redsnow/version.rb +1 -1
- data/redsnow.gemspec +1 -1
- metadata +249 -197
- data/ext/snowcrash/bin/snowcrash +0 -0
- data/ext/snowcrash/build/out/Release/libmarkdownparser.a +0 -0
- data/ext/snowcrash/build/out/Release/libsnowcrash.dylib +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/ByteBuffer.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownNode.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownParser.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprint.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprintSourcemap.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CSourceAnnotation.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/HTTP.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Section.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Serialize.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeJSON.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeYAML.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Signature.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/UriTemplateParser.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/csnowcrash.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/posix/RegexMatch.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/snowcrash.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
- data/ext/snowcrash/build/out/Release/obj.target/snowcrash/src/snowcrash/snowcrash.o +0 -0
- data/ext/snowcrash/build/out/Release/snowcrash +0 -0
- data/ext/snowcrash/src/CBlueprint.cc +0 -628
- data/ext/snowcrash/src/CBlueprint.h +0 -366
- data/ext/snowcrash/src/CBlueprintSourcemap.cc +0 -630
- data/ext/snowcrash/src/CBlueprintSourcemap.h +0 -351
- data/ext/snowcrash/src/CSourceAnnotation.cc +0 -154
- data/ext/snowcrash/src/CSourceAnnotation.h +0 -106
- data/ext/snowcrash/src/Serialize.h +0 -71
- data/ext/snowcrash/src/SerializeJSON.cc +0 -1221
- data/ext/snowcrash/src/SerializeJSON.h +0 -24
- data/ext/snowcrash/src/SerializeYAML.cc +0 -702
- data/ext/snowcrash/src/SerializeYAML.h +0 -24
- data/ext/snowcrash/src/Signature.h +0 -32
- data/ext/snowcrash/src/SymbolTable.h +0 -94
- data/ext/snowcrash/src/Version.h +0 -39
- data/ext/snowcrash/src/csnowcrash.cc +0 -29
- data/ext/snowcrash/src/csnowcrash.h +0 -40
- data/ext/snowcrash/src/snowcrash/snowcrash.cc +0 -200
- data/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
- data/ext/snowcrash/tools/homebrew/snowcrash.rb +0 -12
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#include "HeadersParser.h"
|
|
2
|
+
|
|
3
|
+
using namespace snowcrash;
|
|
4
|
+
|
|
5
|
+
/** Finds a header in its containment group by its key (first) */
|
|
6
|
+
static HeaderIterator findHeader(const Headers& headers,
|
|
7
|
+
const Header& header) {
|
|
8
|
+
|
|
9
|
+
return std::find_if(headers.begin(),
|
|
10
|
+
headers.end(),
|
|
11
|
+
std::bind2nd(MatchFirsts<Header, IEqual<Header::first_type> >(), header));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
typedef std::vector<std::string> HeadersKeyCollection;
|
|
15
|
+
|
|
16
|
+
/** Get collection of allowed keywords - workarround due to C++98 restriction - static initialization of vector */
|
|
17
|
+
static const HeadersKeyCollection& getAllowedMultipleDefinitions() {
|
|
18
|
+
|
|
19
|
+
static std::string keys[] = {
|
|
20
|
+
HTTPHeaderName::SetCookie,
|
|
21
|
+
HTTPHeaderName::Link,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
static const HeadersKeyCollection allowedMultipleDefinitions(keys, keys + (sizeof(keys)/sizeof(keys[0])));
|
|
25
|
+
|
|
26
|
+
return allowedMultipleDefinitions;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Check if Header name has allowed multiple definitions */
|
|
30
|
+
static bool isAllowedMultipleDefinition(const Header& header) {
|
|
31
|
+
|
|
32
|
+
const HeadersKeyCollection& keys = getAllowedMultipleDefinitions();
|
|
33
|
+
|
|
34
|
+
return std::find_if(keys.begin(),
|
|
35
|
+
keys.end(),
|
|
36
|
+
std::bind1st(MatchFirstWith<Header, std::string, IEqual<std::string> >(), header)) != keys.end();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static bool isNotValidTokenChar(const std::string::value_type& c) {
|
|
40
|
+
static const std::string validChars("-#$%&'*+.^_`|~");
|
|
41
|
+
|
|
42
|
+
return !(std::isalnum(c) || (validChars.find(c) != std::string::npos));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static std::string::const_iterator findNonValidCharInHeaderName(const std::string& token) {
|
|
46
|
+
|
|
47
|
+
return std::find_if(token.begin(), token.end(), isNotValidTokenChar);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
bool HeaderNameTokenChecker::operator()() const {
|
|
51
|
+
|
|
52
|
+
return findNonValidCharInHeaderName(headerName) == headerName.end();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
std::string HeaderNameTokenChecker::getMessage() const {
|
|
56
|
+
|
|
57
|
+
std::stringstream ss;
|
|
58
|
+
ss << "HTTP header field name contain illegal character '"
|
|
59
|
+
<< *findNonValidCharInHeaderName(headerName)
|
|
60
|
+
<< "'";
|
|
61
|
+
|
|
62
|
+
return ss.str();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
bool ColonPresentedChecker::operator()() const {
|
|
66
|
+
|
|
67
|
+
return captures[3].size() >= 1 && (captures[3].find(':') != std::string::npos);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
std::string ColonPresentedChecker::getMessage() const {
|
|
71
|
+
|
|
72
|
+
return "missing colon after header name";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
bool HeadersDuplicateChecker::operator()() const {
|
|
76
|
+
|
|
77
|
+
return findHeader(headers, header) == headers.end() ||
|
|
78
|
+
isAllowedMultipleDefinition(header);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
std::string HeadersDuplicateChecker::getMessage() const {
|
|
82
|
+
|
|
83
|
+
std::stringstream ss;
|
|
84
|
+
ss << "duplicate definition of '" << header.first << "' header";
|
|
85
|
+
|
|
86
|
+
return ss.str();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
bool HeaderValuePresentedChecker::operator()() const {
|
|
90
|
+
|
|
91
|
+
return !header.second.empty();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
std::string HeaderValuePresentedChecker::getMessage() const {
|
|
95
|
+
|
|
96
|
+
return "HTTP header has no value";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
bool HeaderParserValidator::operator()(const ValidateFunctorBase& rule) {
|
|
100
|
+
bool rc = rule();
|
|
101
|
+
|
|
102
|
+
if(!rc) {
|
|
103
|
+
out.report.warnings.push_back(Warning(rule.getMessage(),
|
|
104
|
+
HTTPWarning,
|
|
105
|
+
sourceMap));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return rc;
|
|
109
|
+
}
|
|
110
|
+
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#include "CodeBlockUtility.h"
|
|
15
15
|
#include "StringUtility.h"
|
|
16
16
|
#include "BlueprintUtility.h"
|
|
17
|
+
#include "RegexMatch.h"
|
|
17
18
|
|
|
18
19
|
namespace snowcrash {
|
|
19
20
|
|
|
@@ -23,6 +24,87 @@ namespace snowcrash {
|
|
|
23
24
|
/** Header Iterator in its containment group */
|
|
24
25
|
typedef Collection<Header>::const_iterator HeaderIterator;
|
|
25
26
|
|
|
27
|
+
/** Base class for functor to check validity of parsed header */
|
|
28
|
+
struct ValidateFunctorBase {
|
|
29
|
+
|
|
30
|
+
/** intended to generate warning mesage */
|
|
31
|
+
virtual std::string getMessage() const = 0;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* intended to invoke validation
|
|
35
|
+
* \return true if validation is ok
|
|
36
|
+
*
|
|
37
|
+
* data for validation you can inject into functor via c-tor
|
|
38
|
+
*/
|
|
39
|
+
virtual bool operator()() const = 0;
|
|
40
|
+
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** Functor implementation for check header name is valid token according to specification \see http://tools.ietf.org/html/rfc7230#section-3.2.6 */
|
|
44
|
+
struct HeaderNameTokenChecker : public ValidateFunctorBase {
|
|
45
|
+
|
|
46
|
+
const std::string& headerName;
|
|
47
|
+
|
|
48
|
+
explicit HeaderNameTokenChecker(const std::string& headerName) : headerName(headerName) {}
|
|
49
|
+
|
|
50
|
+
virtual bool operator()() const;
|
|
51
|
+
virtual std::string getMessage() const;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** Functor implementation for check header contains colon character between name and value */
|
|
55
|
+
struct ColonPresentedChecker : public ValidateFunctorBase {
|
|
56
|
+
|
|
57
|
+
const CaptureGroups& captures;
|
|
58
|
+
|
|
59
|
+
explicit ColonPresentedChecker(const CaptureGroups& captures) : captures(captures) {}
|
|
60
|
+
|
|
61
|
+
virtual bool operator()() const;
|
|
62
|
+
virtual std::string getMessage() const;
|
|
63
|
+
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** Functor implementation to check Headers duplicity */
|
|
67
|
+
struct HeadersDuplicateChecker : public ValidateFunctorBase {
|
|
68
|
+
|
|
69
|
+
const Header& header;
|
|
70
|
+
const Headers& headers;
|
|
71
|
+
|
|
72
|
+
explicit HeadersDuplicateChecker(const Header& header,
|
|
73
|
+
const Headers& headers)
|
|
74
|
+
: header(header), headers(headers) {}
|
|
75
|
+
|
|
76
|
+
virtual bool operator()() const;
|
|
77
|
+
virtual std::string getMessage() const;
|
|
78
|
+
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** Functor implementation to check Headers duplicity */
|
|
82
|
+
struct HeaderValuePresentedChecker : public ValidateFunctorBase {
|
|
83
|
+
|
|
84
|
+
const Header& header;
|
|
85
|
+
|
|
86
|
+
explicit HeaderValuePresentedChecker(const Header& header)
|
|
87
|
+
: header(header) {}
|
|
88
|
+
|
|
89
|
+
virtual bool operator()() const;
|
|
90
|
+
virtual std::string getMessage() const;
|
|
91
|
+
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/** Functor receive and invoke individual Validators and conditionaly push reports */
|
|
95
|
+
struct HeaderParserValidator {
|
|
96
|
+
|
|
97
|
+
const ParseResultRef<Headers>& out;
|
|
98
|
+
mdp::CharactersRangeSet sourceMap;
|
|
99
|
+
|
|
100
|
+
HeaderParserValidator(const ParseResultRef<Headers>& out,
|
|
101
|
+
mdp::CharactersRangeSet sourceMap)
|
|
102
|
+
: out(out), sourceMap(sourceMap) {}
|
|
103
|
+
|
|
104
|
+
bool operator()(const ValidateFunctorBase& rule);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
|
|
26
108
|
/**
|
|
27
109
|
* Headers Section Processor
|
|
28
110
|
*/
|
|
@@ -43,13 +125,7 @@ namespace snowcrash {
|
|
|
43
125
|
return ++MarkdownNodeIterator(node);
|
|
44
126
|
}
|
|
45
127
|
|
|
46
|
-
|
|
47
|
-
const MarkdownNodes& siblings,
|
|
48
|
-
SectionParserData& pd,
|
|
49
|
-
const ParseResultRef<Headers>& out) {
|
|
50
|
-
|
|
51
|
-
return node;
|
|
52
|
-
}
|
|
128
|
+
NO_SECTION_DESCRIPTION(Headers)
|
|
53
129
|
|
|
54
130
|
static MarkdownNodeIterator processContent(const MarkdownNodeIterator& node,
|
|
55
131
|
const MarkdownNodes& siblings,
|
|
@@ -64,11 +140,6 @@ namespace snowcrash {
|
|
|
64
140
|
return ++MarkdownNodeIterator(node);
|
|
65
141
|
}
|
|
66
142
|
|
|
67
|
-
static bool isDescriptionNode(const MarkdownNodeIterator& node,
|
|
68
|
-
SectionType sectionType) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
143
|
static bool isContentNode(const MarkdownNodeIterator& node,
|
|
73
144
|
SectionType sectionType) {
|
|
74
145
|
|
|
@@ -108,10 +179,47 @@ namespace snowcrash {
|
|
|
108
179
|
}
|
|
109
180
|
}
|
|
110
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Parse individual line of header
|
|
184
|
+
* \return true if valid header definition
|
|
185
|
+
*
|
|
186
|
+
* Header name is checked against token definition
|
|
187
|
+
*
|
|
188
|
+
* \param line - contains individual line with header definition
|
|
189
|
+
* \param header - is filled by name and value if definition is valid
|
|
190
|
+
* \param out - "report" member can receive warning while checking validity
|
|
191
|
+
* \param sourceMap - just contain source mapping for warning report
|
|
192
|
+
*/
|
|
193
|
+
static bool parseHeaderLine(const mdp::ByteBuffer& line,
|
|
194
|
+
Header& header,
|
|
195
|
+
const ParseResultRef<Headers>& out,
|
|
196
|
+
const mdp::CharactersRangeSet sourceMap) {
|
|
197
|
+
|
|
198
|
+
std::string re = " *([^:[:blank:]]+)(( *:? *)(.*)?)$";
|
|
199
|
+
|
|
200
|
+
CaptureGroups parts;
|
|
201
|
+
bool matched = RegexCapture(line, re, parts, 5);
|
|
202
|
+
|
|
203
|
+
if (!matched)
|
|
204
|
+
return false;
|
|
205
|
+
|
|
206
|
+
header = std::make_pair(parts[1], parts[4]);
|
|
207
|
+
TrimString(header.second);
|
|
208
|
+
|
|
209
|
+
HeaderParserValidator validate(out, sourceMap);
|
|
210
|
+
|
|
211
|
+
validate(HeaderNameTokenChecker(header.first));
|
|
212
|
+
validate(ColonPresentedChecker(parts));
|
|
213
|
+
validate(HeadersDuplicateChecker(header, out.node));
|
|
214
|
+
validate(HeaderValuePresentedChecker(header));
|
|
215
|
+
|
|
216
|
+
return !header.first.empty();
|
|
217
|
+
}
|
|
218
|
+
|
|
111
219
|
/** Retrieve headers from content */
|
|
112
220
|
static void headersFromContent(const MarkdownNodeIterator& node,
|
|
113
221
|
const mdp::ByteBuffer& content,
|
|
114
|
-
SectionParserData& pd,
|
|
222
|
+
const SectionParserData& pd,
|
|
115
223
|
const ParseResultRef<Headers>& out) {
|
|
116
224
|
|
|
117
225
|
std::vector<std::string> lines = Split(content, '\n');
|
|
@@ -125,20 +233,9 @@ namespace snowcrash {
|
|
|
125
233
|
}
|
|
126
234
|
|
|
127
235
|
Header header;
|
|
236
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
128
237
|
|
|
129
|
-
if (
|
|
130
|
-
if (findHeader(out.node, header) != out.node.end() && !isAllowedMultipleDefinition(header)) {
|
|
131
|
-
// WARN: duplicate header on this level
|
|
132
|
-
std::stringstream ss;
|
|
133
|
-
|
|
134
|
-
ss << "duplicate definition of '" << header.first << "' header";
|
|
135
|
-
|
|
136
|
-
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
137
|
-
out.report.warnings.push_back(Warning(ss.str(),
|
|
138
|
-
DuplicateWarning,
|
|
139
|
-
sourceMap));
|
|
140
|
-
}
|
|
141
|
-
|
|
238
|
+
if (parseHeaderLine(*line, header, out, sourceMap)) {
|
|
142
239
|
out.node.push_back(header);
|
|
143
240
|
|
|
144
241
|
if (pd.exportSourceMap()) {
|
|
@@ -222,34 +319,6 @@ namespace snowcrash {
|
|
|
222
319
|
}
|
|
223
320
|
}
|
|
224
321
|
|
|
225
|
-
/** Finds a header in its containment group by its key (first) */
|
|
226
|
-
static HeaderIterator findHeader(const Headers& headers,
|
|
227
|
-
const Header& header) {
|
|
228
|
-
|
|
229
|
-
return std::find_if(headers.begin(),
|
|
230
|
-
headers.end(),
|
|
231
|
-
std::bind2nd(MatchFirsts<Header, IEqual<Header::first_type> >(), header));
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
typedef std::vector<std::string> HeadersKeyCollection;
|
|
235
|
-
/** Get collection of allowed keywords - workarround due to C++98 restriction - static initialization of vector */
|
|
236
|
-
static const HeadersKeyCollection& getAllowedMultipleDefinitions() {
|
|
237
|
-
static std::string keys[] = {
|
|
238
|
-
HTTPHeaderName::SetCookie,
|
|
239
|
-
HTTPHeaderName::Link,
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
static const HeadersKeyCollection allowedMultipleDefinitions(keys, keys + (sizeof(keys)/sizeof(keys[0])));
|
|
243
|
-
return allowedMultipleDefinitions;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/** Check if Header name has allowed multiple definitions */
|
|
247
|
-
static bool isAllowedMultipleDefinition(const Header& header) {
|
|
248
|
-
const HeadersKeyCollection& keys = getAllowedMultipleDefinitions();
|
|
249
|
-
return std::find_if(keys.begin(),
|
|
250
|
-
keys.end(),
|
|
251
|
-
std::bind1st(MatchFirstWith<Header, std::string, IEqual<std::string> >(), header)) != keys.end();
|
|
252
|
-
}
|
|
253
322
|
};
|
|
254
323
|
|
|
255
324
|
/** Headers Section Parser */
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MSON.cc
|
|
3
|
+
// snowcrash
|
|
4
|
+
//
|
|
5
|
+
// Created by Pavan Kumar Sunkara on 11/4/14.
|
|
6
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#include "MSON.h"
|
|
10
|
+
|
|
11
|
+
using namespace mson;
|
|
12
|
+
|
|
13
|
+
bool Value::empty() const
|
|
14
|
+
{
|
|
15
|
+
return (this->literal.empty() && this->variable == false);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
bool Symbol::empty() const
|
|
19
|
+
{
|
|
20
|
+
return (this->literal.empty() && this->variable == false);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
bool TypeName::empty() const
|
|
24
|
+
{
|
|
25
|
+
return (this->base == UndefinedTypeName && this->symbol.empty());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
bool TypeSpecification::empty() const
|
|
29
|
+
{
|
|
30
|
+
return (this->nestedTypes.empty() && this->name.empty());
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
bool TypeDefinition::empty() const
|
|
34
|
+
{
|
|
35
|
+
return (this->attributes == 0 && this->typeSpecification.empty());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
bool ValueDefinition::empty() const
|
|
39
|
+
{
|
|
40
|
+
return (this->values.empty() && this->typeDefinition.empty());
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Elements& TypeSection::Content::elements()
|
|
44
|
+
{
|
|
45
|
+
if (!m_elements.get())
|
|
46
|
+
throw ELEMENTS_NOT_SET_ERR;
|
|
47
|
+
|
|
48
|
+
return *m_elements;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const Elements& TypeSection::Content::elements() const
|
|
52
|
+
{
|
|
53
|
+
if (!m_elements.get())
|
|
54
|
+
throw ELEMENTS_NOT_SET_ERR;
|
|
55
|
+
|
|
56
|
+
return *m_elements;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
TypeSection::Content::Content(const Markdown& description_, const Literal& value_)
|
|
60
|
+
: description(description_), value(value_)
|
|
61
|
+
{
|
|
62
|
+
m_elements.reset(::new Elements);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
TypeSection::Content::Content(const TypeSection::Content& rhs)
|
|
66
|
+
{
|
|
67
|
+
this->description = rhs.description;
|
|
68
|
+
this->value = rhs.value;
|
|
69
|
+
m_elements.reset(::new Elements(*rhs.m_elements.get()));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
TypeSection::Content& TypeSection::Content::operator=(const TypeSection::Content& rhs)
|
|
73
|
+
{
|
|
74
|
+
this->description = rhs.description;
|
|
75
|
+
this->value = rhs.value;
|
|
76
|
+
m_elements.reset(::new Elements(*rhs.m_elements.get()));
|
|
77
|
+
|
|
78
|
+
return *this;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
TypeSection::Content::~Content()
|
|
82
|
+
{
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
bool TypeSection::empty() const
|
|
86
|
+
{
|
|
87
|
+
return (this->klass == TypeSection::UndefinedClass &&
|
|
88
|
+
this->content.value.empty() &&
|
|
89
|
+
this->content.description.empty() &&
|
|
90
|
+
this->content.elements().empty());
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
bool NamedType::empty() const
|
|
94
|
+
{
|
|
95
|
+
return (this->typeDefinition.empty() &&
|
|
96
|
+
this->name.empty() &&
|
|
97
|
+
this->sections.empty());
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
bool ValueMember::empty() const
|
|
101
|
+
{
|
|
102
|
+
return (this->valueDefinition.empty() && this->sections.empty() &&
|
|
103
|
+
this->description.empty());
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
bool PropertyName::empty() const
|
|
107
|
+
{
|
|
108
|
+
return (this->literal.empty() && this->variable.empty());
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
bool PropertyMember::empty() const
|
|
112
|
+
{
|
|
113
|
+
return (this->name.empty() && this->description.empty() &&
|
|
114
|
+
this->sections.empty() && this->valueDefinition.empty());
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
OneOf& Element::Content::oneOf()
|
|
118
|
+
{
|
|
119
|
+
if (!m_elements.get())
|
|
120
|
+
throw ELEMENTS_NOT_SET_ERR;
|
|
121
|
+
|
|
122
|
+
return *m_elements;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const OneOf& Element::Content::oneOf() const
|
|
126
|
+
{
|
|
127
|
+
if (!m_elements.get())
|
|
128
|
+
throw ELEMENTS_NOT_SET_ERR;
|
|
129
|
+
|
|
130
|
+
return *m_elements;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
Elements& Element::Content::elements()
|
|
134
|
+
{
|
|
135
|
+
if (!m_elements.get())
|
|
136
|
+
throw ELEMENTS_NOT_SET_ERR;
|
|
137
|
+
|
|
138
|
+
return *m_elements;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const Elements& Element::Content::elements() const
|
|
142
|
+
{
|
|
143
|
+
if (!m_elements.get())
|
|
144
|
+
throw ELEMENTS_NOT_SET_ERR;
|
|
145
|
+
|
|
146
|
+
return *m_elements;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
Element::Content& Element::Content::operator=(const Elements& rhs)
|
|
150
|
+
{
|
|
151
|
+
m_elements.reset(::new Elements(rhs));
|
|
152
|
+
|
|
153
|
+
return *this;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
Element::Content::Content()
|
|
157
|
+
{
|
|
158
|
+
m_elements.reset(::new Elements);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
Element::Content::Content(const Element::Content& rhs)
|
|
162
|
+
{
|
|
163
|
+
this->property = rhs.property;
|
|
164
|
+
this->value = rhs.value;
|
|
165
|
+
this->mixin = rhs.mixin;
|
|
166
|
+
m_elements.reset(::new Elements(*rhs.m_elements.get()));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
Element::Content& Element::Content::operator=(const Element::Content& rhs)
|
|
170
|
+
{
|
|
171
|
+
this->property = rhs.property;
|
|
172
|
+
this->value = rhs.value;
|
|
173
|
+
this->mixin = rhs.mixin;
|
|
174
|
+
m_elements.reset(::new Elements(*rhs.m_elements.get()));
|
|
175
|
+
|
|
176
|
+
return *this;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
Element::Content::~Content()
|
|
180
|
+
{
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
Element::Element(const Element::Class& klass_)
|
|
184
|
+
: klass(klass_)
|
|
185
|
+
{
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
Element::Element(const Element& rhs)
|
|
189
|
+
{
|
|
190
|
+
this->klass = rhs.klass;
|
|
191
|
+
this->content = rhs.content;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
Element& Element::operator=(const Element& rhs)
|
|
195
|
+
{
|
|
196
|
+
this->klass = rhs.klass;
|
|
197
|
+
this->content = rhs.content;
|
|
198
|
+
|
|
199
|
+
return *this;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
Element::~Element()
|
|
203
|
+
{
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* \brief Build Element from property member
|
|
208
|
+
*
|
|
209
|
+
* \param propertyMember Property member which was given
|
|
210
|
+
*/
|
|
211
|
+
void Element::build(const PropertyMember& propertyMember)
|
|
212
|
+
{
|
|
213
|
+
this->klass = Element::PropertyClass;
|
|
214
|
+
this->content.property = propertyMember;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* \brief Build Element from value member
|
|
219
|
+
*
|
|
220
|
+
* \param valueMember Value member which was given
|
|
221
|
+
*/
|
|
222
|
+
void Element::build(const ValueMember& valueMember)
|
|
223
|
+
{
|
|
224
|
+
this->klass = Element::ValueClass;
|
|
225
|
+
this->content.value = valueMember;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* \brief Build Element from mixin type
|
|
230
|
+
*
|
|
231
|
+
* \param mixin Mixin which was given
|
|
232
|
+
*/
|
|
233
|
+
void Element::build(const Mixin& mixin)
|
|
234
|
+
{
|
|
235
|
+
this->klass = Element::MixinClass;
|
|
236
|
+
this->content.mixin = mixin;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* \brief Build Element from one of type
|
|
241
|
+
*
|
|
242
|
+
* \param oneOf One Of which was given
|
|
243
|
+
*/
|
|
244
|
+
void Element::build(const OneOf& oneOf)
|
|
245
|
+
{
|
|
246
|
+
this->buildFromElements(oneOf);
|
|
247
|
+
this->klass = Element::OneOfClass;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* \brief Build Element from a value
|
|
252
|
+
*
|
|
253
|
+
* \param value Value of the value member
|
|
254
|
+
*/
|
|
255
|
+
void Element::build(const Value& value)
|
|
256
|
+
{
|
|
257
|
+
ValueMember valueMember;
|
|
258
|
+
|
|
259
|
+
valueMember.valueDefinition.values.push_back(value);
|
|
260
|
+
this->build(valueMember);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* \brief Buile Element from group of elements
|
|
265
|
+
*
|
|
266
|
+
* \param elements Group of elements
|
|
267
|
+
*/
|
|
268
|
+
void Element::buildFromElements(const Elements &elements)
|
|
269
|
+
{
|
|
270
|
+
this->klass = Element::GroupClass;
|
|
271
|
+
this->content = elements;
|
|
272
|
+
}
|