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,19 @@
|
|
1
|
+
//
|
2
|
+
// SerializeSourcemap.h
|
3
|
+
// drafter
|
4
|
+
//
|
5
|
+
// Created by Pavan Kumar Sunkara on 18/01/15.
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#ifndef DRAFTER_SERIALIZE_SOURCEMAP_H
|
10
|
+
#define DRAFTER_SERIALIZE_SOURCEMAP_H
|
11
|
+
|
12
|
+
#include "Serialize.h"
|
13
|
+
|
14
|
+
namespace drafter {
|
15
|
+
|
16
|
+
sos::Object WrapBlueprintSourcemap(const snowcrash::SourceMap<snowcrash::Blueprint>& blueprint);
|
17
|
+
}
|
18
|
+
|
19
|
+
#endif
|
@@ -0,0 +1,38 @@
|
|
1
|
+
//
|
2
|
+
// version.h
|
3
|
+
// drafter
|
4
|
+
//
|
5
|
+
// Created by Jiri Kratochvil on 2015-02-13
|
6
|
+
// Attribution Notice:
|
7
|
+
// This work might use parts of Node.js `node_version.h`
|
8
|
+
// https://github.com/joyent/node
|
9
|
+
//
|
10
|
+
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
11
|
+
//
|
12
|
+
|
13
|
+
#ifndef DRAFTER_VERSION_H
|
14
|
+
#define DRAFTER_VERSION_H
|
15
|
+
|
16
|
+
#define DRAFTER_MAJOR_VERSION 0
|
17
|
+
#define DRAFTER_MINOR_VERSION 1
|
18
|
+
#define DRAFTER_PATCH_VERSION 0
|
19
|
+
|
20
|
+
#define DRAFTER_VERSION_IS_RELEASE 1
|
21
|
+
|
22
|
+
#ifndef DRAFTER_STRINGIFY
|
23
|
+
# define DRAFTER_STRINGIFY(n) DRAFTER_STRINGIFY_HELPER(n)
|
24
|
+
# define DRAFTER_STRINGIFY_HELPER(n) #n
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#define DRAFTER_VERSION_STRING_HELPER "v" \
|
28
|
+
DRAFTER_STRINGIFY(DRAFTER_MAJOR_VERSION) "." \
|
29
|
+
DRAFTER_STRINGIFY(DRAFTER_MINOR_VERSION) "." \
|
30
|
+
DRAFTER_STRINGIFY(DRAFTER_PATCH_VERSION)
|
31
|
+
|
32
|
+
#if DRAFTER_VERSION_IS_RELEASE
|
33
|
+
# define DRAFTER_VERSION_STRING DRAFTER_VERSION_STRING_HELPER
|
34
|
+
#else
|
35
|
+
# define DRAFTER_VERSION_STRING DRAFTER_VERSION_STRING_HELPER "-pre"
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#endif
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#include "cdrafter.h"
|
2
|
+
|
3
|
+
#include "snowcrash.h"
|
4
|
+
#include "sosJSON.h"
|
5
|
+
|
6
|
+
#include "SerializeAST.h"
|
7
|
+
#include "SerializeSourcemap.h"
|
8
|
+
#include "SerializeResult.h"
|
9
|
+
|
10
|
+
#include <string.h>
|
11
|
+
|
12
|
+
namespace sc = snowcrash;
|
13
|
+
|
14
|
+
static char* ToString(const std::stringstream& stream)
|
15
|
+
{
|
16
|
+
size_t length = stream.str().length() + 1;
|
17
|
+
char* str = (char*)malloc(length);
|
18
|
+
memcpy(str, stream.str().c_str(), length);
|
19
|
+
return str;
|
20
|
+
}
|
21
|
+
|
22
|
+
SC_API int drafter_c_parse(const char* source,
|
23
|
+
sc_blueprint_parser_options options,
|
24
|
+
char** result)
|
25
|
+
{
|
26
|
+
|
27
|
+
std::stringstream inputStream;
|
28
|
+
|
29
|
+
inputStream << source;
|
30
|
+
|
31
|
+
sc::ParseResult<sc::Blueprint> blueprint;
|
32
|
+
sc::parse(inputStream.str(), options, blueprint);
|
33
|
+
|
34
|
+
sos::SerializeJSON serializer;
|
35
|
+
|
36
|
+
if (result) {
|
37
|
+
std::stringstream resultStream;
|
38
|
+
serializer.process(drafter::WrapResult(blueprint, options), resultStream);
|
39
|
+
resultStream << "\n";
|
40
|
+
*result = ToString(resultStream);
|
41
|
+
}
|
42
|
+
|
43
|
+
return blueprint.report.error.code;
|
44
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
//
|
2
|
+
// cdrafter.h
|
3
|
+
// drafter
|
4
|
+
// C Implementation of drafter lib for binding purposes
|
5
|
+
//
|
6
|
+
// Created by Jiri Kratochvil on 27-02-2015
|
7
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
8
|
+
//
|
9
|
+
|
10
|
+
#ifndef SC_C_DRAFTER_H
|
11
|
+
#define SC_C_DRAFTER_H
|
12
|
+
|
13
|
+
#ifdef __cplusplus
|
14
|
+
extern "C" {
|
15
|
+
#endif
|
16
|
+
|
17
|
+
#include "Platform.h" // use Platform.h from snowcrash - we should probably move it to drafter
|
18
|
+
|
19
|
+
/**
|
20
|
+
* \This is C interface for drafter parser.
|
21
|
+
*
|
22
|
+
* \param source A textual source data to be parsed.
|
23
|
+
* \param options Parser options. Use 0 for no addtional options.
|
24
|
+
* \param result parse result with ast, source map and annotations
|
25
|
+
*
|
26
|
+
* for more info about Result format JSON \see https://github.com/apiaryio/api-blueprint-ast/blob/master/Parse%20Result.md
|
27
|
+
*
|
28
|
+
* \return Error status code. Zero represents success, non-zero a failure.
|
29
|
+
*
|
30
|
+
* This function will allocate memory and returns pointer to
|
31
|
+
* resul. Free allocated memory is responsibility of calling function.
|
32
|
+
* You have to release it by calling standard free() function
|
33
|
+
*
|
34
|
+
* if `result` input is NULL output is not created for param and parsed `source` is just validated
|
35
|
+
*/
|
36
|
+
|
37
|
+
typedef unsigned int sc_blueprint_parser_options;
|
38
|
+
|
39
|
+
/** brief Blueprint Parser Options Enums */
|
40
|
+
enum sc_blueprint_parser_option {
|
41
|
+
SC_RENDER_DESCRIPTIONS_OPTION = (1 << 0), /// < Render Markdown in description.
|
42
|
+
SC_REQUIRE_BLUEPRINT_NAME_OPTION = (1 << 1), /// < Treat missing blueprint name as error
|
43
|
+
SC_EXPORT_SORUCEMAP_OPTION = (1 << 2) /// < Export source maps AST
|
44
|
+
};
|
45
|
+
|
46
|
+
SC_API int drafter_c_parse(const char* source,
|
47
|
+
sc_blueprint_parser_options option,
|
48
|
+
char** result);
|
49
|
+
|
50
|
+
#ifdef __cplusplus
|
51
|
+
}
|
52
|
+
#endif
|
53
|
+
|
54
|
+
#endif
|
55
|
+
|
@@ -0,0 +1,80 @@
|
|
1
|
+
//
|
2
|
+
// vi:cin:et:sw=4 ts=4
|
3
|
+
//
|
4
|
+
// config.cc - part of drafter
|
5
|
+
//
|
6
|
+
// Created by Jiri Kratochvil on 2015-02-13
|
7
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
8
|
+
//
|
9
|
+
|
10
|
+
#include "config.h"
|
11
|
+
#include "cmdline.h"
|
12
|
+
|
13
|
+
#include "Version.h"
|
14
|
+
|
15
|
+
namespace config {
|
16
|
+
static const std::string Program = "drafter";
|
17
|
+
|
18
|
+
static const std::string Output = "output";
|
19
|
+
static const std::string Format = "format";
|
20
|
+
static const std::string Render = "render";
|
21
|
+
static const std::string Sourcemap = "sourcemap";
|
22
|
+
static const std::string Validate = "validate";
|
23
|
+
static const std::string Version = "version";
|
24
|
+
static const std::string UseLineNumbers = "use-line-num";
|
25
|
+
};
|
26
|
+
|
27
|
+
void PrepareCommanLineParser(cmdline::parser& parser)
|
28
|
+
{
|
29
|
+
parser.set_program_name(config::Program);
|
30
|
+
|
31
|
+
parser.add<std::string>(config::Output, 'o', "save output AST into file", false);
|
32
|
+
parser.add<std::string>(config::Format, 'f', "output AST format", false, "yaml", cmdline::oneof<std::string>("yaml", "json"));
|
33
|
+
parser.add<std::string>(config::Sourcemap, 's', "export sourcemap AST into file", false);
|
34
|
+
parser.add("help", 'h', "display this help message");
|
35
|
+
parser.add(config::Version , 'v', "print Drafter version");
|
36
|
+
parser.add(config::Validate, 'l', "validate input only, do not print AST");
|
37
|
+
parser.add(config::UseLineNumbers , 'u', "use line and row number instead of character index when printing annotation");
|
38
|
+
|
39
|
+
std::stringstream ss;
|
40
|
+
|
41
|
+
ss << "<input file>\n\n";
|
42
|
+
ss << "API Blueprint Parser\n";
|
43
|
+
ss << "If called without <input file>, 'drafter' will listen on stdin.\n";
|
44
|
+
|
45
|
+
parser.footer(ss.str());
|
46
|
+
}
|
47
|
+
|
48
|
+
void ValidateParsedCommandLine(const cmdline::parser& parser)
|
49
|
+
{
|
50
|
+
if (parser.rest().size() > 1) {
|
51
|
+
std::cerr << "one input file expected, got " << parser.rest().size() << std::endl;
|
52
|
+
exit(EXIT_FAILURE);
|
53
|
+
}
|
54
|
+
|
55
|
+
if (parser.exist(config::Version)) {
|
56
|
+
std::cout << DRAFTER_VERSION_STRING << std::endl;
|
57
|
+
exit(EXIT_SUCCESS);
|
58
|
+
}
|
59
|
+
|
60
|
+
}
|
61
|
+
|
62
|
+
void ParseCommadLineOptions(int argc, const char *argv[], /* out */Config& conf)
|
63
|
+
{
|
64
|
+
cmdline::parser parser;
|
65
|
+
PrepareCommanLineParser(parser);
|
66
|
+
|
67
|
+
parser.parse_check(argc, argv);
|
68
|
+
|
69
|
+
ValidateParsedCommandLine(parser);
|
70
|
+
|
71
|
+
if (!parser.rest().empty()) {
|
72
|
+
conf.input = parser.rest().front();
|
73
|
+
}
|
74
|
+
|
75
|
+
conf.lineNumbers = parser.exist(config::UseLineNumbers);
|
76
|
+
conf.validate = parser.exist(config::Validate);
|
77
|
+
conf.format = parser.get<std::string>(config::Format);
|
78
|
+
conf.output = parser.get<std::string>(config::Output);
|
79
|
+
conf.sourceMap = parser.get<std::string>(config::Sourcemap);
|
80
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
//
|
2
|
+
// vi:cin:et:sw=4 ts=4
|
3
|
+
//
|
4
|
+
// config.h - part of drafter
|
5
|
+
//
|
6
|
+
// Created by Jiri Kratochvil on 2015-02-13
|
7
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
8
|
+
//
|
9
|
+
#ifndef DRAFTER_CONFIG_H
|
10
|
+
#define DRAFTER_CONFIG_H
|
11
|
+
|
12
|
+
#include <string>
|
13
|
+
|
14
|
+
struct Config {
|
15
|
+
std::string input;
|
16
|
+
bool lineNumbers;
|
17
|
+
bool validate;
|
18
|
+
std::string format;
|
19
|
+
std::string sourceMap;
|
20
|
+
std::string output;
|
21
|
+
};
|
22
|
+
|
23
|
+
/**
|
24
|
+
* \brief parse commandline params
|
25
|
+
*
|
26
|
+
* \param argc argc as received to main()
|
27
|
+
* \param argv argv as received to main()
|
28
|
+
* \param conf output - parsed parameters
|
29
|
+
*
|
30
|
+
* side effect - can call exit() if wrong params are sent to program
|
31
|
+
*/
|
32
|
+
void ParseCommadLineOptions(int argc, const char *argv[], /** out */Config& conf);
|
33
|
+
|
34
|
+
|
35
|
+
#endif /* end of include guard: DRAFTER_CONFIG_H */
|
@@ -0,0 +1,22 @@
|
|
1
|
+
//
|
2
|
+
// drafter.cc
|
3
|
+
//
|
4
|
+
// drafter
|
5
|
+
//
|
6
|
+
// Created by Jiri Kratochvil on 2015-03-05
|
7
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
8
|
+
//
|
9
|
+
#include "drafter.h"
|
10
|
+
|
11
|
+
namespace drafter {
|
12
|
+
|
13
|
+
/**
|
14
|
+
* For now just redirect to snowcrash::parse()
|
15
|
+
*/
|
16
|
+
int ParseBlueprint(const mdp::ByteBuffer& source,
|
17
|
+
snowcrash::BlueprintParserOptions options,
|
18
|
+
const snowcrash::ParseResultRef<snowcrash::Blueprint>& out)
|
19
|
+
{
|
20
|
+
return snowcrash::parse(source, options, out);
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
//
|
2
|
+
// drafter.h
|
3
|
+
//
|
4
|
+
// drafter
|
5
|
+
//
|
6
|
+
// Created by Jiri Kratochvil on 2015-03-05
|
7
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
8
|
+
//
|
9
|
+
|
10
|
+
#ifndef DRAFTER_H
|
11
|
+
#define DRAFTER_H
|
12
|
+
|
13
|
+
#include "snowcrash.h"
|
14
|
+
|
15
|
+
|
16
|
+
/**
|
17
|
+
* API Blueprint Parser Interface
|
18
|
+
* ------------------------------
|
19
|
+
*
|
20
|
+
* This is the parser's entry point.
|
21
|
+
*/
|
22
|
+
|
23
|
+
namespace drafter {
|
24
|
+
|
25
|
+
/**
|
26
|
+
* \brief Parse the source data into a blueprint abstract source tree (AST).
|
27
|
+
*
|
28
|
+
* \param source A textual source data to be parsed.
|
29
|
+
* \param options Parser options. Use 0 for no additional options.
|
30
|
+
* \param out Output buffer to store parsing result into.
|
31
|
+
* \return Error status code. Zero represents success, non-zero a failure.
|
32
|
+
*/
|
33
|
+
int ParseBlueprint(const mdp::ByteBuffer& source,
|
34
|
+
snowcrash::BlueprintParserOptions options,
|
35
|
+
const snowcrash::ParseResultRef<snowcrash::Blueprint>& out);
|
36
|
+
}
|
37
|
+
|
38
|
+
#endif // #ifndef DRAFTER_H
|
@@ -0,0 +1,91 @@
|
|
1
|
+
// vi:cin:et:sw=4 ts=4
|
2
|
+
//
|
3
|
+
// drafter.cc
|
4
|
+
//
|
5
|
+
// Created by Jiri Kratochvil on 2015-02-11
|
6
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
|
10
|
+
#include "snowcrash.h"
|
11
|
+
#include "SectionParserData.h" // snowcrash::BlueprintParserOptions
|
12
|
+
|
13
|
+
#include "sos.h"
|
14
|
+
#include "sosJSON.h"
|
15
|
+
#include "sosYAML.h"
|
16
|
+
|
17
|
+
#include "SerializeAST.h"
|
18
|
+
#include "SerializeSourcemap.h"
|
19
|
+
|
20
|
+
#include "reporting.h"
|
21
|
+
#include "config.h"
|
22
|
+
#include "stream.h"
|
23
|
+
|
24
|
+
namespace sc = snowcrash;
|
25
|
+
|
26
|
+
/**
|
27
|
+
* \brief return instance sos::Serializer based on \param `format`
|
28
|
+
*
|
29
|
+
* \param format - output format for serialization
|
30
|
+
*/
|
31
|
+
sos::Serialize* CreateSerializer(const std::string& format)
|
32
|
+
{
|
33
|
+
if (format == "json") {
|
34
|
+
return new sos::SerializeJSON;
|
35
|
+
} else if (format == "yaml") {
|
36
|
+
return new sos::SerializeYAML;
|
37
|
+
}
|
38
|
+
|
39
|
+
std::cerr << "fatal: unknow serialization format: '" << format << "'\n";
|
40
|
+
exit(EXIT_FAILURE);
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* \brief Serialize sos::Object into stream
|
45
|
+
*/
|
46
|
+
void Serialization(std::ostream *stream,
|
47
|
+
const sos::Object& object,
|
48
|
+
sos::Serialize* serializer)
|
49
|
+
{
|
50
|
+
serializer->process(object, *stream);
|
51
|
+
*stream << "\n";
|
52
|
+
*stream << std::flush;
|
53
|
+
}
|
54
|
+
|
55
|
+
int main(int argc, const char *argv[])
|
56
|
+
{
|
57
|
+
Config config;
|
58
|
+
ParseCommadLineOptions(argc, argv, config);
|
59
|
+
|
60
|
+
sc::BlueprintParserOptions options = 0; // Or snowcrash::RequireBlueprintNameOption
|
61
|
+
if (!config.sourceMap.empty()) {
|
62
|
+
options |= snowcrash::ExportSourcemapOption;
|
63
|
+
}
|
64
|
+
|
65
|
+
std::stringstream inputStream;
|
66
|
+
std::auto_ptr<std::istream> in(CreateStreamFromName<std::istream>(config.input));
|
67
|
+
inputStream << in->rdbuf();
|
68
|
+
|
69
|
+
sc::ParseResult<sc::Blueprint> blueprint;
|
70
|
+
sc::parse(inputStream.str(), options, blueprint);
|
71
|
+
|
72
|
+
if (!config.validate) { // not just validate -> we will serialize
|
73
|
+
sos::Serialize* serializer = CreateSerializer(config.format);
|
74
|
+
|
75
|
+
Serialization(CreateStreamFromName<std::ostream>(config.output),
|
76
|
+
drafter::WrapBlueprint(blueprint.node),
|
77
|
+
serializer);
|
78
|
+
|
79
|
+
if (options & snowcrash::ExportSourcemapOption) {
|
80
|
+
Serialization(CreateStreamFromName<std::ostream>(config.sourceMap),
|
81
|
+
drafter::WrapBlueprintSourcemap(blueprint.sourceMap),
|
82
|
+
serializer);
|
83
|
+
}
|
84
|
+
|
85
|
+
delete serializer;
|
86
|
+
}
|
87
|
+
|
88
|
+
PrintReport(blueprint.report, inputStream.str(), config.lineNumbers);
|
89
|
+
|
90
|
+
return blueprint.report.error.code;
|
91
|
+
}
|
@@ -0,0 +1,162 @@
|
|
1
|
+
//
|
2
|
+
// vi:cin:et:sw=4 ts=4
|
3
|
+
//
|
4
|
+
// reporting.cc - part of drafter
|
5
|
+
//
|
6
|
+
// Created by Jiri Kratochvil on 2015-02-13
|
7
|
+
// Copyright (c) 2015 Apiary Inc. All rights reserved.
|
8
|
+
//
|
9
|
+
|
10
|
+
#include "reporting.h"
|
11
|
+
|
12
|
+
#include <algorithm>
|
13
|
+
#include <iostream>
|
14
|
+
|
15
|
+
namespace sc = snowcrash;
|
16
|
+
|
17
|
+
/** structure contains starting and ending position of a error/warning. */
|
18
|
+
struct AnnotationPosition {
|
19
|
+
size_t fromLine;
|
20
|
+
size_t fromColumn;
|
21
|
+
size_t toLine;
|
22
|
+
size_t toColumn;
|
23
|
+
};
|
24
|
+
|
25
|
+
/**
|
26
|
+
* \brief Convert character index mapping to line and column number
|
27
|
+
* \param linesEndIndex Vector containing indexes of end line characters
|
28
|
+
* \param range Character index mapping as input
|
29
|
+
* \param out Position of the given range as output
|
30
|
+
*/
|
31
|
+
void GetLineFromMap(const std::vector<size_t>& linesEndIndex,
|
32
|
+
const mdp::Range& range,
|
33
|
+
AnnotationPosition& out)
|
34
|
+
{
|
35
|
+
|
36
|
+
std::vector<size_t>::const_iterator annotationPositionIt;
|
37
|
+
|
38
|
+
out.fromLine = 0;
|
39
|
+
out.fromColumn = 0;
|
40
|
+
out.toLine = 0;
|
41
|
+
out.toColumn = 0;
|
42
|
+
|
43
|
+
// Finds starting line and column position
|
44
|
+
annotationPositionIt = std::upper_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location) - 1;
|
45
|
+
|
46
|
+
if (annotationPositionIt != linesEndIndex.end()) {
|
47
|
+
|
48
|
+
out.fromLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1;
|
49
|
+
out.fromColumn = range.location - *annotationPositionIt + 1;
|
50
|
+
}
|
51
|
+
|
52
|
+
// Finds ending line and column position
|
53
|
+
annotationPositionIt = std::lower_bound(linesEndIndex.begin(), linesEndIndex.end(), range.location + range.length) - 1;
|
54
|
+
|
55
|
+
if (annotationPositionIt != linesEndIndex.end()) {
|
56
|
+
|
57
|
+
out.toLine = std::distance(linesEndIndex.begin(), annotationPositionIt) + 1;
|
58
|
+
out.toColumn = (range.location + range.length) - *annotationPositionIt + 1;
|
59
|
+
|
60
|
+
if (*(annotationPositionIt + 1) == (range.location + range.length)) {
|
61
|
+
out.toColumn--;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* \brief Given the source returns the length of all the lines in source as a vector
|
68
|
+
* \param source Source data
|
69
|
+
* \param out Vector containing indexes of all end line character in source
|
70
|
+
*/
|
71
|
+
void GetLinesEndIndex(const std::string& source,
|
72
|
+
std::vector<size_t>& out)
|
73
|
+
{
|
74
|
+
|
75
|
+
out.push_back(0);
|
76
|
+
|
77
|
+
for (size_t i = 0; i < source.length(); i++) {
|
78
|
+
|
79
|
+
if (source[i] == '\n') {
|
80
|
+
out.push_back(i + 1);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
/**
|
86
|
+
* \brief Print Markdown source annotation.
|
87
|
+
* \param prefix A string prefix for the annotation
|
88
|
+
* \param annotation An annotation to print
|
89
|
+
* \param source Source data
|
90
|
+
* \param isUseLineNumbers True if the annotations needs to be printed by line and column number
|
91
|
+
*/
|
92
|
+
void PrintAnnotation(const std::string& prefix,
|
93
|
+
const snowcrash::SourceAnnotation& annotation,
|
94
|
+
const std::string& source,
|
95
|
+
const bool isUseLineNumbers)
|
96
|
+
{
|
97
|
+
|
98
|
+
std::cerr << prefix;
|
99
|
+
|
100
|
+
if (annotation.code != sc::SourceAnnotation::OK) {
|
101
|
+
std::cerr << " (" << annotation.code << ") ";
|
102
|
+
}
|
103
|
+
|
104
|
+
if (!annotation.message.empty()) {
|
105
|
+
std::cerr << " " << annotation.message;
|
106
|
+
}
|
107
|
+
|
108
|
+
std::vector<size_t> linesEndIndex;
|
109
|
+
|
110
|
+
if (isUseLineNumbers) {
|
111
|
+
GetLinesEndIndex(source, linesEndIndex);
|
112
|
+
}
|
113
|
+
|
114
|
+
if (!annotation.location.empty()) {
|
115
|
+
|
116
|
+
for (mdp::CharactersRangeSet::const_iterator it = annotation.location.begin();
|
117
|
+
it != annotation.location.end();
|
118
|
+
++it) {
|
119
|
+
|
120
|
+
if (isUseLineNumbers) {
|
121
|
+
|
122
|
+
AnnotationPosition annotationPosition;
|
123
|
+
GetLineFromMap(linesEndIndex, *it, annotationPosition);
|
124
|
+
|
125
|
+
std::cerr << "; line " << annotationPosition.fromLine << ", column " << annotationPosition.fromColumn;
|
126
|
+
std::cerr << " - line " << annotationPosition.toLine << ", column " << annotationPosition.toColumn;
|
127
|
+
}
|
128
|
+
else {
|
129
|
+
|
130
|
+
std::cerr << ((it == annotation.location.begin()) ? " :" : ";");
|
131
|
+
std::cerr << it->location << ":" << it->length;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
std::cerr << std::endl;
|
137
|
+
}
|
138
|
+
|
139
|
+
/**
|
140
|
+
* \brief Print parser report to stderr.
|
141
|
+
* \param report A parser report to print
|
142
|
+
* \param source Source data
|
143
|
+
* \param isUseLineNumbers True if the annotations needs to be printed by line and column number
|
144
|
+
*/
|
145
|
+
void PrintReport(const snowcrash::Report& report,
|
146
|
+
const std::string& source,
|
147
|
+
const bool isUseLineNumbers)
|
148
|
+
{
|
149
|
+
|
150
|
+
std::cerr << std::endl;
|
151
|
+
|
152
|
+
if (report.error.code == sc::Error::OK) {
|
153
|
+
std::cerr << "OK.\n";
|
154
|
+
}
|
155
|
+
else {
|
156
|
+
PrintAnnotation("error:", report.error, source, isUseLineNumbers);
|
157
|
+
}
|
158
|
+
|
159
|
+
for (snowcrash::Warnings::const_iterator it = report.warnings.begin(); it != report.warnings.end(); ++it) {
|
160
|
+
PrintAnnotation("warning:", *it, source, isUseLineNumbers);
|
161
|
+
}
|
162
|
+
}
|