redsnow 0.3.7 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
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,81 @@
1
+ //
2
+ // BlueprintSourcemap.cc
3
+ // snowcrash
4
+ //
5
+ // Created by Pavan Kumar Sunkara on 26/01/15.
6
+ // Copyright (c) 2015 Apiary Inc. All rights reserved.
7
+ //
8
+
9
+ #include "BlueprintSourcemap.h"
10
+
11
+ using namespace snowcrash;
12
+
13
+ SourceMap<Elements>& SourceMap<Element>::Content::elements()
14
+ {
15
+ if (!m_elements.get())
16
+ throw ELEMENTS_NOT_SET_ERR;
17
+
18
+ return *m_elements;
19
+ }
20
+
21
+ const SourceMap<Elements>& SourceMap<Element>::Content::elements() const
22
+ {
23
+ if (!m_elements.get())
24
+ throw ELEMENTS_NOT_SET_ERR;
25
+
26
+ return *m_elements;
27
+ }
28
+
29
+ SourceMap<Element>::Content::Content()
30
+ {
31
+ m_elements.reset(::new SourceMap<Elements>);
32
+ }
33
+
34
+ SourceMap<Element>::Content::Content(const SourceMap<Element>::Content& rhs)
35
+ {
36
+ this->copy = rhs.copy;
37
+ this->resource = rhs.resource;
38
+ this->dataStructure = rhs.dataStructure;
39
+ m_elements.reset(::new SourceMap<Elements>(*rhs.m_elements.get()));
40
+ }
41
+
42
+ SourceMap<Element>::Content& SourceMap<Element>::Content::operator=(const SourceMap<Element>::Content& rhs)
43
+ {
44
+ this->copy = rhs.copy;
45
+ this->resource = rhs.resource;
46
+ this->dataStructure = rhs.dataStructure;
47
+ m_elements.reset(::new SourceMap<Elements>(*rhs.m_elements.get()));
48
+
49
+ return *this;
50
+ }
51
+
52
+ SourceMap<Element>::Content::~Content()
53
+ {
54
+ }
55
+
56
+ SourceMap<Element>::SourceMap(const Element::Class& element_)
57
+ : element(element_)
58
+ {
59
+ }
60
+
61
+ SourceMap<Element>::SourceMap(const SourceMap<Element>& rhs)
62
+ {
63
+ this->element = rhs.element;
64
+ this->attributes = rhs.attributes;
65
+ this->content = rhs.content;
66
+ this->category = rhs.category;
67
+ }
68
+
69
+ SourceMap<Element>& SourceMap<Element>::operator=(const SourceMap<Element>& rhs)
70
+ {
71
+ this->element = rhs.element;
72
+ this->attributes = rhs.attributes;
73
+ this->content = rhs.content;
74
+ this->category = rhs.category;
75
+
76
+ return *this;
77
+ }
78
+
79
+ SourceMap<Element>::~SourceMap()
80
+ {
81
+ }
@@ -10,8 +10,7 @@
10
10
  #define SNOWCRASH_BLUEPRINT_SOURCEMAP_H
11
11
 
12
12
  #include "Blueprint.h"
13
- #include "MarkdownParser.h"
14
-
13
+ #include "MSONSourcemap.h"
15
14
  /**
16
15
  * API Blueprint Sourcemap Abstract Syntax Tree
17
16
  * ---------------------------------------------
@@ -19,21 +18,8 @@
19
18
  * Data types in this documents define the API Blueprint Sourcemap AST.
20
19
  */
21
20
 
