lounge_lizard 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (348) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +2 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +4 -0
  7. data/Guardfile +33 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +50 -0
  10. data/Rakefile +43 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/circle.yml +14 -0
  14. data/ext/drafter/CHANGELOG.md +278 -0
  15. data/ext/drafter/Dockerfile +17 -0
  16. data/ext/drafter/Makefile +62 -0
  17. data/ext/drafter/appveyor.yml +17 -0
  18. data/ext/drafter/bin/drafter +0 -0
  19. data/ext/drafter/build/Makefile +387 -0
  20. data/ext/drafter/build/drafter.Makefile +6 -0
  21. data/ext/drafter/build/drafter.target.mk +159 -0
  22. data/ext/drafter/build/ext/snowcrash/libmarkdownparser.target.mk +141 -0
  23. data/ext/drafter/build/ext/snowcrash/libsnowcrash.target.mk +154 -0
  24. data/ext/drafter/build/ext/snowcrash/libsundown.target.mk +149 -0
  25. data/ext/drafter/build/ext/snowcrash/perf-libsnowcrash.target.mk +147 -0
  26. data/ext/drafter/build/ext/snowcrash/snowcrash.Makefile +6 -0
  27. data/ext/drafter/build/gyp-mac-tool +606 -0
  28. data/ext/drafter/build/libdrafter.target.mk +186 -0
  29. data/ext/drafter/build/libsos.target.mk +137 -0
  30. data/ext/drafter/build/out/Release/drafter +0 -0
  31. data/ext/drafter/build/out/Release/libdrafter.dylib +0 -0
  32. data/ext/drafter/build/out/Release/libmarkdownparser.a +0 -0
  33. data/ext/drafter/build/out/Release/libsnowcrash.a +0 -0
  34. data/ext/drafter/build/out/Release/libsos.a +0 -0
  35. data/ext/drafter/build/out/Release/libsundown.a +0 -0
  36. data/ext/drafter/build/out/Release/obj.target/drafter/src/config.o +0 -0
  37. data/ext/drafter/build/out/Release/obj.target/drafter/src/main.o +0 -0
  38. data/ext/drafter/build/out/Release/obj.target/drafter/src/reporting.o +0 -0
  39. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/ConversionContext.o +0 -0
  40. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/NamedTypesRegistry.o +0 -0
  41. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractAPI.o +0 -0
  42. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractDataStructure.o +0 -0
  43. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractElementFactory.o +0 -0
  44. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractSourceMap.o +0 -0
  45. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Render.o +0 -0
  46. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Serialize.o +0 -0
  47. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeAST.o +0 -0
  48. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeResult.o +0 -0
  49. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeSourcemap.o +0 -0
  50. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter.o +0 -0
  51. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter_private.o +0 -0
  52. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/ComparableVisitor.o +0 -0
  53. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Element.o +0 -0
  54. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/ExpandVisitor.o +0 -0
  55. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/IsExpandableVisitor.o +0 -0
  56. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/JSONSchemaVisitor.o +0 -0
  57. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/PrintVisitor.o +0 -0
  58. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Query.o +0 -0
  59. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Registry.o +0 -0
  60. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/RenderJSONVisitor.o +0 -0
  61. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/SerializeCompactVisitor.o +0 -0
  62. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/SerializeVisitor.o +0 -0
  63. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/TypeQueryVisitor.o +0 -0
  64. data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/VisitorUtils.o +0 -0
  65. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o +0 -0
  66. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.o +0 -0
  67. data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.o +0 -0
  68. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Blueprint.o +0 -0
  69. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/BlueprintSourcemap.o +0 -0
  70. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HTTP.o +0 -0
  71. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HeadersParser.o +0 -0
  72. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSON.o +0 -0
  73. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONOneOfParser.o +0 -0
  74. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONSourcemap.o +0 -0
  75. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONTypeSectionParser.o +0 -0
  76. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONValueMemberParser.o +0 -0
  77. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Section.o +0 -0
  78. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Signature.o +0 -0
  79. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/UriTemplateParser.o +0 -0
  80. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/posix/RegexMatch.o +0 -0
  81. data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/snowcrash.o +0 -0
  82. data/ext/drafter/build/out/Release/obj.target/libsos/ext/sos/src/sos.o +0 -0
  83. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
  84. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
  85. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.o +0 -0
  86. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.o +0 -0
  87. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.o +0 -0
  88. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.o +0 -0
  89. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.o +0 -0
  90. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.o +0 -0
  91. data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
  92. data/ext/drafter/circle.yml +32 -0
  93. data/ext/drafter/config.gypi +10 -0
  94. data/ext/drafter/config.mk +5 -0
  95. data/ext/drafter/configure +224 -0
  96. data/ext/drafter/drafter.gyp +189 -0
  97. data/ext/drafter/drafter.xcworkspace/contents.xcworkspacedata +13 -0
  98. data/ext/drafter/ext/snowcrash/Makefile +58 -0
  99. data/ext/drafter/ext/snowcrash/appveyor.yml +7 -0
  100. data/ext/drafter/ext/snowcrash/common.gypi +165 -0
  101. data/ext/drafter/ext/snowcrash/configure +197 -0
  102. data/ext/drafter/ext/snowcrash/ext/markdown-parser/Makefile +90 -0
  103. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/CONTRIBUTING.md +10 -0
  104. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/Makefile +84 -0
  105. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/Makefile.win +33 -0
  106. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/examples/smartypants.c +72 -0
  107. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/examples/sundown.c +80 -0
  108. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini.h +37 -0
  109. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.c +108 -0
  110. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.c +84 -0
  111. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.c +647 -0
  112. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.h +77 -0
  113. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.c +389 -0
  114. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html_block_names.txt +25 -0
  115. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.c +297 -0
  116. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.h +51 -0
  117. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.c +225 -0
  118. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.h +96 -0
  119. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/html_blocks.h +206 -0
  120. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.c +2726 -0
  121. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.h +147 -0
  122. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.c +204 -0
  123. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.h +58 -0
  124. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.c +81 -0
  125. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.h +29 -0
  126. data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/sundown.def +20 -0
  127. data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/markdown/markdown.vcproj +188 -0
  128. data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/msvc.sln +38 -0
  129. data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/sundown/sundown.vcproj +206 -0
  130. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.cc +160 -0
  131. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.h +90 -0
  132. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.cc +152 -0
  133. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.h +103 -0
  134. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.cc +388 -0
  135. data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.h +106 -0
  136. data/ext/drafter/ext/snowcrash/snowcrash.gyp +196 -0
  137. data/ext/drafter/ext/snowcrash/src/ActionParser.h +560 -0
  138. data/ext/drafter/ext/snowcrash/src/AssetParser.h +123 -0
  139. data/ext/drafter/ext/snowcrash/src/AttributesParser.h +123 -0
  140. data/ext/drafter/ext/snowcrash/src/Blueprint.cc +90 -0
  141. data/ext/drafter/ext/snowcrash/src/Blueprint.h +489 -0
  142. data/ext/drafter/ext/snowcrash/src/BlueprintParser.h +845 -0
  143. data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.cc +81 -0
  144. data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.h +345 -0
  145. data/ext/drafter/ext/snowcrash/src/BlueprintUtility.h +111 -0
  146. data/ext/drafter/ext/snowcrash/src/CodeBlockUtility.h +276 -0
  147. data/ext/drafter/ext/snowcrash/src/DataStructureGroupParser.h +157 -0
  148. data/ext/drafter/ext/snowcrash/src/HTTP.cc +49 -0
  149. data/ext/drafter/ext/snowcrash/src/HTTP.h +108 -0
  150. data/ext/drafter/ext/snowcrash/src/HeadersParser.cc +117 -0
  151. data/ext/drafter/ext/snowcrash/src/HeadersParser.h +377 -0
  152. data/ext/drafter/ext/snowcrash/src/MSON.cc +272 -0
  153. data/ext/drafter/ext/snowcrash/src/MSON.h +405 -0
  154. data/ext/drafter/ext/snowcrash/src/MSONMixinParser.h +103 -0
  155. data/ext/drafter/ext/snowcrash/src/MSONNamedTypeParser.h +135 -0
  156. data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.cc +132 -0
  157. data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.h +80 -0
  158. data/ext/drafter/ext/snowcrash/src/MSONParameterParser.h +166 -0
  159. data/ext/drafter/ext/snowcrash/src/MSONPropertyMemberParser.h +106 -0
  160. data/ext/drafter/ext/snowcrash/src/MSONSourcemap.cc +141 -0
  161. data/ext/drafter/ext/snowcrash/src/MSONSourcemap.h +181 -0
  162. data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.cc +209 -0
  163. data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.h +213 -0
  164. data/ext/drafter/ext/snowcrash/src/MSONUtility.h +506 -0
  165. data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.cc +214 -0
  166. data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.h +390 -0
  167. data/ext/drafter/ext/snowcrash/src/ModelTable.h +87 -0
  168. data/ext/drafter/ext/snowcrash/src/ParameterParser.h +516 -0
  169. data/ext/drafter/ext/snowcrash/src/ParametersParser.h +222 -0
  170. data/ext/drafter/ext/snowcrash/src/PayloadParser.h +733 -0
  171. data/ext/drafter/ext/snowcrash/src/Platform.h +33 -0
  172. data/ext/drafter/ext/snowcrash/src/RegexMatch.h +32 -0
  173. data/ext/drafter/ext/snowcrash/src/RelationParser.h +87 -0
  174. data/ext/drafter/ext/snowcrash/src/ResourceGroupParser.h +297 -0
  175. data/ext/drafter/ext/snowcrash/src/ResourceParser.h +536 -0
  176. data/ext/drafter/ext/snowcrash/src/Section.cc +48 -0
  177. data/ext/drafter/ext/snowcrash/src/Section.h +60 -0
  178. data/ext/drafter/ext/snowcrash/src/SectionParser.h +246 -0
  179. data/ext/drafter/ext/snowcrash/src/SectionParserData.h +109 -0
  180. data/ext/drafter/ext/snowcrash/src/SectionProcessor.h +299 -0
  181. data/ext/drafter/ext/snowcrash/src/Signature.cc +75 -0
  182. data/ext/drafter/ext/snowcrash/src/Signature.h +103 -0
  183. data/ext/drafter/ext/snowcrash/src/SignatureSectionProcessor.h +442 -0
  184. data/ext/drafter/ext/snowcrash/src/SourceAnnotation.h +166 -0
  185. data/ext/drafter/ext/snowcrash/src/StringUtility.h +323 -0
  186. data/ext/drafter/ext/snowcrash/src/UriTemplateParser.cc +195 -0
  187. data/ext/drafter/ext/snowcrash/src/UriTemplateParser.h +240 -0
  188. data/ext/drafter/ext/snowcrash/src/ValuesParser.h +111 -0
  189. data/ext/drafter/ext/snowcrash/src/posix/RegexMatch.cc +99 -0
  190. data/ext/drafter/ext/snowcrash/src/snowcrash.cc +90 -0
  191. data/ext/drafter/ext/snowcrash/src/snowcrash.h +44 -0
  192. data/ext/drafter/ext/snowcrash/src/win/RegexMatch.cc +78 -0
  193. data/ext/drafter/ext/snowcrash/tools/gyp/AUTHORS +12 -0
  194. data/ext/drafter/ext/snowcrash/tools/gyp/DEPS +23 -0
  195. data/ext/drafter/ext/snowcrash/tools/gyp/OWNERS +1 -0
  196. data/ext/drafter/ext/snowcrash/tools/gyp/PRESUBMIT.py +137 -0
  197. data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/buildbot_run.py +136 -0
  198. data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/commit_queue/OWNERS +6 -0
  199. data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/commit_queue/cq_config.json +15 -0
  200. data/ext/drafter/ext/snowcrash/tools/gyp/codereview.settings +10 -0
  201. data/ext/drafter/ext/snowcrash/tools/gyp/data/win/large-pdb-shim.cc +12 -0
  202. data/ext/drafter/ext/snowcrash/tools/gyp/gyp +8 -0
  203. data/ext/drafter/ext/snowcrash/tools/gyp/gyp.bat +5 -0
  204. data/ext/drafter/ext/snowcrash/tools/gyp/gyp_main.py +16 -0
  205. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSNew.py +340 -0
  206. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSProject.py +208 -0
  207. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSSettings.py +1096 -0
  208. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSToolFile.py +58 -0
  209. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUserFile.py +147 -0
  210. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.py +270 -0
  211. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.pyc +0 -0
  212. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.py +445 -0
  213. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.pyc +0 -0
  214. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/__init__.py +548 -0
  215. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/__init__.pyc +0 -0
  216. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.py +608 -0
  217. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
  218. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/easy_xml.py +157 -0
  219. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/flock_tool.py +54 -0
  220. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.py +0 -0
  221. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
  222. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/analyzer.py +741 -0
  223. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/android.py +1069 -0
  224. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/cmake.py +1248 -0
  225. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +99 -0
  226. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/eclipse.py +425 -0
  227. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypd.py +94 -0
  228. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypsh.py +56 -0
  229. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.py +2218 -0
  230. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
  231. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/msvs.py +3467 -0
  232. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.py +2427 -0
  233. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.pyc +0 -0
  234. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.py +1300 -0
  235. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
  236. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/input.py +2899 -0
  237. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/input.pyc +0 -0
  238. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/mac_tool.py +605 -0
  239. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.py +1093 -0
  240. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.pyc +0 -0
  241. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.py +160 -0
  242. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.pyc +0 -0
  243. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ordered_dict.py +289 -0
  244. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/simple_copy.py +46 -0
  245. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/simple_copy.pyc +0 -0
  246. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/win_tool.py +314 -0
  247. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.py +1664 -0
  248. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
  249. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_ninja.py +276 -0
  250. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_ninja.pyc +0 -0
  251. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.py +2927 -0
  252. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
  253. data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xml_fix.py +69 -0
  254. data/ext/drafter/ext/snowcrash/tools/gyp/pylintrc +307 -0
  255. data/ext/drafter/ext/snowcrash/tools/gyp/samples/samples +81 -0
  256. data/ext/drafter/ext/snowcrash/tools/gyp/samples/samples.bat +5 -0
  257. data/ext/drafter/ext/snowcrash/tools/gyp/setup.py +19 -0
  258. data/ext/drafter/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
  259. data/ext/drafter/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
  260. data/ext/drafter/ext/snowcrash/tools/gyp/tools/emacs/gyp.el +275 -0
  261. data/ext/drafter/ext/snowcrash/tools/gyp/tools/graphviz.py +100 -0
  262. data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_gyp.py +155 -0
  263. data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_sln.py +169 -0
  264. data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_vcproj.py +329 -0
  265. data/ext/drafter/ext/snowcrash/vcbuild.bat +139 -0
  266. data/ext/drafter/ext/sos/Makefile +62 -0
  267. data/ext/drafter/ext/sos/src/sos.cc +235 -0
  268. data/ext/drafter/ext/sos/src/sos.h +188 -0
  269. data/ext/drafter/ext/sos/src/sosJSON.h +121 -0
  270. data/ext/drafter/ext/sos/src/sosYAML.h +105 -0
  271. data/ext/drafter/src/ConversionContext.cc +39 -0
  272. data/ext/drafter/src/ConversionContext.h +34 -0
  273. data/ext/drafter/src/NamedTypesRegistry.cc +405 -0
  274. data/ext/drafter/src/NamedTypesRegistry.h +28 -0
  275. data/ext/drafter/src/NodeInfo.h +143 -0
  276. data/ext/drafter/src/RefractAPI.cc +579 -0
  277. data/ext/drafter/src/RefractAPI.h +28 -0
  278. data/ext/drafter/src/RefractDataStructure.cc +1199 -0
  279. data/ext/drafter/src/RefractDataStructure.h +26 -0
  280. data/ext/drafter/src/RefractElementFactory.cc +107 -0
  281. data/ext/drafter/src/RefractElementFactory.h +67 -0
  282. data/ext/drafter/src/RefractSourceMap.cc +29 -0
  283. data/ext/drafter/src/RefractSourceMap.h +57 -0
  284. data/ext/drafter/src/Render.cc +157 -0
  285. data/ext/drafter/src/Render.h +40 -0
  286. data/ext/drafter/src/Serialize.cc +160 -0
  287. data/ext/drafter/src/Serialize.h +289 -0
  288. data/ext/drafter/src/SerializeAST.cc +507 -0
  289. data/ext/drafter/src/SerializeAST.h +29 -0
  290. data/ext/drafter/src/SerializeResult.cc +170 -0
  291. data/ext/drafter/src/SerializeResult.h +34 -0
  292. data/ext/drafter/src/SerializeSourcemap.cc +331 -0
  293. data/ext/drafter/src/SerializeSourcemap.h +21 -0
  294. data/ext/drafter/src/Version.h +40 -0
  295. data/ext/drafter/src/config.cc +91 -0
  296. data/ext/drafter/src/config.h +38 -0
  297. data/ext/drafter/src/drafter.cc +137 -0
  298. data/ext/drafter/src/drafter.h +102 -0
  299. data/ext/drafter/src/drafter_private.cc +85 -0
  300. data/ext/drafter/src/drafter_private.h +34 -0
  301. data/ext/drafter/src/main.cc +137 -0
  302. data/ext/drafter/src/refract/AppendDecorator.h +58 -0
  303. data/ext/drafter/src/refract/Build.h +67 -0
  304. data/ext/drafter/src/refract/ComparableVisitor.cc +43 -0
  305. data/ext/drafter/src/refract/ComparableVisitor.h +62 -0
  306. data/ext/drafter/src/refract/Element.cc +409 -0
  307. data/ext/drafter/src/refract/Element.h +656 -0
  308. data/ext/drafter/src/refract/ElementFwd.h +37 -0
  309. data/ext/drafter/src/refract/ElementInserter.h +59 -0
  310. data/ext/drafter/src/refract/Exception.h +31 -0
  311. data/ext/drafter/src/refract/ExpandVisitor.cc +359 -0
  312. data/ext/drafter/src/refract/ExpandVisitor.h +58 -0
  313. data/ext/drafter/src/refract/FilterVisitor.h +52 -0
  314. data/ext/drafter/src/refract/IsExpandableVisitor.cc +140 -0
  315. data/ext/drafter/src/refract/IsExpandableVisitor.h +31 -0
  316. data/ext/drafter/src/refract/Iterate.h +160 -0
  317. data/ext/drafter/src/refract/JSONSchemaVisitor.cc +675 -0
  318. data/ext/drafter/src/refract/JSONSchemaVisitor.h +73 -0
  319. data/ext/drafter/src/refract/PrintVisitor.cc +164 -0
  320. data/ext/drafter/src/refract/PrintVisitor.h +50 -0
  321. data/ext/drafter/src/refract/Query.cc +13 -0
  322. data/ext/drafter/src/refract/Query.h +38 -0
  323. data/ext/drafter/src/refract/Registry.cc +114 -0
  324. data/ext/drafter/src/refract/Registry.h +43 -0
  325. data/ext/drafter/src/refract/RenderJSONVisitor.cc +255 -0
  326. data/ext/drafter/src/refract/RenderJSONVisitor.h +51 -0
  327. data/ext/drafter/src/refract/SerializeCompactVisitor.cc +167 -0
  328. data/ext/drafter/src/refract/SerializeCompactVisitor.h +56 -0
  329. data/ext/drafter/src/refract/SerializeVisitor.cc +214 -0
  330. data/ext/drafter/src/refract/SerializeVisitor.h +55 -0
  331. data/ext/drafter/src/refract/TypeQueryVisitor.cc +46 -0
  332. data/ext/drafter/src/refract/TypeQueryVisitor.h +110 -0
  333. data/ext/drafter/src/refract/Visitor.h +126 -0
  334. data/ext/drafter/src/refract/VisitorUtils.cc +63 -0
  335. data/ext/drafter/src/refract/VisitorUtils.h +231 -0
  336. data/ext/drafter/src/reporting.cc +263 -0
  337. data/ext/drafter/src/reporting.h +39 -0
  338. data/ext/drafter/src/stream.h +148 -0
  339. data/ext/drafter/tools/homebrew/drafter.rb +18 -0
  340. data/ext/drafter/tools/make-tarball.sh +39 -0
  341. data/ext/drafter/tools/refract-filter.py +96 -0
  342. data/ext/drafter/tools/release.sh +17 -0
  343. data/ext/drafter/vcbuild.bat +203 -0
  344. data/lib/lounge_lizard/binding.rb +29 -0
  345. data/lib/lounge_lizard/version.rb +3 -0
  346. data/lib/lounge_lizard.rb +18 -0
  347. data/lounge_lizard.gemspec +37 -0
  348. metadata +547 -0
