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,155 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) 2012 Google Inc. All rights reserved.
4
+ # Use of this source code is governed by a BSD-style license that can be
5
+ # found in the LICENSE file.
6
+
7
+ """Pretty-prints the contents of a GYP file."""
8
+
9
+ import sys
10
+ import re
11
+
12
+
13
+ # Regex to remove comments when we're counting braces.
14
+ COMMENT_RE = re.compile(r'\s*#.*')
15
+
16
+ # Regex to remove quoted strings when we're counting braces.
17
+ # It takes into account quoted quotes, and makes sure that the quotes match.
18
+ # NOTE: It does not handle quotes that span more than one line, or
19
+ # cases where an escaped quote is preceeded by an escaped backslash.
20
+ QUOTE_RE_STR = r'(?P<q>[\'"])(.*?)(?<![^\\][\\])(?P=q)'
21
+ QUOTE_RE = re.compile(QUOTE_RE_STR)
22
+
23
+
24
+ def comment_replace(matchobj):
25
+ return matchobj.group(1) + matchobj.group(2) + '#' * len(matchobj.group(3))
26
+
27
+
28
+ def mask_comments(input):
29
+ """Mask the quoted strings so we skip braces inside quoted strings."""
30
+ search_re = re.compile(r'(.*?)(#)(.*)')
31
+ return [search_re.sub(comment_replace, line) for line in input]
32
+
33
+
34
+ def quote_replace(matchobj):
35
+ return "%s%s%s%s" % (matchobj.group(1),
36
+ matchobj.group(2),
37
+ 'x'*len(matchobj.group(3)),
38
+ matchobj.group(2))
39
+
40
+
41
+ def mask_quotes(input):
42
+ """Mask the quoted strings so we skip braces inside quoted strings."""
43
+ search_re = re.compile(r'(.*?)' + QUOTE_RE_STR)
44
+ return [search_re.sub(quote_replace, line) for line in input]
45
+
46
+
47
+ def do_split(input, masked_input, search_re):
48
+ output = []
49
+ mask_output = []
50
+ for (line, masked_line) in zip(input, masked_input):
51
+ m = search_re.match(masked_line)
52
+ while m:
53
+ split = len(m.group(1))
54
+ line = line[:split] + r'\n' + line[split:]
55
+ masked_line = masked_line[:split] + r'\n' + masked_line[split:]
56
+ m = search_re.match(masked_line)
57
+ output.extend(line.split(r'\n'))
58
+ mask_output.extend(masked_line.split(r'\n'))
59
+ return (output, mask_output)
60
+
61
+
62
+ def split_double_braces(input):
63
+ """Masks out the quotes and comments, and then splits appropriate
64
+ lines (lines that matche the double_*_brace re's above) before
65
+ indenting them below.
66
+
67
+ These are used to split lines which have multiple braces on them, so
68
+ that the indentation looks prettier when all laid out (e.g. closing
69
+ braces make a nice diagonal line).
70
+ """
71
+ double_open_brace_re = re.compile(r'(.*?[\[\{\(,])(\s*)([\[\{\(])')
72
+ double_close_brace_re = re.compile(r'(.*?[\]\}\)],?)(\s*)([\]\}\)])')
73
+
74
+ masked_input = mask_quotes(input)
75
+ masked_input = mask_comments(masked_input)
76
+
77
+ (output, mask_output) = do_split(input, masked_input, double_open_brace_re)
78
+ (output, mask_output) = do_split(output, mask_output, double_close_brace_re)
79
+
80
+ return output
81
+
82
+
83
+ def count_braces(line):
84
+ """keeps track of the number of braces on a given line and returns the result.
85
+
86
+ It starts at zero and subtracts for closed braces, and adds for open braces.
87
+ """
88
+ open_braces = ['[', '(', '{']
89
+ close_braces = [']', ')', '}']
90
+ closing_prefix_re = re.compile(r'(.*?[^\s\]\}\)]+.*?)([\]\}\)],?)\s*$')
91
+ cnt = 0
92
+ stripline = COMMENT_RE.sub(r'', line)
93
+ stripline = QUOTE_RE.sub(r"''", stripline)
94
+ for char in stripline:
95
+ for brace in open_braces:
96
+ if char == brace:
97
+ cnt += 1
98
+ for brace in close_braces:
99
+ if char == brace:
100
+ cnt -= 1
101
+
102
+ after = False
103
+ if cnt > 0:
104
+ after = True
105
+
106
+ # This catches the special case of a closing brace having something
107
+ # other than just whitespace ahead of it -- we don't want to
108
+ # unindent that until after this line is printed so it stays with
109
+ # the previous indentation level.
110
+ if cnt < 0 and closing_prefix_re.match(stripline):
111
+ after = True
112
+ return (cnt, after)
113
+
114
+
115
+ def prettyprint_input(lines):
116
+ """Does the main work of indenting the input based on the brace counts."""
117
+ indent = 0
118
+ basic_offset = 2
119
+ last_line = ""
120
+ for line in lines:
121
+ if COMMENT_RE.match(line):
122
+ print line
123
+ else:
124
+ line = line.strip('\r\n\t ') # Otherwise doesn't strip \r on Unix.
125
+ if len(line) > 0:
126
+ (brace_diff, after) = count_braces(line)
127
+ if brace_diff != 0:
128
+ if after:
129
+ print " " * (basic_offset * indent) + line
130
+ indent += brace_diff
131
+ else:
132
+ indent += brace_diff
133
+ print " " * (basic_offset * indent) + line
134
+ else:
135
+ print " " * (basic_offset * indent) + line
136
+ else:
137
+ print ""
138
+ last_line = line
139
+
140
+
141
+ def main():
142
+ if len(sys.argv) > 1:
143
+ data = open(sys.argv[1]).read().splitlines()
144
+ else:
145
+ data = sys.stdin.read().splitlines()
146
+ # Split up the double braces.
147
+ lines = split_double_braces(data)
148
+
149
+ # Indent and print the output.
150
+ prettyprint_input(lines)
151
+ return 0
152
+
153
+
154
+ if __name__ == '__main__':
155
+ sys.exit(main())
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) 2012 Google Inc. All rights reserved.
4
+ # Use of this source code is governed by a BSD-style license that can be
5
+ # found in the LICENSE file.
6
+
7
+ """Prints the information in a sln file in a diffable way.
8
+
9
+ It first outputs each projects in alphabetical order with their
10
+ dependencies.
11
+
12
+ Then it outputs a possible build order.
13
+ """
14
+
15
+ __author__ = 'nsylvain (Nicolas Sylvain)'
16
+
17
+ import os
18
+ import re
19
+ import sys
20
+ import pretty_vcproj
21
+
22
+ def BuildProject(project, built, projects, deps):
23
+ # if all dependencies are done, we can build it, otherwise we try to build the
24
+ # dependency.
25
+ # This is not infinite-recursion proof.
26
+ for dep in deps[project]:
27
+ if dep not in built:
28
+ BuildProject(dep, built, projects, deps)
29
+ print project
30
+ built.append(project)
31
+
32
+ def ParseSolution(solution_file):
33
+ # All projects, their clsid and paths.
34
+ projects = dict()
35
+
36
+ # A list of dependencies associated with a project.
37
+ dependencies = dict()
38
+
39
+ # Regular expressions that matches the SLN format.
40
+ # The first line of a project definition.
41
+ begin_project = re.compile(r'^Project\("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942'
42
+ r'}"\) = "(.*)", "(.*)", "(.*)"$')
43
+ # The last line of a project definition.
44
+ end_project = re.compile('^EndProject$')
45
+ # The first line of a dependency list.
46
+ begin_dep = re.compile(
47
+ r'ProjectSection\(ProjectDependencies\) = postProject$')
48
+ # The last line of a dependency list.
49
+ end_dep = re.compile('EndProjectSection$')
50
+ # A line describing a dependency.
51
+ dep_line = re.compile(' *({.*}) = ({.*})$')
52
+
53
+ in_deps = False
54
+ solution = open(solution_file)
55
+ for line in solution:
56
+ results = begin_project.search(line)
57
+ if results:
58
+ # Hack to remove icu because the diff is too different.
59
+ if results.group(1).find('icu') != -1:
60
+ continue
61
+ # We remove "_gyp" from the names because it helps to diff them.
62
+ current_project = results.group(1).replace('_gyp', '')
63
+ projects[current_project] = [results.group(2).replace('_gyp', ''),
64
+ results.group(3),
65
+ results.group(2)]
66
+ dependencies[current_project] = []
67
+ continue
68
+
69
+ results = end_project.search(line)
70
+ if results:
71
+ current_project = None
72
+ continue
73
+
74
+ results = begin_dep.search(line)
75
+ if results:
76
+ in_deps = True
77
+ continue
78
+
79
+ results = end_dep.search(line)
80
+ if results:
81
+ in_deps = False
82
+ continue
83
+
84
+ results = dep_line.search(line)
85
+ if results and in_deps and current_project:
86
+ dependencies[current_project].append(results.group(1))
87
+ continue
88
+
89
+ # Change all dependencies clsid to name instead.
90
+ for project in dependencies:
91
+ # For each dependencies in this project
92
+ new_dep_array = []
93
+ for dep in dependencies[project]:
94
+ # Look for the project name matching this cldis
95
+ for project_info in projects:
96
+ if projects[project_info][1] == dep:
97
+ new_dep_array.append(project_info)
98
+ dependencies[project] = sorted(new_dep_array)
99
+
100
+ return (projects, dependencies)
101
+
102
+ def PrintDependencies(projects, deps):
103
+ print "---------------------------------------"
104
+ print "Dependencies for all projects"
105
+ print "---------------------------------------"
106
+ print "-- --"
107
+
108
+ for (project, dep_list) in sorted(deps.items()):
109
+ print "Project : %s" % project
110
+ print "Path : %s" % projects[project][0]
111
+ if dep_list:
112
+ for dep in dep_list:
113
+ print " - %s" % dep
114
+ print ""
115
+
116
+ print "-- --"
117
+
118
+ def PrintBuildOrder(projects, deps):
119
+ print "---------------------------------------"
120
+ print "Build order "
121
+ print "---------------------------------------"
122
+ print "-- --"
123
+
124
+ built = []
125
+ for (project, _) in sorted(deps.items()):
126
+ if project not in built:
127
+ BuildProject(project, built, projects, deps)
128
+
129
+ print "-- --"
130
+
131
+ def PrintVCProj(projects):
132
+
133
+ for project in projects:
134
+ print "-------------------------------------"
135
+ print "-------------------------------------"
136
+ print project
137
+ print project
138
+ print project
139
+ print "-------------------------------------"
140
+ print "-------------------------------------"
141
+
142
+ project_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[1]),
143
+ projects[project][2]))
144
+
145
+ pretty = pretty_vcproj
146
+ argv = [ '',
147
+ project_path,
148
+ '$(SolutionDir)=%s\\' % os.path.dirname(sys.argv[1]),
149
+ ]
150
+ argv.extend(sys.argv[3:])
151
+ pretty.main(argv)
152
+
153
+ def main():
154
+ # check if we have exactly 1 parameter.
155
+ if len(sys.argv) < 2:
156
+ print 'Usage: %s "c:\\path\\to\\project.sln"' % sys.argv[0]
157
+ return 1
158
+
159
+ (projects, deps) = ParseSolution(sys.argv[1])
160
+ PrintDependencies(projects, deps)
161
+ PrintBuildOrder(projects, deps)
162
+
163
+ if '--recursive' in sys.argv:
164
+ PrintVCProj(projects)
165
+ return 0
166
+
167
+
168
+ if __name__ == '__main__':
169
+ sys.exit(main())
@@ -0,0 +1,329 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) 2012 Google Inc. All rights reserved.
4
+ # Use of this source code is governed by a BSD-style license that can be
5
+ # found in the LICENSE file.
6
+
7
+ """Make the format of a vcproj really pretty.
8
+
9
+ This script normalize and sort an xml. It also fetches all the properties
10
+ inside linked vsprops and include them explicitly in the vcproj.
11
+
12
+ It outputs the resulting xml to stdout.
13
+ """
14
+
15
+ __author__ = 'nsylvain (Nicolas Sylvain)'
16
+
17
+ import os
18
+ import sys
19
+
20
+ from xml.dom.minidom import parse
21
+ from xml.dom.minidom import Node
22
+
23
+ REPLACEMENTS = dict()
24
+ ARGUMENTS = None
25
+
26
+
27
+ class CmpTuple(object):
28
+ """Compare function between 2 tuple."""
29
+ def __call__(self, x, y):
30
+ return cmp(x[0], y[0])
31
+
32
+
33
+ class CmpNode(object):
34
+ """Compare function between 2 xml nodes."""
35
+
36
+ def __call__(self, x, y):
37
+ def get_string(node):
38
+ node_string = "node"
39
+ node_string += node.nodeName
40
+ if node.nodeValue:
41
+ node_string += node.nodeValue
42
+
43
+ if node.attributes:
44
+ # We first sort by name, if present.
45
+ node_string += node.getAttribute("Name")
46
+
47
+ all_nodes = []
48
+ for (name, value) in node.attributes.items():
49
+ all_nodes.append((name, value))
50
+
51
+ all_nodes.sort(CmpTuple())
52
+ for (name, value) in all_nodes:
53
+ node_string += name
54
+ node_string += value
55
+
56
+ return node_string
57
+
58
+ return cmp(get_string(x), get_string(y))
59
+
60
+
61
+ def PrettyPrintNode(node, indent=0):
62
+ if node.nodeType == Node.TEXT_NODE:
63
+ if node.data.strip():
64
+ print '%s%s' % (' '*indent, node.data.strip())
65
+ return
66
+
67
+ if node.childNodes:
68
+ node.normalize()
69
+ # Get the number of attributes
70
+ attr_count = 0
71
+ if node.attributes:
72
+ attr_count = node.attributes.length
73
+
74
+ # Print the main tag
75
+ if attr_count == 0:
76
+ print '%s<%s>' % (' '*indent, node.nodeName)
77
+ else:
78
+ print '%s<%s' % (' '*indent, node.nodeName)
79
+
80
+ all_attributes = []
81
+ for (name, value) in node.attributes.items():
82
+ all_attributes.append((name, value))
83
+ all_attributes.sort(CmpTuple())
84
+ for (name, value) in all_attributes:
85
+ print '%s %s="%s"' % (' '*indent, name, value)
86
+ print '%s>' % (' '*indent)
87
+ if node.nodeValue:
88
+ print '%s %s' % (' '*indent, node.nodeValue)
89
+
90
+ for sub_node in node.childNodes:
91
+ PrettyPrintNode(sub_node, indent=indent+2)
92
+ print '%s</%s>' % (' '*indent, node.nodeName)
93
+
94
+
95
+ def FlattenFilter(node):
96
+ """Returns a list of all the node and sub nodes."""
97
+ node_list = []
98
+
99
+ if (node.attributes and
100
+ node.getAttribute('Name') == '_excluded_files'):
101
+ # We don't add the "_excluded_files" filter.
102
+ return []
103
+
104
+ for current in node.childNodes:
105
+ if current.nodeName == 'Filter':
106
+ node_list.extend(FlattenFilter(current))
107
+ else:
108
+ node_list.append(current)
109
+
110
+ return node_list
111
+
112
+
113
+ def FixFilenames(filenames, current_directory):
114
+ new_list = []
115
+ for filename in filenames:
116
+ if filename:
117
+ for key in REPLACEMENTS:
118
+ filename = filename.replace(key, REPLACEMENTS[key])
119
+ os.chdir(current_directory)
120
+ filename = filename.strip('"\' ')
121
+ if filename.startswith('$'):
122
+ new_list.append(filename)
123
+ else:
124
+ new_list.append(os.path.abspath(filename))
125
+ return new_list
126
+
127
+
128
+ def AbsoluteNode(node):
129
+ """Makes all the properties we know about in this node absolute."""
130
+ if node.attributes:
131
+ for (name, value) in node.attributes.items():
132
+ if name in ['InheritedPropertySheets', 'RelativePath',
133
+ 'AdditionalIncludeDirectories',
134
+ 'IntermediateDirectory', 'OutputDirectory',
135
+ 'AdditionalLibraryDirectories']:
136
+ # We want to fix up these paths
137
+ path_list = value.split(';')
138
+ new_list = FixFilenames(path_list, os.path.dirname(ARGUMENTS[1]))
139
+ node.setAttribute(name, ';'.join(new_list))
140
+ if not value:
141
+ node.removeAttribute(name)
142
+
143
+
144
+ def CleanupVcproj(node):
145
+ """For each sub node, we call recursively this function."""
146
+ for sub_node in node.childNodes:
147
+ AbsoluteNode(sub_node)
148
+ CleanupVcproj(sub_node)
149
+
150
+ # Normalize the node, and remove all extranous whitespaces.
151
+ for sub_node in node.childNodes:
152
+ if sub_node.nodeType == Node.TEXT_NODE:
153
+ sub_node.data = sub_node.data.replace("\r", "")
154
+ sub_node.data = sub_node.data.replace("\n", "")
155
+ sub_node.data = sub_node.data.rstrip()
156
+
157
+ # Fix all the semicolon separated attributes to be sorted, and we also
158
+ # remove the dups.
159
+ if node.attributes:
160
+ for (name, value) in node.attributes.items():
161
+ sorted_list = sorted(value.split(';'))
162
+ unique_list = []
163
+ for i in sorted_list:
164
+ if not unique_list.count(i):
165
+ unique_list.append(i)
166
+ node.setAttribute(name, ';'.join(unique_list))
167
+ if not value:
168
+ node.removeAttribute(name)
169
+
170
+ if node.childNodes:
171
+ node.normalize()
172
+
173
+ # For each node, take a copy, and remove it from the list.
174
+ node_array = []
175
+ while node.childNodes and node.childNodes[0]:
176
+ # Take a copy of the node and remove it from the list.
177
+ current = node.childNodes[0]
178
+ node.removeChild(current)
179
+
180
+ # If the child is a filter, we want to append all its children
181
+ # to this same list.
182
+ if current.nodeName == 'Filter':
183
+ node_array.extend(FlattenFilter(current))
184
+ else:
185
+ node_array.append(current)
186
+
187
+
188
+ # Sort the list.
189
+ node_array.sort(CmpNode())
190
+
191
+ # Insert the nodes in the correct order.
192
+ for new_node in node_array:
193
+ # But don't append empty tool node.
194
+ if new_node.nodeName == 'Tool':
195
+ if new_node.attributes and new_node.attributes.length == 1:
196
+ # This one was empty.
197
+ continue
198
+ if new_node.nodeName == 'UserMacro':
199
+ continue
200
+ node.appendChild(new_node)
201
+
202
+
203
+ def GetConfiguationNodes(vcproj):
204
+ #TODO(nsylvain): Find a better way to navigate the xml.
205
+ nodes = []
206
+ for node in vcproj.childNodes:
207
+ if node.nodeName == "Configurations":
208
+ for sub_node in node.childNodes:
209
+ if sub_node.nodeName == "Configuration":
210
+ nodes.append(sub_node)
211
+
212
+ return nodes
213
+
214
+
215
+ def GetChildrenVsprops(filename):
216
+ dom = parse(filename)
217
+ if dom.documentElement.attributes:
218
+ vsprops = dom.documentElement.getAttribute('InheritedPropertySheets')
219
+ return FixFilenames(vsprops.split(';'), os.path.dirname(filename))
220
+ return []
221
+
222
+ def SeekToNode(node1, child2):
223
+ # A text node does not have properties.
224
+ if child2.nodeType == Node.TEXT_NODE:
225
+ return None
226
+
227
+ # Get the name of the current node.
228
+ current_name = child2.getAttribute("Name")
229
+ if not current_name:
230
+ # There is no name. We don't know how to merge.
231
+ return None
232
+
233
+ # Look through all the nodes to find a match.
234
+ for sub_node in node1.childNodes:
235
+ if sub_node.nodeName == child2.nodeName:
236
+ name = sub_node.getAttribute("Name")
237
+ if name == current_name:
238
+ return sub_node
239
+
240
+ # No match. We give up.
241
+ return None
242
+
243
+
244
+ def MergeAttributes(node1, node2):
245
+ # No attributes to merge?
246
+ if not node2.attributes:
247
+ return
248
+
249
+ for (name, value2) in node2.attributes.items():
250
+ # Don't merge the 'Name' attribute.
251
+ if name == 'Name':
252
+ continue
253
+ value1 = node1.getAttribute(name)
254
+ if value1:
255
+ # The attribute exist in the main node. If it's equal, we leave it
256
+ # untouched, otherwise we concatenate it.
257
+ if value1 != value2:
258
+ node1.setAttribute(name, ';'.join([value1, value2]))
259
+ else:
260
+ # The attribute does nto exist in the main node. We append this one.
261
+ node1.setAttribute(name, value2)
262
+
263
+ # If the attribute was a property sheet attributes, we remove it, since
264
+ # they are useless.
265
+ if name == 'InheritedPropertySheets':
266
+ node1.removeAttribute(name)
267
+
268
+
269
+ def MergeProperties(node1, node2):
270
+ MergeAttributes(node1, node2)
271
+ for child2 in node2.childNodes:
272
+ child1 = SeekToNode(node1, child2)
273
+ if child1:
274
+ MergeProperties(child1, child2)
275
+ else:
276
+ node1.appendChild(child2.cloneNode(True))
277
+
278
+
279
+ def main(argv):
280
+ """Main function of this vcproj prettifier."""
281
+ global ARGUMENTS
282
+ ARGUMENTS = argv
283
+
284
+ # check if we have exactly 1 parameter.
285
+ if len(argv) < 2:
286
+ print ('Usage: %s "c:\\path\\to\\vcproj.vcproj" [key1=value1] '
287
+ '[key2=value2]' % argv[0])
288
+ return 1
289
+
290
+ # Parse the keys
291
+ for i in range(2, len(argv)):
292
+ (key, value) = argv[i].split('=')
293
+ REPLACEMENTS[key] = value
294
+
295
+ # Open the vcproj and parse the xml.
296
+ dom = parse(argv[1])
297
+
298
+ # First thing we need to do is find the Configuration Node and merge them
299
+ # with the vsprops they include.
300
+ for configuration_node in GetConfiguationNodes(dom.documentElement):
301
+ # Get the property sheets associated with this configuration.
302
+ vsprops = configuration_node.getAttribute('InheritedPropertySheets')
303
+
304
+ # Fix the filenames to be absolute.
305
+ vsprops_list = FixFilenames(vsprops.strip().split(';'),
306
+ os.path.dirname(argv[1]))
307
+
308
+ # Extend the list of vsprops with all vsprops contained in the current
309
+ # vsprops.
310
+ for current_vsprops in vsprops_list:
311
+ vsprops_list.extend(GetChildrenVsprops(current_vsprops))
312
+
313
+ # Now that we have all the vsprops, we need to merge them.
314
+ for current_vsprops in vsprops_list:
315
+ MergeProperties(configuration_node,
316
+ parse(current_vsprops).documentElement)
317
+
318
+ # Now that everything is merged, we need to cleanup the xml.
319
+ CleanupVcproj(dom.documentElement)
320
+
321
+ # Finally, we use the prett xml function to print the vcproj back to the
322
+ # user.
323
+ #print dom.toprettyxml(newl="\n")
324
+ PrettyPrintNode(dom.documentElement)
325
+ return 0
326
+
327
+
328
+ if __name__ == '__main__':
329
+ sys.exit(main(sys.argv))