tree-sitter 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (930) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -8
  3. data/Rakefile +19 -4
  4. data/ext/tree-sitter/Makefile +24 -0
  5. data/ext/tree-sitter/document.c +149 -0
  6. data/ext/tree-sitter/document.h +17 -0
  7. data/ext/tree-sitter/extconf.rb +55 -15
  8. data/ext/tree-sitter/node.c +300 -0
  9. data/ext/tree-sitter/node.h +34 -0
  10. data/ext/tree-sitter/out/document.o +0 -0
  11. data/ext/tree-sitter/out/get_changed_ranges.o +0 -0
  12. data/ext/tree-sitter/out/language.o +0 -0
  13. data/ext/tree-sitter/out/lexer.o +0 -0
  14. data/ext/tree-sitter/out/libruntime.a +0 -0
  15. data/ext/tree-sitter/out/node.o +0 -0
  16. data/ext/tree-sitter/out/parser.o +0 -0
  17. data/ext/tree-sitter/out/python/parser.c +65600 -0
  18. data/ext/tree-sitter/out/python/parser.o +0 -0
  19. data/ext/tree-sitter/out/python/scanner.cc +164 -0
  20. data/ext/tree-sitter/out/python/scanner.o +0 -0
  21. data/ext/tree-sitter/out/stack.o +0 -0
  22. data/ext/tree-sitter/out/string_input.o +0 -0
  23. data/ext/tree-sitter/out/tree.o +0 -0
  24. data/ext/tree-sitter/out/utf16.o +0 -0
  25. data/ext/tree-sitter/out/utf8proc.o +0 -0
  26. data/ext/tree-sitter/tree-sitter.c +4 -109
  27. data/ext/tree-sitter/tree-sitter.h +4 -0
  28. data/ext/tree-sitter/tree-sitter/LICENSE +7 -0
  29. data/ext/tree-sitter/tree-sitter/README.md +13 -13
  30. data/ext/tree-sitter/tree-sitter/appveyor.yml +24 -0
  31. data/ext/tree-sitter/tree-sitter/docs/Gemfile +2 -0
  32. data/ext/tree-sitter/tree-sitter/docs/Gemfile.lock +239 -0
  33. data/ext/tree-sitter/tree-sitter/docs/_config.yml +1 -0
  34. data/ext/tree-sitter/tree-sitter/docs/_layouts/table-of-contents.html +74 -0
  35. data/ext/tree-sitter/tree-sitter/docs/creating-parsers.md +360 -0
  36. data/ext/tree-sitter/tree-sitter/docs/css/style.css +13 -0
  37. data/ext/tree-sitter/tree-sitter/docs/index.md +10 -0
  38. data/ext/tree-sitter/tree-sitter/externals/gyp/PRESUBMIT.py +10 -2
  39. data/ext/tree-sitter/tree-sitter/externals/gyp/buildbot/aosp_manifest.xml +466 -0
  40. data/ext/tree-sitter/tree-sitter/externals/gyp/buildbot/buildbot_run.py +91 -30
  41. data/ext/tree-sitter/tree-sitter/externals/gyp/gyp +1 -1
  42. data/ext/tree-sitter/tree-sitter/externals/gyp/gyptest.py +3 -3
  43. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSNew.py +1 -1
  44. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSSettings.py +11 -5
  45. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSSettings_test.py +1 -1
  46. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSUtil.py +18 -15
  47. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSVersion.py +53 -20
  48. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/__init__.py +4 -6
  49. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/__init__.pyc +0 -0
  50. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/common.py +69 -2
  51. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/common.pyc +0 -0
  52. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/flock_tool.py +6 -1
  53. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/__init__.pyc +0 -0
  54. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/analyzer.py +569 -0
  55. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/android.py +133 -111
  56. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/cmake.py +3 -3
  57. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/eclipse.py +112 -22
  58. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/gypd.py +3 -0
  59. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/make.py +45 -14
  60. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/make.pyc +0 -0
  61. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/msvs.py +170 -98
  62. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/ninja.py +300 -71
  63. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/ninja_test.py +12 -9
  64. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/xcode.py +46 -12
  65. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/xcode.pyc +0 -0
  66. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/input.py +379 -335
  67. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/input.pyc +0 -0
  68. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/input_test.py +7 -7
  69. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/mac_tool.py +94 -3
  70. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/msvs_emulation.py +131 -40
  71. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/simple_copy.py +46 -0
  72. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/win_tool.py +28 -5
  73. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcode_emulation.py +185 -88
  74. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
  75. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcode_ninja.py +268 -0
  76. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcodeproj_file.py +53 -46
  77. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
  78. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-bare/gyptest-bare.py +1 -0
  79. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-depfile/depfile.gyp +25 -0
  80. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-depfile/gyptest-all.py +20 -0
  81. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-depfile/input.txt +1 -0
  82. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-none/gyptest-none.py +1 -0
  83. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/gyptest-all.py +1 -1
  84. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/gyptest-default.py +1 -1
  85. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/gyptest-generated-header.py +6 -0
  86. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir1/program.c +1 -1
  87. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir3/generate_main.py +1 -1
  88. data/ext/tree-sitter/tree-sitter/externals/gyp/test/additional-targets/gyptest-additional.py +8 -1
  89. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/common.gypi +6 -0
  90. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/gyptest-analyzer.py +356 -0
  91. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/subdir/subdir.gyp +36 -0
  92. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/subdir/subdir2/subdir2.gyp +15 -0
  93. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/subdir2/subdir.gyp +18 -0
  94. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/subdir2/subdir.includes.gypi +9 -0
  95. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test.gyp +113 -0
  96. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test2.gyp +25 -0
  97. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test2.includes.gypi +13 -0
  98. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test2.includes.includes.gypi +9 -0
  99. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test2.toplevel_includes.gypi +15 -0
  100. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test3.gyp +77 -0
  101. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test4.gyp +80 -0
  102. data/ext/tree-sitter/tree-sitter/externals/gyp/test/analyzer/test5.gyp +25 -0
  103. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/32or64.c +13 -0
  104. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/file.in +1 -0
  105. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-host-multilib.py +32 -0
  106. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-make-functions.py +24 -0
  107. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-noalias.py +21 -0
  108. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-settings-list.py +24 -0
  109. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-settings.py +24 -0
  110. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/gyptest-space-filenames.py +19 -0
  111. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/hello.c +12 -0
  112. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/hello.gyp +15 -0
  113. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/host_32or64.gyp +38 -0
  114. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/make_functions.gyp +31 -0
  115. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/settings-list.gyp +18 -0
  116. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/settings.gyp +18 -0
  117. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/space_filenames.gyp +18 -0
  118. data/ext/tree-sitter/tree-sitter/externals/gyp/test/android/writefile.c +18 -0
  119. data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/src/program.c +1 -1
  120. data/ext/tree-sitter/tree-sitter/externals/gyp/test/build-option/gyptest-build.py +11 -0
  121. data/ext/tree-sitter/tree-sitter/externals/gyp/test/build-option/hello.c +1 -1
  122. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/prog1.c +1 -1
  123. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/prog2.c +1 -1
  124. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/prog3.c +1 -1
  125. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c +1 -1
  126. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c +1 -1
  127. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cflags/cflags.c +1 -1
  128. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cflags/gyptest-cflags.py +15 -55
  129. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compilable/src/program.cpp +1 -1
  130. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/{compiler.gyp → compiler-exe.gyp} +0 -0
  131. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/compiler-shared-lib.gyp +16 -0
  132. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/gyptest-compiler-env-toolchain.py +78 -0
  133. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/gyptest-compiler-env.py +9 -11
  134. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/gyptest-compiler-global-settings.py +5 -0
  135. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/my_nm.py +8 -0
  136. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/my_readelf.py +8 -0
  137. data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/elseif.gyp +43 -0
  138. data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/elseif_bad1.gyp +20 -0
  139. data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/elseif_bad2.gyp +22 -0
  140. data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/elseif_bad3.gyp +23 -0
  141. data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/elseif_conditions.gypi +15 -0
  142. data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/gyptest_elseif.py +33 -0
  143. data/ext/tree-sitter/tree-sitter/externals/gyp/test/conditions/elseif/program.cc +10 -0
  144. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/basics/configurations.c +1 -1
  145. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/basics/gyptest-configurations.py +6 -0
  146. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/configurations.c +1 -1
  147. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/duplicates.gyp +27 -0
  148. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/duplicates.gypd.golden +12 -0
  149. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/gyptest-duplicates.py +34 -0
  150. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/gyptest-inheritance.py +6 -0
  151. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/target_platform/front.c +1 -1
  152. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/x64/configurations.c +1 -1
  153. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-all.py +3 -1
  154. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-default.py +3 -1
  155. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-samedir.py +1 -0
  156. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-slash.py +1 -0
  157. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-updir.py +1 -0
  158. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cxxflags/cxxflags.cc +4 -4
  159. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cxxflags/cxxflags.gyp +0 -1
  160. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cxxflags/gyptest-cxxflags.py +13 -33
  161. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines-escaping/defines-escaping.c +1 -1
  162. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines/defines.c +1 -1
  163. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/gyptest-extra-targets.py +2 -1
  164. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/gyptest-lib-only.py +1 -1
  165. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependency-copy/src/file1.c +1 -1
  166. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependency-copy/src/file2.c +1 -1
  167. data/ext/tree-sitter/tree-sitter/externals/gyp/test/empty-target/empty-target.gyp +12 -0
  168. data/ext/tree-sitter/tree-sitter/externals/gyp/test/empty-target/gyptest-empty-target.py +18 -0
  169. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/dependency_cycle.gyp +23 -0
  170. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/file_cycle0.gyp +17 -0
  171. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/file_cycle1.gyp +13 -0
  172. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/gyptest-errors.py +10 -2
  173. data/ext/tree-sitter/tree-sitter/externals/gyp/test/exclusion/hello.c +1 -1
  174. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/program.cc +1 -1
  175. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir1/program.c +1 -1
  176. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-copies.py +3 -2
  177. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir1/program.c +1 -1
  178. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/prog1.c +1 -1
  179. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/deeper/deeper.c +1 -1
  180. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/prog2.c +1 -1
  181. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir3/prog3.c +1 -1
  182. data/ext/tree-sitter/tree-sitter/externals/gyp/test/gyp-defines/gyptest-multiple-values.py +2 -0
  183. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/hello.c +1 -1
  184. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/hello2.c +1 -1
  185. data/ext/tree-sitter/tree-sitter/externals/gyp/test/home_dot_gyp/src/printfoo.c +1 -1
  186. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/includes.c +1 -1
  187. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/subdir/subdir_includes.c +1 -1
  188. data/ext/tree-sitter/tree-sitter/externals/gyp/test/intermediate_dir/gyptest-intermediate-dir.py +2 -0
  189. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
  190. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/Contents.json +23 -0
  191. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain.png +0 -0
  192. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@2x.png +0 -0
  193. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@3x.png +0 -0
  194. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/test-assets-catalog.gyp +45 -0
  195. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/test-crosscompile.gyp +47 -0
  196. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/test.gyp +0 -1
  197. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/tool_main.cc +7 -0
  198. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ActionExtension/ActionViewController.h +9 -0
  199. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ActionExtension/ActionViewController.m +31 -0
  200. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ActionExtension/Info.plist +42 -0
  201. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ActionExtension/MainInterface.storyboard +63 -0
  202. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/AppDelegate.h +12 -0
  203. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/AppDelegate.m +19 -0
  204. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/Base.lproj/Main.storyboard +25 -0
  205. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  206. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
  207. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/Info.plist +32 -0
  208. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/ViewController.h +11 -0
  209. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/ViewController.m +24 -0
  210. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/ExtensionContainer/main.m +13 -0
  211. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/extension/extension.gyp +85 -0
  212. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-app-ios-assets-catalog.py +57 -0
  213. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-app-ios.py +7 -7
  214. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-archs.py +22 -70
  215. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-crosscompile.py +34 -0
  216. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-extension.py +28 -0
  217. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-watch.py +36 -0
  218. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-xcode-ninja.py +25 -0
  219. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchApp/Images.xcassets/AppIcon.appiconset/Contents.json +62 -0
  220. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchApp/Images.xcassets/LaunchImage.launchimage/Contents.json +24 -0
  221. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchApp/Info.plist +35 -0
  222. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchApp/Interface.storyboard +15 -0
  223. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/AppDelegate.h +12 -0
  224. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/AppDelegate.m +19 -0
  225. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/Base.lproj/Main.storyboard +25 -0
  226. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  227. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
  228. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/Info.plist +32 -0
  229. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/ViewController.h +11 -0
  230. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/ViewController.m +24 -0
  231. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchContainer/main.m +13 -0
  232. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchKitExtension/Images.xcassets/MyImage.imageset/Contents.json +20 -0
  233. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchKitExtension/Info.plist +38 -0
  234. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchKitExtension/InterfaceController.h +10 -0
  235. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchKitExtension/InterfaceController.m +25 -0
  236. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/WatchKitExtension/MainInterface.storyboard +63 -0
  237. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/watch/watch.gyp +105 -0
  238. data/ext/tree-sitter/tree-sitter/externals/gyp/test/lib/TestGyp.py +349 -46
  239. data/ext/tree-sitter/tree-sitter/externals/gyp/test/lib/TestMac.py +73 -0
  240. data/ext/tree-sitter/tree-sitter/externals/gyp/test/lib/TestWin.py +101 -0
  241. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/gyptest-shared.py +6 -0
  242. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/gyptest-static.py +6 -0
  243. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/src/program.c +1 -1
  244. data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-dependency/gyptest-link-dependency.py +23 -0
  245. data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-dependency/main.c +7 -0
  246. data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-dependency/mymalloc.c +12 -0
  247. data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-dependency/test.gyp +37 -0
  248. data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-objects/base.c +1 -1
  249. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
  250. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/Contents.json +23 -0
  251. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain.png +0 -0
  252. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@2x.png +0 -0
  253. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@3x.png +0 -0
  254. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/test-assets-catalog.gyp +43 -0
  255. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_a.cc +8 -0
  256. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_a.h +10 -0
  257. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_b.cc +8 -0
  258. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_b.h +10 -0
  259. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_c.cc +11 -0
  260. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file_d.cc +11 -0
  261. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/test-archs-multiarch.gyp +20 -0
  262. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/test-dependencies.gyp +92 -0
  263. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/test-valid-archs.gyp +28 -0
  264. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/clang-cxx-library/libc++.cc +2 -2
  265. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/clang-cxx-library/libstdc++.cc +1 -1
  266. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-action-envvars.py +6 -0
  267. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-app-assets-catalog.py +120 -0
  268. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-app-error.py +2 -1
  269. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-app.py +8 -20
  270. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-archs.py +39 -33
  271. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-cflags.py +1 -0
  272. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-clang-cxx-library.py +3 -4
  273. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-global-settings.py +7 -0
  274. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-installname.py +1 -0
  275. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-ldflags-passed-to-libtool.py +1 -0
  276. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-ldflags.py +6 -0
  277. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-libraries.py +6 -0
  278. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-libtool-zero.py +26 -0
  279. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-loadable-module-bundle-product-extension.py +31 -0
  280. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-loadable-module.py +1 -0
  281. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-objc-gc.py +24 -18
  282. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-postbuild-copy-bundle.py +1 -1
  283. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-postbuild-fail.py +1 -0
  284. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-prefixheader.py +1 -0
  285. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-rpath.py +5 -4
  286. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-strip.py +13 -5
  287. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-swift-library.py +62 -0
  288. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-type-envvars.py +3 -1
  289. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-xcode-env-order.py +2 -6
  290. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-xcode-support-actions.py +25 -0
  291. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/libtool-zero/mylib.c +7 -0
  292. data/ext/tree-sitter/tree-sitter/externals/gyp/test/{errors/duplicate_basenames.gyp → mac/libtool-zero/test.gyp} +6 -4
  293. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/loadable-module-bundle-product-extension/src.cc +7 -0
  294. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/loadable-module-bundle-product-extension/test.gyp +24 -0
  295. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/swift-library/Info.plist +28 -0
  296. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/swift-library/file.swift +9 -0
  297. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/swift-library/test.gyp +21 -0
  298. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_bundle_executable.sh +1 -2
  299. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh +1 -2
  300. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_bundle_shared_library.sh +1 -2
  301. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_check_sdkroot.sh +47 -0
  302. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_executable.sh +2 -2
  303. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh +1 -2
  304. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_none.sh +1 -2
  305. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh +1 -2
  306. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh +1 -2
  307. data/ext/tree-sitter/tree-sitter/{out/Release/linker.lock → externals/gyp/test/mac/xcode-support-actions/source.c} +0 -0
  308. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-support-actions/test.gyp +26 -0
  309. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/main.cc +1 -1
  310. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/noload/main.c +1 -1
  311. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/ar/gyptest-make_global_settings_ar.py +123 -0
  312. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/ar/make_global_settings_ar.gyp +29 -0
  313. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/basics/gyptest-make_global_settings.py +2 -2
  314. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/bar.cc +1 -0
  315. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/foo.c +1 -0
  316. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/gyptest-make_global_settings.py +48 -0
  317. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/make_global_settings.gyp +22 -0
  318. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/my_nm.py +8 -0
  319. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/full-toolchain/my_readelf.py +8 -0
  320. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/ld/gyptest-make_global_settings_ld.py +130 -0
  321. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/ld/make_global_settings_ld.gyp +29 -0
  322. data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/gyptest-many-actions-unsorted.py +1 -0
  323. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/buildevents/gyptest-ninja-warnings.py +2 -2
  324. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/config_attrs/hello.c +2 -2
  325. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/external_builder/hello.cpp +1 -1
  326. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/filters/gyptest-filters-2010.py +1 -1
  327. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/list_excluded/hello.cpp +1 -1
  328. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/multiple_actions_error_handling/action_fail.py +7 -0
  329. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/multiple_actions_error_handling/action_succeed.py +7 -0
  330. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/multiple_actions_error_handling/actions.gyp +40 -0
  331. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/multiple_actions_error_handling/gyptest.py +26 -0
  332. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/props/hello.c +1 -1
  333. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/shared_output/hello.c +1 -1
  334. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/shared_output/there/there.c +1 -1
  335. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/uldi2010/hello.c +1 -1
  336. data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/gyptest-all.py +0 -3
  337. data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/gyptest-default.py +0 -3
  338. data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/src/prog1.c +1 -1
  339. data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/src/prog2.c +1 -1
  340. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action-rule-hash/gyptest-action-rule-hash.py +32 -0
  341. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action-rule-hash/subdir/action-rule-hash.gyp +29 -0
  342. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action-rule-hash/subdir/emit.py +13 -0
  343. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py +3 -0
  344. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/chained-dependency/chained.c +1 -1
  345. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py +4 -0
  346. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/empty-and-non-empty-duplicate-name/gyptest-empty-and-non-empty-duplicate-name.py +23 -0
  347. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/empty-and-non-empty-duplicate-name/subdir/included.gyp +19 -0
  348. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/empty-and-non-empty-duplicate-name/test.gyp +19 -0
  349. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/normalize-paths-win/gyptest-normalize-paths.py +4 -0
  350. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/normalize-paths-win/normalize-paths.gyp +12 -0
  351. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/solibs_avoid_relinking/gyptest-solibs-avoid-relinking.py +5 -0
  352. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/use-console/foo.bar +5 -0
  353. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/use-console/gyptest-use-console.py +29 -0
  354. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/use-console/use-console.gyp +60 -0
  355. data/ext/tree-sitter/tree-sitter/externals/gyp/test/no-cpp/gyptest-no-cpp.py +1 -0
  356. data/ext/tree-sitter/tree-sitter/externals/gyp/test/product/hello.c +1 -1
  357. data/ext/tree-sitter/tree-sitter/externals/gyp/test/prune_targets/gyptest-prune-targets.py +3 -0
  358. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/gyptest-dirname.py +17 -3
  359. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/a/b/c.gencc +2 -5
  360. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc +2 -5
  361. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp +62 -14
  362. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/main.cc +2 -0
  363. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/nodir.gencc +8 -0
  364. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-rebuild/src/main.c +1 -1
  365. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-use-built-dependencies/gyptest-use-built-dependencies.py +1 -0
  366. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/gyptest-all.py +7 -1
  367. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/gyptest-default.py +7 -1
  368. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/actions.gyp +1 -0
  369. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/special-variables.gyp +0 -1
  370. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir1/program.c +1 -1
  371. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir2/both_rule_and_action_input.gyp +50 -0
  372. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir2/program.c +12 -0
  373. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir3/program.c +1 -1
  374. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir4/build-asm.gyp +1 -1
  375. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir4/program.c +1 -1
  376. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-shared.py +27 -0
  377. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-static.py +29 -0
  378. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/double-shared.gyp +6 -0
  379. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/double-static.gyp +1 -0
  380. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/prog1.c +1 -1
  381. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/prog2.c +1 -1
  382. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/prog3.c +1 -1
  383. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name-different-directory/gyptest-all.py +5 -0
  384. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/gyptest-all.py +6 -3
  385. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/gyptest-relocate.py +6 -3
  386. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/src/prog1/prog1.c +1 -1
  387. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/src/prog2/prog2.c +1 -1
  388. data/ext/tree-sitter/tree-sitter/externals/gyp/test/standalone-static-library/prog.c +1 -1
  389. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-SYMROOT-all.py +1 -1
  390. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-SYMROOT-default.py +1 -1
  391. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/prog1.c +1 -1
  392. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/subdir/prog2.c +1 -1
  393. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/subdir/subdir2/prog3.c +1 -1
  394. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toolsets/main.cc +1 -1
  395. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/gyptest-toplevel-dir.py +1 -1
  396. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/src/sub1/prog1.c +1 -1
  397. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/src/sub2/prog2.c +1 -1
  398. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/gyptest-commands-repeated-multidir.py +23 -0
  399. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/repeated_multidir/dir_1/test_1.gyp +13 -0
  400. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/repeated_multidir/dir_2/test_2.gyp +13 -0
  401. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/repeated_multidir/main.gyp +16 -0
  402. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/repeated_multidir/print_cwd_basename.py +10 -0
  403. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/repeated_multidir/repeated_command_common.gypi +25 -0
  404. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/latelate/src/program.cc +1 -1
  405. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/command-quote/command-quote.gyp +0 -5
  406. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/command-quote/subdir/and/another/in-subdir.gyp +0 -1
  407. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention-cdecl.def +6 -0
  408. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention-fastcall.def +6 -0
  409. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention-stdcall.def +6 -0
  410. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention-vectorcall.def +6 -0
  411. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention.cc +6 -0
  412. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/calling-convention.gyp +66 -0
  413. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.cc +28 -0
  414. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.gyp +68 -0
  415. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/floating-point-model-fast.cc +19 -0
  416. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/floating-point-model-precise.cc +19 -0
  417. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/floating-point-model-strict.cc +19 -0
  418. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/floating-point-model.gyp +43 -0
  419. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/enable-winrt/dllmain.cc +30 -0
  420. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/enable-winrt/enable-winrt.gyp +39 -0
  421. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/generator-output-different-drive/prog.c +1 -1
  422. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-calling-convention.py +22 -0
  423. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-enable-enhanced-instruction-set.py +44 -0
  424. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-floating-point-model.py +22 -0
  425. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-base-address.py +1 -1
  426. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-enable-winrt.py +35 -0
  427. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-pdb-no-output.py +25 -0
  428. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-pdb-output.py +0 -1
  429. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-profile.py +1 -1
  430. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-restat-importlib.py +6 -0
  431. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-safeseh.py +40 -0
  432. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-shard.py +3 -0
  433. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macro-targetext.py +26 -0
  434. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macro-targetfilename.py +32 -0
  435. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macro-targetpath.py +30 -0
  436. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-midl-excluded.py +22 -0
  437. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-midl-includedirs.py +21 -0
  438. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-midl-rules.py +4 -0
  439. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-ml-safeseh.py +22 -0
  440. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-system-include.py +21 -0
  441. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-excluded/bad.idl +6 -0
  442. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-excluded/copy-file.py +11 -0
  443. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-excluded/idl-excluded.gyp +58 -0
  444. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-excluded/program.cc +7 -0
  445. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-includedirs/hello.cc +7 -0
  446. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-includedirs/idl-includedirs.gyp +26 -0
  447. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-includedirs/subdir/bar.idl +13 -0
  448. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-includedirs/subdir/foo.idl +14 -0
  449. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-rules/Window.idl +9 -0
  450. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-rules/basic-idl.gyp +67 -42
  451. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-rules/idl_compiler.py +17 -0
  452. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/large-pdb/main.cc +1 -1
  453. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/pdb-output.gyp +13 -0
  454. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/safeseh.gyp +47 -0
  455. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/safeseh_hello.cc +11 -0
  456. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/safeseh_zero.asm +10 -0
  457. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/update_pgd.py +3 -3
  458. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/ml-safeseh/a.asm +10 -0
  459. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/ml-safeseh/hello.cc +11 -0
  460. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/ml-safeseh/ml-safeseh.gyp +24 -0
  461. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/precompiled/hello.c +1 -1
  462. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/hello.cc +7 -0
  463. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/shard.gyp +11 -0
  464. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/shard_ref.gyp +41 -0
  465. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/system-include/bar/header.h +0 -0
  466. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/system-include/common/commonheader.h +0 -0
  467. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/system-include/foo/header.h +0 -0
  468. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/system-include/main.cc +4 -0
  469. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/system-include/test.gyp +26 -0
  470. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/containing-gyp.gyp +0 -1
  471. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/input-output-macros.gyp +0 -1
  472. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/targetext.gyp +59 -0
  473. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/targetfilename.gyp +59 -0
  474. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/targetpath.gyp +59 -0
  475. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/win-tool/copies_readonly_files.gyp +29 -0
  476. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/win-tool/gyptest-win-tool-handles-readonly-files.py +55 -0
  477. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/emacs/gyp.el +36 -13
  478. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/pretty_sln.py +4 -3
  479. data/ext/tree-sitter/tree-sitter/externals/utf8proc/CMakeLists.txt +4 -2
  480. data/ext/tree-sitter/tree-sitter/externals/utf8proc/MANIFEST +3 -3
  481. data/ext/tree-sitter/tree-sitter/externals/utf8proc/Makefile +11 -6
  482. data/ext/tree-sitter/tree-sitter/externals/utf8proc/NEWS.md +69 -0
  483. data/ext/tree-sitter/tree-sitter/externals/utf8proc/README.md +4 -2
  484. data/ext/tree-sitter/tree-sitter/externals/utf8proc/bench/bench.c +2 -2
  485. data/ext/tree-sitter/tree-sitter/externals/utf8proc/data/Makefile +12 -9
  486. data/ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb +125 -42
  487. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/custom.c +27 -0
  488. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/iterate.c +8 -2
  489. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/printproperty.c +5 -7
  490. data/ext/tree-sitter/tree-sitter/externals/utf8proc/utf8proc.c +209 -98
  491. data/ext/tree-sitter/tree-sitter/externals/utf8proc/utf8proc.h +126 -28
  492. data/ext/tree-sitter/tree-sitter/externals/utf8proc/utf8proc_data.c +12976 -15342
  493. data/ext/tree-sitter/tree-sitter/include/tree_sitter/compiler.h +2 -0
  494. data/ext/tree-sitter/tree-sitter/include/tree_sitter/parser.h +73 -74
  495. data/ext/tree-sitter/tree-sitter/include/tree_sitter/runtime.h +29 -20
  496. data/ext/tree-sitter/tree-sitter/project.gyp +13 -24
  497. data/ext/tree-sitter/tree-sitter/script/benchmark +76 -0
  498. data/ext/tree-sitter/tree-sitter/script/build-fuzzers +66 -0
  499. data/ext/tree-sitter/tree-sitter/script/ci +2 -1
  500. data/ext/tree-sitter/tree-sitter/script/configure.cmd +3 -0
  501. data/ext/tree-sitter/tree-sitter/script/fetch-fixtures +13 -9
  502. data/ext/tree-sitter/tree-sitter/script/fetch-fixtures.cmd +26 -0
  503. data/ext/tree-sitter/tree-sitter/script/reproduce +1 -0
  504. data/ext/tree-sitter/tree-sitter/script/run-fuzzer +57 -0
  505. data/ext/tree-sitter/tree-sitter/script/test +47 -8
  506. data/ext/tree-sitter/tree-sitter/script/test.cmd +2 -0
  507. data/ext/tree-sitter/tree-sitter/script/trim-whitespace +1 -1
  508. data/ext/tree-sitter/tree-sitter/script/util/scan-build.sh +24 -0
  509. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item.cc +60 -41
  510. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item.h +6 -7
  511. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item_transitions.cc +108 -101
  512. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item_transitions.h +1 -4
  513. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_table_builder.cc +537 -0
  514. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_table_builder.h +57 -0
  515. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lookahead_set.cc +93 -19
  516. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lookahead_set.h +90 -5
  517. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item.cc +77 -29
  518. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item.h +4 -9
  519. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item_set_builder.cc +229 -94
  520. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item_set_builder.h +9 -3
  521. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_table_builder.cc +893 -0
  522. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_table_builder.h +38 -0
  523. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/rule_can_be_blank.cc +34 -35
  524. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/rule_can_be_blank.h +1 -1
  525. data/ext/tree-sitter/tree-sitter/src/compiler/compile.cc +23 -40
  526. data/ext/tree-sitter/tree-sitter/src/compiler/compile_error.h +6 -0
  527. data/ext/tree-sitter/tree-sitter/src/compiler/generate_code/c_code.cc +301 -124
  528. data/ext/tree-sitter/tree-sitter/src/compiler/generate_code/c_code.h +12 -4
  529. data/ext/tree-sitter/tree-sitter/{doc → src/compiler}/grammar-schema.json +34 -42
  530. data/ext/tree-sitter/tree-sitter/src/compiler/grammar.h +24 -5
  531. data/ext/tree-sitter/tree-sitter/src/compiler/lex_table.cc +2 -31
  532. data/ext/tree-sitter/tree-sitter/src/compiler/lex_table.h +6 -30
  533. data/ext/tree-sitter/tree-sitter/src/compiler/lexical_grammar.h +15 -3
  534. data/ext/tree-sitter/tree-sitter/src/compiler/parse_grammar.cc +143 -105
  535. data/ext/tree-sitter/tree-sitter/src/compiler/parse_grammar.h +2 -1
  536. data/ext/tree-sitter/tree-sitter/src/compiler/parse_table.cc +71 -174
  537. data/ext/tree-sitter/tree-sitter/src/compiler/parse_table.h +23 -41
  538. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_repeats.cc +67 -34
  539. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_repeats.h +0 -2
  540. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_tokens.cc +53 -61
  541. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_tokens.h +9 -3
  542. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_choices.cc +37 -43
  543. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_choices.h +1 -1
  544. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_tokens.cc +248 -125
  545. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_tokens.h +3 -2
  546. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/flatten_grammar.cc +114 -70
  547. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/flatten_grammar.h +2 -2
  548. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/initial_syntax_grammar.h +4 -3
  549. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/intern_symbols.cc +113 -50
  550. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/intern_symbols.h +2 -2
  551. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/interned_grammar.h +7 -6
  552. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/normalize_rules.cc +5 -3
  553. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/parse_regex.cc +95 -76
  554. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/parse_regex.h +1 -1
  555. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/prepare_grammar.cc +9 -7
  556. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/prepare_grammar.h +2 -5
  557. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/token_description.cc +59 -45
  558. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/token_description.h +1 -1
  559. data/ext/tree-sitter/tree-sitter/src/compiler/rule.cc +284 -6
  560. data/ext/tree-sitter/tree-sitter/src/compiler/rule.h +124 -25
  561. data/ext/tree-sitter/tree-sitter/src/compiler/rules/blank.h +5 -14
  562. data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_set.cc +35 -84
  563. data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_set.h +19 -26
  564. data/ext/tree-sitter/tree-sitter/src/compiler/rules/choice.cc +3 -69
  565. data/ext/tree-sitter/tree-sitter/src/compiler/rules/choice.h +6 -13
  566. data/ext/tree-sitter/tree-sitter/src/compiler/rules/metadata.cc +128 -71
  567. data/ext/tree-sitter/tree-sitter/src/compiler/rules/metadata.h +48 -17
  568. data/ext/tree-sitter/tree-sitter/src/compiler/rules/named_symbol.h +6 -12
  569. data/ext/tree-sitter/tree-sitter/src/compiler/rules/pattern.h +6 -12
  570. data/ext/tree-sitter/tree-sitter/src/compiler/rules/repeat.cc +5 -34
  571. data/ext/tree-sitter/tree-sitter/src/compiler/rules/repeat.h +7 -13
  572. data/ext/tree-sitter/tree-sitter/src/compiler/rules/seq.cc +6 -47
  573. data/ext/tree-sitter/tree-sitter/src/compiler/rules/seq.h +8 -14
  574. data/ext/tree-sitter/tree-sitter/src/compiler/rules/string.h +6 -12
  575. data/ext/tree-sitter/tree-sitter/src/compiler/rules/symbol.h +53 -32
  576. data/ext/tree-sitter/tree-sitter/src/compiler/syntax_grammar.cc +24 -22
  577. data/ext/tree-sitter/tree-sitter/src/compiler/syntax_grammar.h +36 -21
  578. data/ext/tree-sitter/tree-sitter/src/compiler/util/make_visitor.h +31 -0
  579. data/ext/tree-sitter/tree-sitter/src/runtime/alloc.h +1 -1
  580. data/ext/tree-sitter/tree-sitter/src/runtime/array.h +25 -36
  581. data/ext/tree-sitter/tree-sitter/src/runtime/document.c +61 -34
  582. data/ext/tree-sitter/tree-sitter/src/runtime/document.h +3 -0
  583. data/ext/tree-sitter/tree-sitter/src/runtime/error_costs.h +5 -19
  584. data/ext/tree-sitter/tree-sitter/src/runtime/get_changed_ranges.c +355 -0
  585. data/ext/tree-sitter/tree-sitter/src/runtime/get_changed_ranges.h +20 -0
  586. data/ext/tree-sitter/tree-sitter/src/runtime/language.c +33 -31
  587. data/ext/tree-sitter/tree-sitter/src/runtime/language.h +27 -3
  588. data/ext/tree-sitter/tree-sitter/src/runtime/length.h +5 -21
  589. data/ext/tree-sitter/tree-sitter/src/runtime/lexer.c +61 -17
  590. data/ext/tree-sitter/tree-sitter/src/runtime/lexer.h +4 -5
  591. data/ext/tree-sitter/tree-sitter/src/runtime/node.c +93 -89
  592. data/ext/tree-sitter/tree-sitter/src/runtime/node.h +1 -1
  593. data/ext/tree-sitter/tree-sitter/src/runtime/parser.c +850 -743
  594. data/ext/tree-sitter/tree-sitter/src/runtime/parser.h +13 -8
  595. data/ext/tree-sitter/tree-sitter/src/runtime/point.h +9 -4
  596. data/ext/tree-sitter/tree-sitter/src/runtime/reduce_action.h +2 -0
  597. data/ext/tree-sitter/tree-sitter/src/runtime/reusable_node.h +14 -18
  598. data/ext/tree-sitter/tree-sitter/src/runtime/stack.c +424 -302
  599. data/ext/tree-sitter/tree-sitter/src/runtime/stack.h +75 -72
  600. data/ext/tree-sitter/tree-sitter/src/runtime/string_input.c +4 -10
  601. data/ext/tree-sitter/tree-sitter/src/runtime/tree.c +401 -252
  602. data/ext/tree-sitter/tree-sitter/src/runtime/tree.h +71 -57
  603. data/ext/tree-sitter/tree-sitter/src/runtime/utf16.c +5 -0
  604. data/ext/tree-sitter/tree-sitter/test/benchmarks.cc +122 -0
  605. data/ext/tree-sitter/tree-sitter/{spec/compiler/build_tables/lex_item_spec.cc → test/compiler/build_tables/lex_item_test.cc} +141 -143
  606. data/ext/tree-sitter/tree-sitter/test/compiler/build_tables/parse_item_set_builder_test.cc +134 -0
  607. data/ext/tree-sitter/tree-sitter/{spec/compiler/build_tables/rule_can_be_blank_spec.cc → test/compiler/build_tables/rule_can_be_blank_test.cc} +16 -19
  608. data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/expand_repeats_test.cc +170 -0
  609. data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/expand_tokens_test.cc +89 -0
  610. data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/extract_choices_test.cc +77 -0
  611. data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/extract_tokens_test.cc +459 -0
  612. data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/flatten_grammar_test.cc +130 -0
  613. data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/intern_symbols_test.cc +101 -0
  614. data/ext/tree-sitter/tree-sitter/test/compiler/prepare_grammar/parse_regex_test.cc +334 -0
  615. data/ext/tree-sitter/tree-sitter/{spec/compiler/rules/character_set_spec.cc → test/compiler/rules/character_set_test.cc} +15 -27
  616. data/ext/tree-sitter/tree-sitter/test/compiler/rules/rule_test.cc +90 -0
  617. data/ext/tree-sitter/tree-sitter/{spec/compiler/util/string_helpers_spec.cc → test/compiler/util/string_helpers_test.cc} +1 -1
  618. data/ext/tree-sitter/tree-sitter/test/fixtures/error_corpus/c_errors.txt +166 -0
  619. data/ext/tree-sitter/tree-sitter/test/fixtures/error_corpus/javascript_errors.txt +179 -0
  620. data/ext/tree-sitter/tree-sitter/{spec → test}/fixtures/error_corpus/json_errors.txt +10 -7
  621. data/ext/tree-sitter/tree-sitter/{spec → test}/fixtures/error_corpus/python_errors.txt +0 -0
  622. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_inlined_rules/corpus.txt +13 -0
  623. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_inlined_rules/grammar.json +59 -0
  624. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_inlined_rules/readme.md +1 -0
  625. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_rules/corpus.txt +18 -0
  626. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_rules/grammar.json +71 -0
  627. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_unit_reductions/corpus.txt +12 -0
  628. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_unit_reductions/grammar.json +70 -0
  629. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/aliased_unit_reductions/readme.md +5 -0
  630. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/anonymous_tokens_with_escaped_chars/corpus.txt +32 -0
  631. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/anonymous_tokens_with_escaped_chars/grammar.json +14 -0
  632. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/anonymous_tokens_with_escaped_chars/readme.md +1 -0
  633. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_left/corpus.txt +8 -0
  634. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_left/grammar.json +31 -0
  635. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_missing/expected_error.txt +13 -0
  636. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_missing/grammar.json +27 -0
  637. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_right/corpus.txt +8 -0
  638. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/associativity_right/grammar.json +31 -0
  639. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule/expected_error.txt +14 -0
  640. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule/grammar.json +76 -0
  641. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule/readme.md +1 -0
  642. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule_after_external_token/expected_error.txt +14 -0
  643. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule_after_external_token/grammar.json +82 -0
  644. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflict_in_repeat_rule_after_external_token/readme.md +1 -0
  645. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflicting_precedence/expected_error.txt +15 -0
  646. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/conflicting_precedence/grammar.json +58 -0
  647. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/dynamic_precedence/corpus.txt +25 -0
  648. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/dynamic_precedence/grammar.json +73 -0
  649. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/dynamic_precedence/readme.md +1 -0
  650. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/epsilon_rules/expected_error.txt +4 -0
  651. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/epsilon_rules/grammar.json +15 -0
  652. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/corpus.txt +41 -0
  653. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/grammar.json +35 -0
  654. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/readme.md +1 -0
  655. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_anonymous_tokens/scanner.c +36 -0
  656. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_tokens/corpus.txt +41 -0
  657. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_tokens/grammar.json +36 -0
  658. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_and_internal_tokens/readme.md +1 -0
  659. data/ext/tree-sitter/tree-sitter/{spec/fixtures/external_scanners/shared_external_tokens.c → test/fixtures/test_grammars/external_and_internal_tokens/scanner.c} +21 -14
  660. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_extra_tokens/corpus.txt +10 -0
  661. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_extra_tokens/grammar.json +25 -0
  662. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_extra_tokens/scanner.c +49 -0
  663. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_tokens/corpus.txt +22 -0
  664. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/external_tokens/grammar.json +57 -0
  665. data/ext/tree-sitter/tree-sitter/{spec/fixtures/external_scanners/percent_strings.c → test/fixtures/test_grammars/external_tokens/scanner.c} +19 -17
  666. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inline_rules/corpus.txt +20 -0
  667. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inline_rules/grammar.json +76 -0
  668. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inlined_aliased_rules/corpus.txt +18 -0
  669. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inlined_aliased_rules/grammar.json +75 -0
  670. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inlined_aliased_rules/readme.md +1 -0
  671. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inverted_external_token/corpus.txt +32 -0
  672. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inverted_external_token/grammar.json +55 -0
  673. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inverted_external_token/readme.md +1 -0
  674. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/inverted_external_token/scanner.c +48 -0
  675. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/invisible_start_rule/expected_error.txt +1 -0
  676. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/invisible_start_rule/grammar.json +23 -0
  677. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/lexical_conflicts_due_to_state_merging/corpus.txt +33 -0
  678. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/lexical_conflicts_due_to_state_merging/grammar.json +65 -0
  679. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/lexical_conflicts_due_to_state_merging/readme.md +20 -0
  680. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/nested_inlined_rules/corpus.txt +12 -0
  681. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/nested_inlined_rules/grammar.json +54 -0
  682. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/nested_inlined_rules/readme.md +1 -0
  683. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/partially_resolved_conflict/expected_error.txt +14 -0
  684. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/partially_resolved_conflict/grammar.json +58 -0
  685. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/partially_resolved_conflict/readme.txt +1 -0
  686. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_missing/expected_error.txt +15 -0
  687. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_missing/grammar.json +63 -0
  688. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_missing/readme.md +15 -0
  689. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_negative/corpus.txt +12 -0
  690. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_negative/grammar.json +63 -0
  691. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_negative/readme.md +1 -0
  692. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_positive/corpus.txt +13 -0
  693. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_positive/grammar.json +63 -0
  694. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_single_child_positive/readme.md +1 -0
  695. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_subsequence/corpus.txt +24 -0
  696. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/precedence_on_subsequence/grammar.json +135 -0
  697. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/readme.md +3 -0
  698. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/readme_grammar/corpus.txt +13 -0
  699. data/{test/tree-sitter/fixtures/arithmetic → ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/readme_grammar}/grammar.json +3 -3
  700. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/start_rule_is_blank/corpus.txt +7 -0
  701. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/start_rule_is_blank/grammar.json +6 -0
  702. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/start_rule_is_token/corpus.txt +6 -0
  703. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/start_rule_is_token/grammar.json +6 -0
  704. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/unused_rules/corpus.txt +9 -0
  705. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/unused_rules/grammar.json +73 -0
  706. data/ext/tree-sitter/tree-sitter/test/fixtures/test_grammars/unused_rules/readme.md +1 -0
  707. data/ext/tree-sitter/tree-sitter/test/fuzz/README.md +43 -0
  708. data/ext/tree-sitter/tree-sitter/test/fuzz/fuzzer.cc +27 -0
  709. data/ext/tree-sitter/tree-sitter/test/fuzz/gen-dict.py +31 -0
  710. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/dedent.h +0 -0
  711. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/encoding_helpers.cc +9 -3
  712. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/encoding_helpers.h +0 -0
  713. data/ext/tree-sitter/tree-sitter/test/helpers/file_helpers.cc +100 -0
  714. data/ext/tree-sitter/tree-sitter/test/helpers/file_helpers.h +15 -0
  715. data/ext/tree-sitter/tree-sitter/test/helpers/load_language.cc +239 -0
  716. data/ext/tree-sitter/tree-sitter/test/helpers/load_language.h +14 -0
  717. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/point_helpers.cc +2 -5
  718. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/point_helpers.h +0 -0
  719. data/ext/tree-sitter/tree-sitter/test/helpers/random_helpers.cc +59 -0
  720. data/ext/tree-sitter/tree-sitter/test/helpers/random_helpers.h +14 -0
  721. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/read_test_entries.cc +38 -38
  722. data/ext/tree-sitter/tree-sitter/test/helpers/read_test_entries.h +22 -0
  723. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/record_alloc.cc +7 -13
  724. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/record_alloc.h +2 -2
  725. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/scope_sequence.cc +0 -0
  726. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/scope_sequence.h +0 -0
  727. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/spy_input.cc +39 -15
  728. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/spy_input.h +4 -4
  729. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/spy_logger.cc +0 -0
  730. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/spy_logger.h +0 -0
  731. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/stderr_logger.cc +0 -0
  732. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/stderr_logger.h +0 -0
  733. data/ext/tree-sitter/tree-sitter/test/helpers/stream_methods.cc +224 -0
  734. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/stream_methods.h +32 -15
  735. data/ext/tree-sitter/tree-sitter/test/helpers/tree_helpers.cc +99 -0
  736. data/ext/tree-sitter/tree-sitter/{spec → test}/helpers/tree_helpers.h +3 -1
  737. data/ext/tree-sitter/tree-sitter/test/integration/fuzzing-examples.cc +67 -0
  738. data/ext/tree-sitter/tree-sitter/test/integration/real_grammars.cc +142 -0
  739. data/ext/tree-sitter/tree-sitter/test/integration/test_grammars.cc +79 -0
  740. data/ext/tree-sitter/tree-sitter/{spec/runtime/document_spec.cc → test/runtime/document_test.cc} +150 -32
  741. data/ext/tree-sitter/tree-sitter/test/runtime/language_test.cc +55 -0
  742. data/ext/tree-sitter/tree-sitter/{spec/runtime/node_spec.cc → test/runtime/node_test.cc} +222 -127
  743. data/ext/tree-sitter/tree-sitter/{spec/runtime/parser_spec.cc → test/runtime/parser_test.cc} +126 -85
  744. data/ext/tree-sitter/tree-sitter/{spec/runtime/stack_spec.cc → test/runtime/stack_test.cc} +201 -164
  745. data/ext/tree-sitter/tree-sitter/test/runtime/tree_test.cc +475 -0
  746. data/ext/tree-sitter/tree-sitter/{spec/spec_helper.h → test/test_helper.h} +3 -3
  747. data/ext/tree-sitter/tree-sitter/{spec/specs.cc → test/tests.cc} +4 -3
  748. data/ext/tree-sitter/tree-sitter/tests.gyp +77 -23
  749. data/lib/tree-sitter.rb +4 -0
  750. data/lib/tree-sitter/node.rb +27 -0
  751. data/lib/tree-sitter/version.rb +3 -1
  752. data/test/test_helper.rb +4 -0
  753. data/test/tree-sitter/fixtures/parsers/python/parser.c +65600 -0
  754. data/test/tree-sitter/fixtures/parsers/python/scanner.cc +164 -0
  755. data/test/tree-sitter/test_basic.rb +2 -0
  756. data/test/tree-sitter/test_document.rb +101 -1
  757. data/test/tree-sitter/test_node.rb +73 -0
  758. data/tree-sitter.gemspec +4 -2
  759. metadata +445 -217
  760. data/ext/tree-sitter/tree-sitter/Makefile +0 -360
  761. data/ext/tree-sitter/tree-sitter/compiler.target.mk +0 -238
  762. data/ext/tree-sitter/tree-sitter/externals/gyp/pylintrc +0 -307
  763. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-fail-shared.py +0 -18
  764. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-fail-static.py +0 -18
  765. data/ext/tree-sitter/tree-sitter/gyp-mac-tool +0 -511
  766. data/ext/tree-sitter/tree-sitter/out/Release/libcompiler.a +0 -0
  767. data/ext/tree-sitter/tree-sitter/out/Release/libruntime.a +0 -0
  768. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/externals/json-parser/json.o +0 -0
  769. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/externals/utf8proc/utf8proc.o +0 -0
  770. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/build_lex_table.o +0 -0
  771. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/build_parse_table.o +0 -0
  772. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/build_tables.o +0 -0
  773. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lex_conflict_manager.o +0 -0
  774. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lex_item.o +0 -0
  775. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lex_item_transitions.o +0 -0
  776. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lookahead_set.o +0 -0
  777. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/parse_item.o +0 -0
  778. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/parse_item_set_builder.o +0 -0
  779. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/recovery_tokens.o +0 -0
  780. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/rule_can_be_blank.o +0 -0
  781. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/compile.o +0 -0
  782. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/generate_code/c_code.o +0 -0
  783. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/lex_table.o +0 -0
  784. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/parse_grammar.o +0 -0
  785. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/parse_table.o +0 -0
  786. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/precedence_range.o +0 -0
  787. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/expand_repeats.o +0 -0
  788. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/expand_tokens.o +0 -0
  789. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/extract_choices.o +0 -0
  790. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/extract_tokens.o +0 -0
  791. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/flatten_grammar.o +0 -0
  792. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/intern_symbols.o +0 -0
  793. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/is_token.o +0 -0
  794. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/normalize_rules.o +0 -0
  795. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/parse_regex.o +0 -0
  796. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/prepare_grammar.o +0 -0
  797. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/token_description.o +0 -0
  798. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rule.o +0 -0
  799. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/blank.o +0 -0
  800. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/built_in_symbols.o +0 -0
  801. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/character_range.o +0 -0
  802. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/character_set.o +0 -0
  803. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/choice.o +0 -0
  804. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/metadata.o +0 -0
  805. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/named_symbol.o +0 -0
  806. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/pattern.o +0 -0
  807. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/repeat.o +0 -0
  808. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/rules.o +0 -0
  809. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/seq.o +0 -0
  810. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/string.o +0 -0
  811. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/symbol.o +0 -0
  812. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/visitor.o +0 -0
  813. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/syntax_grammar.o +0 -0
  814. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/util/string_helpers.o +0 -0
  815. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/variable.o +0 -0
  816. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/externals/utf8proc/utf8proc.o +0 -0
  817. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/document.o +0 -0
  818. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/error_costs.o +0 -0
  819. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/language.o +0 -0
  820. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/lexer.o +0 -0
  821. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/node.o +0 -0
  822. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/parser.o +0 -0
  823. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/stack.o +0 -0
  824. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/string_input.o +0 -0
  825. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/tree.o +0 -0
  826. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/utf16.o +0 -0
  827. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/distinctive_tokens_spec.o +0 -0
  828. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/lex_conflict_manager_spec.o +0 -0
  829. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/lex_item_spec.o +0 -0
  830. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/parse_item_set_builder_spec.o +0 -0
  831. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/rule_can_be_blank_spec.o +0 -0
  832. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/expand_repeats_spec.o +0 -0
  833. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/expand_tokens_spec.o +0 -0
  834. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/extract_choices_spec.o +0 -0
  835. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/extract_tokens_spec.o +0 -0
  836. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/flatten_grammar_spec.o +0 -0
  837. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/intern_symbols_spec.o +0 -0
  838. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/parse_regex_spec.o +0 -0
  839. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/rules/character_set_spec.o +0 -0
  840. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/rules/choice_spec.o +0 -0
  841. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/rules/repeat_spec.o +0 -0
  842. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/util/string_helpers_spec.o +0 -0
  843. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/encoding_helpers.o +0 -0
  844. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/load_language.o +0 -0
  845. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/point_helpers.o +0 -0
  846. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/random_helpers.o +0 -0
  847. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/read_test_entries.o +0 -0
  848. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/record_alloc.o +0 -0
  849. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/rule_helpers.o +0 -0
  850. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/scope_sequence.o +0 -0
  851. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/spy_input.o +0 -0
  852. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/spy_logger.o +0 -0
  853. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/stderr_logger.o +0 -0
  854. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/stream_methods.o +0 -0
  855. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/tree_helpers.o +0 -0
  856. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/integration/compile_grammar_spec.o +0 -0
  857. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/integration/corpus_specs.o +0 -0
  858. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/document_spec.o +0 -0
  859. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/node_spec.o +0 -0
  860. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/parser_spec.o +0 -0
  861. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/stack_spec.o +0 -0
  862. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/tree_spec.o +0 -0
  863. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/specs.o +0 -0
  864. data/ext/tree-sitter/tree-sitter/out/Release/tests +0 -0
  865. data/ext/tree-sitter/tree-sitter/project.Makefile +0 -6
  866. data/ext/tree-sitter/tree-sitter/runtime.target.mk +0 -174
  867. data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/distinctive_tokens_spec.cc +0 -34
  868. data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/lex_conflict_manager_spec.cc +0 -88
  869. data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/parse_item_set_builder_spec.cc +0 -133
  870. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/expand_repeats_spec.cc +0 -152
  871. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/expand_tokens_spec.cc +0 -109
  872. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/extract_choices_spec.cc +0 -106
  873. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/extract_tokens_spec.cc +0 -251
  874. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/flatten_grammar_spec.cc +0 -89
  875. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/intern_symbols_spec.cc +0 -89
  876. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/parse_regex_spec.cc +0 -245
  877. data/ext/tree-sitter/tree-sitter/spec/compiler/rules/choice_spec.cc +0 -53
  878. data/ext/tree-sitter/tree-sitter/spec/compiler/rules/repeat_spec.cc +0 -22
  879. data/ext/tree-sitter/tree-sitter/spec/fixtures/error_corpus/c_errors.txt +0 -130
  880. data/ext/tree-sitter/tree-sitter/spec/fixtures/error_corpus/javascript_errors.txt +0 -157
  881. data/ext/tree-sitter/tree-sitter/spec/fixtures/external_scanners/extra_external_tokens.c +0 -42
  882. data/ext/tree-sitter/tree-sitter/spec/helpers/equals_pointer.h +0 -37
  883. data/ext/tree-sitter/tree-sitter/spec/helpers/load_language.cc +0 -206
  884. data/ext/tree-sitter/tree-sitter/spec/helpers/load_language.h +0 -12
  885. data/ext/tree-sitter/tree-sitter/spec/helpers/random_helpers.cc +0 -35
  886. data/ext/tree-sitter/tree-sitter/spec/helpers/random_helpers.h +0 -8
  887. data/ext/tree-sitter/tree-sitter/spec/helpers/read_test_entries.h +0 -15
  888. data/ext/tree-sitter/tree-sitter/spec/helpers/rule_helpers.cc +0 -55
  889. data/ext/tree-sitter/tree-sitter/spec/helpers/rule_helpers.h +0 -21
  890. data/ext/tree-sitter/tree-sitter/spec/helpers/stream_methods.cc +0 -140
  891. data/ext/tree-sitter/tree-sitter/spec/helpers/tree_helpers.cc +0 -50
  892. data/ext/tree-sitter/tree-sitter/spec/integration/compile_grammar_spec.cc +0 -847
  893. data/ext/tree-sitter/tree-sitter/spec/integration/corpus_specs.cc +0 -185
  894. data/ext/tree-sitter/tree-sitter/spec/runtime/tree_spec.cc +0 -439
  895. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_lex_table.cc +0 -195
  896. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_lex_table.h +0 -18
  897. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_parse_table.cc +0 -604
  898. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_parse_table.h +0 -22
  899. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_tables.cc +0 -27
  900. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_tables.h +0 -24
  901. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/conflict_type.h +0 -16
  902. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_conflict_manager.cc +0 -55
  903. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_conflict_manager.h +0 -31
  904. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/recovery_tokens.cc +0 -89
  905. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/recovery_tokens.h +0 -19
  906. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/remove_duplicate_states.h +0 -65
  907. data/ext/tree-sitter/tree-sitter/src/compiler/compile.h +0 -16
  908. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/is_token.cc +0 -30
  909. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/is_token.h +0 -14
  910. data/ext/tree-sitter/tree-sitter/src/compiler/rules.h +0 -28
  911. data/ext/tree-sitter/tree-sitter/src/compiler/rules/blank.cc +0 -36
  912. data/ext/tree-sitter/tree-sitter/src/compiler/rules/built_in_symbols.cc +0 -19
  913. data/ext/tree-sitter/tree-sitter/src/compiler/rules/built_in_symbols.h +0 -16
  914. data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_range.cc +0 -36
  915. data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_range.h +0 -25
  916. data/ext/tree-sitter/tree-sitter/src/compiler/rules/named_symbol.cc +0 -35
  917. data/ext/tree-sitter/tree-sitter/src/compiler/rules/pattern.cc +0 -36
  918. data/ext/tree-sitter/tree-sitter/src/compiler/rules/rules.cc +0 -108
  919. data/ext/tree-sitter/tree-sitter/src/compiler/rules/string.cc +0 -35
  920. data/ext/tree-sitter/tree-sitter/src/compiler/rules/symbol.cc +0 -82
  921. data/ext/tree-sitter/tree-sitter/src/compiler/rules/visitor.cc +0 -44
  922. data/ext/tree-sitter/tree-sitter/src/compiler/rules/visitor.h +0 -234
  923. data/ext/tree-sitter/tree-sitter/src/compiler/variable.cc +0 -11
  924. data/ext/tree-sitter/tree-sitter/src/compiler/variable.h +0 -27
  925. data/ext/tree-sitter/tree-sitter/src/runtime/error_costs.c +0 -28
  926. data/ext/tree-sitter/tree-sitter/src/runtime/tree_path.h +0 -217
  927. data/ext/tree-sitter/tree-sitter/tests.Makefile +0 -6
  928. data/ext/tree-sitter/tree-sitter/tests.target.mk +0 -176
  929. data/test/tree-sitter/fixtures/ruby/grammar.json +0 -4803
  930. data/test/tree-sitter/test_grammar.rb +0 -34
