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,213 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MSONTypeSectionParser.h
|
|
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
|
+
#ifndef SNOWCRASH_MSONTYPESECTIONPARSER_H
|
|
10
|
+
#define SNOWCRASH_MSONTYPESECTIONPARSER_H
|
|
11
|
+
|
|
12
|
+
#include "SectionParser.h"
|
|
13
|
+
#include "MSONUtility.h"
|
|
14
|
+
|
|
15
|
+
using namespace scpl;
|
|
16
|
+
|
|
17
|
+
namespace snowcrash {
|
|
18
|
+
|
|
19
|
+
/** MSON Default Type Section matching regex */
|
|
20
|
+
const char* const MSONDefaultTypeSectionRegex = "^[[:blank:]]*[Dd]efault[[:blank:]]*(:.*)?$";
|
|
21
|
+
|
|
22
|
+
/** MSON Sample Type Section matching regex */
|
|
23
|
+
const char* const MSONSampleTypeSectionRegex = "^[[:blank:]]*[Ss]ample[[:blank:]]*(:.*)?$";
|
|
24
|
+
|
|
25
|
+
/** MSON Value Members Type Section matching regex */
|
|
26
|
+
const char* const MSONValueMembersTypeSectionRegex = "^[[:blank:]]*([Ii]tems|[Mm]embers)[[:blank:]]*$";
|
|
27
|
+
|
|
28
|
+
/** MSON Property Members Type Section matching regex */
|
|
29
|
+
const char* const MSONPropertyMembersTypeSectionRegex = "^[[:blank:]]*([Pp]roperties)[[:blank:]]*$";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* MSON Type Section Section Processor
|
|
33
|
+
*/
|
|
34
|
+
template<>
|
|
35
|
+
struct SectionProcessor<mson::TypeSection> : public SignatureSectionProcessorBase<mson::TypeSection> {
|
|
36
|
+
|
|
37
|
+
static SignatureTraits signatureTraits() {
|
|
38
|
+
|
|
39
|
+
SignatureTraits signatureTraits(SignatureTraits::IdentifierTrait |
|
|
40
|
+
SignatureTraits::ValuesTrait);
|
|
41
|
+
|
|
42
|
+
return signatureTraits;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static MarkdownNodeIterator finalizeSignature(const MarkdownNodeIterator& node,
|
|
46
|
+
SectionParserData& pd,
|
|
47
|
+
const Signature& signature,
|
|
48
|
+
const ParseResultRef<mson::TypeSection>& out) {
|
|
49
|
+
|
|
50
|
+
bool assignValues = false;
|
|
51
|
+
|
|
52
|
+
if (IEqual<std::string>()(signature.identifier, "Default")) {
|
|
53
|
+
|
|
54
|
+
out.node.klass = mson::TypeSection::DefaultClass;
|
|
55
|
+
assignValues = true;
|
|
56
|
+
}
|
|
57
|
+
else if (IEqual<std::string>()(signature.identifier, "Sample")) {
|
|
58
|
+
|
|
59
|
+
out.node.klass = mson::TypeSection::SampleClass;
|
|
60
|
+
assignValues = true;
|
|
61
|
+
}
|
|
62
|
+
else if (IEqual<std::string>()(signature.identifier, "Items") ||
|
|
63
|
+
IEqual<std::string>()(signature.identifier, "Members")) {
|
|
64
|
+
|
|
65
|
+
if (out.node.baseType != mson::ValueBaseType &&
|
|
66
|
+
out.node.baseType != mson::ImplicitValueBaseType) {
|
|
67
|
+
|
|
68
|
+
//WARN: Items/Members should only be allowed for value types
|
|
69
|
+
std::stringstream ss;
|
|
70
|
+
|
|
71
|
+
ss << "type section `" << signature.identifier;
|
|
72
|
+
ss << "` not allowed for a type sub-typed from a primitive or object type";
|
|
73
|
+
|
|
74
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
75
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
76
|
+
LogicalErrorWarning,
|
|
77
|
+
sourceMap));
|
|
78
|
+
|
|
79
|
+
return node;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
out.node.klass = mson::TypeSection::MemberTypeClass;
|
|
83
|
+
}
|
|
84
|
+
else if (IEqual<std::string>()(signature.identifier, "Properties")) {
|
|
85
|
+
|
|
86
|
+
if (out.node.baseType != mson::ObjectBaseType &&
|
|
87
|
+
out.node.baseType != mson::ImplicitObjectBaseType) {
|
|
88
|
+
|
|
89
|
+
//WARN: Properties should only be allowed for object types
|
|
90
|
+
std::stringstream ss;
|
|
91
|
+
|
|
92
|
+
ss << "type section `" << signature.identifier;
|
|
93
|
+
ss << "` is only allowed for a type sub-typed from an object type";
|
|
94
|
+
|
|
95
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
96
|
+
out.report.warnings.push_back(Warning(ss.str(),
|
|
97
|
+
LogicalErrorWarning,
|
|
98
|
+
sourceMap));
|
|
99
|
+
|
|
100
|
+
return node;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
out.node.klass = mson::TypeSection::MemberTypeClass;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (assignValues &&
|
|
107
|
+
(!signature.values.empty() || !signature.value.empty())) {
|
|
108
|
+
|
|
109
|
+
if (out.node.baseType == mson::PrimitiveBaseType ||
|
|
110
|
+
out.node.baseType == mson::ImplicitPrimitiveBaseType) {
|
|
111
|
+
|
|
112
|
+
out.node.content.value = signature.value;
|
|
113
|
+
|
|
114
|
+
if (pd.exportSourceMap()) {
|
|
115
|
+
out.sourceMap.value.sourceMap = node->sourceMap;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else if (out.node.baseType == mson::ValueBaseType ||
|
|
119
|
+
out.node.baseType == mson::ImplicitValueBaseType) {
|
|
120
|
+
|
|
121
|
+
for (size_t i = 0; i < signature.values.size(); i++) {
|
|
122
|
+
|
|
123
|
+
mson::Element element;
|
|
124
|
+
SourceMap<mson::Element> elementSM;
|
|
125
|
+
|
|
126
|
+
element.build(mson::parseValue(signature.values[i]));
|
|
127
|
+
out.node.content.elements().push_back(element);
|
|
128
|
+
|
|
129
|
+
if (pd.exportSourceMap()) {
|
|
130
|
+
|
|
131
|
+
elementSM.value.valueDefinition.sourceMap = node->sourceMap;
|
|
132
|
+
out.sourceMap.elements().collection.push_back(elementSM);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else if (out.node.baseType == mson::ObjectBaseType ||
|
|
137
|
+
out.node.baseType == mson::ImplicitObjectBaseType) {
|
|
138
|
+
|
|
139
|
+
// WARN: sample/default is for an object but it has values in signature
|
|
140
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
141
|
+
out.report.warnings.push_back(Warning("a sample and/or default type section for a type which is sub-typed from an object cannot have value(s) beside the keyword",
|
|
142
|
+
LogicalErrorWarning,
|
|
143
|
+
sourceMap));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (assignValues && !signature.remainingContent.empty() &&
|
|
148
|
+
(out.node.baseType == mson::PrimitiveBaseType ||
|
|
149
|
+
out.node.baseType == mson::ImplicitPrimitiveBaseType)) {
|
|
150
|
+
|
|
151
|
+
out.node.content.value += signature.remainingContent;
|
|
152
|
+
|
|
153
|
+
if (pd.exportSourceMap()) {
|
|
154
|
+
out.sourceMap.value.sourceMap.append(node->sourceMap);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return ++MarkdownNodeIterator(node);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
NO_SECTION_DESCRIPTION(mson::TypeSection)
|
|
162
|
+
|
|
163
|
+
static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator&,
|
|
164
|
+
const MarkdownNodes&,
|
|
165
|
+
SectionParserData&,
|
|
166
|
+
const ParseResultRef<mson::TypeSection>&);
|
|
167
|
+
|
|
168
|
+
static SectionType sectionType(const MarkdownNodeIterator& node) {
|
|
169
|
+
|
|
170
|
+
mdp::ByteBuffer subject, remaining;
|
|
171
|
+
|
|
172
|
+
if (node->type == mdp::HeaderMarkdownNodeType &&
|
|
173
|
+
!node->text.empty()) {
|
|
174
|
+
|
|
175
|
+
subject = node->text;
|
|
176
|
+
}
|
|
177
|
+
else if (node->type == mdp::ListItemMarkdownNodeType &&
|
|
178
|
+
!node->children().empty()) {
|
|
179
|
+
|
|
180
|
+
subject = node->children().front().text;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
subject = GetFirstLine(subject, remaining);
|
|
184
|
+
TrimString(subject);
|
|
185
|
+
|
|
186
|
+
if (RegexMatch(subject, MSONDefaultTypeSectionRegex) ||
|
|
187
|
+
RegexMatch(subject, MSONSampleTypeSectionRegex)) {
|
|
188
|
+
|
|
189
|
+
return MSONSampleDefaultSectionType;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (RegexMatch(subject, MSONValueMembersTypeSectionRegex)) {
|
|
193
|
+
return MSONValueMembersSectionType;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (RegexMatch(subject, MSONPropertyMembersTypeSectionRegex)) {
|
|
197
|
+
return MSONPropertyMembersSectionType;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return UndefinedSectionType;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
static SectionType nestedSectionType(const MarkdownNodeIterator&);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/** MSON Type Section (Header) Section Parser */
|
|
207
|
+
typedef SectionParser<mson::TypeSection, HeaderSectionAdapter> MSONTypeSectionHeaderParser;
|
|
208
|
+
|
|
209
|
+
/** MSON Type Section (List) Section Parser */
|
|
210
|
+
typedef SectionParser<mson::TypeSection, ListSectionAdapter> MSONTypeSectionListParser;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
#endif
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MSONUtility.h
|
|
3
|
+
// snowcrash
|
|
4
|
+
//
|
|
5
|
+
// Created by Pavan Kumar Sunkara on 10/23/14.
|
|
6
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef SNOWCRASH_MSONUTILITY_H
|
|
10
|
+
#define SNOWCRASH_MSONUTILITY_H
|
|
11
|
+
|
|
12
|
+
#include "MSONSourcemap.h"
|
|
13
|
+
|
|
14
|
+
using namespace scpl;
|
|
15
|
+
|
|
16
|
+
namespace mson {
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* \brief Check if the given string is variable
|
|
20
|
+
*
|
|
21
|
+
* \param String to check
|
|
22
|
+
*
|
|
23
|
+
* \return True if variable string
|
|
24
|
+
*/
|
|
25
|
+
inline bool checkVariable(const std::string& subject) {
|
|
26
|
+
|
|
27
|
+
std::string emphasisChars = mdp::MarkdownEmphasisChars;
|
|
28
|
+
|
|
29
|
+
if (emphasisChars.find(subject[0]) != std::string::npos &&
|
|
30
|
+
subject[0] == subject[subject.length() - 1]) {
|
|
31
|
+
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* \brief Parse a MSON BaseTypeName into MSON BaseType
|
|
40
|
+
*
|
|
41
|
+
* \param type MSON BaseTypeName
|
|
42
|
+
*
|
|
43
|
+
* \return MSON BaseType
|
|
44
|
+
*/
|
|
45
|
+
inline BaseType parseBaseType(const BaseTypeName& type) {
|
|
46
|
+
|
|
47
|
+
if ((type == StringTypeName) ||
|
|
48
|
+
(type == NumberTypeName) ||
|
|
49
|
+
(type == BooleanTypeName)) {
|
|
50
|
+
|
|
51
|
+
return PrimitiveBaseType;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (type == ObjectTypeName) {
|
|
55
|
+
return ObjectBaseType;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if ((type == ArrayTypeName) ||
|
|
59
|
+
(type == EnumTypeName)) {
|
|
60
|
+
|
|
61
|
+
return ValueBaseType;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return UndefinedBaseType;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* \brief Parse a string into MSON Value structure
|
|
69
|
+
*
|
|
70
|
+
* \param subject String which represents the value
|
|
71
|
+
*
|
|
72
|
+
* \return MSON Value
|
|
73
|
+
*/
|
|
74
|
+
inline Value parseValue(const std::string& subject) {
|
|
75
|
+
|
|
76
|
+
Value value;
|
|
77
|
+
std::string buffer = subject;
|
|
78
|
+
|
|
79
|
+
if (checkVariable(subject)) {
|
|
80
|
+
|
|
81
|
+
std::string escapedString = snowcrash::RetrieveEscaped(buffer, 0, true);
|
|
82
|
+
|
|
83
|
+
value.literal = escapedString;
|
|
84
|
+
value.variable = true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (value.literal.empty()) {
|
|
88
|
+
value.literal = buffer;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// When the value is a wildcard
|
|
92
|
+
if (value.literal == "*") {
|
|
93
|
+
|
|
94
|
+
value.literal = "";
|
|
95
|
+
value.variable = true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* \brief Parse Symbol from a string
|
|
103
|
+
*
|
|
104
|
+
* \param subject String which represents the symbol
|
|
105
|
+
*
|
|
106
|
+
* \return MSON Symbol
|
|
107
|
+
*/
|
|
108
|
+
inline Symbol parseSymbol(const std::string& subject) {
|
|
109
|
+
|
|
110
|
+
Symbol symbol;
|
|
111
|
+
Value value = parseValue(subject);
|
|
112
|
+
|
|
113
|
+
symbol.literal = value.literal;
|
|
114
|
+
symbol.variable = value.variable;
|
|
115
|
+
|
|
116
|
+
return symbol;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* \brief Parse Type Name from a string
|
|
121
|
+
*
|
|
122
|
+
* \param subject String which represents the type name
|
|
123
|
+
* \param typeName MSON Type Name
|
|
124
|
+
*/
|
|
125
|
+
inline void parseTypeName(const std::string& subject,
|
|
126
|
+
TypeName& typeName) {
|
|
127
|
+
|
|
128
|
+
if (subject == "boolean") {
|
|
129
|
+
typeName.base = BooleanTypeName;
|
|
130
|
+
}
|
|
131
|
+
else if (subject == "string") {
|
|
132
|
+
typeName.base = StringTypeName;
|
|
133
|
+
}
|
|
134
|
+
else if (subject == "number") {
|
|
135
|
+
typeName.base = NumberTypeName;
|
|
136
|
+
}
|
|
137
|
+
else if (subject == "array") {
|
|
138
|
+
typeName.base = ArrayTypeName;
|
|
139
|
+
}
|
|
140
|
+
else if (subject == "enum") {
|
|
141
|
+
typeName.base = EnumTypeName;
|
|
142
|
+
}
|
|
143
|
+
else if (subject == "object") {
|
|
144
|
+
typeName.base = ObjectTypeName;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
typeName.symbol = parseSymbol(subject);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* \brief Check Type Attribute from a string and fill list of type attributes accordingly
|
|
153
|
+
*
|
|
154
|
+
* \param attribute String that needs to be checked for attribute
|
|
155
|
+
* \param typeAttributes List of type attributes
|
|
156
|
+
*
|
|
157
|
+
* \return True if the given string is a type attribute
|
|
158
|
+
*/
|
|
159
|
+
inline bool parseTypeAttribute(const std::string& attribute,
|
|
160
|
+
TypeAttributes& typeAttributes) {
|
|
161
|
+
|
|
162
|
+
bool isAttribute = true;
|
|
163
|
+
|
|
164
|
+
if (attribute == "required") {
|
|
165
|
+
typeAttributes |= RequiredTypeAttribute;
|
|
166
|
+
}
|
|
167
|
+
else if (attribute == "optional") {
|
|
168
|
+
typeAttributes |= OptionalTypeAttribute;
|
|
169
|
+
}
|
|
170
|
+
else if (attribute == "fixed") {
|
|
171
|
+
typeAttributes |= FixedTypeAttribute;
|
|
172
|
+
}
|
|
173
|
+
else if (attribute == "sample") {
|
|
174
|
+
typeAttributes |= SampleTypeAttribute;
|
|
175
|
+
}
|
|
176
|
+
else if (attribute == "default") {
|
|
177
|
+
typeAttributes |= DefaultTypeAttribute;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
isAttribute = false;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return isAttribute;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* \brief Parse Type Specification from a signature attribute
|
|
188
|
+
*
|
|
189
|
+
* \param subject Attribute string representing the type specification
|
|
190
|
+
* \param typeSpecification MSON Type Specification
|
|
191
|
+
*/
|
|
192
|
+
inline void parseTypeSpecification(const std::string& attribute,
|
|
193
|
+
TypeSpecification& typeSpecification) {
|
|
194
|
+
|
|
195
|
+
std::string subject = snowcrash::StripMarkdownLink(attribute);
|
|
196
|
+
|
|
197
|
+
bool lookingAtNested = false; // If true, we are looking at nested types
|
|
198
|
+
bool lookingForEndLink = false; // If true, we detected a link text and are looking for the end of it
|
|
199
|
+
bool alreadyParsedLink = false; // If true, we already parsed the link text in the link
|
|
200
|
+
|
|
201
|
+
bool trimSubject = false;
|
|
202
|
+
|
|
203
|
+
size_t i = 0;
|
|
204
|
+
std::string buffer;
|
|
205
|
+
|
|
206
|
+
while (i < subject.length()) {
|
|
207
|
+
|
|
208
|
+
if (subject[i] == mdp::MarkdownBeginReference &&
|
|
209
|
+
!alreadyParsedLink) {
|
|
210
|
+
|
|
211
|
+
trimSubject = true;
|
|
212
|
+
|
|
213
|
+
if (!lookingAtNested) {
|
|
214
|
+
|
|
215
|
+
snowcrash::TrimString(buffer);
|
|
216
|
+
|
|
217
|
+
if (!buffer.empty()) {
|
|
218
|
+
parseTypeName(buffer, typeSpecification.name);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
lookingAtNested = true;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
lookingForEndLink = true;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
else if (subject[i] == mdp::MarkdownEndReference &&
|
|
228
|
+
lookingAtNested &&
|
|
229
|
+
lookingForEndLink) {
|
|
230
|
+
|
|
231
|
+
trimSubject = true;
|
|
232
|
+
|
|
233
|
+
TypeName typeName;
|
|
234
|
+
snowcrash::TrimString(buffer);
|
|
235
|
+
|
|
236
|
+
if (!buffer.empty()) {
|
|
237
|
+
|
|
238
|
+
parseTypeName(buffer, typeName);
|
|
239
|
+
typeSpecification.nestedTypes.push_back(typeName);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
alreadyParsedLink = true;
|
|
243
|
+
lookingForEndLink = false;
|
|
244
|
+
}
|
|
245
|
+
else if (subject[i] == AttributeDelimiter &&
|
|
246
|
+
lookingAtNested &&
|
|
247
|
+
!lookingForEndLink) {
|
|
248
|
+
|
|
249
|
+
trimSubject = true;
|
|
250
|
+
|
|
251
|
+
if (alreadyParsedLink) {
|
|
252
|
+
alreadyParsedLink = false;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
|
|
256
|
+
TypeName typeName;
|
|
257
|
+
snowcrash::TrimString(buffer);
|
|
258
|
+
|
|
259
|
+
if (!buffer.empty()) {
|
|
260
|
+
|
|
261
|
+
parseTypeName(buffer, typeName);
|
|
262
|
+
typeSpecification.nestedTypes.push_back(typeName);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
|
|
268
|
+
buffer += subject[i];
|
|
269
|
+
i++;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Strip the subject until the current index
|
|
273
|
+
if (trimSubject) {
|
|
274
|
+
|
|
275
|
+
subject = subject.substr(i + 1);
|
|
276
|
+
snowcrash::TrimString(subject);
|
|
277
|
+
|
|
278
|
+
trimSubject = false;
|
|
279
|
+
buffer.clear();
|
|
280
|
+
i = 0;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
snowcrash::TrimString(buffer);
|
|
285
|
+
|
|
286
|
+
if (buffer.empty() || alreadyParsedLink) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Remove the ending square bracket
|
|
291
|
+
if (lookingAtNested &&
|
|
292
|
+
buffer[buffer.length() - 1] == mdp::MarkdownEndReference) {
|
|
293
|
+
|
|
294
|
+
buffer = buffer.substr(0, buffer.length() - 1);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
TypeName typeName;
|
|
298
|
+
|
|
299
|
+
snowcrash::TrimString(buffer);
|
|
300
|
+
parseTypeName(buffer, typeName);
|
|
301
|
+
|
|
302
|
+
if (lookingAtNested) {
|
|
303
|
+
typeSpecification.nestedTypes.push_back(typeName);
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
typeSpecification.name = typeName;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* \brief Parse Type Definition from a list of signature attributes
|
|
312
|
+
*
|
|
313
|
+
* \param node Markdown node of the signature
|
|
314
|
+
* \param pd Section parser data
|
|
315
|
+
* \param attributes List of signature attributes
|
|
316
|
+
* \param report Parse result report
|
|
317
|
+
* \param typeDefinition MSON Type Definition
|
|
318
|
+
*/
|
|
319
|
+
inline void parseTypeDefinition(const mdp::MarkdownNodeIterator& node,
|
|
320
|
+
snowcrash::SectionParserData& pd,
|
|
321
|
+
const std::vector<std::string>& attributes,
|
|
322
|
+
snowcrash::Report& report,
|
|
323
|
+
mson::TypeDefinition& typeDefinition) {
|
|
324
|
+
|
|
325
|
+
bool foundTypeSpecification = false;
|
|
326
|
+
|
|
327
|
+
for (std::vector<std::string>::const_iterator it = attributes.begin();
|
|
328
|
+
it != attributes.end();
|
|
329
|
+
it++) {
|
|
330
|
+
|
|
331
|
+
// If not a recognized type attribute
|
|
332
|
+
if (!parseTypeAttribute(*it, typeDefinition.attributes)) {
|
|
333
|
+
|
|
334
|
+
// If type specification is already found
|
|
335
|
+
if (foundTypeSpecification) {
|
|
336
|
+
|
|
337
|
+
// WARN: Ignoring unrecognized type attribute
|
|
338
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
339
|
+
report.warnings.push_back(snowcrash::Warning("ignoring unrecognized type attribute",
|
|
340
|
+
snowcrash::IgnoringWarning,
|
|
341
|
+
sourceMap));
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
|
|
345
|
+
foundTypeSpecification = true;
|
|
346
|
+
parseTypeSpecification(*it, typeDefinition.typeSpecification);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
typeDefinition.baseType = parseBaseType(typeDefinition.typeSpecification.name.base);
|
|
352
|
+
NamedTypeBaseTable::iterator it = pd.namedTypeBaseTable.find(typeDefinition.typeSpecification.name.symbol.literal);
|
|
353
|
+
|
|
354
|
+
if (typeDefinition.baseType == UndefinedBaseType &&
|
|
355
|
+
it != pd.namedTypeBaseTable.end()) {
|
|
356
|
+
|
|
357
|
+
typeDefinition.baseType = it->second;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (typeDefinition.baseType == UndefinedBaseType &&
|
|
361
|
+
!typeDefinition.typeSpecification.name.symbol.literal.empty()) {
|
|
362
|
+
|
|
363
|
+
// WARN: Unable to find the named type in the named type base type table
|
|
364
|
+
std::stringstream ss;
|
|
365
|
+
ss << "unable to find the symbol `" << typeDefinition.typeSpecification.name.symbol.literal << "` in the list of named types";
|
|
366
|
+
|
|
367
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
368
|
+
report.warnings.push_back(snowcrash::Warning(ss.str(),
|
|
369
|
+
snowcrash::LogicalErrorWarning,
|
|
370
|
+
sourceMap));
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
if (typeDefinition.baseType != ValueBaseType &&
|
|
374
|
+
typeDefinition.baseType != ImplicitValueBaseType &&
|
|
375
|
+
!typeDefinition.typeSpecification.nestedTypes.empty()) {
|
|
376
|
+
|
|
377
|
+
// WARN: Nested types for non (array or enum) structure base type
|
|
378
|
+
mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
|
|
379
|
+
report.warnings.push_back(snowcrash::Warning("nested types should be present only for types which are sub typed from either array or enum structure type",
|
|
380
|
+
snowcrash::LogicalErrorWarning,
|
|
381
|
+
sourceMap));
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* \brief Parse Property Name from a string given by signature identifier
|
|
387
|
+
*
|
|
388
|
+
* \param node Markdown node of the signature
|
|
389
|
+
* \param pd Section parser data
|
|
390
|
+
* \param subject String representing the property name
|
|
391
|
+
* \param report Parse result report
|
|
392
|
+
* \param propertyName MSON Property Name
|
|
393
|
+
*/
|
|
394
|
+
inline void parsePropertyName(const mdp::MarkdownNodeIterator& node,
|
|
395
|
+
snowcrash::SectionParserData& pd,
|
|
396
|
+
const std::string& subject,
|
|
397
|
+
snowcrash::Report& report,
|
|
398
|
+
PropertyName& propertyName) {
|
|
399
|
+
|
|
400
|
+
std::string buffer = subject;
|
|
401
|
+
|
|
402
|
+
if (checkVariable(subject)) {
|
|
403
|
+
|
|
404
|
+
std::string escapedString = snowcrash::RetrieveEscaped(buffer, 0, true);
|
|
405
|
+
|
|
406
|
+
SignatureTraits traits(SignatureTraits::ValuesTrait |
|
|
407
|
+
SignatureTraits::AttributesTrait);
|
|
408
|
+
|
|
409
|
+
Signature signature = SignatureSectionProcessorBase<PropertyName>::parseSignature(node, pd, traits, report, escapedString);
|
|
410
|
+
|
|
411
|
+
if (!signature.value.empty()) {
|
|
412
|
+
propertyName.variable.values.push_back(parseValue(signature.value));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
parseTypeDefinition(node, pd, signature.attributes, report, propertyName.variable.typeDefinition);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
propertyName.literal = subject;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
#endif
|