@@ -0,0 +1,845 @@
1
+ //
2
+ // BlueprintParser.h
3
+ // snowcrash
4
+ //
5
+ // Created by Zdenek Nemec on 4/16/13.
6
+ // Copyright (c) 2013 Apiary Inc. All rights reserved.
7
+ //
8
+
9
+ #ifndef SNOWCRASH_BLUEPRINTPARSER_H
10
+ #define SNOWCRASH_BLUEPRINTPARSER_H
11
+
12
+ #include <iterator>
13
+ #include <algorithm>
14
+ #include "ResourceParser.h"
15
+ #include "ResourceGroupParser.h"
16
+ #include "DataStructureGroupParser.h"
17
+ #include "SectionParser.h"
18
+ #include "RegexMatch.h"
19
+ #include "CodeBlockUtility.h"
20
+
21
+ namespace snowcrash {
22
+
23
+ const char* const ExpectedAPINameMessage = "expected API name, e.g. '# <API Name>'";
24
+
25
+ /** Internal type alias for Collection iterator of Metadata */
26
+ typedef Collection<Metadata>::iterator MetadataCollectionIterator;
27
+
28
+ /**
29
+ * Blueprint processor
30
+ */
31
+ template<>
32
+ struct SectionProcessor<Blueprint> : public SectionProcessorBase<Blueprint> {
33
+
34
+ static MarkdownNodeIterator processSignature(const MarkdownNodeIterator& node,
35
+ const MarkdownNodes& siblings,
36
+ SectionParserData& pd,
37
+ SectionLayout& layout,
38
+ const ParseResultRef<Blueprint>& out) {
39
+
40
+ MarkdownNodeIterator cur = node;
41
+
42
+ while (cur != siblings.end() &&
43
+ cur->type == mdp::ParagraphMarkdownNodeType) {
44
+
45
+ IntermediateParseResult<MetadataCollection> metadata(out.report);
46
+
47
+ parseMetadata(cur, pd, metadata);
48
+
49
+ // First block is paragraph and is not metadata (no API name)
50
+ if (metadata.node.empty()) {
51
+ return processDescription(cur, siblings, pd, out);
52
+ } else {
53
+ out.node.metadata.insert(out.node.metadata.end(), metadata.node.begin(), metadata.node.end());
54
+
55
+ if (pd.exportSourceMap()) {
56
+ out.sourceMap.metadata.collection.insert(out.sourceMap.metadata.collection.end(),
57
+ metadata.sourceMap.collection.begin(),
58
+ metadata.sourceMap.collection.end());
59
+ }
60
+ }
61
+
62
+ cur++;
63
+ }
64
+
65
+ // Ideally this parsing metadata should be handled by separate parser
66
+ // that way the following check would be covered in SectionParser::parse()
67
+ if (cur == siblings.end())
68
+ return cur;
69
+
70
+ if (cur->type == mdp::HeaderMarkdownNodeType) {
71
+
72
+ SectionType nestedType = nestedSectionType(cur);
73
+
74
+ // Nested Sections only, parse as exclusive nested sections
75
+ if (nestedType != UndefinedSectionType) {
76
+ layout = ExclusiveNestedSectionLayout;
77
+ return cur;
78
+ }
79
+
80
+ out.node.name = cur->text;
81
+ TrimString(out.node.name);
82
+
83
+ if (pd.exportSourceMap() && !out.node.name.empty()) {
84
+ out.sourceMap.name.sourceMap = cur->sourceMap;
85
+ }
86
+ } else {
87
+
88
+ // Any other type of block, add to description
89
+ return processDescription(cur, siblings, pd, out);
90
+ }
91
+
92
+ return ++MarkdownNodeIterator(cur);
93
+ }
94
+
95
+ static MarkdownNodeIterator processNestedSection(const MarkdownNodeIterator& node,
96
+ const MarkdownNodes& siblings,
97
+ SectionParserData& pd,
98
+ const ParseResultRef<Blueprint>& out) {
99
+
100
+ MarkdownNodeIterator cur = node;
101
+
102
+ if (pd.sectionContext() == ResourceGroupSectionType ||
103
+ pd.sectionContext() == ResourceSectionType) {
104
+
105
+ IntermediateParseResult<ResourceGroup> resourceGroup(out.report);
106
+ cur = ResourceGroupParser::parse(node, siblings, pd, resourceGroup);
107
+
108
+ if (isResourceGroupDuplicate(out.node, resourceGroup.node.attributes.name)) {
109
+
110
+ // WARN: duplicate resource group
111
+ std::stringstream ss;
112
+
113
+ if (resourceGroup.node.attributes.name.empty()) {
114
+ ss << "anonymous group";
115
+ } else {
116
+ ss << "group '" << resourceGroup.node.attributes.name << "'";
117
+ }
118
+
119
+ ss << " is already defined";
120
+
121
+ mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
122
+ out.report.warnings.push_back(Warning(ss.str(),
123
+ DuplicateWarning,
124
+ sourceMap));
125
+ }
126
+
127
+ out.node.content.elements().push_back(resourceGroup.node);
128
+
129
+ if (pd.exportSourceMap()) {
130
+ out.sourceMap.content.elements().collection.push_back(resourceGroup.sourceMap);
131
+ }
132
+ }
133
+ else if (pd.sectionContext() == DataStructureGroupSectionType) {
134
+
135
+ IntermediateParseResult<DataStructureGroup> dataStructureGroup(out.report);
136
+ cur = DataStructureGroupParser::parse(node, siblings, pd, dataStructureGroup);
137
+
138
+ out.node.content.elements().push_back(dataStructureGroup.node);
139
+
140
+ if (pd.exportSourceMap()) {
141
+ out.sourceMap.content.elements().collection.push_back(dataStructureGroup.sourceMap);
142
+ }
143
+ }
144
+
145
+ return cur;
146
+ }
147
+
148
+ /**
149
+ * Look ahead through all the nested sections and gather list of all
150
+ * named types along with their base types and the types they are sub-typed from
151
+ */
152
+ static void preprocessNestedSections(const MarkdownNodeIterator& node,
153
+ const MarkdownNodes& siblings,
154
+ SectionParserData& pd,
155
+ const ParseResultRef<Blueprint>& out) {
156
+
157
+ MarkdownNodeIterator cur = node, contextCur;
158
+ SectionType sectionType = UndefinedSectionType;
159
+ SectionType contextSectionType = UndefinedSectionType;
160
+
161
+ // Iterate over nested sections
162
+ while (cur != siblings.end()) {
163
+
164
+ sectionType = SectionKeywordSignature(cur);
165
+
166
+ // Complete Action is recognized as resource section
167
+ if (sectionType == ResourceSectionType) {
168
+
169
+ ActionType actionType = SectionProcessor<Action>::actionType(cur);
170
+
171
+ if (actionType == CompleteActionType) {
172
+ sectionType = ActionSectionType;
173
+ }
174
+ }
175
+
176
+ if (cur->type == mdp::HeaderMarkdownNodeType) {
177
+
178
+ // If the current node is a Resource or DataStructures section, assign it as context
179
+ // Otherwise, make sure the current context is not DataStructures section and remove the context
180
+ if (sectionType == ResourceSectionType ||
181
+ sectionType == DataStructureGroupSectionType) {
182
+
183
+ contextSectionType = sectionType;
184
+ contextCur = cur;
185
+ }
186
+ else if (contextSectionType != DataStructureGroupSectionType) {
187
+
188
+ contextSectionType = UndefinedSectionType;
189
+ }
190
+
191
+ // If context is DataStructures section, NamedTypes should be filled
192
+ if (contextSectionType == DataStructureGroupSectionType) {
193
+
194
+ if (sectionType != MSONSampleDefaultSectionType &&
195
+ sectionType != MSONPropertyMembersSectionType &&
196
+ sectionType != MSONValueMembersSectionType &&
197
+ sectionType != UndefinedSectionType &&
198
+ sectionType != DataStructureGroupSectionType) {
199
+
200
+ contextSectionType = UndefinedSectionType;
201
+ }
202
+ else if (sectionType == UndefinedSectionType) {
203
+ fillNamedTypeTables(cur, pd, cur->text, out.report);
204
+ }
205
+ }
206
+ }
207
+ else if (cur->type == mdp::ListItemMarkdownNodeType &&
208
+ contextSectionType == ResourceSectionType &&
209
+ sectionType == AttributesSectionType) {
210
+
211
+ Resource resource;
212
+ SectionProcessor<Resource>::matchNamedResourceHeader(contextCur, resource);
213
+
214
+ if (!resource.name.empty()) {
215
+ fillNamedTypeTables(cur, pd, cur->children().front().text, out.report, resource.name);
216
+ }
217
+ }
218
+
219
+ if (sectionType == UndefinedSectionType) {
220
+ checkForPossibleSectionMistakes(cur, pd, out.report);
221
+ }
222
+
223
+ cur++;
224
+
225
+ }
226
+
227
+ // Resolve all named type base table entries
228
+ resolveNamedTypeTables(pd, out.report);
229
+ }
230
+
231
+ static void checkForPossibleSectionMistakes(const MarkdownNodeIterator& node, SectionParserData& pd, Report& report) {
232
+
233
+ SectionProcessor<Action>::checkForTypoMistake(node, pd, report);
234
+ }
235
+
236
+ static SectionType sectionType(const MarkdownNodeIterator& node) {
237
+
238
+ return BlueprintSectionType;
239
+ }
240
+
241
+ static SectionType nestedSectionType(const MarkdownNodeIterator& node) {
242
+
243
+ SectionType nestedType = UndefinedSectionType;
244
+
245
+ // Check if Resource section
246
+ nestedType = SectionProcessor<Resource>::sectionType(node);
247
+
248
+ if (nestedType != UndefinedSectionType) {
249
+ return nestedType;
250
+ }
251
+
252
+ // Check if ResourceGroup section
253
+ nestedType = SectionProcessor<ResourceGroup>::sectionType(node);
254
+
255
+ if (nestedType != UndefinedSectionType) {
256
+ return nestedType;
257
+ }
258
+
259
+ // Check if DataStructures section
260
+ nestedType = SectionProcessor<DataStructureGroup>::sectionType(node);
261
+
262
+ if (nestedType != UndefinedSectionType) {
263
+ return nestedType;
264
+ }
265
+
266
+ return UndefinedSectionType;
267
+ }
268
+
269
+ static void finalize(const MarkdownNodeIterator& node,
270
+ SectionParserData& pd,
271
+ const ParseResultRef<Blueprint>& out) {
272
+
273
+ checkLazyReferencing(pd, out);
274
+ out.node.element = Element::CategoryElement;
275
+
276
+ if (pd.exportSourceMap()) {
277
+ out.sourceMap.element = out.node.element;
278
+ }
279
+
280
+ if (!out.node.name.empty())
281
+ return;
282
+
283
+ if (pd.options & RequireBlueprintNameOption) {
284
+
285
+ // ERR: No API name specified
286
+ mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
287
+ out.report.error = Error(ExpectedAPINameMessage, BusinessError, sourceMap);
288
+
289
+ }
290
+ else if (!out.node.description.empty()) {
291
+
292
+ // WARN: No API name specified
293
+ mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
294
+ out.report.warnings.push_back(Warning(ExpectedAPINameMessage, APINameWarning, sourceMap));
295
+ }
296
+ }
297
+
298
+ static bool isUnexpectedNode(const MarkdownNodeIterator& node,
299
+ SectionType sectionType) {
300
+
301
+ // Since Blueprint is currently top-level node any unprocessed node should be reported
302
+ return true;
303
+ }
304
+
305
+ /**
306
+ * \brief Fill named type table entries from the signature information.
307
+ * Both base table and inheritance table.
308
+ *
309
+ * \param node Markdown node to process
310
+ * \param pd Section parser data
311
+ * \param subject Signature of the named type
312
+ * \param report Parse report
313
+ * \param name Name of the named type (only given in case of named resource)
314
+ */
315
+ static void fillNamedTypeTables(const MarkdownNodeIterator& node,
316
+ SectionParserData& pd,
317
+ const mdp::ByteBuffer& subject,
318
+ Report& report,
319
+ const mdp::ByteBuffer& name = "") {
320
+
321
+ mdp::ByteBuffer buffer = subject;
322
+ mson::Literal identifier;
323
+ mson::TypeDefinition typeDefinition;
324
+ Report tmpReport;
325
+
326
+ SignatureTraits traits(SignatureTraits::IdentifierTrait |
327
+ SignatureTraits::AttributesTrait);
328
+
329
+ Signature signature = SignatureSectionProcessorBase<Blueprint>::parseSignature(node, pd, traits, tmpReport, buffer);
330
+ mson::parseTypeDefinition(node, pd, signature.attributes, tmpReport, typeDefinition);
331
+
332
+ // Name of the named types cannot be variable
333
+ if (!name.empty() && mson::checkVariable(signature.identifier)) {
334
+ return;
335
+ }
336
+
337
+ if (!name.empty()) {
338
+ identifier = name;
339
+ }
340
+ else {
341
+ identifier = StripBackticks(signature.identifier);
342
+ }
343
+
344
+ // If named type already exists, return error
345
+ if (pd.namedTypeDependencyTable.find(identifier) != pd.namedTypeDependencyTable.end()) {
346
+
347
+ // ERR: Named type is defined more than once
348
+ std::stringstream ss;
349
+ ss << "named type '" << identifier << "' is defined more than once";
350
+
351
+ mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
352
+ report.error = Error(ss.str(), MSONError, sourceMap);
353
+ return;
354
+ }
355
+
356
+ mson::BaseTypeName baseTypeName = typeDefinition.typeSpecification.name.base;
357
+
358
+ // Initialize an entry in the dependency table
359
+ pd.namedTypeDependencyTable[identifier] = std::set<mson::Literal>();
360
+
361
+ // Add the respective entries to the tables
362
+ if (baseTypeName != mson::UndefinedTypeName) {
363
+ pd.namedTypeBaseTable[identifier] = mson::parseBaseType(typeDefinition.typeSpecification.name.base);
364
+
365
+ // Add nested types as dependents
366
+ if (baseTypeName == mson::ArrayTypeName || baseTypeName == mson::EnumTypeName) {
367
+
368
+ for (mson::TypeNames::iterator it = typeDefinition.typeSpecification.nestedTypes.begin();
369
+ it != typeDefinition.typeSpecification.nestedTypes.end();
370
+ ++it) {
371
+
372
+ if (!it->symbol.literal.empty() && !it->symbol.variable) {
373
+ pd.namedTypeDependencyTable[identifier].insert(it->symbol.literal);
374
+ }
375
+ }
376
+ }
377
+ }
378
+ else if (!typeDefinition.typeSpecification.name.symbol.literal.empty() &&
379
+ !typeDefinition.typeSpecification.name.symbol.variable) {
380
+
381
+ pd.namedTypeInheritanceTable[identifier] = std::make_pair(typeDefinition.typeSpecification.name.symbol.literal, node->sourceMap);
382
+
383
+ // Make the sub type dependent on super type
384
+ pd.namedTypeDependencyTable[identifier].insert(typeDefinition.typeSpecification.name.symbol.literal);
385
+ }
386
+ else if (typeDefinition.typeSpecification.name.empty()) {
387
+
388
+ // If there is no specification, an object is assumed
389
+ pd.namedTypeBaseTable[identifier] = mson::ImplicitObjectBaseType;
390
+ }
391
+ }
392
+
393
+ /**
394
+ * \brief Resolve named type base table entries from the named type inheritance table
395
+ *
396
+ * \param pd Section parser data
397
+ * \param report Parse report
398
+ */
399
+ static void resolveNamedTypeTables(SectionParserData& pd,
400
+ Report& report) {
401
+
402
+ mson::NamedTypeInheritanceTable::iterator it;
403
+ mson::NamedTypeDependencyTable::iterator depIt;
404
+
405
+ // First resolve dependency tables
406
+ for (depIt = pd.namedTypeDependencyTable.begin();
407
+ depIt != pd.namedTypeDependencyTable.end();
408
+ depIt++) {
409
+
410
+ resolveNamedTypeDependencyTableEntry(pd, depIt->first, report);
411
+ }
412
+
413
+ for (it = pd.namedTypeInheritanceTable.begin();
414
+ it != pd.namedTypeInheritanceTable.end();
415
+ it++) {
416
+
417
+ resolveNamedTypeBaseTableEntry(pd, it->first, it->second.first, it->second.second, report);
418
+
419
+ if (report.error.code != Error::OK) {
420
+ return;
421
+ }
422
+ }
423
+ }
424
+
425
+ /**
426
+ * \brief Resolve the inheritance dependencies of the current named type
427
+ * (Does not include mixin or member dependencies)
428
+ *
429
+ * \param pd Section parser data
430
+ * \param identifier The named type whose dependents need to be resolved
431
+ * \param report Parse report
432
+ */
433
+ static void resolveNamedTypeDependencyTableEntry(SectionParserData& pd,
434
+ const mson::Literal& identifier,
435
+ Report& report) {
436
+
437
+ std::set<mson::Literal> diffDeps, finalDeps, initialDeps;
438
+
439
+ do {
440
+ initialDeps = pd.namedTypeDependencyTable[identifier];
441
+ diffDeps.clear();
442
+
443
+ for (std::set<mson::Literal>::iterator it = initialDeps.begin();
444
+ it != initialDeps.end();
445
+ it++) {
446
+
447
+ std::set<mson::Literal> superTypeDeps = pd.namedTypeDependencyTable[*it];
448
+ pd.namedTypeDependencyTable[identifier].insert(superTypeDeps.begin(), superTypeDeps.end());
449
+ }
450
+
451
+ // Check if the list of dependents has grown
452
+ finalDeps = pd.namedTypeDependencyTable[identifier];
453
+ std::set_difference(finalDeps.begin(), finalDeps.end(), initialDeps.begin(), initialDeps.end(),
454
+ std::inserter(diffDeps, diffDeps.end()));
455
+
456
+ } while (!diffDeps.empty());
457
+ };
458
+
459
+ /**
460
+ * \brief For each entry in the named type inheritance table, resolve the sub-type's base type recursively
461
+ *
462
+ * \param pd Section parser data
463
+ * \param subType The sub named type between the two
464
+ * \param superType The super named type between the two
465
+ * \param report Parse report
466
+ */
467
+ static void resolveNamedTypeBaseTableEntry(SectionParserData& pd,
468
+ const mson::Literal& subType,
469
+ const mson::Literal& superType,
470
+ const mdp::BytesRangeSet& nodeSourceMap,
471
+ Report& report) {
472
+
473
+ mson::BaseType baseType;
474
+ mson::NamedTypeBaseTable::iterator it = pd.namedTypeBaseTable.find(subType);
475
+
476
+ // If the base table entry is already filled, nothing else to do
477
+ if (it != pd.namedTypeBaseTable.end()) {
478
+ return;
479
+ }
480
+
481
+ // Check for circular references
482
+ std::set<mson::Literal> deps = pd.namedTypeDependencyTable[subType];
483
+
484
+ if (deps.find(subType) != deps.end()) {
485
+
486
+ // ERR: A named type is circularly referenced
487
+ std::stringstream ss;
488
+ ss << "base type '" << subType << "' circularly referencing itself";
489
+
490
+ mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(nodeSourceMap, pd.sourceCharacterIndex);
491
+ report.error = Error(ss.str(), MSONError, sourceMap);
492
+ return;
493
+ }
494
+
495
+ // Otherwise, get the base type from super type
496
+ it = pd.namedTypeBaseTable.find(superType);
497
+
498
+ // If super type is not already resolved, then it means that it is a sub type of something else
499
+ if (it == pd.namedTypeBaseTable.end()) {
500
+
501
+ // Try to get the super type of the current super type
502
+ mson::NamedTypeInheritanceTable::iterator inhIt = pd.namedTypeInheritanceTable.find(superType);
503
+
504
+ // Check for recursive MSON definitions
505
+ if (inhIt == pd.namedTypeInheritanceTable.end()) {
506
+
507
+ // ERR: We cannot find the super type in inheritance table at all
508
+ // and there is not base type table entry for it, so, the blueprint is wrong
509
+ std::stringstream ss;
510
+ ss << "base type '" << superType << "' is not defined in the document";
511
+
512
+ mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(nodeSourceMap, pd.sourceCharacterIndex);
513
+ report.error = Error(ss.str(), MSONError, sourceMap);
514
+ return;
515
+ }
516
+
517
+ // Recursively, try to get a base type for the current super type
518
+ resolveNamedTypeBaseTableEntry(pd, superType, inhIt->second.first, inhIt->second.second, report);
519
+
520
+ if (report.error.code != Error::OK) {
521
+ return;
522
+ }
523
+
524
+ baseType = pd.namedTypeBaseTable.find(superType)->second;
525
+ }
526
+ else {
527
+ baseType = it->second;
528
+ }
529
+
530
+ pd.namedTypeBaseTable[subType] = baseType;
531
+ }
532
+
533
+ static void parseMetadata(const MarkdownNodeIterator& node,
534
+ SectionParserData& pd,
535
+ const ParseResultRef<MetadataCollection>& out) {
536
+
537
+ mdp::ByteBuffer content = node->text;
538
+ TrimStringEnd(content);
539
+
540
+ std::vector<mdp::ByteBuffer> lines = Split(content, '\n');
541
+
542
+ for (std::vector<mdp::ByteBuffer>::iterator it = lines.begin();
543
+ it != lines.end();
544
+ ++it) {
545
+
546
+ Metadata metadata;
547
+
548
+ if (CodeBlockUtility::keyValueFromLine(*it, metadata)) {
549
+ out.node.push_back(metadata);
550
+
551
+ if (pd.exportSourceMap()) {
552
+ SourceMap<Metadata> metadataSM;
553
+ metadataSM.sourceMap = node->sourceMap;
554
+ out.sourceMap.collection.push_back(metadataSM);
555
+ }
556
+ }
557
+ }
558
+
559
+ if (lines.size() == out.node.size()) {
560
+
561
+ // Check duplicates
562
+ std::vector<mdp::ByteBuffer> duplicateKeys;
563
+
564
+ for (MetadataCollectionIterator it = out.node.begin();
565
+ it != out.node.end();
566
+ ++it) {
567
+
568
+ MetadataCollectionIterator from = it;
569
+ if (++from == out.node.end())
570
+ break;
571
+
572
+ MetadataCollectionIterator duplicate = std::find_if(from,
573
+ out.node.end(),
574
+ std::bind2nd(MatchFirsts<Metadata>(), *it));
575
+
576
+ if (duplicate != out.node.end() &&
577
+ std::find(duplicateKeys.begin(), duplicateKeys.end(), it->first) == duplicateKeys.end()) {
578
+
579
+ duplicateKeys.push_back(it->first);
580
+
581
+ // WARN: duplicate metadata definition
582
+ std::stringstream ss;
583
+ ss << "duplicate definition of '" << it->first << "'";
584
+
585
+ mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
586
+ out.report.warnings.push_back(Warning(ss.str(),
587
+ DuplicateWarning,
588
+ sourceMap));
589
+ }
590
+ }
591
+ }
592
+ else if (!out.node.empty()) {
593
+
594
+ // WARN: malformed metadata block
595
+ mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(node->sourceMap, pd.sourceCharacterIndex);
596
+ out.report.warnings.push_back(Warning("ignoring possible metadata, expected '<key> : <value>', one one per line",
597
+ FormattingWarning,
598
+ sourceMap));
599
+ }
600
+ }
601
+
602
+ /**
603
+ * \brief Check if a resource group already exists with the given name
604
+ *
605
+ * \param blueprint The blueprint which is formed until now
606
+ * \param name The resource group name to be checked
607
+ */
608
+ static bool isResourceGroupDuplicate(const Blueprint& blueprint,
609
+ mdp::ByteBuffer& name) {
610
+
611
+ for (Elements::const_iterator it = blueprint.content.elements().begin();
612
+ it != blueprint.content.elements().end();
613
+ ++it) {
614
+
615
+ if (it->element == Element::CategoryElement &&
616
+ it->category == Element::ResourceGroupCategory &&
617
+ it->attributes.name == name) {
618
+
619
+ return true;
620
+ }
621
+ }
622
+
623
+ return false;
624
+ }
625
+
626
+ /**
627
+ * \brief Checks both blueprint and source map AST to resolve references with `Pending` state (Lazy referencing)
628
+ * \param pd Section parser state
629
+ * \param out Processed output
630
+ */
631
+ static void checkLazyReferencing(SectionParserData& pd,
632
+ const ParseResultRef<Blueprint>& out) {
633
+
634
+ Collection<SourceMap<Element> >::iterator elementSourceMapIt;
635
+
636
+ if (pd.exportSourceMap()) {
637
+ elementSourceMapIt = out.sourceMap.content.elements().collection.begin();
638
+ }
639
+
640
+ for (Elements::iterator elementIt = out.node.content.elements().begin();
641
+ elementIt != out.node.content.elements().end();
642
+ ++elementIt) {
643
+
644
+ if (elementIt->element == Element::CategoryElement) {
645
+ checkResourceLazyReferencing(*elementIt, elementSourceMapIt, pd, out);
646
+ }
647
+
648
+ if (pd.exportSourceMap()) {
649
+ elementSourceMapIt++;
650
+ }
651
+ }
652
+ }
653
+
654
+ /** Traverses Resource Collection to resolve references with `Pending` state (Lazy referencing) */
655
+ static void checkResourceLazyReferencing(Element& element,
656
+ Collection<SourceMap<Element> >::iterator& elementSourceMap,
657
+ SectionParserData& pd,
658
+ const ParseResultRef<Blueprint>& out) {
659
+
660
+ Collection<SourceMap<Element> >::iterator resourceElementSourceMapIt;
661
+
662
+ if (pd.exportSourceMap()) {
663
+ resourceElementSourceMapIt = elementSourceMap->content.elements().collection.begin();
664
+ }
665
+
666
+ for (Elements::iterator resourceElementIt = element.content.elements().begin();
667
+ resourceElementIt != element.content.elements().end();
668
+ ++resourceElementIt) {
669
+
670
+ if (resourceElementIt->element == Element::ResourceElement) {
671
+ if (pd.exportSourceMap()) {
672
+ checkActionLazyReferencing(resourceElementIt->content.resource, resourceElementSourceMapIt->content.resource, pd, out);
673
+ } else {
674
+ SourceMap<Resource> tempSourceMap;
675
+ checkActionLazyReferencing(resourceElementIt->content.resource, tempSourceMap, pd, out);
676
+ }
677
+ }
678
+
679
+ if (pd.exportSourceMap()) {
680
+ resourceElementSourceMapIt++;
681
+ }
682
+ }
683
+ }
684
+
685
+ /** Traverses Action Collection to resolve references with `Pending` state (Lazy referencing) */
686
+ static void checkActionLazyReferencing(Resource& resource,
687
+ SourceMap<Resource>& resourceSourceMap,
688
+ SectionParserData& pd,
689
+ const ParseResultRef<Blueprint>& out) {
690
+
691
+ Collection<SourceMap<Action> >::iterator actionSourceMapIt;
692
+
693
+ if (pd.exportSourceMap()) {
694
+ actionSourceMapIt = resourceSourceMap.actions.collection.begin();
695
+ }
696
+
697
+ for (Actions::iterator actionIt = resource.actions.begin();
698
+ actionIt != resource.actions.end();
699
+ ++actionIt) {
700
+
701
+ checkExampleLazyReferencing(*actionIt, actionSourceMapIt, pd, out);
702
+
703
+ if (pd.exportSourceMap()) {
704
+ actionSourceMapIt++;
705
+ }
706
+ }
707
+ }
708
+
709
+ /** Traverses Transaction Example Collection AST to resolve references with `Pending` state (Lazy referencing) */
710
+ static void checkExampleLazyReferencing(Action& action,
711
+ Collection<SourceMap<Action> >::iterator& actionSourceMapIt,
712
+ SectionParserData& pd,
713
+ const ParseResultRef<Blueprint>& out) {
714
+
715
+ Collection<SourceMap<TransactionExample> >::iterator exampleSourceMapIt;
716
+
717
+ if (pd.exportSourceMap()) {
718
+ exampleSourceMapIt = actionSourceMapIt->examples.collection.begin();
719
+ }
720
+
721
+ for (TransactionExamples::iterator transactionExampleIt = action.examples.begin();
722
+ transactionExampleIt != action.examples.end();
723
+ ++transactionExampleIt) {
724
+
725
+ checkRequestLazyReferencing(*transactionExampleIt, exampleSourceMapIt, pd, out);
726
+ checkResponseLazyReferencing(*transactionExampleIt, exampleSourceMapIt, pd, out);
727
+
728
+ if (pd.exportSourceMap()) {
729
+ exampleSourceMapIt++;
730
+ }
731
+ }
732
+ }
733
+
734
+ /** Traverses Request Collection to resolve references with `Pending` state (Lazy referencing) */
735
+ static void checkRequestLazyReferencing(TransactionExample& transactionExample,
736
+ Collection<SourceMap<TransactionExample> >::iterator& transactionExampleSourceMapIt,
737
+ SectionParserData& pd,
738
+ const ParseResultRef<Blueprint>& out) {
739
+
740
+ Collection<SourceMap<Request> >::iterator requestSourceMapIt;
741
+
742
+ if (pd.exportSourceMap()) {
743
+ requestSourceMapIt = transactionExampleSourceMapIt->requests.collection.begin();
744
+ }
745
+
746
+ for (Requests::iterator requestIt = transactionExample.requests.begin();
747
+ requestIt != transactionExample.requests.end();
748
+ ++requestIt) {
749
+
750
+ if (!requestIt->reference.id.empty() &&
751
+ requestIt->reference.meta.state == Reference::StatePending) {
752
+
753
+ if (pd.exportSourceMap()) {
754
+
755
+ ParseResultRef<Payload> payload(out.report, *requestIt, *requestSourceMapIt);
756
+ resolvePendingModels(pd, payload);
757
+ SectionProcessor<Payload>::checkRequest(requestIt->reference.meta.node, pd, payload);
758
+ }
759
+ else {
760
+
761
+ SourceMap<Payload> tempSourceMap;
762
+ ParseResultRef<Payload> payload(out.report, *requestIt, tempSourceMap);
763
+ resolvePendingModels(pd, payload);
764
+ SectionProcessor<Payload>::checkRequest(requestIt->reference.meta.node, pd, payload);
765
+ }
766
+ }
767
+
768
+ if (pd.exportSourceMap()) {
769
+ requestSourceMapIt++;
770
+ }
771
+ }
772
+ }
773
+
774
+ /** Traverses Response Collection to resolve references with `Pending` state (Lazy referencing) */
775
+ static void checkResponseLazyReferencing(TransactionExample& transactionExample,
776
+ Collection<SourceMap<TransactionExample> >::iterator& transactionExampleSourceMapIt,
777
+ SectionParserData& pd,
778
+ const ParseResultRef<Blueprint>& out) {
779
+
780
+ Collection<SourceMap<Response> >::iterator responseSourceMapIt;
781
+
782
+ if (pd.exportSourceMap()) {
783
+ responseSourceMapIt = transactionExampleSourceMapIt->responses.collection.begin();
784
+ }
785
+
786
+ for (Responses::iterator responseIt = transactionExample.responses.begin();
787
+ responseIt != transactionExample.responses.end();
788
+ ++responseIt) {
789
+
790
+ if (!responseIt->reference.id.empty() &&
791
+ responseIt->reference.meta.state == Reference::StatePending) {
792
+
793
+ if (pd.exportSourceMap()) {
794
+
795
+ ParseResultRef<Payload> payload(out.report, *responseIt, *responseSourceMapIt);
796
+ resolvePendingModels(pd, payload);
797
+ SectionProcessor<Payload>::checkResponse(responseIt->reference.meta.node, pd, payload);
798
+ }
799
+ else {
800
+
801
+ SourceMap<Payload> tempSourceMap;
802
+ ParseResultRef<Payload> payload(out.report, *responseIt, tempSourceMap);
803
+ resolvePendingModels(pd, payload);
804
+ SectionProcessor<Payload>::checkResponse(responseIt->reference.meta.node, pd, payload);
805
+ }
806
+ }
807
+
808
+ if (pd.exportSourceMap()) {
809
+ responseSourceMapIt++;
810
+ }
811
+ }
812
+ }
813
+
814
+ /**
815
+ * \brief Resolve pending model references
816
+ * \param pd Section parser data
817
+ * \param out Processed output
818
+ */
819
+ static void resolvePendingModels(SectionParserData& pd,
820
+ const ParseResultRef<Payload>& out) {
821
+
822
+ if (pd.modelTable.find(out.node.reference.id) == pd.modelTable.end()) {
823
+
824
+ // ERR: Undefined model reference
825
+ std::stringstream ss;
826
+ ss << "Undefined resource model " << out.node.reference.id;
827
+
828
+ mdp::CharactersRangeSet sourceMap = mdp::BytesRangeSetToCharactersRangeSet(out.node.reference.meta.node->sourceMap, pd.sourceCharacterIndex);
829
+ out.report.error = Error(ss.str(), ModelError, sourceMap);
830
+
831
+ out.node.reference.meta.state = Reference::StateUnresolved;
832
+ }
833
+ else {
834
+
835
+ out.node.reference.meta.state = Reference::StateResolved;
836
+ SectionProcessor<Payload>::assingReferredPayload(pd, out);
837
+ }
838
+ }
839
+ };
840
+
841
+ /** Blueprint Parser */
842
+ typedef SectionParser<Blueprint, BlueprintSectionAdapter> BlueprintParser;
843
+ }
844
+
845
+ #endif