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,34 @@
1
+ //
2
+ // SerializeResult.h
3
+ // drafter
4
+ //
5
+ // Created by Jiri Kratochvil on 27-02-2015
6
+ // Copyright (c) 2015 Apiary Inc. All rights reserved.
7
+ //
8
+
9
+ #ifndef DRAFTER_SERIALIZERESULT_H
10
+ #define DRAFTER_SERIALIZERESULT_H
11
+
12
+ #include "Serialize.h"
13
+ #include "SectionParserData.h"
14
+
15
+ namespace snowcrash {
16
+ struct SourceAnnotation;
17
+ }
18
+
19
+ namespace refract {
20
+ struct IElement;
21
+ }
22
+
23
+ namespace drafter {
24
+
25
+ class ConversionContext;
26
+
27
+ sos::Object WrapAnnotation(const snowcrash::SourceAnnotation& annotation);
28
+ sos::Object WrapResult(snowcrash::ParseResult<snowcrash::Blueprint>& blueprint, const WrapperOptions& options);
29
+
30
+ refract::IElement* WrapParseResultRefract(snowcrash::ParseResult<snowcrash::Blueprint>& blueprint,
31
+ ConversionContext& context);
32
+ }
33
+
34
+ #endif // #ifndef DRAFTER_SERIALIZERESULT_H
@@ -0,0 +1,331 @@
1
+ //
2
+ // SerializeSourcemap.cc
3
+ // drafter
4
+ //
5
+ // Created by Pavan Kumar Sunkara on 18/01/15.
6
+ // Copyright (c) 2015 Apiary Inc. All rights reserved.
7
+ //
8
+
9
+ #include "SerializeSourcemap.h"
10
+ #include "ConversionContext.h"
11
+
12
+ using namespace drafter;
13
+
14
+ using snowcrash::SourceMapBase;
15
+ using snowcrash::SourceMap;
16
+ using snowcrash::Collection;
17
+
18
+ using snowcrash::DataStructure;
19
+ using snowcrash::Asset;
20
+ using snowcrash::Payload;
21
+ using snowcrash::Header;
22
+ using snowcrash::Parameter;
23
+ using snowcrash::Value;
24
+ using snowcrash::TransactionExample;
25
+ using snowcrash::Request;
26
+ using snowcrash::Response;
27
+ using snowcrash::Action;
28
+ using snowcrash::Resource;
29
+ using snowcrash::Element;
30
+ using snowcrash::Description;
31
+ using snowcrash::Blueprint;
32
+ using snowcrash::Metadata;
33
+
34
+ sos::Array WrapSourcemap(const SourceMapBase& value)
35
+ {
36
+ sos::Array sourceMap;
37
+
38
+ for (mdp::RangeSet<mdp::BytesRange>::const_iterator it = value.sourceMap.begin();
39
+ it != value.sourceMap.end();
40
+ ++it) {
41
+
42
+ sos::Array sourceMapRow;
43
+
44
+ sourceMapRow.push(sos::Number(it->location));
45
+ sourceMapRow.push(sos::Number(it->length));
46
+
47
+ sourceMap.push(sourceMapRow);
48
+ }
49
+
50
+ return sourceMap;
51
+ }
52
+
53
+ sos::Object WrapAssetSourcemap(const SourceMap<Asset>& asset)
54
+ {
55
+ sos::Object assetObject;
56
+
57
+ // Content
58
+ assetObject.set(SerializeKey::Content, WrapSourcemap(asset));
59
+
60
+ return assetObject;
61
+ }
62
+
63
+ sos::Object WrapPayloadSourcemap(const SourceMap<Payload>& payload)
64
+ {
65
+ sos::Object payloadObject;
66
+
67
+ // Reference
68
+ if (!payload.reference.sourceMap.empty()) {
69
+ payloadObject.set(SerializeKey::Reference, WrapSourcemap(payload.reference));
70
+ }
71
+
72
+ // Name
73
+ payloadObject.set(SerializeKey::Name, WrapSourcemap(payload.name));
74
+
75
+ // Description
76
+ payloadObject.set(SerializeKey::Description, WrapSourcemap(payload.description));
77
+
78
+ // Headers
79
+ payloadObject.set(SerializeKey::Headers,
80
+ WrapCollection<Header>()(payload.headers.collection, WrapSourcemap));
81
+
82
+ // Body
83
+ payloadObject.set(SerializeKey::Body, WrapSourcemap(payload.body));
84
+
85
+ // Schema
86
+ payloadObject.set(SerializeKey::Schema, WrapSourcemap(payload.schema));
87
+
88
+ // Content
89
+ sos::Array content;
90
+
91
+ /// Asset 'bodyExample'
92
+ if (!payload.body.sourceMap.empty()) {
93
+ content.push(WrapAssetSourcemap(payload.body));
94
+ }
95
+
96
+ /// Asset 'bodySchema'
97
+ if (!payload.schema.sourceMap.empty()) {
98
+ content.push(WrapAssetSourcemap(payload.schema));
99
+ }
100
+
101
+ payloadObject.set(SerializeKey::Content, content);
102
+
103
+ return payloadObject;
104
+ }
105
+
106
+ sos::Object WrapParameterValueSourceMap(const SourceMap<Value>& value)
107
+ {
108
+ sos::Object object;
109
+ object.set(SerializeKey::Value, WrapSourcemap(value));
110
+ return object;
111
+ }
112
+
113
+ sos::Object WrapParameterSourcemap(const SourceMap<Parameter>& parameter)
114
+ {
115
+ sos::Object object;
116
+
117
+ // Name
118
+ object.set(SerializeKey::Name, WrapSourcemap(parameter.name));
119
+
120
+ // Description
121
+ object.set(SerializeKey::Description, WrapSourcemap(parameter.description));
122
+
123
+ // Type
124
+ object.set(SerializeKey::Type, WrapSourcemap(parameter.type));
125
+
126
+ // Use
127
+ object.set(SerializeKey::Required, WrapSourcemap(parameter.use));
128
+
129
+ // Example Value
130
+ object.set(SerializeKey::Example, WrapSourcemap(parameter.exampleValue));
131
+
132
+ // Default Value
133
+ object.set(SerializeKey::Default, WrapSourcemap(parameter.defaultValue));
134
+
135
+ // Values
136
+ object.set(SerializeKey::Values,
137
+ WrapCollection<Value>()(parameter.values.collection, WrapParameterValueSourceMap));
138
+
139
+ return object;
140
+ }
141
+
142
+ sos::Object WrapTransactionExampleSourcemap(const SourceMap<TransactionExample>& example)
143
+ {
144
+ sos::Object exampleObject;
145
+
146
+ // Name
147
+ exampleObject.set(SerializeKey::Name, WrapSourcemap(example.name));
148
+
149
+ // Description
150
+ exampleObject.set(SerializeKey::Description, WrapSourcemap(example.description));
151
+
152
+ // Requests
153
+ exampleObject.set(SerializeKey::Requests,
154
+ WrapCollection<Request>()(example.requests.collection, WrapPayloadSourcemap));
155
+
156
+ // Responses
157
+ exampleObject.set(SerializeKey::Responses,
158
+ WrapCollection<Response>()(example.responses.collection, WrapPayloadSourcemap));
159
+
160
+ return exampleObject;
161
+ }
162
+
163
+ sos::Object WrapActionSourcemap(const SourceMap<Action>& action)
164
+ {
165
+ sos::Object actionObject;
166
+
167
+ // Name
168
+ actionObject.set(SerializeKey::Name, WrapSourcemap(action.name));
169
+
170
+ // Description
171
+ actionObject.set(SerializeKey::Description, WrapSourcemap(action.description));
172
+
173
+ // HTTP Method
174
+ actionObject.set(SerializeKey::Method, WrapSourcemap(action.method));
175
+
176
+ // Parameters
177
+ actionObject.set(SerializeKey::Parameters,
178
+ WrapCollection<Parameter>()(action.parameters.collection, WrapParameterSourcemap));
179
+
180
+ // Transaction Examples
181
+ actionObject.set(SerializeKey::Examples,
182
+ WrapCollection<TransactionExample>()(action.examples.collection, WrapTransactionExampleSourcemap));
183
+
184
+ // Attributes
185
+ sos::Object attributes;
186
+
187
+ /// Relation
188
+ attributes.set(SerializeKey::Relation, WrapSourcemap(action.relation));
189
+
190
+ /// URI Template
191
+ attributes.set(SerializeKey::URITemplate, WrapSourcemap(action.uriTemplate));
192
+
193
+ actionObject.set(SerializeKey::Attributes, attributes);
194
+
195
+ // Content
196
+ sos::Array content;
197
+
198
+ actionObject.set(SerializeKey::Content, content);
199
+
200
+ return actionObject;
201
+ }
202
+
203
+ sos::Object WrapResourceSourcemap(const SourceMap<Resource>& resource)
204
+ {
205
+ sos::Object resourceObject;
206
+
207
+ // Name
208
+ resourceObject.set(SerializeKey::Name, WrapSourcemap(resource.name));
209
+
210
+ // Description
211
+ resourceObject.set(SerializeKey::Description, WrapSourcemap(resource.description));
212
+
213
+ // URI Template
214
+ resourceObject.set(SerializeKey::URITemplate, WrapSourcemap(resource.uriTemplate));
215
+
216
+ // Model
217
+ sos::Object model = (resource.model.name.sourceMap.empty() ? sos::Object() : WrapPayloadSourcemap(resource.model));
218
+ resourceObject.set(SerializeKey::Model, model);
219
+
220
+ // Parameters
221
+ resourceObject.set(SerializeKey::Parameters,
222
+ WrapCollection<Parameter>()(resource.parameters.collection, WrapParameterSourcemap));
223
+
224
+ // Actions
225
+ resourceObject.set(SerializeKey::Actions,
226
+ WrapCollection<Action>()(resource.actions.collection, WrapActionSourcemap));
227
+
228
+ // Content
229
+ sos::Array content;
230
+
231
+ resourceObject.set(SerializeKey::Content, content);
232
+
233
+ return resourceObject;
234
+ }
235
+
236
+ sos::Object WrapResourceGroupSourcemap(const SourceMap<Element>& resourceGroup)
237
+ {
238
+ sos::Object resourceGroupObject;
239
+
240
+ // Name
241
+ resourceGroupObject.set(SerializeKey::Name, WrapSourcemap(resourceGroup.attributes.name));
242
+
243
+ // Description & Resources
244
+ SourceMap<Description> description;
245
+ sos::Array resources;
246
+
247
+ for (Collection<SourceMap<Element> >::const_iterator it = resourceGroup.content.elements().collection.begin();
248
+ it != resourceGroup.content.elements().collection.end();
249
+ ++it) {
250
+
251
+ if (it->element == Element::ResourceElement) {
252
+ resources.push(WrapResourceSourcemap(it->content.resource));
253
+ }
254
+ else if (it->element == Element::CopyElement) {
255
+ description.sourceMap.append(it->content.copy.sourceMap);
256
+ }
257
+ }
258
+
259
+ resourceGroupObject.set(SerializeKey::Description, WrapSourcemap(description));
260
+ resourceGroupObject.set(SerializeKey::Resources, resources);
261
+
262
+ return resourceGroupObject;
263
+ }
264
+
265
+ sos::Object WrapElementSourcemap(const SourceMap<Element>& element)
266
+ {
267
+ sos::Object elementObject;
268
+
269
+ if (!element.attributes.name.sourceMap.empty()) {
270
+
271
+ sos::Object attributes;
272
+
273
+ attributes.set(SerializeKey::Name, WrapSourcemap(element.attributes.name));
274
+ elementObject.set(SerializeKey::Attributes, attributes);
275
+ }
276
+
277
+ switch (element.element) {
278
+ case Element::CopyElement:
279
+ {
280
+ elementObject.set(SerializeKey::Content, WrapSourcemap(element.content.copy));
281
+ break;
282
+ }
283
+
284
+ case Element::ResourceElement:
285
+ {
286
+ return WrapResourceSourcemap(element.content.resource);
287
+ }
288
+
289
+ case Element::CategoryElement:
290
+ {
291
+ elementObject.set(SerializeKey::Content,
292
+ WrapCollection<Element>()(element.content.elements().collection, WrapElementSourcemap));
293
+ break;
294
+ }
295
+
296
+ default:
297
+ break;
298
+ }
299
+
300
+ return elementObject;
301
+ }
302
+
303
+ bool IsElementResourceGroup(const SourceMap<Element>& element)
304
+ {
305
+ return element.element == Element::CategoryElement && element.category == Element::ResourceGroupCategory;
306
+ }
307
+
308
+ sos::Object drafter::WrapBlueprintSourcemap(const SourceMap<Blueprint>& blueprint, ConversionContext& context)
309
+ {
310
+ sos::Object blueprintObject;
311
+
312
+ // Metadata
313
+ blueprintObject.set(SerializeKey::Metadata,
314
+ WrapCollection<Metadata>()(blueprint.metadata.collection, WrapSourcemap));
315
+
316
+ // Name
317
+ blueprintObject.set(SerializeKey::Name, WrapSourcemap(blueprint.name));
318
+
319
+ // Description
320
+ blueprintObject.set(SerializeKey::Description, WrapSourcemap(blueprint.description));
321
+
322
+ // Resource Groups
323
+ blueprintObject.set(SerializeKey::ResourceGroups,
324
+ WrapCollectionIf<Element>()(blueprint.content.elements().collection, WrapResourceGroupSourcemap, IsElementResourceGroup));
325
+
326
+ // Content
327
+ blueprintObject.set(SerializeKey::Content,
328
+ WrapCollectionIf<Element>()(blueprint.content.elements().collection, WrapElementSourcemap, IsElementResourceGroup));
329
+
330
+ return blueprintObject;
331
+ }
@@ -0,0 +1,21 @@
1
+ //
2
+ // SerializeSourcemap.h
3
+ // drafter
4
+ //
5
+ // Created by Pavan Kumar Sunkara on 18/01/15.
6
+ // Copyright (c) 2015 Apiary Inc. All rights reserved.
7
+ //
8
+
9
+ #ifndef DRAFTER_SERIALIZESOURCEMAP_H
10
+ #define DRAFTER_SERIALIZESOURCEMAP_H
11
+
12
+ #include "Serialize.h"
13
+
14
+ namespace drafter {
15
+
16
+ class ConversionContext;
17
+
18
+ sos::Object WrapBlueprintSourcemap(const snowcrash::SourceMap<snowcrash::Blueprint>& blueprint, ConversionContext& context);
19
+ }
20
+
21
+ #endif
@@ -0,0 +1,40 @@
1
+ //
2
+ // version.h
3
+ // drafter
4
+ //
5
+ // Created by Jiri Kratochvil on 2015-02-13
6
+ // Attribution Notice:
7
+ // This work might use parts of Node.js `node_version.h`
8
+ // https://github.com/joyent/node
9
+ //
10
+ // Copyright (c) 2015 Apiary Inc. All rights reserved.
11
+ //
12
+
13
+ #ifndef DRAFTER_VERSION_H
14
+ #define DRAFTER_VERSION_H
15
+
16
+ #define DRAFTER_MAJOR_VERSION 3
17
+ #define DRAFTER_MINOR_VERSION 2
18
+ #define DRAFTER_PATCH_VERSION 2
19
+
20
+ #define DRAFTER_VERSION_IS_RELEASE 1
21
+ #define DRAFTER_PRE_RELEASE_VERSION 0
22
+
23
+ #ifndef DRAFTER_STRINGIFY
24
+ # define DRAFTER_STRINGIFY(n) DRAFTER_STRINGIFY_HELPER(n)
25
+ # define DRAFTER_STRINGIFY_HELPER(n) #n
26
+ #endif
27
+
28
+ #define DRAFTER_VERSION_STRING_HELPER "v" \
29
+ DRAFTER_STRINGIFY(DRAFTER_MAJOR_VERSION) "." \
30
+ DRAFTER_STRINGIFY(DRAFTER_MINOR_VERSION) "." \
31
+ DRAFTER_STRINGIFY(DRAFTER_PATCH_VERSION)
32
+
33
+ #if DRAFTER_VERSION_IS_RELEASE
34
+ # define DRAFTER_VERSION_STRING DRAFTER_VERSION_STRING_HELPER
35
+ #else
36
+ # define DRAFTER_VERSION_STRING DRAFTER_VERSION_STRING_HELPER "-pre." \
37
+ DRAFTER_STRINGIFY(DRAFTER_PRE_RELEASE_VERSION)
38
+ #endif
39
+
40
+ #endif
@@ -0,0 +1,91 @@
1
+ //
2
+ //
3
+ // vi:cin:et:sw=4 ts=4
4
+ //
5
+ // config.cc - part of drafter
6
+ //
7
+ // Created by Jiri Kratochvil on 2015-02-13
8
+ // Copyright (c) 2015 Apiary Inc. All rights reserved.
9
+ //
10
+
11
+ #include "config.h"
12
+ #include "cmdline.h"
13
+
14
+ #include "Version.h"
15
+
16
+ namespace config {
17
+ static const std::string Program = "drafter";
18
+
19
+ static const std::string Output = "output";
20
+ static const std::string Format = "format";
21
+ static const std::string Type = "type";
22
+ static const std::string Render = "render";
23
+ static const std::string Sourcemap = "sourcemap";
24
+ static const std::string Help = "help";
25
+ static const std::string Validate = "validate";
26
+ static const std::string Version = "version";
27
+ static const std::string UseLineNumbers = "use-line-num";
28
+ };
29
+
30
+ void PrepareCommanLineParser(cmdline::parser& parser)
31
+ {
32
+ parser.set_program_name(config::Program);
33
+
34
+ parser.add<std::string>(config::Output, 'o', "save output Parse Result into file", false);
35
+ parser.add<std::string>(config::Format, 'f', "output format of the Parse Result (yaml|json)", false, "yaml", cmdline::oneof<std::string>("yaml", "json"));
36
+ parser.add<std::string>(config::Type, 't', "type of the Parse Result (refract|ast)", false, "refract", cmdline::oneof<std::string>("refract", "ast"));
37
+ parser.add(config::Sourcemap, 's', "export sourcemap in the Parse Result");
38
+ parser.add(config::Help, 'h', "display this help message");
39
+ parser.add(config::Version , 'v', "print Drafter version");
40
+ parser.add(config::Validate, 'l', "validate input only, do not output Parse Result");
41
+ parser.add(config::UseLineNumbers , 'u', "use line and row number instead of character index when printing annotation");
42
+
43
+ std::stringstream ss;
44
+
45
+ ss << "<input file>\n\n";
46
+ ss << "API Blueprint Parser\n";
47
+ ss << "If called without <input file>, 'drafter' will listen on stdin.\n";
48
+
49
+ parser.footer(ss.str());
50
+ }
51
+
52
+ void ValidateParsedCommandLine(const cmdline::parser& parser, const Config& config)
53
+ {
54
+ if (parser.rest().size() > 1) {
55
+ std::cerr << "one input file expected, got " << parser.rest().size() << std::endl;
56
+ exit(EXIT_FAILURE);
57
+ }
58
+
59
+ if (parser.exist(config::Version)) {
60
+ std::cout << DRAFTER_VERSION_STRING << std::endl;
61
+ exit(EXIT_SUCCESS);
62
+ }
63
+
64
+ if (config.validate) {
65
+ if (parser.exist(config::Output)) {
66
+ std::cerr << "WARN: While validation is enabled, output file will not be created" << std::endl;
67
+ }
68
+ }
69
+
70
+ }
71
+
72
+ void ParseCommadLineOptions(int argc, const char *argv[], /* out */Config& conf)
73
+ {
74
+ cmdline::parser parser;
75
+ PrepareCommanLineParser(parser);
76
+
77
+ parser.parse_check(argc, argv);
78
+
79
+ if (!parser.rest().empty()) {
80
+ conf.input = parser.rest().front();
81
+ }
82
+
83
+ conf.lineNumbers = parser.exist(config::UseLineNumbers);
84
+ conf.validate = parser.exist(config::Validate);
85
+ conf.format = parser.get<std::string>(config::Format) == "json" ? drafter::JSONFormat : drafter::YAMLFormat;
86
+ conf.astType = parser.get<std::string>(config::Type) == "ast" ? drafter::NormalASTType : drafter::RefractASTType;
87
+ conf.output = parser.get<std::string>(config::Output);
88
+ conf.sourceMap = parser.exist(config::Sourcemap);
89
+
90
+ ValidateParsedCommandLine(parser, conf);
91
+ }
@@ -0,0 +1,38 @@
1
+ //
2
+ // vi:cin:et:sw=4 ts=4
3
+ //
4
+ // config.h - part of drafter
5
+ //
6
+ // Created by Jiri Kratochvil on 2015-02-13
7
+ // Copyright (c) 2015 Apiary Inc. All rights reserved.
8
+ //
9
+ #ifndef DRAFTER_CONFIG_H
10
+ #define DRAFTER_CONFIG_H
11
+
12
+ #include <string>
13
+
14
+ #include "Serialize.h"
15
+
16
+ struct Config {
17
+ std::string input;
18
+ bool lineNumbers;
19
+ bool validate;
20
+ drafter::SerializeFormat format;
21
+ drafter::ASTType astType;
22
+ bool sourceMap;
23
+ std::string output;
24
+ };
25
+
26
+ /**
27
+ * \brief parse commandline params
28
+ *
29
+ * \param argc argc as received to main()
30
+ * \param argv argv as received to main()
31
+ * \param conf output - parsed parameters
32
+ *
33
+ * side effect - can call exit() if wrong params are sent to program
34
+ */
35
+ void ParseCommadLineOptions(int argc, const char *argv[], /** out */Config& conf);
36
+
37
+
38
+ #endif /* end of include guard: DRAFTER_CONFIG_H */
@@ -0,0 +1,137 @@
1
+ //
2
+ // drafter.cc
3
+ // drafter
4
+ //
5
+ // Created by Jiri Kratochvil on 2016-06-27
6
+ // Copyright (c) 2016 Apiary Inc. All rights reserved.
7
+ //
8
+ #include "drafter_private.h"
9
+
10
+ #include "snowcrash.h"
11
+
12
+ #include "SerializeResult.h" // FIXME: remove - actualy required by WrapParseResultRefract()
13
+ #include "Serialize.h" // FIXME: remove - actualy required by WrapperOptions
14
+ #include "ConversionContext.h" // FIXME: remove - required by ConversionContext
15
+ #include "RefractDataStructure.h" // FIXME: remove - required by SerializeRefract()
16
+
17
+ #include "sos.h" // FIXME: remove sos dependency
18
+ #include "sosJSON.h"
19
+ #include "sosYAML.h"
20
+
21
+ #include "Version.h"
22
+
23
+ #include <string.h>
24
+
25
+ DRAFTER_API int drafter_parse_blueprint_to(const char* source,
26
+ char ** out,
27
+ const drafter_options options) {
28
+
29
+ if (!source || !out) {
30
+ return -1;
31
+ }
32
+
33
+ drafter_result* result = nullptr;
34
+ *out = nullptr;
35
+
36
+ int ret = drafter_parse_blueprint(source, &result);
37
+
38
+ if (!result) {
39
+ return -1;
40
+ }
41
+
42
+ *out = drafter_serialize(result, options);
43
+
44
+ drafter_free_result(result);
45
+
46
+ return ret;
47
+ }
48
+
49
+ namespace sc = snowcrash;
50
+
51
+ /* Parse API Bleuprint and return result, which is a opaque handle for
52
+ * later use*/
53
+ DRAFTER_API int drafter_parse_blueprint(const char* source, drafter_result** out) {
54
+
55
+ drafter_parse_options options = {false};
56
+
57
+ return drafter_parse_blueprint_with_options(source, out, options);
58
+ }
59
+
60
+ namespace { // FIXME: cut'n'paste from main.cc - duplicity
61
+
62
+ sos::Serialize* CreateSerializer(const drafter::SerializeFormat& format)
63
+ {
64
+ if (format == drafter::JSONFormat) {
65
+ return new sos::SerializeJSON;
66
+ }
67
+
68
+ return new sos::SerializeYAML;
69
+ }
70
+
71
+ /**
72
+ * \brief Serialize sos::Object into stream
73
+ */
74
+ void Serialization(std::ostream *stream,
75
+ const sos::Object& object,
76
+ sos::Serialize* serializer)
77
+ {
78
+ serializer->process(object, *stream);
79
+ *stream << "\n";
80
+ *stream << std::flush;
81
+ }
82
+
83
+ }
84
+
85
+ /* Serialize result to given format*/
86
+ DRAFTER_API char* drafter_serialize(drafter_result *res, const drafter_options options) {
87
+
88
+ if (!res) {
89
+ return nullptr;
90
+ }
91
+
92
+ drafter::WrapperOptions woptions(drafter::RefractASTType, options.sourcemap);
93
+ drafter::ConversionContext context(woptions);
94
+
95
+ sos::Object result = drafter::SerializeRefract(res, context);
96
+
97
+ std::unique_ptr<sos::Serialize> serializer(CreateSerializer(options.format == DRAFTER_SERIALIZE_JSON ? drafter::JSONFormat : drafter::YAMLFormat));
98
+
99
+ std::ostringstream out;
100
+
101
+ Serialization(&out, result, serializer.get());
102
+
103
+ return strdup(out.str().c_str());
104
+ }
105
+
106
+ /* Parse API Blueprint and return only annotations, if NULL than
107
+ * document is error and warning free.*/
108
+ DRAFTER_API drafter_result* drafter_check_blueprint(const char* source) {
109
+
110
+ drafter_parse_options options = {false};
111
+
112
+ return drafter_check_blueprint_with_options(source, options);
113
+ }
114
+
115
+ DRAFTER_API void drafter_free_result(drafter_result* result) {
116
+ delete result;
117
+ }
118
+
119
+ #define VERSION_SHIFT_STEP 8
120
+
121
+ DRAFTER_API unsigned int drafter_version(void) {
122
+ unsigned int version = 0;
123
+
124
+ version |= DRAFTER_MAJOR_VERSION;
125
+ version <<= VERSION_SHIFT_STEP;
126
+ version |= DRAFTER_MINOR_VERSION;
127
+ version <<= VERSION_SHIFT_STEP;
128
+ version |= DRAFTER_PATCH_VERSION;
129
+
130
+ return version;
131
+ }
132
+
133
+ #undef VERSION_SHIFT_STEP
134
+
135
+ DRAFTER_API const char* drafter_version_string(void) {
136
+ return DRAFTER_VERSION_STRING;
137
+ }