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.
Files changed (302) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/Rakefile +4 -4
  4. data/ext/drafter/Makefile +54 -0
  5. data/ext/drafter/appveyor.yml +10 -0
  6. data/ext/drafter/bin/drafter +0 -0
  7. data/ext/{snowcrash → drafter}/build/Makefile +29 -14
  8. data/ext/{snowcrash/build/snowcrash.Makefile → drafter/build/drafter.Makefile} +1 -1
  9. data/ext/{snowcrash/build/snowcrash.target.mk → drafter/build/drafter.target.mk} +25 -23
  10. data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/libmarkdownparser.target.mk +7 -7
  11. data/ext/drafter/build/ext/snowcrash/libsnowcrash.target.mk +152 -0
  12. data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/libsundown.target.mk +13 -13
  13. data/ext/{snowcrash/build → drafter/build/ext/snowcrash}/perf-libsnowcrash.target.mk +14 -20
  14. data/ext/drafter/build/ext/snowcrash/snowcrash.Makefile +6 -0
  15. data/ext/{snowcrash → drafter}/build/gyp-mac-tool +0 -0
  16. data/ext/{snowcrash/build/libsnowcrash.target.mk → drafter/build/libdrafter.target.mk} +29 -36
  17. data/ext/drafter/build/libsos.target.mk +133 -0
  18. data/ext/drafter/build/out/Release/drafter +0 -0
  19. data/ext/drafter/build/out/Release/libdrafter.dylib +0 -0
  20. data/ext/drafter/build/out/Release/libmarkdownparser.a +0 -0
  21. data/ext/drafter/build/out/Release/libsnowcrash.a +0 -0
  22. data/ext/drafter/build/out/Release/libsos.a +0 -0
  23. data/ext/{snowcrash → drafter}/build/out/Release/libsundown.a +0 -0
  24. data/ext/{snowcrash → drafter}/build/out/Release/linker.lock +0 -0
  25. data/ext/drafter/build/out/Release/obj.target/drafter/src/config.o +0 -0
  26. data/ext/drafter/build/out/Release/obj.target/drafter/src/main.o +0 -0
  27. data/ext/drafter/build/out/Release/obj.target/drafter/src/reporting.o +0 -0
  28. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Serialize.o +0 -0
  29. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeAST.o +0 -0
  30. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeResult.o +0 -0
  31. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeSourcemap.o +0 -0
  32. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/cdrafter.o +0 -0
  33. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter.o +0 -0
  34. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o +0 -0
  35. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.o +0 -0
  36. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.o +0 -0
  37. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Blueprint.o +0 -0
  38. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/BlueprintSourcemap.o +0 -0
  39. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HTTP.o +0 -0
  40. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HeadersParser.o +0 -0
  41. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSON.o +0 -0
  42. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONOneOfParser.o +0 -0
  43. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONSourcemap.o +0 -0
  44. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONTypeSectionParser.o +0 -0
  45. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONValueMemberParser.o +0 -0
  46. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Section.o +0 -0
  47. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Signature.o +0 -0
  48. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/UriTemplateParser.o +0 -0
  49. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/posix/RegexMatch.o +0 -0
  50. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/snowcrash.o +0 -0
  51. data/ext/drafter/build/out/Release/obj.target/libsos/ext/sos/src/sos.o +0 -0
  52. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
  53. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
  54. 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
  55. 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
  56. 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
  57. 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
  58. 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
  59. 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
  60. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
  61. data/ext/drafter/circle.yml +12 -0
  62. data/ext/{snowcrash → drafter}/config.gypi +1 -1
  63. data/ext/{snowcrash → drafter}/config.mk +0 -0
  64. data/ext/{snowcrash → drafter}/configure +16 -5
  65. data/ext/drafter/drafter.gyp +118 -0
  66. data/ext/{snowcrash → drafter/ext/snowcrash}/Makefile +4 -12
  67. data/ext/{snowcrash → drafter/ext/snowcrash}/Vagrantfile +14 -4
  68. data/ext/drafter/ext/snowcrash/appveyor.yml +7 -0
  69. data/ext/{snowcrash → drafter/ext/snowcrash}/common.gypi +0 -0
  70. data/ext/drafter/ext/snowcrash/configure +197 -0
  71. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/Makefile +0 -0
  72. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/CONTRIBUTING.md +0 -0
  73. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/Makefile +0 -0
  74. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/Makefile.win +0 -0
  75. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/examples/smartypants.c +0 -0
  76. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/examples/sundown.c +0 -0
  77. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini.h +0 -0
  78. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini_href_e.c +0 -0
  79. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/houdini_html_e.c +0 -0
  80. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.c +0 -0
  81. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html.h +0 -0
  82. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html/html_smartypants.c +0 -0
  83. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/html_block_names.txt +0 -0
  84. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.c +0 -0
  85. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/autolink.h +0 -0
  86. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.c +0 -0
  87. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/buffer.h +0 -0
  88. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/html_blocks.h +0 -0
  89. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.c +0 -0
  90. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/markdown.h +0 -0
  91. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.c +0 -0
  92. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/src_map.h +0 -0
  93. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/stack.c +0 -0
  94. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/src/stack.h +0 -0
  95. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/ext/sundown/sundown.def +0 -0
  96. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/markdown/markdown.vcproj +0 -0
  97. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/msvc.sln +0 -0
  98. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/msvc/sundown/sundown.vcproj +0 -0
  99. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/ByteBuffer.cc +0 -0
  100. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/ByteBuffer.h +0 -0
  101. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownNode.cc +0 -0
  102. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownNode.h +0 -0
  103. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownParser.cc +0 -0
  104. data/ext/{snowcrash → drafter/ext/snowcrash}/ext/markdown-parser/src/MarkdownParser.h +10 -2
  105. data/ext/{snowcrash → drafter/ext/snowcrash}/provisioning.sh +0 -0
  106. data/ext/{snowcrash → drafter/ext/snowcrash}/snowcrash.gyp +41 -39
  107. data/ext/{snowcrash → drafter/ext/snowcrash}/snowcrash.xcworkspace/contents.xcworkspacedata +0 -0
  108. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ActionParser.h +50 -6
  109. data/ext/{snowcrash → drafter/ext/snowcrash}/src/AssetParser.h +1 -12
  110. data/ext/drafter/ext/snowcrash/src/AttributesParser.h +121 -0
  111. data/ext/drafter/ext/snowcrash/src/Blueprint.cc +90 -0
  112. data/ext/{snowcrash → drafter/ext/snowcrash}/src/Blueprint.h +169 -33
  113. data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintParser.h +305 -48
  114. data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.cc +81 -0
  115. data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintSourcemap.h +130 -39
  116. data/ext/{snowcrash → drafter/ext/snowcrash}/src/BlueprintUtility.h +10 -4
  117. data/ext/{snowcrash → drafter/ext/snowcrash}/src/CodeBlockUtility.h +1 -1
  118. data/ext/drafter/ext/snowcrash/src/DataStructureGroupParser.h +154 -0
  119. data/ext/{snowcrash → drafter/ext/snowcrash}/src/HTTP.cc +0 -0
  120. data/ext/{snowcrash → drafter/ext/snowcrash}/src/HTTP.h +0 -0
  121. data/ext/drafter/ext/snowcrash/src/HeadersParser.cc +110 -0
  122. data/ext/{snowcrash → drafter/ext/snowcrash}/src/HeadersParser.h +123 -54
  123. data/ext/drafter/ext/snowcrash/src/MSON.cc +272 -0
  124. data/ext/drafter/ext/snowcrash/src/MSON.h +399 -0
  125. data/ext/drafter/ext/snowcrash/src/MSONMixinParser.h +95 -0
  126. data/ext/drafter/ext/snowcrash/src/MSONNamedTypeParser.h +108 -0
  127. data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.cc +132 -0
  128. data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.h +80 -0
  129. data/ext/drafter/ext/snowcrash/src/MSONParameterParser.h +232 -0
  130. data/ext/drafter/ext/snowcrash/src/MSONPropertyMemberParser.h +91 -0
  131. data/ext/drafter/ext/snowcrash/src/MSONSourcemap.cc +141 -0
  132. data/ext/drafter/ext/snowcrash/src/MSONSourcemap.h +181 -0
  133. data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.cc +209 -0
  134. data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.h +213 -0
  135. data/ext/drafter/ext/snowcrash/src/MSONUtility.h +423 -0
  136. data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.cc +179 -0
  137. data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.h +346 -0
  138. data/ext/drafter/ext/snowcrash/src/ModelTable.h +87 -0
  139. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ParameterParser.h +120 -61
  140. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ParametersParser.h +17 -18
  141. data/ext/{snowcrash → drafter/ext/snowcrash}/src/PayloadParser.h +36 -18
  142. data/ext/{snowcrash → drafter/ext/snowcrash}/src/Platform.h +0 -0
  143. data/ext/{snowcrash → drafter/ext/snowcrash}/src/RegexMatch.h +0 -0
  144. data/ext/drafter/ext/snowcrash/src/RelationParser.h +75 -0
  145. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ResourceGroupParser.h +127 -33
  146. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ResourceParser.h +126 -33
  147. data/ext/{snowcrash → drafter/ext/snowcrash}/src/Section.cc +6 -0
  148. data/ext/{snowcrash → drafter/ext/snowcrash}/src/Section.h +15 -2
  149. data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionParser.h +3 -1
  150. data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionParserData.h +15 -5
  151. data/ext/{snowcrash → drafter/ext/snowcrash}/src/SectionProcessor.h +24 -0
  152. data/ext/{snowcrash → drafter/ext/snowcrash}/src/Signature.cc +14 -0
  153. data/ext/drafter/ext/snowcrash/src/Signature.h +80 -0
  154. data/ext/drafter/ext/snowcrash/src/SignatureSectionProcessor.h +439 -0
  155. data/ext/{snowcrash → drafter/ext/snowcrash}/src/SourceAnnotation.h +3 -2
  156. data/ext/{snowcrash → drafter/ext/snowcrash}/src/StringUtility.h +103 -6
  157. data/ext/{snowcrash → drafter/ext/snowcrash}/src/UriTemplateParser.cc +0 -0
  158. data/ext/{snowcrash → drafter/ext/snowcrash}/src/UriTemplateParser.h +0 -0
  159. data/ext/{snowcrash → drafter/ext/snowcrash}/src/ValuesParser.h +1 -13
  160. data/ext/{snowcrash → drafter/ext/snowcrash}/src/posix/RegexMatch.cc +0 -0
  161. data/ext/{snowcrash → drafter/ext/snowcrash}/src/snowcrash.cc +0 -0
  162. data/ext/{snowcrash → drafter/ext/snowcrash}/src/snowcrash.h +0 -0
  163. data/ext/{snowcrash → drafter/ext/snowcrash}/src/win/RegexMatch.cc +0 -0
  164. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/AUTHORS +0 -0
  165. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/DEPS +0 -0
  166. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/OWNERS +0 -0
  167. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/PRESUBMIT.py +0 -0
  168. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/buildbot/buildbot_run.py +0 -0
  169. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/codereview.settings +0 -0
  170. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/data/win/large-pdb-shim.cc +0 -0
  171. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp +0 -0
  172. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp.bat +0 -0
  173. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/gyp_main.py +0 -0
  174. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSNew.py +0 -0
  175. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSProject.py +0 -0
  176. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSSettings.py +0 -0
  177. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSToolFile.py +0 -0
  178. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSUserFile.py +0 -0
  179. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSUtil.py +0 -0
  180. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/MSVSVersion.py +0 -0
  181. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/__init__.py +0 -0
  182. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/__init__.pyc +0 -0
  183. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/common.py +0 -0
  184. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
  185. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/easy_xml.py +0 -0
  186. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/flock_tool.py +0 -0
  187. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/__init__.py +0 -0
  188. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
  189. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/android.py +0 -0
  190. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/cmake.py +0 -0
  191. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -0
  192. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/eclipse.py +0 -0
  193. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/gypd.py +0 -0
  194. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/gypsh.py +0 -0
  195. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/make.py +0 -0
  196. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
  197. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/msvs.py +0 -0
  198. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/ninja.py +0 -0
  199. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/xcode.py +0 -0
  200. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
  201. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/input.py +0 -0
  202. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/input.pyc +0 -0
  203. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/mac_tool.py +0 -0
  204. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/msvs_emulation.py +0 -0
  205. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/ninja_syntax.py +0 -0
  206. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/ordered_dict.py +0 -0
  207. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/win_tool.py +0 -0
  208. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcode_emulation.py +0 -0
  209. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
  210. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcodeproj_file.py +0 -0
  211. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
  212. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylib/gyp/xml_fix.py +0 -0
  213. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/pylintrc +0 -0
  214. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/samples/samples +0 -0
  215. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/samples/samples.bat +0 -0
  216. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/setup.py +0 -0
  217. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +0 -0
  218. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +0 -0
  219. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/emacs/gyp.el +0 -0
  220. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/graphviz.py +0 -0
  221. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_gyp.py +0 -0
  222. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_sln.py +0 -0
  223. data/ext/{snowcrash → drafter/ext/snowcrash}/tools/gyp/tools/pretty_vcproj.py +0 -0
  224. data/ext/drafter/ext/snowcrash/vcbuild.bat +139 -0
  225. data/ext/drafter/ext/sos/Makefile +57 -0
  226. data/ext/drafter/ext/sos/src/sos.cc +200 -0
  227. data/ext/drafter/ext/sos/src/sos.h +179 -0
  228. data/ext/drafter/ext/sos/src/sosJSON.h +105 -0
  229. data/ext/drafter/ext/sos/src/sosYAML.h +104 -0
  230. data/ext/{snowcrash → drafter}/src/Serialize.cc +30 -15
  231. data/ext/drafter/src/Serialize.h +135 -0
  232. data/ext/drafter/src/SerializeAST.cc +775 -0
  233. data/ext/drafter/src/SerializeAST.h +19 -0
  234. data/ext/drafter/src/SerializeResult.cc +67 -0
  235. data/ext/drafter/src/SerializeResult.h +26 -0
  236. data/ext/drafter/src/SerializeSourcemap.cc +446 -0
  237. data/ext/drafter/src/SerializeSourcemap.h +19 -0
  238. data/ext/drafter/src/Version.h +38 -0
  239. data/ext/drafter/src/cdrafter.cc +44 -0
  240. data/ext/drafter/src/cdrafter.h +55 -0
  241. data/ext/drafter/src/config.cc +80 -0
  242. data/ext/drafter/src/config.h +35 -0
  243. data/ext/drafter/src/drafter.cc +22 -0
  244. data/ext/drafter/src/drafter.h +38 -0
  245. data/ext/drafter/src/main.cc +91 -0
  246. data/ext/drafter/src/reporting.cc +162 -0
  247. data/ext/drafter/src/reporting.h +28 -0
  248. data/ext/drafter/src/stream.h +146 -0
  249. data/ext/drafter/tools/homebrew/drafter.rb +12 -0
  250. data/ext/{snowcrash → drafter}/vcbuild.bat +3 -3
  251. data/lib/redsnow.rb +6 -11
  252. data/lib/redsnow/binding.rb +11 -201
  253. data/lib/redsnow/blueprint.rb +104 -169
  254. data/lib/redsnow/parseresult.rb +28 -42
  255. data/lib/redsnow/sourcemap.rb +92 -177
  256. data/lib/redsnow/version.rb +1 -1
  257. data/redsnow.gemspec +1 -1
  258. metadata +249 -197
  259. data/ext/snowcrash/bin/snowcrash +0 -0
  260. data/ext/snowcrash/build/out/Release/libmarkdownparser.a +0 -0
  261. data/ext/snowcrash/build/out/Release/libsnowcrash.dylib +0 -0
  262. data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/ByteBuffer.o +0 -0
  263. data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownNode.o +0 -0
  264. data/ext/snowcrash/build/out/Release/obj.target/libmarkdownparser/ext/markdown-parser/src/MarkdownParser.o +0 -0
  265. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprint.o +0 -0
  266. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CBlueprintSourcemap.o +0 -0
  267. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/CSourceAnnotation.o +0 -0
  268. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/HTTP.o +0 -0
  269. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Section.o +0 -0
  270. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Serialize.o +0 -0
  271. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeJSON.o +0 -0
  272. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/SerializeYAML.o +0 -0
  273. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/Signature.o +0 -0
  274. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/UriTemplateParser.o +0 -0
  275. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/csnowcrash.o +0 -0
  276. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/posix/RegexMatch.o +0 -0
  277. data/ext/snowcrash/build/out/Release/obj.target/libsnowcrash/src/snowcrash.o +0 -0
  278. data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
  279. data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
  280. data/ext/snowcrash/build/out/Release/obj.target/libsundown/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
  281. data/ext/snowcrash/build/out/Release/obj.target/snowcrash/src/snowcrash/snowcrash.o +0 -0
  282. data/ext/snowcrash/build/out/Release/snowcrash +0 -0
  283. data/ext/snowcrash/src/CBlueprint.cc +0 -628
  284. data/ext/snowcrash/src/CBlueprint.h +0 -366
  285. data/ext/snowcrash/src/CBlueprintSourcemap.cc +0 -630
  286. data/ext/snowcrash/src/CBlueprintSourcemap.h +0 -351
  287. data/ext/snowcrash/src/CSourceAnnotation.cc +0 -154
  288. data/ext/snowcrash/src/CSourceAnnotation.h +0 -106
  289. data/ext/snowcrash/src/Serialize.h +0 -71
  290. data/ext/snowcrash/src/SerializeJSON.cc +0 -1221
  291. data/ext/snowcrash/src/SerializeJSON.h +0 -24
  292. data/ext/snowcrash/src/SerializeYAML.cc +0 -702
  293. data/ext/snowcrash/src/SerializeYAML.h +0 -24
  294. data/ext/snowcrash/src/Signature.h +0 -32
  295. data/ext/snowcrash/src/SymbolTable.h +0 -94
  296. data/ext/snowcrash/src/Version.h +0 -39
  297. data/ext/snowcrash/src/csnowcrash.cc +0 -29
  298. data/ext/snowcrash/src/csnowcrash.h +0 -40
  299. data/ext/snowcrash/src/snowcrash/snowcrash.cc +0 -200
  300. data/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
  301. data/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
  302. data/ext/snowcrash/tools/homebrew/snowcrash.rb +0 -12