22
- #define SOURCE_MAP_COLLECTION(T, TC) template<>\
23
- struct SourceMap<TC> {\
24
- Collection<SourceMap<T> >::type collection;\
25
- };\
26
-
27
21
  namespace snowcrash {
28
22
 
29
- struct SourceMapBase {
30
- mdp::BytesRangeSet sourceMap;
31
- };
32
-
33
- template<typename T>
34
- struct SourceMap : public SourceMapBase {
35
- };
36
-
37
23
  /** Source Map of Metadata Collection */
38
24
  SOURCE_MAP_COLLECTION(Metadata, MetadataCollection)
39
25
 
@@ -43,7 +29,9 @@ namespace snowcrash {
43
29
  /** Source Map of Collection of Parameter values */
44
30
  SOURCE_MAP_COLLECTION(Value, Values)
45
31
 
46
- /** Source Map Structure for Parameter */
32
+ /**
33
+ * Source Map Structure for Parameter
34
+ */
47
35
  template<>
48
36
  struct SourceMap<Parameter> : public SourceMapBase {
49
37
 
@@ -69,9 +57,26 @@ namespace snowcrash {
69
57
  SourceMap<Values> values;
70
58
  };
71
59
 
60
+ /**
61
+ * Source Map Structure for MSON Parameter
62
+ */
63
+ template<>
64
+ struct SourceMap<MSONParameter> : public SourceMap<Parameter> {
65
+ };
66
+
72
67
  /** Source Map of Collection of Parameters */
73
68
  SOURCE_MAP_COLLECTION(Parameter, Parameters)
74
69
 
70
+ /**
71
+ * Source Map Structure for DataStructure
72
+ */
73
+ template<>
74
+ struct SourceMap<DataStructure> : public SourceMap<mson::NamedType> {
75
+ };
76
+
77
+ /** Source Map Structure for Attributes */
78
+ // 'Attributes' is the same as 'DataStructure'
79
+
75
80
  /**
76
81
  * Source Map Structure for Payload
77
82
  */
@@ -84,19 +89,22 @@ namespace snowcrash {
84
89
  /** Source Map of Payload Description */
85
90
  SourceMap<Description> description;
86
91
 
87
- /** Payload-specific Parameters */
92
+ /** Source Map of Payload-specific Parameters */
88
93
  SourceMap<Parameters> parameters;
89
94
 
90
- /** Payload-specific Headers */
95
+ /** Source Map of Payload-specific Headers */
91
96
  SourceMap<Headers> headers;
92
97
 
93
- /** Source Map of Body */
98
+ /** Source Map of Payload-specific Attributes (THIS SHOULD NOT BE HERE - should be under content) */
99
+ SourceMap<Attributes> attributes;
100
+
101
+ /** Source Map of Body (THIS SHOULD NOT BE HERE - should be under content) */
94
102
  SourceMap<Asset> body;
95
103
 
96
- /** Source Map of Schema */
104
+ /** Source Map of Schema (THIS SHOULD NOT BE HERE - should be under content) */
97
105
  SourceMap<Asset> schema;
98
106
 
99
- /** Source Map of Symbol */
107
+ /** Source Map of Model Reference */
100
108
  SourceMap<Reference> reference;
101
109
  };
102
110
 
@@ -146,6 +154,15 @@ namespace snowcrash {
146
154
  /** Action-specific Parameters */
147
155
  SourceMap<Parameters> parameters;
148
156
 
157
+ /** Action-specific Attributes (THIS SHOULD NOT BE HERE - should be under content) */
158
+ SourceMap<Attributes> attributes;
159
+
160
+ /** Source Map of URI Template (THIS SHOULD NOT BE HERE - should be under element attributes) */
161
+ SourceMap<URITemplate> uriTemplate;
162
+
163
+ /** Source Map of Link Relation (THIS SHOULD NOT BE HERE - should be under element attributes) */
164
+ SourceMap<Relation> relation;
165
+
149
166
  /**
150
167
  * \brief Action-specific HTTP headers
151
168
  *
@@ -171,7 +188,7 @@ namespace snowcrash {
171
188
  * Source Map Structure for API Resource
172
189
  */
173
190
  template<>
174
- struct SourceMap<Resource> : public SourceMapBase {
191
+ struct SourceMap<Resource> {
175
192
 
176
193
  /** Source Map of URI template */
177
194
  SourceMap<URITemplate> uriTemplate;
@@ -185,6 +202,9 @@ namespace snowcrash {
185
202
  /** Model representing this Resource */
186
203
  SourceMap<ResourceModel> model;
187
204
 
205
+ /** Source Map of Resource-specific Attributes (THIS SHOULD NOT BE HERE - should be under content) */
206
+ SourceMap<Attributes> attributes;
207
+
188
208
  /** Parameters */
189
209
  SourceMap<Parameters> parameters;
190
210
 
@@ -209,24 +229,96 @@ namespace snowcrash {
209
229
  /** Source Map of Collection of Resources */
210
230
  SOURCE_MAP_COLLECTION(Resource, Resources)
211
231
 
232
+ /** Forward Declaration for Source Map of Element */
233
+ template<>
234
+ struct SourceMap<Element>;
235
+
236
+ /** Source Map of Collection of Elements */
237
+ SOURCE_MAP_COLLECTION(Element, Elements)
238
+
212
239
  /**
213
- * Source Map Structure for Group of API Resources
240
+ * Source Map Structure for Element
214
241
  */
215
242
  template<>
216
- struct SourceMap<ResourceGroup> : public SourceMapBase {
243
+ struct SourceMap<Element> : public SourceMapBase {
217
244
 
218
- /** Source Map of a Group Name */
219
- SourceMap<Name> name;
245
+ /** Source Map Structure for Attributes of the Element */
246
+ struct Attributes {
220
247
 
221
- /** Source Map of Group description */
222
- SourceMap<Description> description;
248
+ /** Source Map of a Element Name */
249
+ SourceMap<Name> name;
250
+ };
251
+
252
+ /** Source Map Structure for Content of the Element */
253
+ struct Content {
254
+
255
+ /** EITHER Source Map of Copy */
256
+ SourceMap<std::string> copy;
223
257
 
224
- /** Resources */
225
- SourceMap<Resources> resources;
258
+ /** OR Source Map of Resource */
259
+ SourceMap<Resource> resource;
260
+
261
+ /** OR Source Map of Data Structure */
262
+ SourceMap<DataStructure> dataStructure;
263
+
264
+ /** OR Source Map of Collection of elements */
265
+ SourceMap<Elements>& elements();
266
+ const SourceMap<Elements>& elements() const;
267
+
268
+ /** Constructor */
269
+ Content();
270
+
271
+ /** Copy constructor */
272
+ Content(const SourceMap<Element>::Content& rhs);
273
+
274
+ /** Assignment operator */
275
+ SourceMap<Element>::Content& operator=(const SourceMap<Element>::Content& rhs);
276
+
277
+ /** Destructor */
278
+ ~Content();
279
+
280
+ private:
281
+ std::auto_ptr<SourceMap<Elements> > m_elements;
282
+ };
283
+
284
+ /** Class of the Element (to be used internally only) */
285
+ Element::Class element;
286
+
287
+ /** Source Map of Attributes of the Element */
288
+ Attributes attributes;
289
+
290
+ /** Source Map of Content of the Element */
291
+ Content content;
292
+
293
+ /** Type of the Category element (to be used internally only) */
294
+ Element::Category category;
295
+
296
+ /** Constructor */
297
+ SourceMap(const Element::Class& element_ = Element::UndefinedElement);
298
+
299
+ /** Copy constructor */
300
+ SourceMap(const SourceMap<Element>& rhs);
301
+
302
+ /** Assignment operator */
303
+ SourceMap<Element>& operator=(const SourceMap<Element>& rhs);
304
+
305
+ /** Destructor */
306
+ ~SourceMap();
307
+ };
308
+
309
+ /**
310
+ * Source Map Structure for Group of API Resources (Category Element)
311
+ */
312
+ template<>
313
+ struct SourceMap<ResourceGroup> : public SourceMap<Element> {
226
314
  };
227
315
 
228
- /** Source Map of Collection of Resource groups */
229
- SOURCE_MAP_COLLECTION(ResourceGroup, ResourceGroups)
316
+ /**
317
+ * Source Map Structure for Group of Data Structures (Category Element)
318
+ */
319
+ template<>
320
+ struct SourceMap<DataStructureGroup> : public SourceMap<Element> {
321
+ };
230
322
 
231
323
  /**
232
324
  * \brief API Blueprint Sourcemap AST
@@ -235,20 +327,19 @@ namespace snowcrash {
235
327
  * Start reading a parsed API here.
236
328
  */
237
329
  template<>
238
- struct SourceMap<Blueprint> : public SourceMapBase {
239
-
240
- /** Source Map of API Blueprint metadata */
241
- SourceMap<MetadataCollection> metadata;
330
+ struct SourceMap<Blueprint> : public SourceMap<Element> {
242
331
 
243
332
  /** Source Map of the API Name */
244
333
  SourceMap<Name> name;
245
334
 
335
+ /** Source Map of API Blueprint metadata */
336
+ SourceMap<MetadataCollection> metadata;
337
+
246
338
  /** Source Map of an API Overview description */
247
339
  SourceMap<Description> description;
248
-
249
- /** The set of API Resource Groups */
250
- SourceMap<ResourceGroups> resourceGroups;
251
340
  };
252
341
  }
253
342
 
343
+ #undef SOURCE_MAP_COLLECTION
344
+
254
345
  #endif
@@ -94,10 +94,16 @@ namespace snowcrash {
94
94
  };
95
95
 
96
96
  /** Action matching predicate. */
97
- template <class T>
98
- struct MatchAction : std::binary_function<T, T, bool> {
99
- bool operator()(const T& first, const T& second) const {
100
- return first.method == second.method;
97
+ struct MatchAction : std::binary_function<Action, Action, bool> {
98
+ bool operator()(const first_argument_type& first, const second_argument_type& second) const {
99
+ return first.uriTemplate == second.uriTemplate && first.method == second.method;
100
+ }
101
+ };
102
+
103
+ /** Relation matching predicate. */
104
+ struct MatchRelation : std::binary_function<Action, Relation, bool> {
105
+ bool operator()(const first_argument_type& first, const second_argument_type& second) const {
106
+ return !first.relation.str.empty() && !second.str.empty() && first.relation.str == second.str;
101
107
  }
102
108
  };
103
109
  }
@@ -254,7 +254,7 @@ namespace snowcrash {
254
254
 
255
255
  TrimString(source);
256
256
 
257
- if(GetSymbolReference(source, symbol)) {
257
+ if(GetModelReference(source, symbol)) {
258
258
 
259
259
  std::stringstream ss;
260
260
  ss << "found a possible '" << symbol << "' model reference, ";
@@ -0,0 +1,154 @@
1
+ //
2
+ // DataStructureGroupParser.h
3
+ // snowcrash
4
+ //
5
+ // Created by Pavan Kumar Sunkara on 02/12/14.
6
+ // Copyright (c) 2014 Apiary Inc. All rights reserved.
7
+ //
8
+
9
+ #ifndef SNOWCRASH_DATASTRUCTUREGROUPPARSER_H
10
+ #define SNOWCRASH_DATASTRUCTUREGROUPPARSER_H
11
+
12
+ #include "MSONNamedTypeParser.h"
13
+
14
+ using namespace scpl;
15
+
16
+ namespace snowcrash {
17
+
18
+ /** Data structure group matching regex */
19
+ const char* const DataStructureGroupRegex = "^[[:blank:]]*[Dd]ata[[:blank:]]+[Ss]tructures?[[:blank:]]*$";
20
+
21
+ /**
22
+ * Data structure group section processor
23
+ */
24
+ template<>
25
+ struct SectionProcessor<DataStructureGroup> : public SectionProcessorBase<DataStructureGroup> {
26
+
27
+ NO_SECTION_DESCRIPTION(DataStructureGroup)
28
+
29
+ static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
30
+ const MarkdownNodes& siblings,
31
+ SectionParserData& pd,
32
+ const ParseResultRef<DataStructureGroup>& out) {
33
+
34
+ MarkdownNodeIterator cur = node;
35
+
36
+ if (pd.sectionContext() == MSONNamedTypeSectionType) {
37
+
38
+ IntermediateParseResult<mson::NamedType> namedType(out.report);
39
+ cur = MSONNamedTypeParser::parse(node, siblings, pd, namedType);
40
+
41
+ if (isNamedTypeDuplicate(pd.blueprint, namedType.node.name.symbol.literal)) {
42
+
43
+ // WARN: duplicate named type
44
+ std::stringstream ss;
45
+ ss << "named type with name '" << namedType.node.name.symbol.literal << "' already exists";
46
+
47
+ mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceData);
48
+ out.report.warnings.push_back(Warning(ss.str(),
49
+ DuplicateWarning,
50
+ sourceMap));
51
+ }
52
+ else {
53
+
54
+ Element element(Element::DataStructureElement);
55
+ element.content.dataStructure = namedType.node;
56
+
57
+ out.node.content.elements().push_back(element);
58
+
59
+ if (pd.exportSourceMap()) {
60
+
61
+ SourceMap<Element> elementSM(Element::DataStructureElement);
62
+
63
+ elementSM.content.dataStructure.name = namedType.sourceMap.name;
64
+ elementSM.content.dataStructure.typeDefinition = namedType.sourceMap.typeDefinition;
65
+ elementSM.content.dataStructure.sections = namedType.sourceMap.sections;
66
+
67
+ out.sourceMap.content.elements().collection.push_back(elementSM);
68
+ }
69
+ }
70
+ }
71
+
72
+ return cur;
73
+ }
74
+
75
+ static void finalize(const MarkdownNodeIterator& node,
76
+ SectionParserData& pd,
77
+ const ParseResultRef<DataStructureGroup>& out) {
78
+
79
+ out.node.element = Element::CategoryElement;
80
+ out.node.category = Element::DataStructureGroupCategory;
81
+
82
+ if (pd.exportSourceMap()) {
83
+
84
+ out.sourceMap.element = out.node.element;
85
+ out.sourceMap.category = out.node.category;
86
+ }
87
+ }
88
+
89
+ static SectionType sectionType(const MarkdownNodeIterator& node) {
90
+
91
+ if (node->type == mdp::HeaderMarkdownNodeType &&
92
+ !node->text.empty()) {
93
+
94
+ mdp::ByteBuffer remaining, subject = node->text;
95
+
96
+ subject = GetFirstLine(subject, remaining);
97
+ TrimString(subject);
98
+
99
+ if (RegexMatch(subject, DataStructureGroupRegex)) {
100
+ return DataStructureGroupSectionType;
101
+ }
102
+ }
103
+
104
+ return UndefinedSectionType;
105
+ }
106
+
107
+ static SectionType nestedSectionType(const MarkdownNodeIterator& node) {
108
+
109
+ return SectionProcessor<mson::NamedType>::sectionType(node);
110
+ }
111
+
112
+ /**
113
+ * \brief Check if a named type already exists with the given name
114
+ *
115
+ * \param blueprint The blueprint which is formed until now
116
+ * \param name The named type name to be checked
117
+ */
118
+ static bool isNamedTypeDuplicate(const Blueprint& blueprint,
119
+ mdp::ByteBuffer& name) {
120
+
121
+ for (Elements::const_iterator it = blueprint.content.elements().begin();
122
+ it != blueprint.content.elements().end();
123
+ ++it) {
124
+
125
+ if (it->element == Element::CategoryElement) {
126
+
127
+ for (Elements::const_iterator subIt = it->content.elements().begin();
128
+ subIt != it->content.elements().end();
129
+ ++subIt) {
130
+
131
+ if (subIt->element == Element::ResourceElement &&
132
+ subIt->content.resource.attributes.name.symbol.literal == name) {
133
+
134
+ return true;
135
+ }
136
+
137
+ if (subIt->element == Element::DataStructureElement &&
138
+ subIt->content.dataStructure.name.symbol.literal == name) {
139
+
140
+ return true;
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ return false;
147
+ }
148
+ };
149
+
150
+ /** Data Structures Parser */
151
+ typedef SectionParser<DataStructureGroup, HeaderSectionAdapter> DataStructureGroupParser;
152
+ }
153
+
154
+ #endif