@@ -15,15 +15,18 @@ import TestCommon
15
15
 
16
16
  class TestPrefixesAndSuffixes(unittest.TestCase):
17
17
  def test_BinaryNamesWindows(self):
18
- writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'build.ninja', '.',
19
- 'build.ninja', 'win')
20
- spec = { 'target_name': 'wee' }
21
- self.assertTrue(writer.ComputeOutputFileName(spec, 'executable').
22
- endswith('.exe'))
23
- self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library').
24
- endswith('.dll'))
25
- self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library').
26
- endswith('.lib'))
18
+ # These cannot run on non-Windows as they require a VS installation to
19
+ # correctly handle variable expansion.
20
+ if sys.platform.startswith('win'):
21
+ writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'build.ninja', '.',
22
+ 'build.ninja', 'win')
23
+ spec = { 'target_name': 'wee' }
24
+ self.assertTrue(writer.ComputeOutputFileName(spec, 'executable').
25
+ endswith('.exe'))
26
+ self.assertTrue(writer.ComputeOutputFileName(spec, 'shared_library').
27
+ endswith('.dll'))
28
+ self.assertTrue(writer.ComputeOutputFileName(spec, 'static_library').
29
+ endswith('.lib'))
27
30
 
28
31
  def test_BinaryNamesLinux(self):