@@ -0,0 +1,19 @@
1
+ //
2
+ // SerializeAST.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_AST_H
10
+ #define DRAFTER_SERIALIZE_AST_H
11
+
12
+ #include "Serialize.h"
13
+
14
+ namespace drafter {
15
+
16
+ sos::Object WrapBlueprint(const snowcrash::Blueprint& blueprint);
17
+ }
18
+
19
+ #endif
@@ -0,0 +1,67 @@
1
+ //
2
+ // SerializeResult.cc
3
+ // drafter
4
+ //
5
+ // Created by Jiri Kratochvil on 27-02-2015
6
+ // Copyright (c) 2015 Apiary Inc. All rights reserved.
7
+ //
8
+
9
+ #include "SerializeResult.h"
10
+ #include "SerializeSourcemap.h"
11
+ #include "SerializeAST.h"
12
+
13
+ #include "SourceAnnotation.h"
14
+
15
+ #include "SectionProcessor.h"
16
+ #include "Blueprint.h"
17
+
18
+ #include <stdio.h>
19
+
20
+ using namespace drafter;
21
+
22
+ static sos::Object WrapLocation(const mdp::BytesRange& range)
23
+ {
24
+ sos::Object location;
25
+
26
+ location.set(SerializeKey::AnnotationLocationIndex, sos::Number(range.location));
27
+ location.set(SerializeKey::AnnotationLocationLength, sos::Number(range.length));
28
+
29
+ return location;
30
+ }
31
+
32
+ static sos::Object WrapAnnotation(const snowcrash::SourceAnnotation& annotation)
33
+ {
34
+ sos::Object object;
35
+
36
+ object.set(SerializeKey::AnnotationCode, sos::Number(annotation.code));
37
+ object.set(SerializeKey::AnnotationMessage, sos::String(annotation.message));
38
+ object.set(SerializeKey::AnnotationLocation, WrapCollection<mdp::BytesRange>()(annotation.location, WrapLocation));
39
+
40
+ return object;
41
+ }
42
+
43
+ sos::Object drafter::WrapResult(const snowcrash::ParseResult<snowcrash::Blueprint>& blueprint, const snowcrash::BlueprintParserOptions options)
44
+ {
45
+ sos::Object object;
46
+
47
+ using namespace snowcrash;
48
+
49
+ const Report& report = blueprint.report;
50
+
51
+ object.set(SerializeKey::Version, sos::String(PARSE_RESULT_SERIALIZATION_VERSION));
52
+
53
+ object.set(SerializeKey::Ast, WrapBlueprint(blueprint.node));
54
+
55
+ if (options & ExportSourcemapOption) {
56
+ const SourceMap<Blueprint>& sourceMap = blueprint.sourceMap;
57
+ object.set(SerializeKey::SourceMap, WrapBlueprintSourcemap(sourceMap));
58
+ }
59
+
60
+ object.set(SerializeKey::Error, WrapAnnotation(report.error));
61
+
62
+ if (!report.warnings.empty()) {
63
+ object.set(SerializeKey::Warnings, WrapCollection<snowcrash::SourceAnnotation>()(report.warnings, WrapAnnotation));
64
+ }
65
+
66
+ return object;
67
+ }
@@ -0,0 +1,26 @@
1
+ //
2
+ // SerializeResult.h
3
+ // drafter
4
+ //
5
+ // Created by Jiri Kratochvil on 27-02-2015
6
+ // Copyright (c) 2015 Apiary Inc. All rights reserved.
7
+ //
8
+
9
+ #ifndef DRAFTER_SERIALIZE_RESULT_H
10
+ #define DRAFTER_SERIALIZE_RESULT_H
11
+
12
+ #include "Serialize.h"
13
+
14
+ #include "SectionParserData.h" // required by BlueprintParserOptions
15
+
16
+ namespace snowcrash {
17
+ struct Blueprint;
18
+ template <typename T> struct ParseResult;
19
+ }
20
+
21
+ namespace drafter {
22
+
23
+ sos::Object WrapResult(const snowcrash::ParseResult<snowcrash::Blueprint>& blueprint, const snowcrash::BlueprintParserOptions options);
24
+ }
25
+
26
+ #endif // #ifndef DRAFTER_SERIALIZE_RESULT_H
@@ -0,0 +1,446 @@
1
+ //
2
+ // SerializeSourcemap.cc
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
+ #include "SerializeSourcemap.h"
10
+
11
+ using namespace drafter;
12
+
13
+ using snowcrash::SourceMapBase;
14
+ using snowcrash::SourceMap;
15
+ using snowcrash::Collection;
16
+
17
+ using snowcrash::DataStructure;
18
+ using snowcrash::Asset;
19
+ using snowcrash::Payload;
20
+ using snowcrash::Header;
21
+ using snowcrash::Parameter;
22
+ using snowcrash::Value;
23
+ using snowcrash::TransactionExample;
24
+ using snowcrash::Request;
25
+ using snowcrash::Response;
26
+ using snowcrash::Action;
27
+ using snowcrash::Resource;
28
+ using snowcrash::Element;
29
+ using snowcrash::Description;
30
+ using snowcrash::Blueprint;
31
+ using snowcrash::Metadata;
32
+
33
+ sos::Array WrapSourcemap(const SourceMapBase& value)
34
+ {
35
+ sos::Array sourceMap;
36
+
37
+ for (mdp::RangeSet<mdp::BytesRange>::const_iterator it = value.sourceMap.begin();
38
+ it != value.sourceMap.end();
39
+ ++it) {
40
+
41
+ sos::Array sourceMapRow;
42
+
43
+ sourceMapRow.push(sos::Number(it->location));
44
+ sourceMapRow.push(sos::Number(it->length));
45
+
46
+ sourceMap.push(sourceMapRow);
47
+ }
48
+
49
+ return sourceMap;
50
+ }
51
+
52
+ // Forward declarations
53
+ sos::Array WrapTypeSectionSourcemap(const SourceMap<mson::TypeSection>& typeSection);
54
+
55
+ sos::Object WrapPropertyMemberSourcemap(const SourceMap<mson::PropertyMember>& propertyMember)
56
+ {
57
+ sos::Object propertyMemberObject;
58
+
59
+ // Name
60
+ propertyMemberObject.set(SerializeKey::Name, WrapSourcemap(propertyMember.name));
61
+
62
+ // Description
63
+ propertyMemberObject.set(SerializeKey::Description, WrapSourcemap(propertyMember.description));
64
+
65
+ // Value Definition
66
+ propertyMemberObject.set(SerializeKey::ValueDefinition, WrapSourcemap(propertyMember.valueDefinition));
67
+
68
+ // Type Sections
69
+ propertyMemberObject.set(SerializeKey::Sections,
70
+ WrapCollection<mson::TypeSection>()(propertyMember.sections.collection, WrapTypeSectionSourcemap));
71
+
72
+ return propertyMemberObject;
73
+ }
74
+
75
+ sos::Object WrapValueMemberSourcemap(const SourceMap<mson::ValueMember>& valueMember)
76
+ {
77
+ sos::Object valueMemberObject;
78
+
79
+ // Description
80
+ valueMemberObject.set(SerializeKey::Description, WrapSourcemap(valueMember.description));
81
+
82
+ // Value Definition
83
+ valueMemberObject.set(SerializeKey::ValueDefinition, WrapSourcemap(valueMember.valueDefinition));
84
+
85
+ // Type Sections
86
+ valueMemberObject.set(SerializeKey::Sections,
87
+ WrapCollection<mson::TypeSection>()(valueMember.sections.collection, WrapTypeSectionSourcemap));
88
+
89
+ return valueMemberObject;
90
+ }
91
+
92
+ sos::Array WrapMixinSourcemap(const SourceMap<mson::Mixin>& mixin)
93
+ {
94
+ return WrapSourcemap(mixin);
95
+ }
96
+
97
+ sos::Base WrapMSONElementSourcemap(const SourceMap<mson::Element>& element)
98
+ {
99
+ if (!element.elements().collection.empty()) {
100
+ // Same for oneOf
101
+ return WrapCollection<mson::Element>()(element.elements().collection, WrapMSONElementSourcemap);
102
+ }
103
+ else if (!element.mixin.sourceMap.empty()) {
104
+ return WrapMixinSourcemap(element.mixin); // return sos::Array
105
+ }
106
+ else if (!element.value.empty()) {
107
+ return WrapValueMemberSourcemap(element.value); // return sos::Object
108
+ }
109
+ else if (!element.property.empty()) {
110
+ return WrapPropertyMemberSourcemap(element.property); // return sos::Object
111
+ }
112
+
113
+ return sos::Null(); // return sos::Null
114
+ }
115
+
116
+ sos::Array WrapTypeSectionSourcemap(const SourceMap<mson::TypeSection>& section)
117
+ {
118
+ if (!section.description.sourceMap.empty()) {
119
+ return WrapSourcemap(section.description);
120
+ }
121
+ else if (!section.value.sourceMap.empty()) {
122
+ return WrapSourcemap(section.value);
123
+ }
124
+ else if (!section.elements().collection.empty()) {
125
+ return WrapCollection<mson::Element>()(section.elements().collection, WrapMSONElementSourcemap);
126
+ }
127
+
128
+ return sos::Array();
129
+ }
130
+
131
+ sos::Object WrapDataStructureSourcemap(const SourceMap<DataStructure>& dataStructure)
132
+ {
133
+ sos::Object dataStructureObject;
134
+
135
+ // Name
136
+ dataStructureObject.set(SerializeKey::Name, WrapSourcemap(dataStructure.name));
137
+
138
+ // Type Definition
139
+ dataStructureObject.set(SerializeKey::TypeDefinition, WrapSourcemap(dataStructure.typeDefinition));
140
+
141
+ // Type Sections
142
+ dataStructureObject.set(SerializeKey::Sections,
143
+ WrapCollection<mson::TypeSection>()(dataStructure.sections.collection, WrapTypeSectionSourcemap));
144
+
145
+ return dataStructureObject;
146
+ }
147
+
148
+ sos::Object WrapAssetSourcemap(const SourceMap<Asset>& asset)
149
+ {
150
+ sos::Object assetObject;
151
+
152
+ // Content
153
+ assetObject.set(SerializeKey::Content, WrapSourcemap(asset));
154
+
155
+ return assetObject;
156
+ }
157
+
158
+ sos::Object WrapPayloadSourcemap(const SourceMap<Payload>& payload)
159
+ {
160
+ sos::Object payloadObject;
161
+
162
+ // Reference
163
+ if (!payload.reference.sourceMap.empty()) {
164
+ payloadObject.set(SerializeKey::Reference, WrapSourcemap(payload.reference));
165
+ }
166
+
167
+ // Name
168
+ payloadObject.set(SerializeKey::Name, WrapSourcemap(payload.name));
169
+
170
+ // Description
171
+ payloadObject.set(SerializeKey::Description, WrapSourcemap(payload.description));
172
+
173
+ // Headers
174
+ payloadObject.set(SerializeKey::Headers,
175
+ WrapCollection<Header>()(payload.headers.collection, WrapSourcemap));
176
+
177
+ // Body
178
+ payloadObject.set(SerializeKey::Body, WrapSourcemap(payload.body));
179
+
180
+ // Schema
181
+ payloadObject.set(SerializeKey::Schema, WrapSourcemap(payload.schema));
182
+
183
+ // Content
184
+ sos::Array content;
185
+
186
+ /// Attributes
187
+ if (!payload.attributes.empty()) {
188
+ content.push(WrapDataStructureSourcemap(payload.attributes));
189
+ }
190
+
191
+ /// Asset 'bodyExample'
192
+ if (!payload.body.sourceMap.empty()) {
193
+ content.push(WrapAssetSourcemap(payload.body));
194
+ }
195
+
196
+ /// Asset 'bodySchema'
197
+ if (!payload.schema.sourceMap.empty()) {
198
+ content.push(WrapAssetSourcemap(payload.schema));
199
+ }
200
+
201
+ payloadObject.set(SerializeKey::Content, content);
202
+
203
+ return payloadObject;
204
+ }
205
+
206
+ sos::Object WrapParameterValueSourceMap(const SourceMap<Value>& value)
207
+ {
208
+ sos::Object object;
209
+ object.set(SerializeKey::Value, WrapSourcemap(value));
210
+ return object;
211
+ }
212
+
213
+ sos::Object WrapParameterSourcemap(const SourceMap<Parameter>& parameter)
214
+ {
215
+ sos::Object object;
216
+
217
+ // Name
218
+ object.set(SerializeKey::Name, WrapSourcemap(parameter.name));
219
+
220
+ // Description
221
+ object.set(SerializeKey::Description, WrapSourcemap(parameter.description));
222
+
223
+ // Type
224
+ object.set(SerializeKey::Type, WrapSourcemap(parameter.type));
225
+
226
+ // Use
227
+ object.set(SerializeKey::Required, WrapSourcemap(parameter.use));
228
+
229
+ // Example Value
230
+ object.set(SerializeKey::Example, WrapSourcemap(parameter.exampleValue));
231
+
232
+ // Default Value
233
+ object.set(SerializeKey::Default, WrapSourcemap(parameter.defaultValue));
234
+
235
+ // Values
236
+ object.set(SerializeKey::Values,
237
+ WrapCollection<Value>()(parameter.values.collection, WrapParameterValueSourceMap));
238
+
239
+ return object;
240
+ }
241
+
242
+ sos::Object WrapTransactionExampleSourcemap(const SourceMap<TransactionExample>& example)
243
+ {
244
+ sos::Object exampleObject;
245
+
246
+ // Name
247
+ exampleObject.set(SerializeKey::Name, WrapSourcemap(example.name));
248
+
249
+ // Description
250
+ exampleObject.set(SerializeKey::Description, WrapSourcemap(example.description));
251
+
252
+ // Requests
253
+ exampleObject.set(SerializeKey::Requests,
254
+ WrapCollection<Request>()(example.requests.collection, WrapPayloadSourcemap));
255
+
256
+ // Responses
257
+ exampleObject.set(SerializeKey::Responses,
258
+ WrapCollection<Response>()(example.responses.collection, WrapPayloadSourcemap));
259
+
260
+ return exampleObject;
261
+ }
262
+
263
+ sos::Object WrapActionSourcemap(const SourceMap<Action>& action)
264
+ {
265
+ sos::Object actionObject;
266
+
267
+ // Name
268
+ actionObject.set(SerializeKey::Name, WrapSourcemap(action.name));
269
+
270
+ // Description
271
+ actionObject.set(SerializeKey::Description, WrapSourcemap(action.description));
272
+
273
+ // HTTP Method
274
+ actionObject.set(SerializeKey::Method, WrapSourcemap(action.method));
275
+
276
+ // Parameters
277
+ actionObject.set(SerializeKey::Parameters,
278
+ WrapCollection<Parameter>()(action.parameters.collection, WrapParameterSourcemap));
279
+
280
+ // Transaction Examples
281
+ actionObject.set(SerializeKey::Examples,
282
+ WrapCollection<TransactionExample>()(action.examples.collection, WrapTransactionExampleSourcemap));
283
+
284
+ // Attributes
285
+ sos::Object attributes;
286
+
287
+ /// Relation
288
+ attributes.set(SerializeKey::Relation, WrapSourcemap(action.relation));
289
+
290
+ /// URI Template
291
+ attributes.set(SerializeKey::URITemplate, WrapSourcemap(action.uriTemplate));
292
+
293
+ actionObject.set(SerializeKey::Attributes, attributes);
294
+
295
+ // Content
296
+ sos::Array content;
297
+
298
+ /// Attributes
299
+ if (!action.attributes.empty()) {
300
+ content.push(WrapDataStructureSourcemap(action.attributes));
301
+ }
302
+
303
+ actionObject.set(SerializeKey::Content, content);
304
+
305
+ return actionObject;
306
+ }
307
+
308
+ sos::Object WrapResourceSourcemap(const SourceMap<Resource>& resource)
309
+ {
310
+ sos::Object resourceObject;
311
+
312
+ // Name
313
+ resourceObject.set(SerializeKey::Name, WrapSourcemap(resource.name));
314
+
315
+ // Description
316
+ resourceObject.set(SerializeKey::Description, WrapSourcemap(resource.description));
317
+
318
+ // URI Template
319
+ resourceObject.set(SerializeKey::URITemplate, WrapSourcemap(resource.uriTemplate));
320
+
321
+ // Model
322
+ sos::Object model = (resource.model.name.sourceMap.empty() ? sos::Object() : WrapPayloadSourcemap(resource.model));
323
+ resourceObject.set(SerializeKey::Model, model);
324
+
325
+ // Parameters
326
+ resourceObject.set(SerializeKey::Parameters,
327
+ WrapCollection<Parameter>()(resource.parameters.collection, WrapParameterSourcemap));
328
+
329
+ // Actions
330
+ resourceObject.set(SerializeKey::Actions,
331
+ WrapCollection<Action>()(resource.actions.collection, WrapActionSourcemap));
332
+
333
+ // Content
334
+ sos::Array content;
335
+
336
+ /// Attributes
337
+ if (!resource.attributes.empty()) {
338
+ content.push(WrapDataStructureSourcemap(resource.attributes));
339
+ }
340
+
341
+ resourceObject.set(SerializeKey::Content, content);
342
+
343
+ return resourceObject;
344
+ }
345
+
346
+ sos::Object WrapResourceGroupSourcemap(const SourceMap<Element>& resourceGroup)
347
+ {
348
+ sos::Object resourceGroupObject;
349
+
350
+ // Name
351
+ resourceGroupObject.set(SerializeKey::Name, WrapSourcemap(resourceGroup.attributes.name));
352
+
353
+ // Description & Resources
354
+ SourceMap<Description> description;
355
+ sos::Array resources;
356
+
357
+ for (Collection<SourceMap<Element> >::const_iterator it = resourceGroup.content.elements().collection.begin();
358
+ it != resourceGroup.content.elements().collection.end();
359
+ ++it) {
360
+
361
+ if (it->element == Element::ResourceElement) {
362
+ resources.push(WrapResourceSourcemap(it->content.resource));
363
+ }
364
+ else if (it->element == Element::CopyElement) {
365
+ description.sourceMap.append(it->content.copy.sourceMap);
366
+ }
367
+ }
368
+
369
+ resourceGroupObject.set(SerializeKey::Description, WrapSourcemap(description));
370
+ resourceGroupObject.set(SerializeKey::Resources, resources);
371
+
372
+ return resourceGroupObject;
373
+ }
374
+
375
+ sos::Object WrapElementSourcemap(const SourceMap<Element>& element)
376
+ {
377
+ sos::Object elementObject;
378
+
379
+ if (!element.attributes.name.sourceMap.empty()) {
380
+
381
+ sos::Object attributes;
382
+
383
+ attributes.set(SerializeKey::Name, WrapSourcemap(element.attributes.name));
384
+ elementObject.set(SerializeKey::Attributes, attributes);
385
+ }
386
+
387
+ switch (element.element) {
388
+ case Element::CopyElement:
389
+ {
390
+ elementObject.set(SerializeKey::Content, WrapSourcemap(element.content.copy));
391
+ break;
392
+ }
393
+
394
+ case Element::DataStructureElement:
395
+ {
396
+ return WrapDataStructureSourcemap(element.content.dataStructure);
397
+ }
398
+
399
+ case Element::ResourceElement:
400
+ {
401
+ return WrapResourceSourcemap(element.content.resource);
402
+ }
403
+
404
+ case Element::CategoryElement:
405
+ {
406
+ elementObject.set(SerializeKey::Content,
407
+ WrapCollection<Element>()(element.content.elements().collection, WrapElementSourcemap));
408
+ break;
409
+ }
410
+
411
+ default:
412
+ break;
413
+ }
414
+
415
+ return elementObject;
416
+ }
417
+
418
+ bool IsElementResourceGroup(const SourceMap<Element>& element)
419
+ {
420
+ return element.element == Element::CategoryElement && element.category == Element::ResourceGroupCategory;
421
+ }
422
+
423
+ sos::Object drafter::WrapBlueprintSourcemap(const SourceMap<Blueprint>& blueprint)
424
+ {
425
+ sos::Object blueprintObject;
426
+
427
+ // Metadata
428
+ blueprintObject.set(SerializeKey::Metadata,
429
+ WrapCollection<Metadata>()(blueprint.metadata.collection, WrapSourcemap));
430
+
431
+ // Name
432
+ blueprintObject.set(SerializeKey::Name, WrapSourcemap(blueprint.name));
433
+
434
+ // Description
435
+ blueprintObject.set(SerializeKey::Description, WrapSourcemap(blueprint.description));
436
+
437
+ // Resource Groups
438
+ blueprintObject.set(SerializeKey::ResourceGroups,
439
+ WrapCollection<Element>()(blueprint.content.elements().collection, WrapResourceGroupSourcemap, IsElementResourceGroup));
440
+
441
+ // Content
442
+ blueprintObject.set(SerializeKey::Content,
443
+ WrapCollection<Element>()(blueprint.content.elements().collection, WrapElementSourcemap));
444
+
445
+ return blueprintObject;
446
+ }