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
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// SerializeYAML.h
|
|
3
|
-
// snowcrash
|
|
4
|
-
//
|
|
5
|
-
// Created by Zdenek Nemec on 5/3/13.
|
|
6
|
-
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#ifndef SNOWCRASH_SERIALIZE_YAML_H
|
|
10
|
-
#define SNOWCRASH_SERIALIZE_YAML_H
|
|
11
|
-
|
|
12
|
-
#include <ostream>
|
|
13
|
-
#include "BlueprintSourcemap.h"
|
|
14
|
-
|
|
15
|
-
namespace snowcrash {
|
|
16
|
-
|
|
17
|
-
// Naive YAML serialization to ostream
|
|
18
|
-
void SerializeYAML(const snowcrash::Blueprint& blueprint, std::ostream &os);
|
|
19
|
-
|
|
20
|
-
// Naive Sourcmap YAML serialization to ostream
|
|
21
|
-
void SerializeSourceMapYAML(const snowcrash::SourceMap<snowcrash::Blueprint>& blueprint, std::ostream &os);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
#endif
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Signature.h
|
|
3
|
-
// snowcrash
|
|
4
|
-
//
|
|
5
|
-
// Created by Zdenek Nemec on 5/14/14.
|
|
6
|
-
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#ifndef SNOWCRASH_SIGNATURE_H
|
|
10
|
-
#define SNOWCRASH_SIGNATURE_H
|
|
11
|
-
|
|
12
|
-
#include "MarkdownNode.h"
|
|
13
|
-
#include "Section.h"
|
|
14
|
-
|
|
15
|
-
namespace snowcrash {
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* \brief Query whether a node has keyword-defined signature.
|
|
19
|
-
* \param node A Markdown AST node to check.
|
|
20
|
-
* \return Type of the node if it has a recognized keyword signature, UndefinedType otherwise
|
|
21
|
-
*/
|
|
22
|
-
extern SectionType SectionKeywordSignature(const mdp::MarkdownNodeIterator& node);
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* \brief Recognize the type of section given the first line from a code block
|
|
26
|
-
* \param subject The first line that needs to be recognized
|
|
27
|
-
* \return SectionType Type of the section if the line contains a keyword
|
|
28
|
-
*/
|
|
29
|
-
extern SectionType RecognizeCodeBlockFirstLine(const mdp::ByteBuffer& subject);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
#endif
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// SymbolTable.h
|
|
3
|
-
// snowcrash
|
|
4
|
-
//
|
|
5
|
-
// Created by Zdenek Nemec on 6/9/13.
|
|
6
|
-
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#ifndef SNOWCRASH_SYMBOLTABLE_H
|
|
10
|
-
#define SNOWCRASH_SYMBOLTABLE_H
|
|
11
|
-
|
|
12
|
-
#include <string>
|
|
13
|
-
#include <map>
|
|
14
|
-
#include "ByteBuffer.h"
|
|
15
|
-
#include "RegexMatch.h"
|
|
16
|
-
|
|
17
|
-
#ifdef DEBUG
|
|
18
|
-
#include <iostream>
|
|
19
|
-
#include "Serialize.h"
|
|
20
|
-
#endif
|
|
21
|
-
|
|
22
|
-
#include "BlueprintSourcemap.h"
|
|
23
|
-
#include "StringUtility.h"
|
|
24
|
-
|
|
25
|
-
// Symbol identifier regex
|
|
26
|
-
#define SYMBOL_IDENTIFIER "([^][()]+)"
|
|
27
|
-
|
|
28
|
-
namespace snowcrashconst {
|
|
29
|
-
|
|
30
|
-
/** Symbol reference matching regex */
|
|
31
|
-
const char* const SymbolReferenceRegex("^[[:blank:]]*\\[" SYMBOL_IDENTIFIER "]\\[][[:blank:]]*$");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
namespace snowcrash {
|
|
35
|
-
|
|
36
|
-
// Resource Object Symbol
|
|
37
|
-
typedef std::pair<Identifier, ResourceModel> ResourceModelSymbol;
|
|
38
|
-
|
|
39
|
-
// Resource Object Symbol source map
|
|
40
|
-
typedef std::pair<Identifier, SourceMap<ResourceModel> > ResourceModelSymbolSourceMap;
|
|
41
|
-
|
|
42
|
-
// Resource Object Symbol Table
|
|
43
|
-
typedef std::map<Identifier, ResourceModel> ResourceModelSymbolTable;
|
|
44
|
-
|
|
45
|
-
// Resource Object Symbol Table source map
|
|
46
|
-
typedef std::map<Identifier, SourceMap<ResourceModel> > ResourceModelSymbolSourceMapTable;
|
|
47
|
-
|
|
48
|
-
struct SymbolTable {
|
|
49
|
-
|
|
50
|
-
// Resource Object Symbol Table
|
|
51
|
-
ResourceModelSymbolTable resourceModels;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
struct SymbolSourceMapTable {
|
|
55
|
-
|
|
56
|
-
// Resource Object Symbol Table source map
|
|
57
|
-
ResourceModelSymbolSourceMapTable resourceModels;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// Checks whether given source data represents reference to a symbol returning true if so,
|
|
61
|
-
// false otherwise. If source data is represent reference referred symbol name is filled in.
|
|
62
|
-
inline bool GetSymbolReference(const mdp::ByteBuffer& sourceData,
|
|
63
|
-
Identifier& referredSymbol) {
|
|
64
|
-
|
|
65
|
-
CaptureGroups captureGroups;
|
|
66
|
-
|
|
67
|
-
if (RegexCapture(sourceData, snowcrashconst::SymbolReferenceRegex, captureGroups, 3)) {
|
|
68
|
-
referredSymbol = captureGroups[1];
|
|
69
|
-
TrimString(referredSymbol);
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
#ifdef DEBUG
|
|
77
|
-
// Prints markdown block recursively to stdout
|
|
78
|
-
inline void PrintSymbolTable(const SymbolTable& symbolTable) {
|
|
79
|
-
|
|
80
|
-
std::cout << "Resource Model Symbols:\n";
|
|
81
|
-
for (ResourceModelSymbolTable::const_iterator it = symbolTable.resourceModels.begin();
|
|
82
|
-
it != symbolTable.resourceModels.end();
|
|
83
|
-
++it) {
|
|
84
|
-
|
|
85
|
-
std::cout << "- " << it->first << " - body: '" << EscapeNewlines(it->second.body) << "'\n";
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
std::cout << std::endl;
|
|
89
|
-
}
|
|
90
|
-
#endif
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
#endif
|
data/ext/snowcrash/src/Version.h
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// version.h
|
|
3
|
-
// snowcrash
|
|
4
|
-
//
|
|
5
|
-
// Created by Zdenek Nemec on 4/14/14.
|
|
6
|
-
//
|
|
7
|
-
// Attribution Notice:
|
|
8
|
-
// This work might use parts of Node.js `node_version.h`
|
|
9
|
-
// https://github.com/joyent/node
|
|
10
|
-
//
|
|
11
|
-
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
#ifndef SNOWCRASH_VERSION_H
|
|
15
|
-
#define SNOWCRASH_VERSION_H
|
|
16
|
-
|
|
17
|
-
#define SNOWCRASH_MAJOR_VERSION 0
|
|
18
|
-
#define SNOWCRASH_MINOR_VERSION 16
|
|
19
|
-
#define SNOWCRASH_PATCH_VERSION 1
|
|
20
|
-
|
|
21
|
-
#define SNOWCRASH_VERSION_IS_RELEASE 1
|
|
22
|
-
|
|
23
|
-
#ifndef SNOWCRASH_STRINGIFY
|
|
24
|
-
# define SNOWCRASH_STRINGIFY(n) SNOWCRASH_STRINGIFY_HELPER(n)
|
|
25
|
-
# define SNOWCRASH_STRINGIFY_HELPER(n) #n
|
|
26
|
-
#endif
|
|
27
|
-
|
|
28
|
-
#define SNOWCRASH_VERSION_STRING_HELPER "v" \
|
|
29
|
-
SNOWCRASH_STRINGIFY(SNOWCRASH_MAJOR_VERSION) "." \
|
|
30
|
-
SNOWCRASH_STRINGIFY(SNOWCRASH_MINOR_VERSION) "." \
|
|
31
|
-
SNOWCRASH_STRINGIFY(SNOWCRASH_PATCH_VERSION)
|
|
32
|
-
|
|
33
|
-
#if SNOWCRASH_VERSION_IS_RELEASE
|
|
34
|
-
# define SNOWCRASH_VERSION_STRING SNOWCRASH_VERSION_STRING_HELPER
|
|
35
|
-
#else
|
|
36
|
-
# define SNOWCRASH_VERSION_STRING SNOWCRASH_VERSION_STRING_HELPER "-pre"
|
|
37
|
-
#endif
|
|
38
|
-
|
|
39
|
-
#endif
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// CSnowcrash.cc
|
|
3
|
-
// snowcrash
|
|
4
|
-
//
|
|
5
|
-
// Created by Ali Khoramshahi on 13/6/14.
|
|
6
|
-
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#include "csnowcrash.h"
|
|
10
|
-
#include "snowcrash.h"
|
|
11
|
-
|
|
12
|
-
using namespace snowcrash;
|
|
13
|
-
|
|
14
|
-
int sc_c_parse(const char* source, sc_blueprint_parser_options option, sc_report_t** report, sc_blueprint_t** blueprint, sc_sm_blueprint_t** sm_blueprint)
|
|
15
|
-
{
|
|
16
|
-
Report* resultReport = ::new snowcrash::Report;
|
|
17
|
-
Blueprint* resultblueprint = ::new snowcrash::Blueprint;
|
|
18
|
-
SourceMap<snowcrash::Blueprint>* resultSourceMap = ::new SourceMap<snowcrash::Blueprint>;
|
|
19
|
-
|
|
20
|
-
ParseResultRef<Blueprint> result(*resultReport, *resultblueprint, *resultSourceMap);
|
|
21
|
-
|
|
22
|
-
int ret = snowcrash::parse(source, option, result);
|
|
23
|
-
|
|
24
|
-
*report = AS_TYPE(sc_report_t, resultReport);
|
|
25
|
-
*blueprint = AS_TYPE(sc_blueprint_t, resultblueprint);
|
|
26
|
-
*sm_blueprint = AS_TYPE(sc_sm_blueprint_t, resultSourceMap);
|
|
27
|
-
|
|
28
|
-
return ret;
|
|
29
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// CSnowcrash.h
|
|
3
|
-
// snowcrash
|
|
4
|
-
// C Implementation of Snowcrash.h for binding purposes
|
|
5
|
-
//
|
|
6
|
-
// Created by Ali Khoramshahi on 13/6/14.
|
|
7
|
-
// Copyright (c) 2014 Apiary Inc. All rights reserved.
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
#ifndef SC_C_SNOWCRASH_H
|
|
11
|
-
#define SC_C_SNOWCRASH_H
|
|
12
|
-
|
|
13
|
-
#include "CSourceAnnotation.h"
|
|
14
|
-
#include "CBlueprint.h"
|
|
15
|
-
#include "CBlueprintSourcemap.h"
|
|
16
|
-
|
|
17
|
-
#ifdef __cplusplus
|
|
18
|
-
extern "C" {
|
|
19
|
-
#endif
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* \This is C interface for snowcrash parser.
|
|
23
|
-
*
|
|
24
|
-
* \param source A textual source data to be parsed.
|
|
25
|
-
* \param options Parser options. Use 0 for no addtional options.
|
|
26
|
-
* \param report returns the pointer to report.
|
|
27
|
-
* \param blueprint returns the pointer to blueprint AST.
|
|
28
|
-
*
|
|
29
|
-
* \return Error status code. Zero represents success, non-zero a failure.
|
|
30
|
-
*
|
|
31
|
-
* this function will allocate `report` and `blueprint`, `sm_blueprint`,
|
|
32
|
-
* for deallocation `sc_blueprint_free`, `sc_sm_blueprint_free` and `sc_report_free` should be called.
|
|
33
|
-
*/
|
|
34
|
-
SC_API int sc_c_parse(const char* source, sc_blueprint_parser_options option, sc_report_t** report, sc_blueprint_t** blueprint, sc_sm_blueprint_t** sm_blueprint);
|
|
35
|
-
|
|
36
|
-
#ifdef __cplusplus
|
|
37
|
-
}
|
|
38
|
-
#endif
|
|
39
|
-
|
|
40
|
-
#endif
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// snowcrash.cc
|
|
3
|
-
// snowcrash
|
|
4
|
-
//
|
|
5
|
-
// Created by Zdenek Nemec on 4/27/13.
|
|
6
|
-
// Copyright (c) 2013 Apiary Inc. All rights reserved.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
#include <iostream>
|
|
10
|
-
#include <sstream>
|
|
11
|
-
#include <fstream>
|
|
12
|
-
#include "snowcrash.h"
|
|
13
|
-
#include "SerializeJSON.h"
|
|
14
|
-
#include "SerializeYAML.h"
|
|
15
|
-
#include "cmdline.h"
|
|
16
|
-
#include "Version.h"
|
|
17
|
-
|
|
18
|
-
using snowcrash::SourceAnnotation;
|
|
19
|
-
using snowcrash::Error;
|
|
20
|
-
|
|
21
|
-
static const std::string OutputArgument = "output";
|
|
22
|
-
static const std::string FormatArgument = "format";
|
|
23
|
-
static const std::string RenderArgument = "render";
|
|
24
|
-
static const std::string SourcemapArgument = "sourcemap";
|
|
25
|
-
static const std::string ValidateArgument = "validate";
|
|
26
|
-
static const std::string VersionArgument = "version";
|
|
27
|
-
|
|
28
|
-
/// \enum Snow Crash AST output format.
|
|
29
|
-
enum SerializationFormat {
|
|
30
|
-
YAMLSerializationFormat,
|
|
31
|
-
JSONSerializationFormat
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/// \brief Print Markdown source annotation.
|
|
35
|
-
/// \param prefix A string prefix for the annotation
|
|
36
|
-
/// \param annotation An annotation to print
|
|
37
|
-
void PrintAnnotation(const std::string& prefix, const snowcrash::SourceAnnotation& annotation)
|
|
38
|
-
{
|
|
39
|
-
std::cerr << prefix;
|
|
40
|
-
|
|
41
|
-
if (annotation.code != SourceAnnotation::OK) {
|
|
42
|
-
std::cerr << " (" << annotation.code << ") ";
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (!annotation.message.empty()) {
|
|
46
|
-
std::cerr << " " << annotation.message;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (!annotation.location.empty()) {
|
|
50
|
-
for (mdp::CharactersRangeSet::const_iterator it = annotation.location.begin();
|
|
51
|
-
it != annotation.location.end();
|
|
52
|
-
++it) {
|
|
53
|
-
std::cerr << ((it == annotation.location.begin()) ? " :" : ";");
|
|
54
|
-
std::cerr << it->location << ":" << it->length;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
std::cerr << std::endl;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/// \brief Print parser report to stderr.
|
|
62
|
-
/// \param report A parser report to print
|
|
63
|
-
void PrintReport(const snowcrash::Report& report)
|
|
64
|
-
{
|
|
65
|
-
std::cerr << std::endl;
|
|
66
|
-
|
|
67
|
-
if (report.error.code == Error::OK) {
|
|
68
|
-
std::cerr << "OK.\n";
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
PrintAnnotation("error:", report.error);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
for (snowcrash::Warnings::const_iterator it = report.warnings.begin(); it != report.warnings.end(); ++it) {
|
|
75
|
-
PrintAnnotation("warning:", *it);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
int main(int argc, const char *argv[])
|
|
80
|
-
{
|
|
81
|
-
cmdline::parser argumentParser;
|
|
82
|
-
|
|
83
|
-
argumentParser.set_program_name("snowcrash");
|
|
84
|
-
std::stringstream ss;
|
|
85
|
-
|
|
86
|
-
ss << "<input file>\n\n";
|
|
87
|
-
ss << "API Blueprint Parser\n";
|
|
88
|
-
ss << "If called without <input file>, 'snowcrash' will listen on stdin.\n";
|
|
89
|
-
|
|
90
|
-
argumentParser.footer(ss.str());
|
|
91
|
-
|
|
92
|
-
argumentParser.add<std::string>(OutputArgument, 'o', "save output AST into file", false);
|
|
93
|
-
argumentParser.add<std::string>(FormatArgument, 'f', "output AST format", false, "yaml", cmdline::oneof<std::string>("yaml", "json"));
|
|
94
|
-
argumentParser.add<std::string>(SourcemapArgument, 's', "export sourcemap AST into file", false);
|
|
95
|
-
// TODO: argumentParser.add("render", 'r', "render markdown descriptions");
|
|
96
|
-
argumentParser.add("help", 'h', "display this help message");
|
|
97
|
-
argumentParser.add(VersionArgument, 'v', "print Snow Crash version");
|
|
98
|
-
argumentParser.add(ValidateArgument, 'l', "validate input only, do not print AST");
|
|
99
|
-
|
|
100
|
-
argumentParser.parse_check(argc, argv);
|
|
101
|
-
|
|
102
|
-
// Check arguments
|
|
103
|
-
if (argumentParser.rest().size() > 1) {
|
|
104
|
-
std::cerr << "one input file expected, got " << argumentParser.rest().size() << std::endl;
|
|
105
|
-
exit(EXIT_FAILURE);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Version query
|
|
109
|
-
if (argumentParser.exist(VersionArgument)) {
|
|
110
|
-
std::cout << SNOWCRASH_VERSION_STRING << std::endl;
|
|
111
|
-
exit(EXIT_SUCCESS);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Input
|
|
115
|
-
std::stringstream inputStream;
|
|
116
|
-
if (argumentParser.rest().empty()) {
|
|
117
|
-
// Read stdin
|
|
118
|
-
inputStream << std::cin.rdbuf();
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
// Read from file
|
|
122
|
-
std::ifstream inputFileStream;
|
|
123
|
-
std::string inputFileName = argumentParser.rest().front();
|
|
124
|
-
inputFileStream.open(inputFileName.c_str());
|
|
125
|
-
|
|
126
|
-
if (!inputFileStream.is_open()) {
|
|
127
|
-
std::cerr << "fatal: unable to open input file '" << inputFileName << "'\n";
|
|
128
|
-
exit(EXIT_FAILURE);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
inputStream << inputFileStream.rdbuf();
|
|
132
|
-
inputFileStream.close();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// Initialize
|
|
136
|
-
snowcrash::BlueprintParserOptions options = 0; // Or snowcrash::RequireBlueprintNameOption
|
|
137
|
-
snowcrash::ParseResult<snowcrash::Blueprint> blueprint;
|
|
138
|
-
|
|
139
|
-
if (argumentParser.exist(SourcemapArgument)) {
|
|
140
|
-
options |= snowcrash::ExportSourcemapOption;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Parse
|
|
144
|
-
snowcrash::parse(inputStream.str(), options, blueprint);
|
|
145
|
-
|
|
146
|
-
// Output
|
|
147
|
-
if (!argumentParser.exist(ValidateArgument)) {
|
|
148
|
-
|
|
149
|
-
std::stringstream outputStream;
|
|
150
|
-
std::stringstream sourcemapOutputStream;
|
|
151
|
-
|
|
152
|
-
if (argumentParser.get<std::string>(FormatArgument) == "json") {
|
|
153
|
-
SerializeJSON(blueprint.node, outputStream);
|
|
154
|
-
SerializeSourceMapJSON(blueprint.sourceMap, sourcemapOutputStream);
|
|
155
|
-
}
|
|
156
|
-
else if (argumentParser.get<std::string>(FormatArgument) == "yaml") {
|
|
157
|
-
SerializeYAML(blueprint.node, outputStream);
|
|
158
|
-
SerializeSourceMapYAML(blueprint.sourceMap, sourcemapOutputStream);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
std::string outputFileName = argumentParser.get<std::string>(OutputArgument);
|
|
162
|
-
std::string sourcemapOutputFileName = argumentParser.get<std::string>(SourcemapArgument);
|
|
163
|
-
|
|
164
|
-
if (!outputFileName.empty()) {
|
|
165
|
-
// Serialize to file
|
|
166
|
-
std::ofstream outputFileStream;
|
|
167
|
-
outputFileStream.open(outputFileName.c_str());
|
|
168
|
-
|
|
169
|
-
if (!outputFileStream.is_open()) {
|
|
170
|
-
std::cerr << "fatal: unable to write to file '" << outputFileName << "'\n";
|
|
171
|
-
exit(EXIT_FAILURE);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
outputFileStream << outputStream.rdbuf();
|
|
175
|
-
outputFileStream.close();
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
// Serialize to stdout
|
|
179
|
-
std::cout << outputStream.rdbuf();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (!sourcemapOutputFileName.empty()) {
|
|
183
|
-
// Serialize to file
|
|
184
|
-
std::ofstream sourcemapOutputFileStream;
|
|
185
|
-
sourcemapOutputFileStream.open(sourcemapOutputFileName.c_str());
|
|
186
|
-
|
|
187
|
-
if (!sourcemapOutputFileStream.is_open()) {
|
|
188
|
-
std::cerr << "fatal: unable to write to file '" << sourcemapOutputFileName << "'\n";
|
|
189
|
-
exit(EXIT_FAILURE);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
sourcemapOutputFileStream << sourcemapOutputStream.rdbuf();
|
|
193
|
-
sourcemapOutputFileStream.close();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// report
|
|
198
|
-
PrintReport(blueprint.report);
|
|
199
|
-
return blueprint.report.error.code;
|
|
200
|
-
}
|