29
32
  writer = ninja.NinjaWriter('foo', 'wee', '.', '.', 'build.ninja', '.',
@@ -5,6 +5,7 @@
5
5
  import filecmp
6
6
  import gyp.common
7
7
  import gyp.xcodeproj_file
8
+ import gyp.xcode_ninja
8
9
  import errno
9
10
  import os
10
11
  import sys
@@ -68,6 +69,9 @@ generator_additional_path_sections = [
68
69
  # The Xcode-specific keys that exist on targets and aren't moved down to
69
70
  # configurations.
70
71
  generator_additional_non_configuration_keys = [
72
+ 'ios_app_extension',
73
+ 'ios_watch_app',
74
+ 'ios_watchkit_extension',
71
75
  'mac_bundle',
72
76
  'mac_bundle_resources',
73
77
  'mac_framework_headers',
@@ -484,7 +488,7 @@ sys.exit(subprocess.call(sys.argv[1:]))" """
484
488
  def AddSourceToTarget(source, type, pbxp, xct):
485
489
  # TODO(mark): Perhaps source_extensions and library_extensions can be made a
486
490
  # little bit fancier.
487
- source_extensions = ['c', 'cc', 'cpp', 'cxx', 'm', 'mm', 's']
491
+ source_extensions = ['c', 'cc', 'cpp', 'cxx', 'm', 'mm', 's', 'swift']
488
492
 
489
493
  # .o is conceptually more of a "source" than a "library," but Xcode thinks
490
494
  # of "sources" as things to compile and "libraries" (or "frameworks") as
@@ -520,7 +524,7 @@ def AddHeaderToTarget(header, pbxp, xct, is_public):
520
524
  xct.HeadersPhase().AddFile(header, settings)
521
525
 
522
526
 
523
- _xcode_variable_re = re.compile('(\$\((.*?)\))')
527
+ _xcode_variable_re = re.compile(r'(\$\((.*?)\))')
524
528
  def ExpandXcodeVariables(string, expansions):
525
529
  """Expands Xcode-style $(VARIABLES) in string per the expansions dict.
526
530
 
@@ -575,6 +579,12 @@ def PerformBuild(data, configurations, params):
575
579
 
576
580
 
577
581
  def GenerateOutput(target_list, target_dicts, data, params):
582
+ # Optionally configure each spec to use ninja as the external builder.
583
+ ninja_wrapper = params.get('flavor') == 'ninja'
584
+ if ninja_wrapper:
585
+ (target_list, target_dicts, data) = \
586
+ gyp.xcode_ninja.CreateWrapper(target_list, target_dicts, data, params)
587
+
578
588
  options = params['options']
579
589
  generator_flags = params.get('generator_flags', {})
580
590
  parallel_builds = generator_flags.get('xcode_parallel_builds', True)
@@ -637,14 +647,18 @@ def GenerateOutput(target_list, target_dicts, data, params):
637
647
  # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets
638
648
  # to create a single-file mh_bundle.
639
649
  _types = {
640
- 'executable': 'com.apple.product-type.tool',
641
- 'loadable_module': 'com.googlecode.gyp.xcode.bundle',
642
- 'shared_library': 'com.apple.product-type.library.dynamic',
643
- 'static_library': 'com.apple.product-type.library.static',
644
- 'executable+bundle': 'com.apple.product-type.application',
645
- 'loadable_module+bundle': 'com.apple.product-type.bundle',
646
- 'loadable_module+xctest': 'com.apple.product-type.bundle.unit-test',
647
- 'shared_library+bundle': 'com.apple.product-type.framework',
650
+ 'executable': 'com.apple.product-type.tool',
651
+ 'loadable_module': 'com.googlecode.gyp.xcode.bundle',
652
+ 'shared_library': 'com.apple.product-type.library.dynamic',
653
+ 'static_library': 'com.apple.product-type.library.static',
654
+ 'executable+bundle': 'com.apple.product-type.application',
655
+ 'loadable_module+bundle': 'com.apple.product-type.bundle',
656
+ 'loadable_module+xctest': 'com.apple.product-type.bundle.unit-test',
657
+ 'shared_library+bundle': 'com.apple.product-type.framework',
658
+ 'executable+extension+bundle': 'com.apple.product-type.app-extension',
659
+ 'executable+watch+extension+bundle':
660
+ 'com.apple.product-type.watchkit-extension',
661
+ 'executable+watch+bundle': 'com.apple.product-type.application.watchapp',
648
662
  }
649
663
 
650
664
  target_properties = {
@@ -655,6 +669,9 @@ def GenerateOutput(target_list, target_dicts, data, params):
655
669
  type = spec['type']
656
670
  is_xctest = int(spec.get('mac_xctest_bundle', 0))
657
671
  is_bundle = int(spec.get('mac_bundle', 0)) or is_xctest
672
+ is_app_extension = int(spec.get('ios_app_extension', 0))
673
+ is_watchkit_extension = int(spec.get('ios_watchkit_extension', 0))
674
+ is_watch_app = int(spec.get('ios_watch_app', 0))
658
675
  if type != 'none':
659
676
  type_bundle_key = type
660
677
  if is_xctest:
@@ -662,6 +679,18 @@ def GenerateOutput(target_list, target_dicts, data, params):
662
679
  assert type == 'loadable_module', (
663
680
  'mac_xctest_bundle targets must have type loadable_module '
664
681
  '(target %s)' % target_name)
682
+ elif is_app_extension:
683
+ assert is_bundle, ('ios_app_extension flag requires mac_bundle '
684
+ '(target %s)' % target_name)
685
+ type_bundle_key += '+extension+bundle'
686
+ elif is_watchkit_extension:
687
+ assert is_bundle, ('ios_watchkit_extension flag requires mac_bundle '
688
+ '(target %s)' % target_name)
689
+ type_bundle_key += '+watch+extension+bundle'
690
+ elif is_watch_app:
691
+ assert is_bundle, ('ios_watch_app flag requires mac_bundle '
692
+ '(target %s)' % target_name)
693
+ type_bundle_key += '+watch+bundle'
665
694
  elif is_bundle:
666
695
  type_bundle_key += '+bundle'
667
696
 
@@ -703,11 +732,16 @@ def GenerateOutput(target_list, target_dicts, data, params):
703
732
  # and is made a dependency of this target. This way the work is done
704
733
  # before the dependency checks for what should be recompiled.
705
734
  support_xct = None
706
- if type != 'none' and (spec_actions or spec_rules):
735
+ # The Xcode "issues" don't affect xcode-ninja builds, since the dependency
736
+ # logic all happens in ninja. Don't bother creating the extra targets in
737
+ # that case.
738
+ if type != 'none' and (spec_actions or spec_rules) and not ninja_wrapper:
707
739
  support_xccl = CreateXCConfigurationList(configuration_names);
740
+ support_target_suffix = generator_flags.get(
741
+ 'support_target_suffix', ' Support')
708
742
  support_target_properties = {
709
743
  'buildConfigurationList': support_xccl,
710
- 'name': target_name + ' Support',
744
+ 'name': target_name + support_target_suffix,
711
745
  }
712
746
  if target_product_name:
713
747
  support_target_properties['productName'] = \
@@ -10,8 +10,8 @@ from compiler.ast import Module
10
10
  from compiler.ast import Node
11
11
  from compiler.ast import Stmt
12
12
  import compiler
13
- import copy
14
13
  import gyp.common
14
+ import gyp.simple_copy
15
15
  import multiprocessing
16
16
  import optparse
17
17
  import os.path
@@ -24,6 +24,7 @@ import threading
24
24
  import time
25
25
  import traceback
26
26
  from gyp.common import GypError
27
+ from gyp.common import OrderedSet
27
28
 
28
29
 
29
30
  # A list of types that are treated as linkable.
@@ -45,18 +46,36 @@ base_path_sections = [
45
46
  'outputs',
46
47
  'sources',
47
48
  ]
48
- path_sections = []
49
+ path_sections = set()
49
50
 
50
- is_path_section_charset = set('=+?!')
51
- is_path_section_match_re = re.compile('_(dir|file|path)s?$')
51
+ # These per-process dictionaries are used to cache build file data when loading
52
+ # in parallel mode.
53
+ per_process_data = {}
54
+ per_process_aux_data = {}
52
55
 
53
56
  def IsPathSection(section):
54
- # If section ends in one of these characters, it's applied to a section
57
+ # If section ends in one of the '=+?!' characters, it's applied to a section
55
58
  # without the trailing characters. '/' is notably absent from this list,
56
59
  # because there's no way for a regular expression to be treated as a path.
57
- while section[-1:] in is_path_section_charset:
60
+ while section[-1:] in '=+?!':
58
61
  section = section[:-1]
59
- return section in path_sections or is_path_section_match_re.search(section)
62
+
63
+ if section in path_sections:
64
+ return True
65
+
66
+ # Sections mathing the regexp '_(dir|file|path)s?$' are also
67
+ # considered PathSections. Using manual string matching since that
68
+ # is much faster than the regexp and this can be called hundreds of
69
+ # thousands of times so micro performance matters.
70
+ if "_" in section:
71
+ tail = section[-6:]
72
+ if tail[-1] == 's':
73
+ tail = tail[:-1]
74
+ if tail[-5:] in ('_file', '_path'):
75
+ return True
76
+ return tail[-4:] == '_dir'
77
+
78
+ return False
60
79
 
61
80
  # base_non_configuration_keys is a list of key names that belong in the target
62
81
  # itself and should not be propagated into its configurations. It is merged
@@ -196,11 +215,11 @@ def CheckNode(node, keypath):
196
215
  elif isinstance(node, Const):
197
216
  return node.getChildren()[0]
198
217
  else:
199
- raise TypeError, "Unknown AST node at key path '" + '.'.join(keypath) + \
200
- "': " + repr(node)
218
+ raise TypeError("Unknown AST node at key path '" + '.'.join(keypath) +
219
+ "': " + repr(node))
201
220
 
202
221
 
203
- def LoadOneBuildFile(build_file_path, data, aux_data, variables, includes,
222
+ def LoadOneBuildFile(build_file_path, data, aux_data, includes,
204
223
  is_target, check):
205
224
  if build_file_path in data:
206
225
  return data[build_file_path]
@@ -224,7 +243,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, variables, includes,
224
243
  gyp.common.ExceptionAppend(e, 'while reading ' + build_file_path)
225
244
  raise
226
245
 
227
- if not isinstance(build_file_data, dict):
246
+ if type(build_file_data) is not dict:
228
247
  raise GypError("%s does not evaluate to a dictionary." % build_file_path)
229
248
 
230
249
  data[build_file_path] = build_file_data
@@ -236,10 +255,10 @@ def LoadOneBuildFile(build_file_path, data, aux_data, variables, includes,
236
255
  try:
237
256
  if is_target:
238
257
  LoadBuildFileIncludesIntoDict(build_file_data, build_file_path, data,
239
- aux_data, variables, includes, check)
258
+ aux_data, includes, check)
240
259
  else:
241
260
  LoadBuildFileIncludesIntoDict(build_file_data, build_file_path, data,
242
- aux_data, variables, None, check)
261
+ aux_data, None, check)
243
262
  except Exception, e:
244
263
  gyp.common.ExceptionAppend(e,
245
264
  'while reading includes of ' + build_file_path)
@@ -249,7 +268,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, variables, includes,
249
268
 
250
269
 
251
270
  def LoadBuildFileIncludesIntoDict(subdict, subdict_path, data, aux_data,
252
- variables, includes, check):
271
+ includes, check):
253
272
  includes_list = []
254
273
  if includes != None:
255
274
  includes_list.extend(includes)
@@ -273,30 +292,27 @@ def LoadBuildFileIncludesIntoDict(subdict, subdict_path, data, aux_data,
273
292
  gyp.DebugOutput(gyp.DEBUG_INCLUDES, "Loading Included File: '%s'", include)
274
293
 
275
294
  MergeDicts(subdict,
276
- LoadOneBuildFile(include, data, aux_data, variables, None,
277
- False, check),
295
+ LoadOneBuildFile(include, data, aux_data, None, False, check),
278
296
  subdict_path, include)
279
297
 
280
298
  # Recurse into subdictionaries.
281
299
  for k, v in subdict.iteritems():
282
- if v.__class__ == dict:
283
- LoadBuildFileIncludesIntoDict(v, subdict_path, data, aux_data, variables,
300
+ if type(v) is dict:
301
+ LoadBuildFileIncludesIntoDict(v, subdict_path, data, aux_data,
284
302
  None, check)
285
- elif v.__class__ == list:
286
- LoadBuildFileIncludesIntoList(v, subdict_path, data, aux_data, variables,
303
+ elif type(v) is list:
304
+ LoadBuildFileIncludesIntoList(v, subdict_path, data, aux_data,
287
305
  check)
288
306
 
289
307
 
290
308
  # This recurses into lists so that it can look for dicts.
291
- def LoadBuildFileIncludesIntoList(sublist, sublist_path, data, aux_data,
292
- variables, check):
309
+ def LoadBuildFileIncludesIntoList(sublist, sublist_path, data, aux_data, check):
293
310
  for item in sublist:
294
- if item.__class__ == dict:
311
+ if type(item) is dict:
295
312
  LoadBuildFileIncludesIntoDict(item, sublist_path, data, aux_data,
296
- variables, None, check)
297
- elif item.__class__ == list:
298
- LoadBuildFileIncludesIntoList(item, sublist_path, data, aux_data,
299
- variables, check)
313
+ None, check)
314
+ elif type(item) is list:
315
+ LoadBuildFileIncludesIntoList(item, sublist_path, data, aux_data, check)
300
316
 
301
317
  # Processes toolsets in all the targets. This recurses into condition entries
302
318
  # since they can contain toolsets as well.
@@ -320,7 +336,7 @@ def ProcessToolsetsInDict(data):
320
336
  if len(toolsets) > 0:
321
337
  # Optimization: only do copies if more than one toolset is specified.
322
338
  for build in toolsets[1:]:
323
- new_target = copy.deepcopy(target)
339
+ new_target = gyp.simple_copy.deepcopy(target)
324
340
  new_target['toolset'] = build
325
341
  new_target_list.append(new_target)
326
342
  target['toolset'] = toolsets[0]
@@ -328,9 +344,10 @@ def ProcessToolsetsInDict(data):
328
344
  data['targets'] = new_target_list
329
345
  if 'conditions' in data:
330
346
  for condition in data['conditions']:
331
- if isinstance(condition, list):
347
+ if type(condition) is list:
332
348
  for condition_dict in condition[1:]:
333
- ProcessToolsetsInDict(condition_dict)
349
+ if type(condition_dict) is dict:
350
+ ProcessToolsetsInDict(condition_dict)
334
351
 
335
352
 
336
353
  # TODO(mark): I don't love this name. It just means that it's going to load
@@ -350,15 +367,22 @@ def LoadTargetBuildFile(build_file_path, data, aux_data, variables, includes,
350
367
  else:
351
368
  variables['DEPTH'] = d.replace('\\', '/')
352
369
 
353
- if build_file_path in data['target_build_files']:
354
- # Already loaded.
355
- return False
356
- data['target_build_files'].add(build_file_path)
370
+ # The 'target_build_files' key is only set when loading target build files in
371
+ # the non-parallel code path, where LoadTargetBuildFile is called
372
+ # recursively. In the parallel code path, we don't need to check whether the
373
+ # |build_file_path| has already been loaded, because the 'scheduled' set in
374
+ # ParallelState guarantees that we never load the same |build_file_path|
375
+ # twice.
376
+ if 'target_build_files' in data:
377
+ if build_file_path in data['target_build_files']:
378
+ # Already loaded.
379
+ return False
380
+ data['target_build_files'].add(build_file_path)
357
381
 
358
382
  gyp.DebugOutput(gyp.DEBUG_INCLUDES,
359
383
  "Loading Target Build File '%s'", build_file_path)
360
384
 
361
- build_file_data = LoadOneBuildFile(build_file_path, data, aux_data, variables,
385
+ build_file_data = LoadOneBuildFile(build_file_path, data, aux_data,
362
386
  includes, True, check)
363
387
 
364
388
  # Store DEPTH for later use in generators.
@@ -408,7 +432,8 @@ def LoadTargetBuildFile(build_file_path, data, aux_data, variables, includes,
408
432
  # copy with the target-specific data merged into it as the replacement
409
433
  # target dict.
410
434
  old_target_dict = build_file_data['targets'][index]
411
- new_target_dict = copy.deepcopy(build_file_data['target_defaults'])
435
+ new_target_dict = gyp.simple_copy.deepcopy(
436
+ build_file_data['target_defaults'])
412
437
  MergeDicts(new_target_dict, old_target_dict,
413
438
  build_file_path, build_file_path)
414
439
  build_file_data['targets'][index] = new_target_dict
@@ -443,10 +468,8 @@ def LoadTargetBuildFile(build_file_path, data, aux_data, variables, includes,
443
468
  else:
444
469
  return (build_file_path, dependencies)
445
470
 
446
-
447
471
  def CallLoadTargetBuildFile(global_flags,
448
- build_file_path, data,
449
- aux_data, variables,
472
+ build_file_path, variables,
450
473
  includes, depth, check,
451
474
  generator_input_info):
452
475
  """Wrapper around LoadTargetBuildFile for parallel processing.
@@ -462,35 +485,24 @@ def CallLoadTargetBuildFile(global_flags,
462
485
  for key, value in global_flags.iteritems():
463
486
  globals()[key] = value
464
487
 
465
- # Save the keys so we can return data that changed.
466
- data_keys = set(data)
467
- aux_data_keys = set(aux_data)
468
-
469
488
  SetGeneratorGlobals(generator_input_info)
470
- result = LoadTargetBuildFile(build_file_path, data,
471
- aux_data, variables,
489
+ result = LoadTargetBuildFile(build_file_path, per_process_data,
490
+ per_process_aux_data, variables,
472
491
  includes, depth, check, False)
473
492
  if not result:
474
493
  return result
475
494
 
476
495
  (build_file_path, dependencies) = result
477
496
 
478
- data_out = {}
479
- for key in data:
480
- if key == 'target_build_files':
481
- continue
482
- if key not in data_keys:
483
- data_out[key] = data[key]
484
- aux_data_out = {}
485
- for key in aux_data:
486
- if key not in aux_data_keys:
487
- aux_data_out[key] = aux_data[key]
497
+ # We can safely pop the build_file_data from per_process_data because it
498
+ # will never be referenced by this process again, so we don't need to keep
499
+ # it in the cache.
500
+ build_file_data = per_process_data.pop(build_file_path)
488
501
 
489
502
  # This gets serialized and sent back to the main process via a pipe.
490
503
  # It's handled in LoadTargetBuildFileCallback.
491
504
  return (build_file_path,
492
- data_out,
493
- aux_data_out,
505
+ build_file_data,
494
506
  dependencies)
495
507
  except GypError, e:
496
508
  sys.stderr.write("gyp: %s\n" % e)
@@ -521,8 +533,6 @@ class ParallelState(object):
521
533
  self.condition = None
522
534
  # The "data" dict that was passed to LoadTargetBuildFileParallel
523
535
  self.data = None
524
- # The "aux_data" dict that was passed to LoadTargetBuildFileParallel
525
- self.aux_data = None
526
536
  # The number of parallel calls outstanding; decremented when a response
527
537
  # was received.
528
538
  self.pending = 0
@@ -543,12 +553,9 @@ class ParallelState(object):
543
553
  self.condition.notify()
544
554
  self.condition.release()
545
555
  return
546
- (build_file_path0, data0, aux_data0, dependencies0) = result
556
+ (build_file_path0, build_file_data0, dependencies0) = result
557
+ self.data[build_file_path0] = build_file_data0
547
558
  self.data['target_build_files'].add(build_file_path0)
548
- for key in data0:
549
- self.data[key] = data0[key]
550
- for key in aux_data0:
551
- self.aux_data[key] = aux_data0[key]
552
559
  for new_dependency in dependencies0:
553
560
  if new_dependency not in self.scheduled:
554
561
  self.scheduled.add(new_dependency)
@@ -558,9 +565,8 @@ class ParallelState(object):
558
565
  self.condition.release()
559
566
 
560
567
 
561
- def LoadTargetBuildFilesParallel(build_files, data, aux_data,
562
- variables, includes, depth, check,
563
- generator_input_info):
568
+ def LoadTargetBuildFilesParallel(build_files, data, variables, includes, depth,
569
+ check, generator_input_info):
564
570
  parallel_state = ParallelState()
565
571
  parallel_state.condition = threading.Condition()
566
572
  # Make copies of the build_files argument that we can modify while working.
@@ -568,7 +574,6 @@ def LoadTargetBuildFilesParallel(build_files, data, aux_data,
568
574
  parallel_state.scheduled = set(build_files)
569
575
  parallel_state.pending = 0
570
576
  parallel_state.data = data
571
- parallel_state.aux_data = aux_data
572
577
 
573
578
  try:
574
579
  parallel_state.condition.acquire()
@@ -582,20 +587,16 @@ def LoadTargetBuildFilesParallel(build_files, data, aux_data,
582
587
  dependency = parallel_state.dependencies.pop()
583
588
 
584
589
  parallel_state.pending += 1
585
- data_in = {}
586
- data_in['target_build_files'] = data['target_build_files']
587
- aux_data_in = {}
588
590
  global_flags = {
589
591
  'path_sections': globals()['path_sections'],
590
592
  'non_configuration_keys': globals()['non_configuration_keys'],
591
593
  'multiple_toolsets': globals()['multiple_toolsets']}
592
594
 
593
595
  if not parallel_state.pool:
594
- parallel_state.pool = multiprocessing.Pool(8)
596
+ parallel_state.pool = multiprocessing.Pool(multiprocessing.cpu_count())
595
597
  parallel_state.pool.apply_async(
596
598
  CallLoadTargetBuildFile,
597
599
  args = (global_flags, dependency,
598
- data_in, aux_data_in,
599
600
  variables, includes, depth, check, generator_input_info),
600
601
  callback = parallel_state.LoadTargetBuildFileCallback)
601
602
  except KeyboardInterrupt, e:
@@ -636,39 +637,50 @@ def FindEnclosingBracketGroup(input_str):
636
637
  return (-1, -1)
637
638
 
638
639
 
639
- canonical_int_re = re.compile('(0|-?[1-9][0-9]*)$')
640
-
641
-
642
640
  def IsStrCanonicalInt(string):
643
641
  """Returns True if |string| is in its canonical integer form.
644
642
 
645
643
  The canonical form is such that str(int(string)) == string.
646
644
  """
647
- return isinstance(string, str) and canonical_int_re.match(string)
645
+ if type(string) is str:
646
+ # This function is called a lot so for maximum performance, avoid
647
+ # involving regexps which would otherwise make the code much
648
+ # shorter. Regexps would need twice the time of this function.
649
+ if string:
650
+ if string == "0":
651
+ return True
652
+ if string[0] == "-":
653
+ string = string[1:]
654
+ if not string:
655
+ return False
656
+ if '1' <= string[0] <= '9':
657
+ return string.isdigit()
658
+
659
+ return False
648
660
 
649
661
 
650
662
  # This matches things like "<(asdf)", "<!(cmd)", "<!@(cmd)", "<|(list)",
651
663
  # "<!interpreter(arguments)", "<([list])", and even "<([)" and "<(<())".
652
664
  # In the last case, the inner "<()" is captured in match['content'].
653
665
  early_variable_re = re.compile(
654
- '(?P<replace>(?P<type><(?:(?:!?@?)|\|)?)'
655
- '(?P<command_string>[-a-zA-Z0-9_.]+)?'
656
- '\((?P<is_array>\s*\[?)'
657
- '(?P<content>.*?)(\]?)\))')
666
+ r'(?P<replace>(?P<type><(?:(?:!?@?)|\|)?)'
667
+ r'(?P<command_string>[-a-zA-Z0-9_.]+)?'
668
+ r'\((?P<is_array>\s*\[?)'
669
+ r'(?P<content>.*?)(\]?)\))')
658
670
 
659
671
  # This matches the same as early_variable_re, but with '>' instead of '<'.
660
672
  late_variable_re = re.compile(
661
- '(?P<replace>(?P<type>>(?:(?:!?@?)|\|)?)'
662
- '(?P<command_string>[-a-zA-Z0-9_.]+)?'
663
- '\((?P<is_array>\s*\[?)'
664
- '(?P<content>.*?)(\]?)\))')
673
+ r'(?P<replace>(?P<type>>(?:(?:!?@?)|\|)?)'
674
+ r'(?P<command_string>[-a-zA-Z0-9_.]+)?'
675
+ r'\((?P<is_array>\s*\[?)'
676
+ r'(?P<content>.*?)(\]?)\))')
665
677
 
666
678
  # This matches the same as early_variable_re, but with '^' instead of '<'.
667
679
  latelate_variable_re = re.compile(
668
- '(?P<replace>(?P<type>[\^](?:(?:!?@?)|\|)?)'
669
- '(?P<command_string>[-a-zA-Z0-9_.]+)?'
670
- '\((?P<is_array>\s*\[?)'
671
- '(?P<content>.*?)(\]?)\))')
680
+ r'(?P<replace>(?P<type>[\^](?:(?:!?@?)|\|)?)'
681
+ r'(?P<command_string>[-a-zA-Z0-9_.]+)?'
682
+ r'\((?P<is_array>\s*\[?)'
683
+ r'(?P<content>.*?)(\]?)\))')
672
684
 
673
685
  # Global cache of results from running commands so they don't have to be run
674
686
  # more then once.
@@ -677,7 +689,7 @@ cached_command_results = {}
677
689
 
678
690
  def FixupPlatformCommand(cmd):
679
691
  if sys.platform == 'win32':
680
- if type(cmd) == list:
692
+ if type(cmd) is list:
681
693
  cmd = [re.sub('^cat ', 'type ', cmd[0])] + cmd[1:]
682
694
  else:
683
695
  cmd = re.sub('^cat ', 'type ', cmd)
@@ -767,7 +779,7 @@ def ExpandVariables(input, phase, variables, build_file):
767
779
  # contexts. However, since filtration has no chance to run on <|(),
768
780
  # this seems like the only obvious way to give them access to filters.
769
781
  if file_list:
770
- processed_variables = copy.deepcopy(variables)
782
+ processed_variables = gyp.simple_copy.deepcopy(variables)
771
783
  ProcessListFiltersInDict(contents, processed_variables)
772
784
  # Recurse to expand variables in the contents
773
785
  contents = ExpandVariables(contents, phase,
@@ -804,7 +816,7 @@ def ExpandVariables(input, phase, variables, build_file):
804
816
  # This works around actions/rules which have more inputs than will
805
817
  # fit on the command line.
806
818
  if file_list:
807
- if type(contents) == list:
819
+ if type(contents) is list:
808
820
  contents_list = contents
809
821
  else:
810
822
  contents_list = contents.split(' ')
@@ -837,17 +849,15 @@ def ExpandVariables(input, phase, variables, build_file):
837
849
  use_shell = False
838
850
 
839
851
  # Check for a cached value to avoid executing commands, or generating
840
- # file lists more than once.
841
- # TODO(http://code.google.com/p/gyp/issues/detail?id=112): It is
842
- # possible that the command being invoked depends on the current
843
- # directory. For that case the syntax needs to be extended so that the
844
- # directory is also used in cache_key (it becomes a tuple).
852
+ # file lists more than once. The cache key contains the command to be
853
+ # run as well as the directory to run it from, to account for commands
854
+ # that depend on their current directory.
845
855
  # TODO(http://code.google.com/p/gyp/issues/detail?id=111): In theory,
846
856
  # someone could author a set of GYP files where each time the command
847
857
  # is invoked it produces different output by design. When the need
848
858
  # arises, the syntax should be extended to support no caching off a
849
859
  # command's output so it is run every time.
850
- cache_key = str(contents)
860
+ cache_key = (str(contents), build_file_dir)
851
861
  cached_value = cached_command_results.get(cache_key, None)
852
862
  if cached_value is None:
853
863
  gyp.DebugOutput(gyp.DEBUG_VARIABLES,
@@ -925,10 +935,9 @@ def ExpandVariables(input, phase, variables, build_file):
925
935
  else:
926
936
  replacement = variables[contents]
927
937
 
928
- if isinstance(replacement, list):
938
+ if type(replacement) is list:
929
939
  for item in replacement:
930
- if (not contents[-1] == '/' and
931
- not isinstance(item, str) and not isinstance(item, int)):
940
+ if not contents[-1] == '/' and type(item) not in (str, int):
932
941
  raise GypError('Variable ' + contents +
933
942
  ' must expand to a string or list of strings; ' +
934
943
  'list contains a ' +
@@ -938,8 +947,7 @@ def ExpandVariables(input, phase, variables, build_file):
938
947
  # with conditions sections.
939
948
  ProcessVariablesAndConditionsInList(replacement, phase, variables,
940
949
  build_file)
941
- elif not isinstance(replacement, str) and \
942
- not isinstance(replacement, int):
950
+ elif type(replacement) not in (str, int):
943
951
  raise GypError('Variable ' + contents +
944
952
  ' must expand to a string or list of strings; ' +
945
953
  'found a ' + replacement.__class__.__name__)
@@ -948,7 +956,7 @@ def ExpandVariables(input, phase, variables, build_file):
948
956
  # Expanding in list context. It's guaranteed that there's only one
949
957
  # replacement to do in |input_str| and that it's this replacement. See
950
958
  # above.
951
- if isinstance(replacement, list):
959
+ if type(replacement) is list:
952
960
  # If it's already a list, make a copy.
953
961
  output = replacement[:]
954
962
  else:
@@ -957,7 +965,7 @@ def ExpandVariables(input, phase, variables, build_file):
957
965
  else:
958
966
  # Expanding in string context.
959
967
  encoded_replacement = ''
960
- if isinstance(replacement, list):
968
+ if type(replacement) is list:
961
969
  # When expanding a list into string context, turn the list items
962
970
  # into a string in a way that will work with a subprocess call.
963
971
  #
@@ -975,26 +983,32 @@ def ExpandVariables(input, phase, variables, build_file):
975
983
  # Prepare for the next match iteration.
976
984
  input_str = output
977
985
 
978
- # Look for more matches now that we've replaced some, to deal with
979
- # expanding local variables (variables defined in the same
980
- # variables block as this one).
981
- gyp.DebugOutput(gyp.DEBUG_VARIABLES, "Found output %r, recursing.", output)
982
- if isinstance(output, list):
983
- if output and isinstance(output[0], list):
984
- # Leave output alone if it's a list of lists.
985
- # We don't want such lists to be stringified.
986
- pass
987
- else:
988
- new_output = []
989
- for item in output:
990
- new_output.append(
991
- ExpandVariables(item, phase, variables, build_file))
992
- output = new_output
986
+ if output == input:
987
+ gyp.DebugOutput(gyp.DEBUG_VARIABLES,
988
+ "Found only identity matches on %r, avoiding infinite "
989
+ "recursion.",
990
+ output)
993
991
  else:
994
- output = ExpandVariables(output, phase, variables, build_file)
992
+ # Look for more matches now that we've replaced some, to deal with
993
+ # expanding local variables (variables defined in the same
994
+ # variables block as this one).
995
+ gyp.DebugOutput(gyp.DEBUG_VARIABLES, "Found output %r, recursing.", output)
996
+ if type(output) is list:
997
+ if output and type(output[0]) is list:
998
+ # Leave output alone if it's a list of lists.
999
+ # We don't want such lists to be stringified.
1000
+ pass
1001
+ else:
1002
+ new_output = []
1003
+ for item in output:
1004
+ new_output.append(
1005
+ ExpandVariables(item, phase, variables, build_file))
1006
+ output = new_output
1007
+ else:
1008
+ output = ExpandVariables(output, phase, variables, build_file)
995
1009
 
996
1010
  # Convert all strings that are canonically-represented integers into integers.
997
- if isinstance(output, list):
1011
+ if type(output) is list:
998
1012
  for index in xrange(0, len(output)):
999
1013
  if IsStrCanonicalInt(output[index]):
1000
1014
  output[index] = int(output[index])
@@ -1003,6 +1017,80 @@ def ExpandVariables(input, phase, variables, build_file):
1003
1017
 
1004
1018
  return output
1005
1019
 
1020
+ # The same condition is often evaluated over and over again so it
1021
+ # makes sense to cache as much as possible between evaluations.
1022
+ cached_conditions_asts = {}
1023
+
1024
+ def EvalCondition(condition, conditions_key, phase, variables, build_file):
1025
+ """Returns the dict that should be used or None if the result was
1026
+ that nothing should be used."""
1027
+ if type(condition) is not list:
1028
+ raise GypError(conditions_key + ' must be a list')
1029
+ if len(condition) < 2:
1030
+ # It's possible that condition[0] won't work in which case this
1031
+ # attempt will raise its own IndexError. That's probably fine.
1032
+ raise GypError(conditions_key + ' ' + condition[0] +
1033
+ ' must be at least length 2, not ' + str(len(condition)))
1034
+
1035
+ i = 0
1036
+ result = None
1037
+ while i < len(condition):
1038
+ cond_expr = condition[i]
1039
+ true_dict = condition[i + 1]
1040
+ if type(true_dict) is not dict:
1041
+ raise GypError('{} {} must be followed by a dictionary, not {}'.format(
1042
+ conditions_key, cond_expr, type(true_dict)))
1043
+ if len(condition) > i + 2 and type(condition[i + 2]) is dict:
1044
+ false_dict = condition[i + 2]
1045
+ i = i + 3
1046
+ if i != len(condition):
1047
+ raise GypError('{} {} has {} unexpected trailing items'.format(
1048
+ conditions_key, cond_expr, len(condition) - i))
1049
+ else:
1050
+ false_dict = None
1051
+ i = i + 2
1052
+ if result == None:
1053
+ result = EvalSingleCondition(
1054
+ cond_expr, true_dict, false_dict, phase, variables, build_file)
1055
+
1056
+ return result
1057
+
1058
+
1059
+ def EvalSingleCondition(
1060
+ cond_expr, true_dict, false_dict, phase, variables, build_file):
1061
+ """Returns true_dict if cond_expr evaluates to true, and false_dict
1062
+ otherwise."""
1063
+ # Do expansions on the condition itself. Since the conditon can naturally
1064
+ # contain variable references without needing to resort to GYP expansion
1065
+ # syntax, this is of dubious value for variables, but someone might want to
1066
+ # use a command expansion directly inside a condition.
1067
+ cond_expr_expanded = ExpandVariables(cond_expr, phase, variables,
1068
+ build_file)
1069
+ if type(cond_expr_expanded) not in (str, int):
1070
+ raise ValueError(
1071
+ 'Variable expansion in this context permits str and int ' + \
1072
+ 'only, found ' + cond_expr_expanded.__class__.__name__)
1073
+
1074
+ try:
1075
+ if cond_expr_expanded in cached_conditions_asts:
1076
+ ast_code = cached_conditions_asts[cond_expr_expanded]
1077
+ else:
1078
+ ast_code = compile(cond_expr_expanded, '<string>', 'eval')
1079
+ cached_conditions_asts[cond_expr_expanded] = ast_code
1080
+ if eval(ast_code, {'__builtins__': None}, variables):
1081
+ return true_dict
1082
+ return false_dict
1083
+ except SyntaxError, e:
1084
+ syntax_error = SyntaxError('%s while evaluating condition \'%s\' in %s '
1085
+ 'at character %d.' %
1086
+ (str(e.args[0]), e.text, build_file, e.offset),
1087
+ e.filename, e.lineno, e.offset, e.text)
1088
+ raise syntax_error
1089
+ except NameError, e:
1090
+ gyp.common.ExceptionAppend(e, 'while evaluating condition \'%s\' in %s' %
1091
+ (cond_expr_expanded, build_file))
1092
+ raise GypError(e)
1093
+
1006
1094
 
1007
1095
  def ProcessConditionsInDict(the_dict, phase, variables, build_file):
1008
1096
  # Process a 'conditions' or 'target_conditions' section in the_dict,
@@ -1038,48 +1126,8 @@ def ProcessConditionsInDict(the_dict, phase, variables, build_file):
1038
1126
  del the_dict[conditions_key]
1039
1127
 
1040
1128
  for condition in conditions_list:
1041
- if not isinstance(condition, list):
1042
- raise GypError(conditions_key + ' must be a list')
1043
- if len(condition) != 2 and len(condition) != 3:
1044
- # It's possible that condition[0] won't work in which case this
1045
- # attempt will raise its own IndexError. That's probably fine.
1046
- raise GypError(conditions_key + ' ' + condition[0] +
1047
- ' must be length 2 or 3, not ' + str(len(condition)))
1048
-
1049
- [cond_expr, true_dict] = condition[0:2]
1050
- false_dict = None
1051
- if len(condition) == 3:
1052
- false_dict = condition[2]
1053
-
1054
- # Do expansions on the condition itself. Since the conditon can naturally
1055
- # contain variable references without needing to resort to GYP expansion
1056
- # syntax, this is of dubious value for variables, but someone might want to
1057
- # use a command expansion directly inside a condition.
1058
- cond_expr_expanded = ExpandVariables(cond_expr, phase, variables,
1059
- build_file)
1060
- if not isinstance(cond_expr_expanded, str) and \
1061
- not isinstance(cond_expr_expanded, int):
1062
- raise ValueError, \
1063
- 'Variable expansion in this context permits str and int ' + \
1064
- 'only, found ' + expanded.__class__.__name__
1065
-
1066
- try:
1067
- ast_code = compile(cond_expr_expanded, '<string>', 'eval')
1068
-
1069
- if eval(ast_code, {'__builtins__': None}, variables):
1070
- merge_dict = true_dict
1071
- else:
1072
- merge_dict = false_dict
1073
- except SyntaxError, e:
1074
- syntax_error = SyntaxError('%s while evaluating condition \'%s\' in %s '
1075
- 'at character %d.' %
1076
- (str(e.args[0]), e.text, build_file, e.offset),
1077
- e.filename, e.lineno, e.offset, e.text)
1078
- raise syntax_error
1079
- except NameError, e:
1080
- gyp.common.ExceptionAppend(e, 'while evaluating condition \'%s\' in %s' %
1081
- (cond_expr_expanded, build_file))
1082
- raise GypError(e)
1129
+ merge_dict = EvalCondition(condition, conditions_key, phase, variables,
1130
+ build_file)
1083
1131
 
1084
1132
  if merge_dict != None:
1085
1133
  # Expand variables and nested conditinals in the merge_dict before
@@ -1094,8 +1142,7 @@ def LoadAutomaticVariablesFromDict(variables, the_dict):
1094
1142
  # Any keys with plain string values in the_dict become automatic variables.
1095
1143
  # The variable name is the key name with a "_" character prepended.
1096
1144
  for key, value in the_dict.iteritems():
1097
- if isinstance(value, str) or isinstance(value, int) or \
1098
- isinstance(value, list):
1145
+ if type(value) in (str, int, list):
1099
1146
  variables['_' + key] = value
1100
1147
 
1101
1148
 
@@ -1108,8 +1155,7 @@ def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key):
1108
1155
  # (it could be a list or it could be parentless because it is a root dict),
1109
1156
  # the_dict_key will be None.
1110
1157
  for key, value in the_dict.get('variables', {}).iteritems():
1111
- if not isinstance(value, str) and not isinstance(value, int) and \
1112
- not isinstance(value, list):
1158
+ if type(value) not in (str, int, list):
1113
1159
  continue
1114
1160
 
1115
1161
  if key.endswith('%'):
@@ -1162,12 +1208,12 @@ def ProcessVariablesAndConditionsInDict(the_dict, phase, variables_in,
1162
1208
 
1163
1209
  for key, value in the_dict.iteritems():
1164
1210
  # Skip "variables", which was already processed if present.
1165
- if key != 'variables' and isinstance(value, str):
1211
+ if key != 'variables' and type(value) is str:
1166
1212
  expanded = ExpandVariables(value, phase, variables, build_file)
1167
- if not isinstance(expanded, str) and not isinstance(expanded, int):
1168
- raise ValueError, \
1213
+ if type(expanded) not in (str, int):
1214
+ raise ValueError(
1169
1215
  'Variable expansion in this context permits str and int ' + \
1170
- 'only, found ' + expanded.__class__.__name__ + ' for ' + key
1216
+ 'only, found ' + expanded.__class__.__name__ + ' for ' + key)
1171
1217
  the_dict[key] = expanded
1172
1218
 
1173
1219
  # Variable expansion may have resulted in changes to automatics. Reload.
@@ -1221,23 +1267,23 @@ def ProcessVariablesAndConditionsInDict(the_dict, phase, variables_in,
1221
1267
  for key, value in the_dict.iteritems():
1222
1268
  # Skip "variables" and string values, which were already processed if
1223
1269
  # present.
1224
- if key == 'variables' or isinstance(value, str):
1270
+ if key == 'variables' or type(value) is str:
1225
1271
  continue
1226
- if isinstance(value, dict):
1272
+ if type(value) is dict:
1227
1273
  # Pass a copy of the variables dict so that subdicts can't influence
1228
1274
  # parents.
1229
1275
  ProcessVariablesAndConditionsInDict(value, phase, variables,
1230
1276
  build_file, key)
1231
- elif isinstance(value, list):
1277
+ elif type(value) is list:
1232
1278
  # The list itself can't influence the variables dict, and
1233
1279
  # ProcessVariablesAndConditionsInList will make copies of the variables
1234
1280
  # dict if it needs to pass it to something that can influence it. No
1235
1281
  # copy is necessary here.
1236
1282
  ProcessVariablesAndConditionsInList(value, phase, variables,
1237
1283
  build_file)
1238
- elif not isinstance(value, int):
1239
- raise TypeError, 'Unknown type ' + value.__class__.__name__ + \
1240
- ' for ' + key
1284
+ elif type(value) is not int:
1285
+ raise TypeError('Unknown type ' + value.__class__.__name__ + \
1286
+ ' for ' + key)
1241
1287
 
1242
1288
 
1243
1289
  def ProcessVariablesAndConditionsInList(the_list, phase, variables,
@@ -1246,17 +1292,17 @@ def ProcessVariablesAndConditionsInList(the_list, phase, variables,
1246
1292
  index = 0
1247
1293
  while index < len(the_list):
1248
1294
  item = the_list[index]
1249
- if isinstance(item, dict):
1295
+ if type(item) is dict:
1250
1296
  # Make a copy of the variables dict so that it won't influence anything
1251
1297
  # outside of its own scope.
1252
1298
  ProcessVariablesAndConditionsInDict(item, phase, variables, build_file)
1253
- elif isinstance(item, list):
1299
+ elif type(item) is list:
1254
1300
  ProcessVariablesAndConditionsInList(item, phase, variables, build_file)
1255
- elif isinstance(item, str):
1301
+ elif type(item) is str:
1256
1302
  expanded = ExpandVariables(item, phase, variables, build_file)
1257
- if isinstance(expanded, str) or isinstance(expanded, int):
1303
+ if type(expanded) in (str, int):
1258
1304
  the_list[index] = expanded
1259
- elif isinstance(expanded, list):
1305
+ elif type(expanded) is list:
1260
1306
  the_list[index:index+1] = expanded
1261
1307
  index += len(expanded)
1262
1308
 
@@ -1264,13 +1310,13 @@ def ProcessVariablesAndConditionsInList(the_list, phase, variables,
1264
1310
  # without falling into the index increment below.
1265
1311
  continue
1266
1312
  else:
1267
- raise ValueError, \
1313
+ raise ValueError(
1268
1314
  'Variable expansion in this context permits strings and ' + \
1269
1315
  'lists only, found ' + expanded.__class__.__name__ + ' at ' + \
1270
- index
1271
- elif not isinstance(item, int):
1272
- raise TypeError, 'Unknown type ' + item.__class__.__name__ + \
1273
- ' at index ' + index
1316
+ index)
1317
+ elif type(item) is not int:
1318
+ raise TypeError('Unknown type ' + item.__class__.__name__ + \
1319
+ ' at index ' + index)
1274
1320
  index = index + 1
1275
1321
 
1276
1322
 
@@ -1443,6 +1489,20 @@ def RemoveSelfDependencies(targets):
1443
1489
  target_dict[dependency_key] = Filter(dependencies, target_name)
1444
1490
 
1445
1491
 
1492
+ def RemoveLinkDependenciesFromNoneTargets(targets):
1493
+ """Remove dependencies having the 'link_dependency' attribute from the 'none'
1494
+ targets."""
1495
+ for target_name, target_dict in targets.iteritems():
1496
+ for dependency_key in dependency_sections:
1497
+ dependencies = target_dict.get(dependency_key, [])
1498
+ if dependencies:
1499
+ for t in dependencies:
1500
+ if target_dict.get('type', None) == 'none':
1501
+ if targets[t].get('variables', {}).get('link_dependency', 0):
1502
+ target_dict[dependency_key] = \
1503
+ Filter(target_dict[dependency_key], t)
1504
+
1505
+
1446
1506
  class DependencyGraphNode(object):
1447
1507
  """
1448
1508
 
@@ -1468,7 +1528,7 @@ class DependencyGraphNode(object):
1468
1528
  # are the "ref" attributes of DependencyGraphNodes. Every target will
1469
1529
  # appear in flat_list after all of its dependencies, and before all of its
1470
1530
  # dependents.
1471
- flat_list = []
1531
+ flat_list = OrderedSet()
1472
1532
 
1473
1533
  # in_degree_zeros is the list of DependencyGraphNodes that have no
1474
1534
  # dependencies not in flat_list. Initially, it is a copy of the children
@@ -1482,12 +1542,15 @@ class DependencyGraphNode(object):
1482
1542
  # as work progresses, so that the next node to process from the list can
1483
1543
  # always be accessed at a consistent position.
1484
1544
  node = in_degree_zeros.pop()
1485
- flat_list.append(node.ref)
1545
+ flat_list.add(node.ref)
1486
1546
 
1487
1547
  # Look at dependents of the node just added to flat_list. Some of them
1488
1548
  # may now belong in in_degree_zeros.
1489
1549
  for node_dependent in node.dependents:
1490
1550
  is_in_degree_zero = True
1551
+ # TODO: We want to check through the
1552
+ # node_dependent.dependencies list but if it's long and we
1553
+ # always start at the beginning, then we get O(n^2) behaviour.
1491
1554
  for node_dependent_dependency in node_dependent.dependencies:
1492
1555
  if not node_dependent_dependency.ref in flat_list:
1493
1556
  # The dependent one or more dependencies not in flat_list. There
@@ -1503,28 +1566,27 @@ class DependencyGraphNode(object):
1503
1566
  # iteration of the outer loop.
1504
1567
  in_degree_zeros.add(node_dependent)
1505
1568
 
1506
- return flat_list
1569
+ return list(flat_list)
1507
1570
 
1508
- def FindCycles(self, path=None):
1571
+ def FindCycles(self):
1509
1572
  """
1510
1573
  Returns a list of cycles in the graph, where each cycle is its own list.
1511
1574
  """
1512
- if path is None:
1513
- path = [self]
1514
-
1515
1575
  results = []
1516
- for node in self.dependents:
1517
- if node in path:
1518
- cycle = [node]
1519
- for part in path:
1520
- cycle.append(part)
1521
- if part == node:
1522
- break
1523
- results.append(tuple(cycle))
1524
- else:
1525
- results.extend(node.FindCycles([node] + path))
1576
+ visited = set()
1577
+
1578
+ def Visit(node, path):
1579
+ for child in node.dependents:
1580
+ if child in path:
1581
+ results.append([child] + path[:path.index(child) + 1])
1582
+ elif not child in visited:
1583
+ visited.add(child)
1584
+ Visit(child, [child] + path)
1585
+
1586
+ visited.add(self)
1587
+ Visit(self, [self])
1526
1588
 
1527
- return list(set(results))
1589
+ return results
1528
1590
 
1529
1591
  def DirectDependencies(self, dependencies=None):
1530
1592
  """Returns a list of just direct dependencies."""
@@ -1589,21 +1651,26 @@ class DependencyGraphNode(object):
1589
1651
  return self._AddImportedDependencies(targets, dependencies)
1590
1652
 
1591
1653
  def DeepDependencies(self, dependencies=None):
1592
- """Returns a list of all of a target's dependencies, recursively."""
1593
- if dependencies == None:
1594
- dependencies = []
1654
+ """Returns an OrderedSet of all of a target's dependencies, recursively."""
1655
+ if dependencies is None:
1656
+ # Using a list to get ordered output and a set to do fast "is it
1657
+ # already added" checks.
1658
+ dependencies = OrderedSet()
1595
1659
 
1596
1660
  for dependency in self.dependencies:
1597
1661
  # Check for None, corresponding to the root node.
1598
- if dependency.ref != None and dependency.ref not in dependencies:
1599
- dependencies.append(dependency.ref)
1662
+ if dependency.ref is None:
1663
+ continue
1664
+ if dependency.ref not in dependencies:
1665
+ dependencies.add(dependency.ref)
1600
1666
  dependency.DeepDependencies(dependencies)
1601
1667
 
1602
1668
  return dependencies
1603
1669
 
1604
1670
  def _LinkDependenciesInternal(self, targets, include_shared_libraries,
1605
1671
  dependencies=None, initial=True):
1606
- """Returns a list of dependency targets that are linked into this target.
1672
+ """Returns an OrderedSet of dependency targets that are linked
1673
+ into this target.
1607
1674
 
1608
1675
  This function has a split personality, depending on the setting of
1609
1676
  |initial|. Outside callers should always leave |initial| at its default
@@ -1616,11 +1683,13 @@ class DependencyGraphNode(object):
1616
1683
  If |include_shared_libraries| is False, the resulting dependencies will not
1617
1684
  include shared_library targets that are linked into this target.
1618
1685
  """
1619
- if dependencies == None:
1620
- dependencies = []
1686
+ if dependencies is None:
1687
+ # Using a list to get ordered output and a set to do fast "is it
1688
+ # already added" checks.
1689
+ dependencies = OrderedSet()
1621
1690
 
1622
1691
  # Check for None, corresponding to the root node.
1623
- if self.ref == None:
1692
+ if self.ref is None:
1624
1693
  return dependencies
1625
1694
 
1626
1695
  # It's kind of sucky that |targets| has to be passed into this function,
@@ -1648,8 +1717,7 @@ class DependencyGraphNode(object):
1648
1717
  # Don't traverse 'none' targets if explicitly excluded.
1649
1718
  if (target_type == 'none' and
1650
1719
  not targets[self.ref].get('dependencies_traverse', True)):
1651
- if self.ref not in dependencies:
1652
- dependencies.append(self.ref)
1720
+ dependencies.add(self.ref)
1653
1721
  return dependencies
1654
1722
 
1655
1723
  # Executables and loadable modules are already fully and finally linked.
@@ -1671,7 +1739,7 @@ class DependencyGraphNode(object):
1671
1739
 
1672
1740
  # The target is linkable, add it to the list of link dependencies.
1673
1741
  if self.ref not in dependencies:
1674
- dependencies.append(self.ref)
1742
+ dependencies.add(self.ref)
1675
1743
  if initial or not is_linkable:
1676
1744
  # If this is a subsequent target and it's linkable, don't look any
1677
1745
  # further for linkable dependencies, as they'll already be linked into
@@ -1735,12 +1803,22 @@ def BuildDependencyList(targets):
1735
1803
  flat_list = root_node.FlattenToList()
1736
1804
 
1737
1805
  # If there's anything left unvisited, there must be a circular dependency
1738
- # (cycle). If you need to figure out what's wrong, look for elements of
1739
- # targets that are not in flat_list.
1806
+ # (cycle).
1740
1807
  if len(flat_list) != len(targets):
1808
+ if not root_node.dependents:
1809
+ # If all targets have dependencies, add the first target as a dependent
1810
+ # of root_node so that the cycle can be discovered from root_node.
1811
+ target = targets.keys()[0]
1812
+ target_node = dependency_nodes[target]
1813
+ target_node.dependencies.append(root_node)
1814
+ root_node.dependents.append(target_node)
1815
+
1816
+ cycles = []
1817
+ for cycle in root_node.FindCycles():
1818
+ paths = [node.ref for node in cycle]
1819
+ cycles.append('Cycle: %s' % ' -> '.join(paths))
1741
1820
  raise DependencyGraphNode.CircularException(
1742
- 'Some targets not reachable, cycle in dependency graph detected: ' +
1743
- ' '.join(set(flat_list) ^ set(targets)))
1821
+ 'Cycles in dependency graph detected:\n' + '\n'.join(cycles))
1744
1822
 
1745
1823
  return [dependency_nodes, flat_list]
1746
1824
 
@@ -1790,20 +1868,18 @@ def VerifyNoGYPFileCircularDependencies(targets):
1790
1868
  # If there's anything left unvisited, there must be a circular dependency
1791
1869
  # (cycle).
1792
1870
  if len(flat_list) != len(dependency_nodes):
1793
- bad_files = []
1794
- for file in dependency_nodes.iterkeys():
1795
- if not file in flat_list:
1796
- bad_files.append(file)
1797
- common_path_prefix = os.path.commonprefix(dependency_nodes)
1871
+ if not root_node.dependents:
1872
+ # If all files have dependencies, add the first file as a dependent
1873
+ # of root_node so that the cycle can be discovered from root_node.
1874
+ file_node = dependency_nodes.values()[0]
1875
+ file_node.dependencies.append(root_node)
1876
+ root_node.dependents.append(file_node)
1798
1877
  cycles = []
1799
1878
  for cycle in root_node.FindCycles():
1800
- simplified_paths = []
1801
- for node in cycle:
1802
- assert(node.ref.startswith(common_path_prefix))
1803
- simplified_paths.append(node.ref[len(common_path_prefix):])
1804
- cycles.append('Cycle: %s' % ' -> '.join(simplified_paths))
1805
- raise DependencyGraphNode.CircularException, \
1806
- 'Cycles in .gyp file dependency graph detected:\n' + '\n'.join(cycles)
1879
+ paths = [node.ref for node in cycle]
1880
+ cycles.append('Cycle: %s' % ' -> '.join(paths))
1881
+ raise DependencyGraphNode.CircularException(
1882
+ 'Cycles in .gyp file dependency graph detected:\n' + '\n'.join(cycles))
1807
1883
 
1808
1884
 
1809
1885
  def DoDependentSettings(key, flat_list, targets, dependency_nodes):
@@ -1966,25 +2042,25 @@ def MergeLists(to, fro, to_file, fro_file, is_paths=False, append=True):
1966
2042
  hashable_to_set = set(x for x in to if is_hashable(x))
1967
2043
  for item in fro:
1968
2044
  singleton = False
1969
- if isinstance(item, str) or isinstance(item, int):
2045
+ if type(item) in (str, int):
1970
2046
  # The cheap and easy case.
1971
2047
  if is_paths:
1972
2048
  to_item = MakePathRelative(to_file, fro_file, item)
1973
2049
  else:
1974
2050
  to_item = item
1975
2051
 
1976
- if not isinstance(item, str) or not item.startswith('-'):
2052
+ if not (type(item) is str and item.startswith('-')):
1977
2053
  # Any string that doesn't begin with a "-" is a singleton - it can
1978
2054
  # only appear once in a list, to be enforced by the list merge append
1979
2055
  # or prepend.
1980
2056
  singleton = True
1981
- elif isinstance(item, dict):
2057
+ elif type(item) is dict:
1982
2058
  # Make a copy of the dictionary, continuing to look for paths to fix.
1983
2059
  # The other intelligent aspects of merge processing won't apply because
1984
2060
  # item is being merged into an empty dict.
1985
2061
  to_item = {}
1986
2062
  MergeDicts(to_item, item, to_file, fro_file)
1987
- elif isinstance(item, list):
2063
+ elif type(item) is list:
1988
2064
  # Recurse, making a copy of the list. If the list contains any
1989
2065
  # descendant dicts, path fixing will occur. Note that here, custom
1990
2066
  # values for is_paths and append are dropped; those are only to be
@@ -1993,9 +2069,9 @@ def MergeLists(to, fro, to_file, fro_file, is_paths=False, append=True):
1993
2069
  to_item = []
1994
2070
  MergeLists(to_item, item, to_file, fro_file)
1995
2071
  else:
1996
- raise TypeError, \
2072
+ raise TypeError(
1997
2073
  'Attempt to merge list item of unsupported type ' + \
1998
- item.__class__.__name__
2074
+ item.__class__.__name__)
1999
2075
 
2000
2076
  if append:
2001
2077
  # If appending a singleton that's already in the list, don't append.
@@ -2030,30 +2106,30 @@ def MergeDicts(to, fro, to_file, fro_file):
2030
2106
  # modified.
2031
2107
  if k in to:
2032
2108
  bad_merge = False
2033
- if isinstance(v, str) or isinstance(v, int):
2034
- if not (isinstance(to[k], str) or isinstance(to[k], int)):
2109
+ if type(v) in (str, int):
2110
+ if type(to[k]) not in (str, int):
2035
2111
  bad_merge = True
2036
- elif v.__class__ != to[k].__class__:
2112
+ elif type(v) is not type(to[k]):
2037
2113
  bad_merge = True
2038
2114
 
2039
2115
  if bad_merge:
2040
- raise TypeError, \
2116
+ raise TypeError(
2041
2117
  'Attempt to merge dict value of type ' + v.__class__.__name__ + \
2042
2118
  ' into incompatible type ' + to[k].__class__.__name__ + \
2043
- ' for key ' + k
2044
- if isinstance(v, str) or isinstance(v, int):
2119
+ ' for key ' + k)
2120
+ if type(v) in (str, int):
2045
2121
  # Overwrite the existing value, if any. Cheap and easy.
2046
2122
  is_path = IsPathSection(k)
2047
2123
  if is_path:
2048
2124
  to[k] = MakePathRelative(to_file, fro_file, v)
2049
2125
  else:
2050
2126
  to[k] = v
2051
- elif isinstance(v, dict):
2127
+ elif type(v) is dict:
2052
2128
  # Recurse, guaranteeing copies will be made of objects that require it.
2053
2129
  if not k in to:
2054
2130
  to[k] = {}
2055
2131
  MergeDicts(to[k], v, to_file, fro_file)
2056
- elif isinstance(v, list):
2132
+ elif type(v) is list:
2057
2133
  # Lists in dicts can be merged with different policies, depending on
2058
2134
  # how the key in the "from" dict (k, the from-key) is written.
2059
2135
  #
@@ -2096,13 +2172,13 @@ def MergeDicts(to, fro, to_file, fro_file):
2096
2172
  # If the key ends in "?", the list will only be merged if it doesn't
2097
2173
  # already exist.
2098
2174
  continue
2099
- if not isinstance(to[list_base], list):
2175
+ elif type(to[list_base]) is not list:
2100
2176
  # This may not have been checked above if merging in a list with an
2101
2177
  # extension character.
2102
- raise TypeError, \
2178
+ raise TypeError(
2103
2179
  'Attempt to merge dict value of type ' + v.__class__.__name__ + \
2104
2180
  ' into incompatible type ' + to[list_base].__class__.__name__ + \
2105
- ' for key ' + list_base + '(' + k + ')'
2181
+ ' for key ' + list_base + '(' + k + ')')
2106
2182
  else:
2107
2183
  to[list_base] = []
2108
2184
 
@@ -2114,9 +2190,9 @@ def MergeDicts(to, fro, to_file, fro_file):
2114
2190
  is_paths = IsPathSection(list_base)
2115
2191
  MergeLists(to[list_base], v, to_file, fro_file, is_paths, append)
2116
2192
  else:
2117
- raise TypeError, \
2193
+ raise TypeError(
2118
2194
  'Attempt to merge dict value of unsupported type ' + \
2119
- v.__class__.__name__ + ' for key ' + k
2195
+ v.__class__.__name__ + ' for key ' + k)
2120
2196
 
2121
2197
 
2122
2198
  def MergeConfigWithInheritance(new_configuration_dict, build_file,
@@ -2157,43 +2233,39 @@ def SetUpConfigurations(target, target_dict):
2157
2233
  if not 'configurations' in target_dict:
2158
2234
  target_dict['configurations'] = {'Default': {}}
2159
2235
  if not 'default_configuration' in target_dict:
2160
- concrete = [i for i in target_dict['configurations'].iterkeys()
2161
- if not target_dict['configurations'][i].get('abstract')]
2236
+ concrete = [i for (i, config) in target_dict['configurations'].iteritems()
2237
+ if not config.get('abstract')]
2162
2238
  target_dict['default_configuration'] = sorted(concrete)[0]
2163
2239
 
2164
- for configuration in target_dict['configurations'].keys():
2165
- old_configuration_dict = target_dict['configurations'][configuration]
2240
+ merged_configurations = {}
2241
+ configs = target_dict['configurations']
2242
+ for (configuration, old_configuration_dict) in configs.iteritems():
2166
2243
  # Skip abstract configurations (saves work only).
2167
2244
  if old_configuration_dict.get('abstract'):
2168
2245
  continue
2169
2246
  # Configurations inherit (most) settings from the enclosing target scope.
2170
2247
  # Get the inheritance relationship right by making a copy of the target
2171
2248
  # dict.
2172
- new_configuration_dict = copy.deepcopy(target_dict)
2173
-
2174
- # Take out the bits that don't belong in a "configurations" section.
2175
- # Since configuration setup is done before conditional, exclude, and rules
2176
- # processing, be careful with handling of the suffix characters used in
2177
- # those phases.
2178
- delete_keys = []
2179
- for key in new_configuration_dict:
2249
+ new_configuration_dict = {}
2250
+ for (key, target_val) in target_dict.iteritems():
2180
2251
  key_ext = key[-1:]
2181
2252
  if key_ext in key_suffixes:
2182
2253
  key_base = key[:-1]
2183
2254
  else:
2184
2255
  key_base = key
2185
- if key_base in non_configuration_keys:
2186
- delete_keys.append(key)
2187
-
2188
- for key in delete_keys:
2189
- del new_configuration_dict[key]
2256
+ if not key_base in non_configuration_keys:
2257
+ new_configuration_dict[key] = gyp.simple_copy.deepcopy(target_val)
2190
2258
 
2191
2259
  # Merge in configuration (with all its parents first).
2192
2260
  MergeConfigWithInheritance(new_configuration_dict, build_file,
2193
2261
  target_dict, configuration, [])
2194
2262
 
2195
- # Put the new result back into the target dict as a configuration.
2196
- target_dict['configurations'][configuration] = new_configuration_dict
2263
+ merged_configurations[configuration] = new_configuration_dict
2264
+
2265
+ # Put the new configurations back into the target dict as a configuration.
2266
+ for configuration in merged_configurations.keys():
2267
+ target_dict['configurations'][configuration] = (
2268
+ merged_configurations[configuration])
2197
2269
 
2198
2270
  # Now drop all the abstract ones.
2199
2271
  for configuration in target_dict['configurations'].keys():
@@ -2264,9 +2336,9 @@ def ProcessListFiltersInDict(name, the_dict):
2264
2336
  if operation != '!' and operation != '/':
2265
2337
  continue
2266
2338
 
2267
- if not isinstance(value, list):
2268
- raise ValueError, name + ' key ' + key + ' must be list, not ' + \
2269
- value.__class__.__name__
2339
+ if type(value) is not list:
2340
+ raise ValueError(name + ' key ' + key + ' must be list, not ' + \
2341
+ value.__class__.__name__)
2270
2342
 
2271
2343
  list_key = key[:-1]
2272
2344
  if list_key not in the_dict:
@@ -2276,12 +2348,12 @@ def ProcessListFiltersInDict(name, the_dict):
2276
2348
  del_lists.append(key)
2277
2349
  continue
2278
2350
 
2279
- if not isinstance(the_dict[list_key], list):
2351
+ if type(the_dict[list_key]) is not list:
2280
2352
  value = the_dict[list_key]
2281
- raise ValueError, name + ' key ' + list_key + \
2282
- ' must be list, not ' + \
2283
- value.__class__.__name__ + ' when applying ' + \
2284
- {'!': 'exclusion', '/': 'regex'}[operation]
2353
+ raise ValueError(name + ' key ' + list_key + \
2354
+ ' must be list, not ' + \
2355
+ value.__class__.__name__ + ' when applying ' + \
2356
+ {'!': 'exclusion', '/': 'regex'}[operation])
2285
2357
 
2286
2358
  if not list_key in lists:
2287
2359
  lists.append(list_key)
@@ -2330,8 +2402,8 @@ def ProcessListFiltersInDict(name, the_dict):
2330
2402
  action_value = 1
2331
2403
  else:
2332
2404
  # This is an action that doesn't make any sense.
2333
- raise ValueError, 'Unrecognized action ' + action + ' in ' + name + \
2334
- ' key ' + regex_key
2405
+ raise ValueError('Unrecognized action ' + action + ' in ' + name + \
2406
+ ' key ' + regex_key)
2335
2407
 
2336
2408
  for index in xrange(0, len(the_list)):
2337
2409
  list_item = the_list[index]
@@ -2378,17 +2450,17 @@ def ProcessListFiltersInDict(name, the_dict):
2378
2450
 
2379
2451
  # Now recurse into subdicts and lists that may contain dicts.
2380
2452
  for key, value in the_dict.iteritems():
2381
- if isinstance(value, dict):
2453
+ if type(value) is dict:
2382
2454
  ProcessListFiltersInDict(key, value)
2383
- elif isinstance(value, list):
2455
+ elif type(value) is list:
2384
2456
  ProcessListFiltersInList(key, value)
2385
2457
 
2386
2458
 
2387
2459
  def ProcessListFiltersInList(name, the_list):
2388
2460
  for item in the_list:
2389
- if isinstance(item, dict):
2461
+ if type(item) is dict:
2390
2462
  ProcessListFiltersInDict(name, item)
2391
- elif isinstance(item, list):
2463
+ elif type(item) is list:
2392
2464
  ProcessListFiltersInList(name, item)
2393
2465
 
2394
2466
 
@@ -2416,33 +2488,6 @@ def ValidateTargetType(target, target_dict):
2416
2488
  target_type))
2417
2489
 
2418
2490
 
2419
- def ValidateSourcesInTarget(target, target_dict, build_file):
2420
- # TODO: Check if MSVC allows this for loadable_module targets.
2421
- if target_dict.get('type', None) not in ('static_library', 'shared_library'):
2422
- return
2423
- sources = target_dict.get('sources', [])
2424
- basenames = {}
2425
- for source in sources:
2426
- name, ext = os.path.splitext(source)
2427
- is_compiled_file = ext in [
2428
- '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S']
2429
- if not is_compiled_file:
2430
- continue
2431
- basename = os.path.basename(name) # Don't include extension.
2432
- basenames.setdefault(basename, []).append(source)
2433
-
2434
- error = ''
2435
- for basename, files in basenames.iteritems():
2436
- if len(files) > 1:
2437
- error += ' %s: %s\n' % (basename, ' '.join(files))
2438
-
2439
- if error:
2440
- print('static library %s has several files with the same basename:\n' %
2441
- target + error + 'Some build systems, e.g. MSVC08, '
2442
- 'cannot handle that.')
2443
- raise GypError('Duplicate basenames in sources section, see list above')
2444
-
2445
-
2446
2491
  def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules):
2447
2492
  """Ensures that the rules sections in target_dict are valid and consistent,
2448
2493
  and determines which sources they apply to.
@@ -2506,7 +2551,7 @@ def ValidateRunAsInTarget(target, target_dict, build_file):
2506
2551
  run_as = target_dict.get('run_as')
2507
2552
  if not run_as:
2508
2553
  return
2509
- if not isinstance(run_as, dict):
2554
+ if type(run_as) is not dict:
2510
2555
  raise GypError("The 'run_as' in target %s from file %s should be a "
2511
2556
  "dictionary." %
2512
2557
  (target_name, build_file))
@@ -2515,17 +2560,17 @@ def ValidateRunAsInTarget(target, target_dict, build_file):
2515
2560
  raise GypError("The 'run_as' in target %s from file %s must have an "
2516
2561
  "'action' section." %
2517
2562
  (target_name, build_file))
2518
- if not isinstance(action, list):
2563
+ if type(action) is not list:
2519
2564
  raise GypError("The 'action' for 'run_as' in target %s from file %s "
2520
2565
  "must be a list." %
2521
2566
  (target_name, build_file))
2522
2567
  working_directory = run_as.get('working_directory')
2523
- if working_directory and not isinstance(working_directory, str):
2568
+ if working_directory and type(working_directory) is not str:
2524
2569
  raise GypError("The 'working_directory' for 'run_as' in target %s "
2525
2570
  "in file %s should be a string." %
2526
2571
  (target_name, build_file))
2527
2572
  environment = run_as.get('environment')
2528
- if environment and not isinstance(environment, dict):
2573
+ if environment and type(environment) is not dict:
2529
2574
  raise GypError("The 'environment' for 'run_as' in target %s "
2530
2575
  "in file %s should be a dictionary." %
2531
2576
  (target_name, build_file))
@@ -2555,17 +2600,17 @@ def TurnIntIntoStrInDict(the_dict):
2555
2600
  # Use items instead of iteritems because there's no need to try to look at
2556
2601
  # reinserted keys and their associated values.
2557
2602
  for k, v in the_dict.items():
2558
- if isinstance(v, int):
2603
+ if type(v) is int:
2559
2604
  v = str(v)
2560
2605
  the_dict[k] = v
2561
- elif isinstance(v, dict):
2606
+ elif type(v) is dict:
2562
2607
  TurnIntIntoStrInDict(v)
2563
- elif isinstance(v, list):
2608
+ elif type(v) is list:
2564
2609
  TurnIntIntoStrInList(v)
2565
2610
 
2566
- if isinstance(k, int):
2567
- the_dict[str(k)] = v
2611
+ if type(k) is int:
2568
2612
  del the_dict[k]
2613
+ the_dict[str(k)] = v
2569
2614
 
2570
2615
 
2571
2616
  def TurnIntIntoStrInList(the_list):
@@ -2573,11 +2618,11 @@ def TurnIntIntoStrInList(the_list):
2573
2618
  """
2574
2619
  for index in xrange(0, len(the_list)):
2575
2620
  item = the_list[index]
2576
- if isinstance(item, int):
2621
+ if type(item) is int:
2577
2622
  the_list[index] = str(item)
2578
- elif isinstance(item, dict):
2623
+ elif type(item) is dict:
2579
2624
  TurnIntIntoStrInDict(item)
2580
- elif isinstance(item, list):
2625
+ elif type(item) is list:
2581
2626
  TurnIntIntoStrInList(item)
2582
2627
 
2583
2628
 
@@ -2647,8 +2692,8 @@ def SetGeneratorGlobals(generator_input_info):
2647
2692
  # Set up path_sections and non_configuration_keys with the default data plus
2648
2693
  # the generator-specific data.
2649
2694
  global path_sections
2650
- path_sections = base_path_sections[:]
2651
- path_sections.extend(generator_input_info['path_sections'])
2695
+ path_sections = set(base_path_sections)
2696
+ path_sections.update(generator_input_info['path_sections'])
2652
2697
 
2653
2698
  global non_configuration_keys
2654
2699
  non_configuration_keys = base_non_configuration_keys[:]
@@ -2677,15 +2722,14 @@ def Load(build_files, variables, includes, depth, generator_input_info, check,
2677
2722
  # well as meta-data (e.g. 'included_files' key). 'target_build_files' keeps
2678
2723
  # track of the keys corresponding to "target" files.
2679
2724
  data = {'target_build_files': set()}
2680
- aux_data = {}
2681
2725
  # Normalize paths everywhere. This is important because paths will be
2682
2726
  # used as keys to the data dict and for references between input files.
2683
2727
  build_files = set(map(os.path.normpath, build_files))
2684
2728
  if parallel:
2685
- LoadTargetBuildFilesParallel(build_files, data, aux_data,
2686
- variables, includes, depth, check,
2687
- generator_input_info)
2729
+ LoadTargetBuildFilesParallel(build_files, data, variables, includes, depth,
2730
+ check, generator_input_info)
2688
2731
  else:
2732
+ aux_data = {}
2689
2733
  for build_file in build_files:
2690
2734
  try:
2691
2735
  LoadTargetBuildFile(build_file, data, aux_data,
@@ -2707,6 +2751,10 @@ def Load(build_files, variables, includes, depth, generator_input_info, check,
2707
2751
  # Expand dependencies specified as build_file:*.
2708
2752
  ExpandWildcardDependencies(targets, data)
2709
2753
 
2754
+ # Remove all dependencies marked as 'link_dependency' from the targets of
2755
+ # type 'none'.
2756
+ RemoveLinkDependenciesFromNoneTargets(targets)
2757
+
2710
2758
  # Apply exclude (!) and regex (/) list filters only for dependency_sections.
2711
2759
  for target_name, target_dict in targets.iteritems():
2712
2760
  tmp_dict = {}
@@ -2792,10 +2840,6 @@ def Load(build_files, variables, includes, depth, generator_input_info, check,
2792
2840
  target_dict = targets[target]
2793
2841
  build_file = gyp.common.BuildFile(target)
2794
2842
  ValidateTargetType(target, target_dict)
2795
- # TODO(thakis): Get vpx_scale/arm/scalesystemdependent.c to be renamed to
2796
- # scalesystemdependent_arm_additions.c or similar.
2797
- if 'arm' not in variables.get('target_arch', ''):
2798
- ValidateSourcesInTarget(target, target_dict, build_file)
2799
2843
  ValidateRulesInTarget(target, target_dict, extra_sources_for_rules)
2800
2844
  ValidateRunAsInTarget(target, target_dict, build_file)
2801
2845
  ValidateActionsInTarget(target, target_dict, build_file)