tree-sitter 0.0.1

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 (1857) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +36 -0
  4. data/Rakefile +49 -0
  5. data/ext/tree-sitter/extconf.rb +34 -0
  6. data/ext/tree-sitter/tree-sitter.c +114 -0
  7. data/ext/tree-sitter/tree-sitter.h +15 -0
  8. data/ext/tree-sitter/tree-sitter/Makefile +360 -0
  9. data/ext/tree-sitter/tree-sitter/README.md +224 -0
  10. data/ext/tree-sitter/tree-sitter/compiler.target.mk +238 -0
  11. data/ext/tree-sitter/tree-sitter/doc/grammar-schema.json +249 -0
  12. data/ext/tree-sitter/tree-sitter/externals/bandit/CMakeLists.txt +57 -0
  13. data/ext/tree-sitter/tree-sitter/externals/bandit/LICENSE.md +21 -0
  14. data/ext/tree-sitter/tree-sitter/externals/bandit/README.md +64 -0
  15. data/ext/tree-sitter/tree-sitter/externals/bandit/appveyor.yml +12 -0
  16. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/adapters/adapter.h +12 -0
  17. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/adapters/adapters.h +16 -0
  18. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/adapters/snowhouse.h +22 -0
  19. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_exception.h +51 -0
  20. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/BeCloseTo.h +55 -0
  21. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/BeEmpty.h +32 -0
  22. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/BeFalsy.h +39 -0
  23. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/BeGTE.h +45 -0
  24. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/BeGreaterThan.h +39 -0
  25. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/BeLTE.h +45 -0
  26. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/BeLessThan.h +39 -0
  27. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/BeNull.h +29 -0
  28. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/BeTruthy.h +35 -0
  29. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/Contain.h +58 -0
  30. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/Equal.h +90 -0
  31. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/MatchProxy.h +43 -0
  32. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/Matcher.h +74 -0
  33. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/MatcherException.h +16 -0
  34. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/ThrowException.h +60 -0
  35. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/ValueProxy.h +26 -0
  36. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/matchers.h +19 -0
  37. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/matchers/must.h +36 -0
  38. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/CMakeLists.txt +49 -0
  39. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/LICENSE_1_0.txt +23 -0
  40. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/README.md +419 -0
  41. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/cross_compile.sh +50 -0
  42. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/basic_assertions.cpp +228 -0
  43. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/boolean_operators.cpp +48 -0
  44. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/container_spec.cpp +85 -0
  45. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/custom_matchers_test.cpp +69 -0
  46. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/exceptions_tests.cpp +97 -0
  47. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/expression_error_handling.cpp +28 -0
  48. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/main.cpp +43 -0
  49. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/map_tests.cpp +38 -0
  50. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/operator_tests.cpp +137 -0
  51. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/sequence_container_tests.cpp +192 -0
  52. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/string_line_tests.cpp +179 -0
  53. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/string_tests.cpp +65 -0
  54. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/stringize_tests.cpp +111 -0
  55. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/example/tests.h +16 -0
  56. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/assert.h +126 -0
  57. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/assertionexception.h +58 -0
  58. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/assertmacro.h +22 -0
  59. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/constraints.h +23 -0
  60. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/containsconstraint.h +80 -0
  61. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/endswithconstraint.h +53 -0
  62. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/equalsconstraint.h +83 -0
  63. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/equalscontainerconstraint.h +80 -0
  64. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/equalswithdeltaconstraint.h +51 -0
  65. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/andexpression.h +46 -0
  66. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/expression.h +38 -0
  67. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/expression_fwd.h +15 -0
  68. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/notexpression.h +44 -0
  69. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/orexpression.h +46 -0
  70. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/fulfillsconstraint.h +51 -0
  71. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/haslengthconstraint.h +60 -0
  72. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/isgreaterthanconstraint.h +55 -0
  73. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/isgreaterthanorequaltoconstraint.h +55 -0
  74. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/islessthanconstraint.h +54 -0
  75. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/islessthanorequaltoconstraint.h +55 -0
  76. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/startswithconstraint.h +52 -0
  77. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/exceptions.h +120 -0
  78. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/constraintadapter.h +39 -0
  79. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/constraintlist.h +91 -0
  80. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/expressionbuilder.h +357 -0
  81. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/fluent.h +38 -0
  82. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/andoperator.h +54 -0
  83. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/collections/alloperator.h +35 -0
  84. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/collections/atleastoperator.h +41 -0
  85. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/collections/atmostoperator.h +39 -0
  86. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/collections/collectionconstraintevaluator.h +113 -0
  87. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/collections/collectionoperator.h +24 -0
  88. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/collections/exactlyoperator.h +39 -0
  89. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/collections/noneoperator.h +33 -0
  90. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/constraintoperator.h +70 -0
  91. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/invalidexpressionexception.h +28 -0
  92. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/notoperator.h +53 -0
  93. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/fluent/operators/oroperator.h +55 -0
  94. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/snowhouse.h +33 -0
  95. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/stringize.h +104 -0
  96. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/stringizers.h +60 -0
  97. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/bandit.h +44 -0
  98. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/context.h +97 -0
  99. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/external/optionparser.h +2825 -0
  100. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/failure_formatters/default_failure_formatter.h +30 -0
  101. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/failure_formatters/failure_formatter.h +13 -0
  102. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/failure_formatters/failure_formatters.h +16 -0
  103. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/failure_formatters/visual_studio_failure_formatter.h +36 -0
  104. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/grammar.h +185 -0
  105. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/listener.h +27 -0
  106. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/options.h +117 -0
  107. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/registration/registrar.h +25 -0
  108. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/registration/registration.h +7 -0
  109. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/registration/spec_registry.h +17 -0
  110. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/reporters/colorizer.h +141 -0
  111. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/reporters/dots_reporter.h +76 -0
  112. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/reporters/info_reporter.h +319 -0
  113. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/reporters/progress_reporter.h +116 -0
  114. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/reporters/reporters.h +53 -0
  115. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/reporters/single_line_reporter.h +86 -0
  116. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/reporters/spec_reporter.h +126 -0
  117. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/reporters/test_run_summary.h +90 -0
  118. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/reporters/xunit_reporter.h +109 -0
  119. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/run_policies/always_run_policy.h +16 -0
  120. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/run_policies/bandit_run_policy.h +168 -0
  121. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/run_policies/never_run_policy.h +14 -0
  122. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/run_policies/run_policies.h +9 -0
  123. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/run_policies/run_policy.h +66 -0
  124. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/runner.h +103 -0
  125. data/ext/tree-sitter/tree-sitter/externals/bandit/bandit/test_run_error.h +12 -0
  126. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/CMake/cotire.cmake +3695 -0
  127. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/CMakeLists.txt +11 -0
  128. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/HISTORY.md +281 -0
  129. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/MANUAL.md +780 -0
  130. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/OpenCV-2.3.1.patch +299 -0
  131. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/README.md +24 -0
  132. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/bullet-2.80-rev2531.patch +389 -0
  133. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/clang-3.0.src.patch +35 -0
  134. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/clang-3.1.src.patch +35 -0
  135. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/clang-3.3.src.patch +46 -0
  136. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/clang-3.4.src.patch +48 -0
  137. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/clang-3.5.src.patch +39 -0
  138. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/clapack-3.2.1-CMAKE.patch +93 -0
  139. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/cmake-2.8.7.patch +218 -0
  140. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/cminpack-1.1.4.patch +18 -0
  141. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/fsedit-qt5.patch +74 -0
  142. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/fseditor-1.0.patch +68 -0
  143. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/hdf5-1.8.8.patch +118 -0
  144. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/libpng-1.5.9.patch +38 -0
  145. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/llvm-3.0.src.patch +69 -0
  146. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/llvm-3.1.src.patch +69 -0
  147. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/llvm-3.3.src.patch +128 -0
  148. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/llvm-3.4.src.patch +100 -0
  149. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/llvm-3.5.src.patch +99 -0
  150. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/yaml-cpp.patch +37 -0
  151. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/Patches/zlib-1.2.6.patch +23 -0
  152. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/README.md +137 -0
  153. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/license +22 -0
  154. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/src/CMakeLists.txt +33 -0
  155. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/src/example.cpp +24 -0
  156. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/src/example.h +10 -0
  157. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/src/log.cpp +17 -0
  158. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/src/log.h +10 -0
  159. data/ext/tree-sitter/tree-sitter/externals/bandit/cmake/cotire/src/main.cpp +12 -0
  160. data/ext/tree-sitter/tree-sitter/externals/bandit/cross_compile.sh +43 -0
  161. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/before_each_after_each.spec.cpp +78 -0
  162. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/context.spec.cpp +44 -0
  163. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/describe.spec.cpp +117 -0
  164. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/failure_formatters/default_formatter.spec.cpp +21 -0
  165. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/failure_formatters/visual_studio_failure_formatter.spec.cpp +22 -0
  166. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/fakes/fake_context.h +69 -0
  167. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/fakes/fake_reporter.h +78 -0
  168. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/fakes/fakes.h +8 -0
  169. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/fakes/logging_fake.h +32 -0
  170. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/fuzzbox.spec.cpp +77 -0
  171. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/it.spec.cpp +355 -0
  172. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/main.cpp +6 -0
  173. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/be_close_to.cpp +112 -0
  174. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/be_empty.cpp +89 -0
  175. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/be_falsy.cpp +85 -0
  176. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/be_greater_than.cpp +105 -0
  177. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/be_gte.cpp +120 -0
  178. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/be_less_than.cpp +105 -0
  179. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/be_lte.cpp +119 -0
  180. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/be_null.cpp +43 -0
  181. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/be_truthy.cpp +85 -0
  182. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/contain.cpp +156 -0
  183. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/equal.cpp +218 -0
  184. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/matchers/throw_exception.cpp +105 -0
  185. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/options.spec.cpp +134 -0
  186. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/reporters/colorizer.spec.cpp +45 -0
  187. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/reporters/dots_reporter.spec.cpp +206 -0
  188. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/reporters/info_reporter.spec.cpp +377 -0
  189. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/reporters/single_line_reporter.spec.cpp +201 -0
  190. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/reporters/xunit_reporter.spec.cpp +161 -0
  191. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/run.spec.cpp +77 -0
  192. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/run_policies/bandit_run_policy.spec.cpp +247 -0
  193. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/specs.h +10 -0
  194. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/synopsis.spec.cpp +54 -0
  195. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/util/argv_helper.h +62 -0
  196. data/ext/tree-sitter/tree-sitter/externals/bandit/specs/util/util.h +6 -0
  197. data/ext/tree-sitter/tree-sitter/externals/gyp/AUTHORS +11 -0
  198. data/ext/tree-sitter/tree-sitter/externals/gyp/DEPS +24 -0
  199. data/ext/tree-sitter/tree-sitter/externals/gyp/LICENSE +27 -0
  200. data/ext/tree-sitter/tree-sitter/externals/gyp/OWNERS +1 -0
  201. data/ext/tree-sitter/tree-sitter/externals/gyp/PRESUBMIT.py +120 -0
  202. data/ext/tree-sitter/tree-sitter/externals/gyp/buildbot/buildbot_run.py +190 -0
  203. data/ext/tree-sitter/tree-sitter/externals/gyp/codereview.settings +10 -0
  204. data/ext/tree-sitter/tree-sitter/externals/gyp/data/win/large-pdb-shim.cc +12 -0
  205. data/ext/tree-sitter/tree-sitter/externals/gyp/gyp +8 -0
  206. data/ext/tree-sitter/tree-sitter/externals/gyp/gyp.bat +5 -0
  207. data/ext/tree-sitter/tree-sitter/externals/gyp/gyp_main.py +18 -0
  208. data/ext/tree-sitter/tree-sitter/externals/gyp/gyptest.py +274 -0
  209. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSNew.py +340 -0
  210. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSProject.py +208 -0
  211. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSSettings.py +1076 -0
  212. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSSettings_test.py +1483 -0
  213. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSToolFile.py +58 -0
  214. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSUserFile.py +147 -0
  215. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSUtil.py +267 -0
  216. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/MSVSVersion.py +409 -0
  217. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/__init__.py +537 -0
  218. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/__init__.pyc +0 -0
  219. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/common.py +521 -0
  220. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/common.pyc +0 -0
  221. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/common_test.py +72 -0
  222. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/easy_xml.py +157 -0
  223. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/easy_xml_test.py +103 -0
  224. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/flock_tool.py +49 -0
  225. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/__init__.py +0 -0
  226. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/__init__.pyc +0 -0
  227. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/android.py +1072 -0
  228. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/cmake.py +1143 -0
  229. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/dump_dependency_json.py +81 -0
  230. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/eclipse.py +335 -0
  231. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/gypd.py +87 -0
  232. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/gypsh.py +56 -0
  233. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/make.py +2181 -0
  234. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/make.pyc +0 -0
  235. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/msvs.py +3342 -0
  236. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/msvs_test.py +37 -0
  237. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/ninja.py +2160 -0
  238. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/ninja_test.py +44 -0
  239. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/xcode.py +1224 -0
  240. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/xcode.pyc +0 -0
  241. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/generator/xcode_test.py +23 -0
  242. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/input.py +2809 -0
  243. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/input.pyc +0 -0
  244. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/input_test.py +90 -0
  245. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/mac_tool.py +510 -0
  246. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/msvs_emulation.py +972 -0
  247. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/ninja_syntax.py +160 -0
  248. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/ordered_dict.py +289 -0
  249. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/win_tool.py +292 -0
  250. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcode_emulation.py +1499 -0
  251. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
  252. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcodeproj_file.py +2889 -0
  253. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
  254. data/ext/tree-sitter/tree-sitter/externals/gyp/pylib/gyp/xml_fix.py +69 -0
  255. data/ext/tree-sitter/tree-sitter/externals/gyp/pylintrc +307 -0
  256. data/ext/tree-sitter/tree-sitter/externals/gyp/samples/samples +81 -0
  257. data/ext/tree-sitter/tree-sitter/externals/gyp/samples/samples.bat +5 -0
  258. data/ext/tree-sitter/tree-sitter/externals/gyp/setup.py +19 -0
  259. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-bare/gyptest-bare.py +23 -0
  260. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-bare/src/bare.gyp +25 -0
  261. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-bare/src/bare.py +11 -0
  262. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-multiple/gyptest-all.py +72 -0
  263. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-multiple/src/actions.gyp +226 -0
  264. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-multiple/src/copy.py +9 -0
  265. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-multiple/src/filter.py +12 -0
  266. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-multiple/src/foo.c +11 -0
  267. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-multiple/src/input.txt +1 -0
  268. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-multiple/src/main.c +22 -0
  269. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-none/gyptest-none.py +23 -0
  270. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-none/src/fake_cross.py +12 -0
  271. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-none/src/foo.cc +1 -0
  272. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-none/src/none_with_source_files.gyp +35 -0
  273. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-subdir/gyptest-action.py +26 -0
  274. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-subdir/src/make-file.py +11 -0
  275. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-subdir/src/none.gyp +31 -0
  276. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-subdir/src/subdir/make-subdir-file.py +11 -0
  277. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions-subdir/src/subdir/subdir.gyp +28 -0
  278. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/generated-header/action.py +11 -0
  279. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/generated-header/main.cc +7 -0
  280. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/generated-header/test.gyp +34 -0
  281. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/gyptest-all.py +102 -0
  282. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/gyptest-default.py +69 -0
  283. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/gyptest-errors.py +24 -0
  284. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/gyptest-generated-header.py +38 -0
  285. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/action_missing_name.gyp +24 -0
  286. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/actions.gyp +114 -0
  287. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/confirm-dep-files.py +21 -0
  288. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir1/counter.py +44 -0
  289. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir1/executable.gyp +74 -0
  290. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir1/make-prog1.py +20 -0
  291. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir1/make-prog2.py +20 -0
  292. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir1/program.c +12 -0
  293. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir2/make-file.py +11 -0
  294. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir2/none.gyp +33 -0
  295. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir3/generate_main.py +21 -0
  296. data/ext/tree-sitter/tree-sitter/externals/gyp/test/actions/src/subdir3/null_input.gyp +29 -0
  297. data/ext/tree-sitter/tree-sitter/externals/gyp/test/additional-targets/gyptest-additional.py +56 -0
  298. data/ext/tree-sitter/tree-sitter/externals/gyp/test/additional-targets/src/all.gyp +13 -0
  299. data/ext/tree-sitter/tree-sitter/externals/gyp/test/additional-targets/src/dir1/actions.gyp +56 -0
  300. data/ext/tree-sitter/tree-sitter/externals/gyp/test/additional-targets/src/dir1/emit.py +11 -0
  301. data/ext/tree-sitter/tree-sitter/externals/gyp/test/additional-targets/src/dir1/lib1.c +6 -0
  302. data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/gyptest-assembly.py +31 -0
  303. data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/gyptest-override.py +24 -0
  304. data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/src/as.bat +4 -0
  305. data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/src/assembly.gyp +62 -0
  306. data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/src/lib1.S +15 -0
  307. data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/src/lib1.c +3 -0
  308. data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/src/override.gyp +34 -0
  309. data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/src/override_asm.asm +8 -0
  310. data/ext/tree-sitter/tree-sitter/externals/gyp/test/assembly/src/program.c +12 -0
  311. data/ext/tree-sitter/tree-sitter/externals/gyp/test/build-option/gyptest-build.py +22 -0
  312. data/ext/tree-sitter/tree-sitter/externals/gyp/test/build-option/hello.c +13 -0
  313. data/ext/tree-sitter/tree-sitter/externals/gyp/test/build-option/hello.gyp +15 -0
  314. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/gyptest-all.py +85 -0
  315. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/gyptest-default.py +85 -0
  316. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/builddir.gypi +18 -0
  317. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/func1.c +6 -0
  318. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/func2.c +6 -0
  319. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/func3.c +6 -0
  320. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/func4.c +6 -0
  321. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/func5.c +6 -0
  322. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/prog1.c +10 -0
  323. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/prog1.gyp +30 -0
  324. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/prog2.c +10 -0
  325. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/prog2.gyp +19 -0
  326. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/prog3.c +10 -0
  327. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp +19 -0
  328. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c +10 -0
  329. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp +19 -0
  330. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c +10 -0
  331. data/ext/tree-sitter/tree-sitter/externals/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp +19 -0
  332. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cflags/cflags.c +15 -0
  333. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cflags/cflags.gyp +23 -0
  334. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cflags/gyptest-cflags.py +104 -0
  335. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compilable/gyptest-headers.py +29 -0
  336. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compilable/src/headers.gyp +26 -0
  337. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compilable/src/lib1.cpp +7 -0
  338. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compilable/src/lib1.hpp +6 -0
  339. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compilable/src/program.cpp +9 -0
  340. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/compiler-global-settings.gyp.in +34 -0
  341. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/compiler-host.gyp +17 -0
  342. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/compiler.gyp +16 -0
  343. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/cxxtest.cc +7 -0
  344. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/gyptest-compiler-env.py +112 -0
  345. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/gyptest-compiler-global-settings.py +73 -0
  346. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/my_cc.py +6 -0
  347. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/my_cxx.py +6 -0
  348. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/my_ld.py +6 -0
  349. data/ext/tree-sitter/tree-sitter/externals/gyp/test/compiler-override/test.c +7 -0
  350. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/basics/configurations.c +15 -0
  351. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/basics/configurations.gyp +32 -0
  352. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/basics/gyptest-configurations.py +29 -0
  353. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/configurations.c +21 -0
  354. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/configurations.gyp +40 -0
  355. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/inheritance/gyptest-inheritance.py +33 -0
  356. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/actions.gyp +18 -0
  357. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/all_dependent_settings.gyp +18 -0
  358. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/configurations.gyp +18 -0
  359. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/dependencies.gyp +18 -0
  360. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/direct_dependent_settings.gyp +18 -0
  361. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/gyptest-configurations.py +36 -0
  362. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/libraries.gyp +18 -0
  363. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/link_settings.gyp +18 -0
  364. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/sources.gyp +18 -0
  365. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/standalone_static_library.gyp +17 -0
  366. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/target_name.gyp +18 -0
  367. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/invalid/type.gyp +18 -0
  368. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/target_platform/configurations.gyp +58 -0
  369. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/target_platform/front.c +8 -0
  370. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/target_platform/gyptest-target_platform.py +40 -0
  371. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/target_platform/left.c +3 -0
  372. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/target_platform/right.c +3 -0
  373. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/x64/configurations.c +12 -0
  374. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/x64/configurations.gyp +38 -0
  375. data/ext/tree-sitter/tree-sitter/externals/gyp/test/configurations/x64/gyptest-x86.py +31 -0
  376. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-all.py +40 -0
  377. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-attribs.py +41 -0
  378. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-default.py +40 -0
  379. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-samedir.py +28 -0
  380. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-slash.py +38 -0
  381. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/gyptest-updir.py +24 -0
  382. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/copies-attribs.gyp +20 -0
  383. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/copies-samedir.gyp +37 -0
  384. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/copies-slash.gyp +36 -0
  385. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/copies-updir.gyp +21 -0
  386. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/copies.gyp +70 -0
  387. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/directory/file3 +1 -0
  388. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/directory/file4 +1 -0
  389. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/directory/subdir/file5 +1 -0
  390. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/executable-file.sh +3 -0
  391. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/file1 +1 -0
  392. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/file2 +1 -0
  393. data/ext/tree-sitter/tree-sitter/externals/gyp/test/copies/src/parentdir/subdir/file6 +1 -0
  394. data/ext/tree-sitter/tree-sitter/externals/gyp/test/custom-generator/gyptest-custom-generator.py +18 -0
  395. data/ext/tree-sitter/tree-sitter/externals/gyp/test/custom-generator/mygenerator.py +14 -0
  396. data/ext/tree-sitter/tree-sitter/externals/gyp/test/custom-generator/test.gyp +15 -0
  397. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cxxflags/cxxflags.cc +15 -0
  398. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cxxflags/cxxflags.gyp +16 -0
  399. data/ext/tree-sitter/tree-sitter/externals/gyp/test/cxxflags/gyptest-cxxflags.py +65 -0
  400. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines-escaping/defines-escaping.c +11 -0
  401. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines-escaping/defines-escaping.gyp +19 -0
  402. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines-escaping/gyptest-defines-escaping.py +184 -0
  403. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines/defines-env.gyp +22 -0
  404. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines/defines.c +23 -0
  405. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines/defines.gyp +38 -0
  406. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines/gyptest-define-override.py +43 -0
  407. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines/gyptest-defines-env-regyp.py +51 -0
  408. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines/gyptest-defines-env.py +85 -0
  409. data/ext/tree-sitter/tree-sitter/externals/gyp/test/defines/gyptest-defines.py +39 -0
  410. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/a.c +9 -0
  411. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/b/b.c +3 -0
  412. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/b/b.gyp +22 -0
  413. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/b/b3.c +9 -0
  414. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/c/c.c +4 -0
  415. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/c/c.gyp +22 -0
  416. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/c/d.c +3 -0
  417. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/double_dependency.gyp +23 -0
  418. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/double_dependent.gyp +12 -0
  419. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/extra_targets.gyp +18 -0
  420. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/gyptest-double-dependency.py +19 -0
  421. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/gyptest-extra-targets.py +21 -0
  422. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/gyptest-lib-only.py +39 -0
  423. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/gyptest-none-traversal.py +25 -0
  424. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/gyptest-sharedlib-linksettings.py +21 -0
  425. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/lib_only.gyp +16 -0
  426. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/main.c +14 -0
  427. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/none_traversal.gyp +46 -0
  428. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/sharedlib-linksettings/program.c +25 -0
  429. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/sharedlib-linksettings/sharedlib.c +16 -0
  430. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/sharedlib-linksettings/staticlib.c +24 -0
  431. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependencies/sharedlib-linksettings/test.gyp +37 -0
  432. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependency-copy/gyptest-copy.py +26 -0
  433. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependency-copy/src/copies.gyp +25 -0
  434. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependency-copy/src/file1.c +7 -0
  435. data/ext/tree-sitter/tree-sitter/externals/gyp/test/dependency-copy/src/file2.c +7 -0
  436. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/duplicate_basenames.gyp +13 -0
  437. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/duplicate_node.gyp +12 -0
  438. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/duplicate_rule.gyp +22 -0
  439. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/duplicate_targets.gyp +14 -0
  440. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/gyptest-errors.py +47 -0
  441. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/missing_dep.gyp +15 -0
  442. data/ext/tree-sitter/tree-sitter/externals/gyp/test/errors/missing_targets.gyp +8 -0
  443. data/ext/tree-sitter/tree-sitter/externals/gyp/test/escaping/colon/test.gyp +21 -0
  444. data/ext/tree-sitter/tree-sitter/externals/gyp/test/escaping/gyptest-colon.py +43 -0
  445. data/ext/tree-sitter/tree-sitter/externals/gyp/test/exclusion/exclusion.gyp +23 -0
  446. data/ext/tree-sitter/tree-sitter/externals/gyp/test/exclusion/gyptest-exclusion.py +22 -0
  447. data/ext/tree-sitter/tree-sitter/externals/gyp/test/exclusion/hello.c +15 -0
  448. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/gyptest-cross.py +31 -0
  449. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/bogus1.cc +1 -0
  450. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/bogus2.c +1 -0
  451. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/cross.gyp +83 -0
  452. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/cross_compile.gypi +23 -0
  453. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/fake_cross.py +18 -0
  454. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/program.cc +16 -0
  455. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/test1.cc +1 -0
  456. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/test2.c +1 -0
  457. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/test3.cc +1 -0
  458. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/test4.c +1 -0
  459. data/ext/tree-sitter/tree-sitter/externals/gyp/test/external-cross-compile/src/tochar.py +13 -0
  460. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/actions.gyp +16 -0
  461. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/build/README.txt +4 -0
  462. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir1/actions-out/README.txt +4 -0
  463. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir1/build/README.txt +4 -0
  464. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir1/executable.gyp +44 -0
  465. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir1/make-prog1.py +20 -0
  466. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir1/make-prog2.py +20 -0
  467. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir1/program.c +12 -0
  468. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir2/actions-out/README.txt +4 -0
  469. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir2/build/README.txt +4 -0
  470. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir2/make-file.py +11 -0
  471. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/actions/subdir2/none.gyp +31 -0
  472. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/copies/build/README.txt +4 -0
  473. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/copies/copies-out/README.txt +4 -0
  474. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/copies/copies.gyp +50 -0
  475. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/copies/file1 +1 -0
  476. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/copies/file2 +1 -0
  477. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/copies/subdir/build/README.txt +4 -0
  478. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/copies/subdir/copies-out/README.txt +4 -0
  479. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/copies/subdir/file3 +1 -0
  480. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/copies/subdir/file4 +1 -0
  481. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/copies/subdir/subdir.gyp +32 -0
  482. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-actions.py +58 -0
  483. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-copies.py +59 -0
  484. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-depth.py +58 -0
  485. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-mac-bundle.py +28 -0
  486. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-relocate.py +60 -0
  487. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-rules.py +59 -0
  488. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-subdir2-deep.py +37 -0
  489. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-symlink.py +43 -0
  490. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/gyptest-top-all.py +54 -0
  491. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/mac-bundle/Info.plist +32 -0
  492. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/mac-bundle/app.order +1 -0
  493. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/mac-bundle/header.h +1 -0
  494. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/mac-bundle/main.c +1 -0
  495. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/mac-bundle/resource.sb +1 -0
  496. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/mac-bundle/test.gyp +25 -0
  497. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/build/README.txt +4 -0
  498. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/copy-file.py +12 -0
  499. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/rules.gyp +16 -0
  500. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir1/build/README.txt +4 -0
  501. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir1/define3.in0 +1 -0
  502. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir1/define4.in0 +1 -0
  503. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir1/executable.gyp +59 -0
  504. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir1/function1.in1 +6 -0
  505. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir1/function2.in1 +6 -0
  506. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir1/program.c +18 -0
  507. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir2/build/README.txt +4 -0
  508. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir2/file1.in0 +1 -0
  509. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir2/file2.in0 +1 -0
  510. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir2/file3.in1 +1 -0
  511. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir2/file4.in1 +1 -0
  512. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir2/none.gyp +49 -0
  513. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/rules/subdir2/rules-out/README.txt +4 -0
  514. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/build/README.txt +4 -0
  515. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/inc.h +1 -0
  516. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/inc1/include1.h +1 -0
  517. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/prog1.c +18 -0
  518. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/prog1.gyp +28 -0
  519. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/build/README.txt +4 -0
  520. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/deeper/build/README.txt +4 -0
  521. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/deeper/deeper.c +7 -0
  522. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp +18 -0
  523. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/deeper/deeper.h +1 -0
  524. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/inc2/include2.h +1 -0
  525. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/prog2.c +18 -0
  526. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir2/prog2.gyp +28 -0
  527. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir3/build/README.txt +4 -0
  528. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir3/inc3/include3.h +1 -0
  529. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir3/prog3.c +18 -0
  530. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/subdir3/prog3.gyp +25 -0
  531. data/ext/tree-sitter/tree-sitter/externals/gyp/test/generator-output/src/symroot.gypi +16 -0
  532. data/ext/tree-sitter/tree-sitter/externals/gyp/test/gyp-defines/defines.gyp +26 -0
  533. data/ext/tree-sitter/tree-sitter/externals/gyp/test/gyp-defines/echo.py +11 -0
  534. data/ext/tree-sitter/tree-sitter/externals/gyp/test/gyp-defines/gyptest-multiple-values.py +40 -0
  535. data/ext/tree-sitter/tree-sitter/externals/gyp/test/gyp-defines/gyptest-regyp.py +40 -0
  536. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py +37 -0
  537. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py +36 -0
  538. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/src/a.c +9 -0
  539. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/src/a.h +12 -0
  540. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/src/b.c +9 -0
  541. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/src/b.h +12 -0
  542. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/src/c.c +10 -0
  543. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/src/c.h +10 -0
  544. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/src/d.c +9 -0
  545. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/src/emit.py +11 -0
  546. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hard_dependency/src/hard_dependency.gyp +78 -0
  547. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/gyptest-all.py +24 -0
  548. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/gyptest-default.py +24 -0
  549. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/gyptest-disable-regyp.py +32 -0
  550. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/gyptest-regyp-output.py +36 -0
  551. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/gyptest-regyp.py +32 -0
  552. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/gyptest-target.py +24 -0
  553. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/hello.c +11 -0
  554. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/hello.gyp +15 -0
  555. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/hello2.c +11 -0
  556. data/ext/tree-sitter/tree-sitter/externals/gyp/test/hello/hello2.gyp +15 -0
  557. data/ext/tree-sitter/tree-sitter/externals/gyp/test/home_dot_gyp/gyptest-home-includes-config-arg.py +31 -0
  558. data/ext/tree-sitter/tree-sitter/externals/gyp/test/home_dot_gyp/gyptest-home-includes-config-env.py +33 -0
  559. data/ext/tree-sitter/tree-sitter/externals/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py +44 -0
  560. data/ext/tree-sitter/tree-sitter/externals/gyp/test/home_dot_gyp/gyptest-home-includes.py +30 -0
  561. data/ext/tree-sitter/tree-sitter/externals/gyp/test/home_dot_gyp/src/all.gyp +22 -0
  562. data/ext/tree-sitter/tree-sitter/externals/gyp/test/home_dot_gyp/src/printfoo.c +7 -0
  563. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/gyptest-all.py +43 -0
  564. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/gyptest-default.py +43 -0
  565. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/inc.h +1 -0
  566. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/inc1/include1.h +1 -0
  567. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/includes.c +19 -0
  568. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/includes.gyp +27 -0
  569. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/shadow1/shadow.h +1 -0
  570. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/shadow2/shadow.h +1 -0
  571. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/subdir/inc.h +1 -0
  572. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/subdir/inc2/include2.h +1 -0
  573. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/subdir/subdir_includes.c +14 -0
  574. data/ext/tree-sitter/tree-sitter/externals/gyp/test/include_dirs/src/subdir/subdir_includes.gyp +20 -0
  575. data/ext/tree-sitter/tree-sitter/externals/gyp/test/intermediate_dir/gyptest-intermediate-dir.py +42 -0
  576. data/ext/tree-sitter/tree-sitter/externals/gyp/test/intermediate_dir/src/script.py +24 -0
  577. data/ext/tree-sitter/tree-sitter/externals/gyp/test/intermediate_dir/src/shared_infile.txt +1 -0
  578. data/ext/tree-sitter/tree-sitter/externals/gyp/test/intermediate_dir/src/test.gyp +42 -0
  579. data/ext/tree-sitter/tree-sitter/externals/gyp/test/intermediate_dir/src/test2.gyp +42 -0
  580. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/English.lproj/InfoPlist-error.strings +3 -0
  581. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/English.lproj/InfoPlist.strings +3 -0
  582. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/English.lproj/MainMenu.xib +4119 -0
  583. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/English.lproj/Main_iPhone.storyboard +27 -0
  584. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/TestApp-Info.plist +32 -0
  585. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/check_no_signature.py +13 -0
  586. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/main.m +13 -0
  587. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/only-compile-in-32-bits.m +7 -0
  588. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/TestApp/only-compile-in-64-bits.m +7 -0
  589. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/test-archs.gyp +110 -0
  590. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/test-device.gyp +79 -0
  591. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/app-bundle/test.gyp +45 -0
  592. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/deployment-target/check-version-min.c +33 -0
  593. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/deployment-target/deployment-target.gyp +58 -0
  594. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-app-ios.py +46 -0
  595. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-archs.py +106 -0
  596. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-deployment-target.py +23 -0
  597. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ios/gyptest-per-config-settings.py +147 -0
  598. data/ext/tree-sitter/tree-sitter/externals/gyp/test/lib/README.txt +17 -0
  599. data/ext/tree-sitter/tree-sitter/externals/gyp/test/lib/TestCmd.py +1597 -0
  600. data/ext/tree-sitter/tree-sitter/externals/gyp/test/lib/TestCommon.py +570 -0
  601. data/ext/tree-sitter/tree-sitter/externals/gyp/test/lib/TestGyp.py +1117 -0
  602. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/gyptest-shared-obj-install-path.py +42 -0
  603. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/gyptest-shared.py +84 -0
  604. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/gyptest-static.py +84 -0
  605. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/src/lib1.c +10 -0
  606. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/src/lib1_moveable.c +10 -0
  607. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/src/lib2.c +10 -0
  608. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/src/lib2_moveable.c +10 -0
  609. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/src/library.gyp +58 -0
  610. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/src/program.c +15 -0
  611. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library/src/shared_dependency.gyp +33 -0
  612. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library_dirs/gyptest-library-dirs.py +50 -0
  613. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library_dirs/subdir/README.txt +1 -0
  614. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library_dirs/subdir/hello.cc +11 -0
  615. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library_dirs/subdir/mylib.cc +9 -0
  616. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library_dirs/subdir/mylib.h +12 -0
  617. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library_dirs/subdir/test-win.gyp +60 -0
  618. data/ext/tree-sitter/tree-sitter/externals/gyp/test/library_dirs/subdir/test.gyp +68 -0
  619. data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-objects/base.c +6 -0
  620. data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-objects/extra.c +5 -0
  621. data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-objects/gyptest-all.py +28 -0
  622. data/ext/tree-sitter/tree-sitter/externals/gyp/test/link-objects/link-objects.gyp +24 -0
  623. data/ext/tree-sitter/tree-sitter/externals/gyp/test/linux/gyptest-implicit-rpath.py +48 -0
  624. data/ext/tree-sitter/tree-sitter/externals/gyp/test/linux/implicit-rpath/file.c +1 -0
  625. data/ext/tree-sitter/tree-sitter/externals/gyp/test/linux/implicit-rpath/main.c +1 -0
  626. data/ext/tree-sitter/tree-sitter/externals/gyp/test/linux/implicit-rpath/test.gyp +47 -0
  627. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/action-envvars/action/action.gyp +34 -0
  628. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/action-envvars/action/action.sh +8 -0
  629. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist-error.strings +3 -0
  630. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist.strings +3 -0
  631. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/English.lproj/MainMenu.xib +4119 -0
  632. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/English.lproj/utf-16be.strings +0 -0
  633. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/English.lproj/utf-16le.strings +0 -0
  634. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/TestApp-Info.plist +34 -0
  635. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.h +13 -0
  636. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.m +15 -0
  637. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/TestApp/main.m +10 -0
  638. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/empty.c +0 -0
  639. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/test-error.gyp +31 -0
  640. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/app-bundle/test.gyp +41 -0
  641. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/empty_main.cc +1 -0
  642. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/file.mm +1 -0
  643. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/header.h +1 -0
  644. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/my_file.cc +4 -0
  645. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/my_main_file.cc +9 -0
  646. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/test-archs-multiarch.gyp +72 -0
  647. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/test-archs-x86_64.gyp +27 -0
  648. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/archs/test-no-archs.gyp +21 -0
  649. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/bundle-resources/change.sh +3 -0
  650. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/bundle-resources/executable-file.sh +3 -0
  651. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/bundle-resources/secret.txt +1 -0
  652. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/bundle-resources/test.gyp +59 -0
  653. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/ccfile.cc +7 -0
  654. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/ccfile_withcflags.cc +7 -0
  655. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/cfile.c +7 -0
  656. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/cppfile.cpp +7 -0
  657. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/cppfile_withcflags.cpp +7 -0
  658. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/cxxfile.cxx +7 -0
  659. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/cxxfile_withcflags.cxx +7 -0
  660. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/mfile.m +7 -0
  661. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/mmfile.mm +7 -0
  662. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/mmfile_withcflags.mm +7 -0
  663. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/cflags/test.gyp +132 -0
  664. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/clang-cxx-language-standard/c++11.cc +8 -0
  665. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/clang-cxx-language-standard/c++98.cc +24 -0
  666. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/clang-cxx-language-standard/clang-cxx-language-standard.gyp +30 -0
  667. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/clang-cxx-library/clang-cxx-library.gyp +32 -0
  668. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/clang-cxx-library/libc++.cc +11 -0
  669. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/clang-cxx-library/libstdc++.cc +11 -0
  670. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/copy-dylib/empty.c +1 -0
  671. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/copy-dylib/test.gyp +31 -0
  672. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/debuginfo/file.c +6 -0
  673. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/debuginfo/test.gyp +82 -0
  674. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/depend-on-bundle/English.lproj/InfoPlist.strings +1 -0
  675. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/depend-on-bundle/Info.plist +28 -0
  676. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/depend-on-bundle/bundle.c +1 -0
  677. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/depend-on-bundle/executable.c +4 -0
  678. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/depend-on-bundle/test.gyp +28 -0
  679. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/deployment-target/check-version-min.c +33 -0
  680. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/deployment-target/deployment-target.gyp +28 -0
  681. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework-dirs/calculate.c +15 -0
  682. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework-dirs/framework-dirs.gyp +21 -0
  683. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework-headers/myframework.h +8 -0
  684. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework-headers/myframework.m +8 -0
  685. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework-headers/test.gyp +44 -0
  686. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings +2 -0
  687. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework/TestFramework/Info.plist +28 -0
  688. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework/TestFramework/ObjCVector.h +28 -0
  689. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework/TestFramework/ObjCVector.mm +63 -0
  690. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h +9 -0
  691. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch +7 -0
  692. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework/empty.c +0 -0
  693. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/framework/framework.gyp +71 -0
  694. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/global-settings/src/dir1/dir1.gyp +11 -0
  695. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/global-settings/src/dir2/dir2.gyp +22 -0
  696. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/global-settings/src/dir2/file.txt +1 -0
  697. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-action-envvars.py +30 -0
  698. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-app-error.py +43 -0
  699. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-app.py +119 -0
  700. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-archs.py +89 -0
  701. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-bundle-resources.py +58 -0
  702. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-cflags.py +20 -0
  703. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-clang-cxx-language-standard.py +25 -0
  704. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-clang-cxx-library.py +29 -0
  705. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-copies.py +49 -0
  706. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-copy-dylib.py +25 -0
  707. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-debuginfo.py +36 -0
  708. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-depend-on-bundle.py +40 -0
  709. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-deployment-target.py +23 -0
  710. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-framework-dirs.py +23 -0
  711. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-framework-headers.py +38 -0
  712. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-framework.py +74 -0
  713. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-global-settings.py +26 -0
  714. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-infoplist-process.py +51 -0
  715. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-installname.py +79 -0
  716. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-ldflags-passed-to-libtool.py +31 -0
  717. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-ldflags.py +68 -0
  718. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-libraries.py +22 -0
  719. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-loadable-module.py +48 -0
  720. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-missing-cfbundlesignature.py +29 -0
  721. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-non-strs-flattened-to-env.py +33 -0
  722. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-objc-arc.py +26 -0
  723. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-objc-gc.py +45 -0
  724. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-postbuild-copy-bundle.py +75 -0
  725. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-postbuild-defaults.py +29 -0
  726. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-postbuild-fail.py +67 -0
  727. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-postbuild-multiple-configurations.py +26 -0
  728. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-postbuild-static-library.py +28 -0
  729. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-postbuild.py +53 -0
  730. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-prefixheader.py +19 -0
  731. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-rebuild.py +41 -0
  732. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-rpath.py +49 -0
  733. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-sdkroot.py +50 -0
  734. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-sourceless-module.py +72 -0
  735. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-strip-default.py +95 -0
  736. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-strip.py +53 -0
  737. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-type-envvars.py +24 -0
  738. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-unicode-settings.py +20 -0
  739. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-xcode-env-order.py +94 -0
  740. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-xcode-gcc-clang.py +40 -0
  741. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-xcode-gcc.py +56 -0
  742. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/gyptest-xctest.py +38 -0
  743. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/infoplist-process/Info.plist +36 -0
  744. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/infoplist-process/main.c +7 -0
  745. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/infoplist-process/test1.gyp +25 -0
  746. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/infoplist-process/test2.gyp +25 -0
  747. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/infoplist-process/test3.gyp +25 -0
  748. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/installname/Info.plist +28 -0
  749. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/installname/file.c +1 -0
  750. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/installname/main.c +1 -0
  751. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/installname/test.gyp +93 -0
  752. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/ldflags-libtool/file.c +1 -0
  753. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/ldflags-libtool/test.gyp +17 -0
  754. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/ldflags/subdirectory/Info.plist +8 -0
  755. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/ldflags/subdirectory/file.c +2 -0
  756. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/ldflags/subdirectory/symbol_list.def +1 -0
  757. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/ldflags/subdirectory/test.gyp +66 -0
  758. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/libraries/subdir/README.txt +1 -0
  759. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/libraries/subdir/hello.cc +10 -0
  760. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/libraries/subdir/mylib.c +7 -0
  761. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/libraries/subdir/test.gyp +65 -0
  762. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/loadable-module/Info.plist +26 -0
  763. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/loadable-module/module.c +11 -0
  764. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/loadable-module/test.gyp +18 -0
  765. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/missing-cfbundlesignature/Info.plist +10 -0
  766. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/missing-cfbundlesignature/Other-Info.plist +12 -0
  767. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/missing-cfbundlesignature/Third-Info.plist +12 -0
  768. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/missing-cfbundlesignature/file.c +1 -0
  769. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/missing-cfbundlesignature/test.gyp +34 -0
  770. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/non-strs-flattened-to-env/Info.plist +15 -0
  771. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/non-strs-flattened-to-env/main.c +7 -0
  772. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/non-strs-flattened-to-env/test.gyp +27 -0
  773. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-arc/c-file.c +6 -0
  774. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-arc/cc-file.cc +5 -0
  775. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-arc/m-file-no-arc.m +5 -0
  776. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-arc/m-file.m +5 -0
  777. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-arc/mm-file-no-arc.mm +5 -0
  778. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-arc/mm-file.mm +5 -0
  779. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-arc/test.gyp +45 -0
  780. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-gc/c-file.c +1 -0
  781. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-gc/cc-file.cc +1 -0
  782. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-gc/main.m +6 -0
  783. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-gc/needs-gc-mm.mm +1 -0
  784. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-gc/needs-gc.m +1 -0
  785. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/objc-gc/test.gyp +102 -0
  786. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-copy-bundle/Framework-Info.plist +30 -0
  787. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-copy-bundle/TestApp-Info.plist +32 -0
  788. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-copy-bundle/copied.txt +1 -0
  789. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-copy-bundle/empty.c +0 -0
  790. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-copy-bundle/main.c +4 -0
  791. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-copy-bundle/postbuild-copy-framework.sh +9 -0
  792. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-copy-bundle/resource_file.sb +1 -0
  793. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-copy-bundle/test.gyp +49 -0
  794. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-defaults/Info.plist +13 -0
  795. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-defaults/main.c +7 -0
  796. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-defaults/postbuild-defaults.sh +15 -0
  797. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-defaults/test.gyp +26 -0
  798. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-fail/file.c +6 -0
  799. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-fail/postbuild-fail.sh +6 -0
  800. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-fail/test.gyp +38 -0
  801. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-fail/touch-dynamic.sh +7 -0
  802. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-fail/touch-static.sh +7 -0
  803. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-multiple-configurations/main.c +4 -0
  804. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-multiple-configurations/postbuild-touch-file.sh +7 -0
  805. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-multiple-configurations/test.gyp +26 -0
  806. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-static-library/empty.c +4 -0
  807. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-static-library/postbuild-touch-file.sh +7 -0
  808. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuild-static-library/test.gyp +34 -0
  809. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuilds/copy.sh +3 -0
  810. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuilds/file.c +4 -0
  811. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuilds/file_g.c +4 -0
  812. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuilds/file_h.c +4 -0
  813. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuilds/script/shared_library_postbuild.sh +23 -0
  814. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuilds/script/static_library_postbuild.sh +23 -0
  815. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuilds/subdirectory/copied_file.txt +1 -0
  816. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuilds/subdirectory/nested_target.gyp +53 -0
  817. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/postbuilds/test.gyp +93 -0
  818. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/prefixheader/file.c +1 -0
  819. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/prefixheader/file.cc +1 -0
  820. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/prefixheader/file.m +1 -0
  821. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/prefixheader/file.mm +1 -0
  822. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/prefixheader/header.h +1 -0
  823. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/prefixheader/test.gyp +82 -0
  824. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/rebuild/TestApp-Info.plist +32 -0
  825. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/rebuild/delay-touch.sh +6 -0
  826. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/rebuild/empty.c +0 -0
  827. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/rebuild/main.c +1 -0
  828. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/rebuild/test.gyp +56 -0
  829. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/rpath/file.c +1 -0
  830. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/rpath/main.c +1 -0
  831. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/rpath/test.gyp +48 -0
  832. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/sdkroot/file.cc +5 -0
  833. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/sdkroot/test.gyp +35 -0
  834. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/sdkroot/test_shorthand.sh +20 -0
  835. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/sourceless-module/empty.c +1 -0
  836. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/sourceless-module/empty.txt +2 -0
  837. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/sourceless-module/fun.c +1 -0
  838. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/sourceless-module/test.gyp +96 -0
  839. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/strip/file.c +22 -0
  840. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/strip/main.c +25 -0
  841. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/strip/strip.saves +5 -0
  842. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/strip/subdirectory/nested_file.c +1 -0
  843. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/strip/subdirectory/nested_strip.saves +5 -0
  844. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/strip/subdirectory/subdirectory.gyp +38 -0
  845. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/strip/subdirectory/test_reading_save_file_from_postbuild.sh +5 -0
  846. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/strip/test-defaults.gyp +51 -0
  847. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/strip/test.gyp +119 -0
  848. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/file.c +6 -0
  849. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test.gyp +100 -0
  850. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_bundle_executable.sh +21 -0
  851. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh +22 -0
  852. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_bundle_shared_library.sh +23 -0
  853. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_executable.sh +22 -0
  854. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh +21 -0
  855. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_none.sh +22 -0
  856. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh +21 -0
  857. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh +21 -0
  858. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/unicode-settings/file.cc +2 -0
  859. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/unicode-settings/test.gyp +23 -0
  860. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/unicode-settings/test_bundle_display_name.sh +7 -0
  861. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-env-order/Info.plist +56 -0
  862. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-env-order/file.ext1 +0 -0
  863. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-env-order/file.ext2 +0 -0
  864. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-env-order/file.ext3 +0 -0
  865. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-env-order/main.c +7 -0
  866. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-env-order/test.gyp +121 -0
  867. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-gcc/aliasing.cc +13 -0
  868. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-gcc/test-clang.gyp +42 -0
  869. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-gcc/test.gyp +60 -0
  870. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-gcc/valid_c.c +8 -0
  871. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-gcc/valid_cc.cc +8 -0
  872. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-gcc/valid_m.m +8 -0
  873. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-gcc/valid_mm.mm +8 -0
  874. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-gcc/warn_about_invalid_offsetof_macro.cc +15 -0
  875. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xcode-gcc/warn_about_missing_newline.c +8 -0
  876. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xctest/MyClass.h +8 -0
  877. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xctest/MyClass.m +8 -0
  878. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xctest/TestCase.m +16 -0
  879. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xctest/resource.txt +1 -0
  880. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xctest/test.gyp +47 -0
  881. data/ext/tree-sitter/tree-sitter/externals/gyp/test/mac/xctest/test.xcodeproj/xcshareddata/xcschemes/classes.xcscheme +69 -0
  882. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/dependencies.gyp +15 -0
  883. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/gyptest-dependencies.py +26 -0
  884. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/gyptest-noload.py +57 -0
  885. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/main.cc +12 -0
  886. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/main.h +0 -0
  887. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/noload/all.gyp +18 -0
  888. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/noload/lib/shared.c +3 -0
  889. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/noload/lib/shared.gyp +16 -0
  890. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/noload/lib/shared.h +1 -0
  891. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make/noload/main.c +9 -0
  892. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/basics/gyptest-make_global_settings.py +46 -0
  893. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/basics/make_global_settings.gyp +17 -0
  894. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/env-wrapper/gyptest-wrapper.py +46 -0
  895. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/env-wrapper/wrapper.gyp +17 -0
  896. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/wrapper/gyptest-wrapper.py +47 -0
  897. data/ext/tree-sitter/tree-sitter/externals/gyp/test/make_global_settings/wrapper/wrapper.gyp +21 -0
  898. data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/file0 +0 -0
  899. data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/file1 +0 -0
  900. data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/file2 +0 -0
  901. data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/file3 +0 -0
  902. data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/file4 +0 -0
  903. data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/gyptest-many-actions-unsorted.py +34 -0
  904. data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/gyptest-many-actions.py +20 -0
  905. data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/many-actions-unsorted.gyp +154 -0
  906. data/ext/tree-sitter/tree-sitter/externals/gyp/test/many-actions/many-actions.gyp +1817 -0
  907. data/ext/tree-sitter/tree-sitter/externals/gyp/test/module/gyptest-default.py +29 -0
  908. data/ext/tree-sitter/tree-sitter/externals/gyp/test/module/src/lib1.c +10 -0
  909. data/ext/tree-sitter/tree-sitter/externals/gyp/test/module/src/lib2.c +10 -0
  910. data/ext/tree-sitter/tree-sitter/externals/gyp/test/module/src/module.gyp +53 -0
  911. data/ext/tree-sitter/tree-sitter/externals/gyp/test/module/src/program.c +111 -0
  912. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/buildevents/buildevents.gyp +14 -0
  913. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/buildevents/gyptest-msbuild-supports-prepostbuild.py +24 -0
  914. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/buildevents/gyptest-ninja-warnings.py +29 -0
  915. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/buildevents/main.cc +5 -0
  916. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/config_attrs/gyptest-config_attrs.py +31 -0
  917. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/config_attrs/hello.c +11 -0
  918. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/config_attrs/hello.gyp +21 -0
  919. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/express/base/base.gyp +22 -0
  920. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/express/express.gyp +19 -0
  921. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/express/gyptest-express.py +29 -0
  922. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/external_builder/external.gyp +68 -0
  923. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/external_builder/external_builder.py +9 -0
  924. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/external_builder/gyptest-all.py +59 -0
  925. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/external_builder/hello.cpp +10 -0
  926. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/external_builder/hello.z +6 -0
  927. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/external_builder/msbuild_action.py +9 -0
  928. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/external_builder/msbuild_rule.py +11 -0
  929. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/filters/filters.gyp +47 -0
  930. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/filters/gyptest-filters-2008.py +68 -0
  931. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/filters/gyptest-filters-2010.py +57 -0
  932. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/list_excluded/gyptest-all.py +51 -0
  933. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/list_excluded/hello.cpp +10 -0
  934. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/list_excluded/hello_exclude.gyp +19 -0
  935. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/list_excluded/hello_mac.cpp +10 -0
  936. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/missing_sources/gyptest-missing.py +43 -0
  937. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/missing_sources/hello_missing.gyp +15 -0
  938. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/props/AppName.props +14 -0
  939. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/props/AppName.vsprops +11 -0
  940. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/props/gyptest-props.py +22 -0
  941. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/props/hello.c +11 -0
  942. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/props/hello.gyp +22 -0
  943. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/shared_output/common.gypi +17 -0
  944. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/shared_output/gyptest-shared_output.py +41 -0
  945. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/shared_output/hello.c +12 -0
  946. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/shared_output/hello.gyp +21 -0
  947. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/shared_output/there/there.c +12 -0
  948. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/shared_output/there/there.gyp +16 -0
  949. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/uldi2010/gyptest-all.py +20 -0
  950. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/uldi2010/hello.c +13 -0
  951. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/uldi2010/hello.gyp +26 -0
  952. data/ext/tree-sitter/tree-sitter/externals/gyp/test/msvs/uldi2010/hello2.c +10 -0
  953. data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/gyptest-all.py +33 -0
  954. data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/gyptest-default.py +33 -0
  955. data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/src/common.c +7 -0
  956. data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/src/multiple.gyp +24 -0
  957. data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/src/prog1.c +10 -0
  958. data/ext/tree-sitter/tree-sitter/externals/gyp/test/multiple-targets/src/prog2.c +10 -0
  959. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py +53 -0
  960. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/src/a.c +10 -0
  961. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/src/a.h +13 -0
  962. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/src/action_dependencies.gyp +88 -0
  963. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/src/b.c +18 -0
  964. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/src/b.h +13 -0
  965. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/src/c.c +10 -0
  966. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/src/c.h +13 -0
  967. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/action_dependencies/src/emit.py +11 -0
  968. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/chained-dependency/chained-dependency.gyp +53 -0
  969. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/chained-dependency/chained.c +5 -0
  970. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py +26 -0
  971. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/normalize-paths-win/gyptest-normalize-paths.py +42 -0
  972. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/normalize-paths-win/hello.cc +7 -0
  973. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/normalize-paths-win/normalize-paths.gyp +56 -0
  974. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/s-needs-no-depfiles/empty.s +1 -0
  975. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/s-needs-no-depfiles/gyptest-s-needs-no-depfiles.py +42 -0
  976. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/s-needs-no-depfiles/s-needs-no-depfiles.gyp +13 -0
  977. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/solibs_avoid_relinking/gyptest-solibs-avoid-relinking.py +41 -0
  978. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/solibs_avoid_relinking/main.cc +5 -0
  979. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/solibs_avoid_relinking/solib.cc +8 -0
  980. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/solibs_avoid_relinking/solibs_avoid_relinking.gyp +38 -0
  981. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/use-custom-environment-files/gyptest-use-custom-environment-files.py +28 -0
  982. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/use-custom-environment-files/use-custom-environment-files.cc +7 -0
  983. data/ext/tree-sitter/tree-sitter/externals/gyp/test/ninja/use-custom-environment-files/use-custom-environment-files.gyp +15 -0
  984. data/ext/tree-sitter/tree-sitter/externals/gyp/test/no-cpp/gyptest-no-cpp.py +50 -0
  985. data/ext/tree-sitter/tree-sitter/externals/gyp/test/no-cpp/src/call-f-main.c +2 -0
  986. data/ext/tree-sitter/tree-sitter/externals/gyp/test/no-cpp/src/empty-main.c +1 -0
  987. data/ext/tree-sitter/tree-sitter/externals/gyp/test/no-cpp/src/f.cc +3 -0
  988. data/ext/tree-sitter/tree-sitter/externals/gyp/test/no-cpp/src/test.gyp +25 -0
  989. data/ext/tree-sitter/tree-sitter/externals/gyp/test/no-output/gyptest-no-output.py +21 -0
  990. data/ext/tree-sitter/tree-sitter/externals/gyp/test/no-output/src/nooutput.gyp +17 -0
  991. data/ext/tree-sitter/tree-sitter/externals/gyp/test/product/gyptest-product.py +44 -0
  992. data/ext/tree-sitter/tree-sitter/externals/gyp/test/product/hello.c +15 -0
  993. data/ext/tree-sitter/tree-sitter/externals/gyp/test/product/product.gyp +128 -0
  994. data/ext/tree-sitter/tree-sitter/externals/gyp/test/prune_targets/gyptest-prune-targets.py +64 -0
  995. data/ext/tree-sitter/tree-sitter/externals/gyp/test/prune_targets/lib1.cc +6 -0
  996. data/ext/tree-sitter/tree-sitter/externals/gyp/test/prune_targets/lib2.cc +6 -0
  997. data/ext/tree-sitter/tree-sitter/externals/gyp/test/prune_targets/lib3.cc +6 -0
  998. data/ext/tree-sitter/tree-sitter/externals/gyp/test/prune_targets/lib_indirect.cc +6 -0
  999. data/ext/tree-sitter/tree-sitter/externals/gyp/test/prune_targets/program.cc +7 -0
  1000. data/ext/tree-sitter/tree-sitter/externals/gyp/test/prune_targets/test1.gyp +26 -0
  1001. data/ext/tree-sitter/tree-sitter/externals/gyp/test/prune_targets/test2.gyp +30 -0
  1002. data/ext/tree-sitter/tree-sitter/externals/gyp/test/relative/foo/a/a.cc +9 -0
  1003. data/ext/tree-sitter/tree-sitter/externals/gyp/test/relative/foo/a/a.gyp +13 -0
  1004. data/ext/tree-sitter/tree-sitter/externals/gyp/test/relative/foo/a/c/c.cc +9 -0
  1005. data/ext/tree-sitter/tree-sitter/externals/gyp/test/relative/foo/a/c/c.gyp +12 -0
  1006. data/ext/tree-sitter/tree-sitter/externals/gyp/test/relative/foo/b/b.cc +9 -0
  1007. data/ext/tree-sitter/tree-sitter/externals/gyp/test/relative/foo/b/b.gyp +9 -0
  1008. data/ext/tree-sitter/tree-sitter/externals/gyp/test/relative/gyptest-default.py +25 -0
  1009. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rename/filecase/file.c +1 -0
  1010. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rename/filecase/test-casesensitive.gyp +15 -0
  1011. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rename/filecase/test.gyp +14 -0
  1012. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rename/gyptest-filecase.py +35 -0
  1013. data/ext/tree-sitter/tree-sitter/externals/gyp/test/restat/gyptest-restat.py +31 -0
  1014. data/ext/tree-sitter/tree-sitter/externals/gyp/test/restat/src/create_intermediate.py +17 -0
  1015. data/ext/tree-sitter/tree-sitter/externals/gyp/test/restat/src/restat.gyp +50 -0
  1016. data/ext/tree-sitter/tree-sitter/externals/gyp/test/restat/src/touch.py +16 -0
  1017. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/gyptest-dirname.py +36 -0
  1018. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/actions.gyp +15 -0
  1019. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/copy-file.py +11 -0
  1020. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/a/b/c.gencc +11 -0
  1021. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/a/b/c.printvars +1 -0
  1022. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc +11 -0
  1023. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/foo/bar/baz.printvars +1 -0
  1024. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp +92 -0
  1025. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/main.cc +12 -0
  1026. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-dirname/src/subdir/printvars.py +14 -0
  1027. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-rebuild/gyptest-all.py +70 -0
  1028. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-rebuild/gyptest-default.py +91 -0
  1029. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-rebuild/src/main.c +12 -0
  1030. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-rebuild/src/make-sources.py +19 -0
  1031. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-rebuild/src/prog1.in +7 -0
  1032. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-rebuild/src/prog2.in +7 -0
  1033. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-rebuild/src/same_target.gyp +31 -0
  1034. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-use-built-dependencies/gyptest-use-built-dependencies.py +22 -0
  1035. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-use-built-dependencies/src/main.cc +17 -0
  1036. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-use-built-dependencies/src/use-built-dependencies-rule.gyp +42 -0
  1037. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-variables/gyptest-rules-variables.py +26 -0
  1038. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-variables/src/input_ext.c +9 -0
  1039. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-variables/src/input_name/test.c +9 -0
  1040. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-variables/src/input_path/subdir/test.c +9 -0
  1041. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-variables/src/subdir/input_dirname.c +9 -0
  1042. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-variables/src/subdir/test.c +18 -0
  1043. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-variables/src/test.input_root.c +9 -0
  1044. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules-variables/src/variables.gyp +40 -0
  1045. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/gyptest-all.py +69 -0
  1046. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/gyptest-default.py +55 -0
  1047. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/gyptest-input-root.py +26 -0
  1048. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/gyptest-special-variables.py +18 -0
  1049. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/actions.gyp +22 -0
  1050. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/an_asm.S +6 -0
  1051. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/as.bat +7 -0
  1052. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/copy-file.py +11 -0
  1053. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/external/external.gyp +66 -0
  1054. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/external/file1.in +1 -0
  1055. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/external/file2.in +1 -0
  1056. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/input-root.gyp +24 -0
  1057. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/noaction/file1.in +1 -0
  1058. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/noaction/no_action_with_rules_fails.gyp +37 -0
  1059. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/rule.py +17 -0
  1060. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/somefile.ext +0 -0
  1061. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/special-variables.gyp +35 -0
  1062. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir1/executable.gyp +37 -0
  1063. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir1/function1.in +6 -0
  1064. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir1/function2.in +6 -0
  1065. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir1/program.c +12 -0
  1066. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir2/file1.in +1 -0
  1067. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir2/file2.in +1 -0
  1068. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir2/never_used.gyp +31 -0
  1069. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir2/no_action.gyp +38 -0
  1070. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir2/no_inputs.gyp +32 -0
  1071. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir2/none.gyp +33 -0
  1072. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir3/executable2.gyp +37 -0
  1073. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir3/function3.in +6 -0
  1074. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir3/program.c +10 -0
  1075. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir4/asm-function.assem +10 -0
  1076. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir4/build-asm.gyp +49 -0
  1077. data/ext/tree-sitter/tree-sitter/externals/gyp/test/rules/src/subdir4/program.c +19 -0
  1078. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/gyptest-all.py +38 -0
  1079. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/gyptest-default.py +38 -0
  1080. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/gyptest-library.py +20 -0
  1081. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/library/one/sub.gyp +11 -0
  1082. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/library/test.gyp +15 -0
  1083. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/library/two/sub.gyp +11 -0
  1084. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/src/all.gyp +16 -0
  1085. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/src/subdir1/executable.gyp +15 -0
  1086. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/src/subdir1/main1.cc +6 -0
  1087. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/src/subdir2/executable.gyp +15 -0
  1088. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-gyp-name/src/subdir2/main2.cc +6 -0
  1089. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-rule-output-file-name/gyptest-all.py +23 -0
  1090. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-rule-output-file-name/src/subdir1/subdir1.gyp +30 -0
  1091. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-rule-output-file-name/src/subdir2/subdir2.gyp +30 -0
  1092. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-rule-output-file-name/src/subdirs.gyp +16 -0
  1093. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-rule-output-file-name/src/touch.py +11 -0
  1094. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-all.py +34 -0
  1095. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-default.py +34 -0
  1096. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-fail-shared.py +18 -0
  1097. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-fail-static.py +18 -0
  1098. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/gyptest-pass-executable.py +33 -0
  1099. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/all.gyp +30 -0
  1100. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/double-executable.gyp +21 -0
  1101. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/double-shared.gyp +21 -0
  1102. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/double-static.gyp +21 -0
  1103. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/func.c +6 -0
  1104. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/prog1.c +16 -0
  1105. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/prog2.c +16 -0
  1106. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/prog3.c +18 -0
  1107. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/subdir1/func.c +6 -0
  1108. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-source-file-name/src/subdir2/func.c +6 -0
  1109. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name-different-directory/gyptest-all.py +36 -0
  1110. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name-different-directory/src/subdir1/subdir1.gyp +66 -0
  1111. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name-different-directory/src/subdir2/subdir2.gyp +66 -0
  1112. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name-different-directory/src/subdirs.gyp +16 -0
  1113. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name-different-directory/src/touch.py +11 -0
  1114. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name/gyptest-same-target-name.py +18 -0
  1115. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name/src/all.gyp +16 -0
  1116. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name/src/executable1.gyp +15 -0
  1117. data/ext/tree-sitter/tree-sitter/externals/gyp/test/same-target-name/src/executable2.gyp +15 -0
  1118. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sanitize-rule-names/blah.S +0 -0
  1119. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sanitize-rule-names/gyptest-sanitize-rule-names.py +17 -0
  1120. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sanitize-rule-names/hello.cc +7 -0
  1121. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sanitize-rule-names/sanitize-rule-names.gyp +27 -0
  1122. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sanitize-rule-names/script.py +10 -0
  1123. data/ext/tree-sitter/tree-sitter/externals/gyp/test/self-dependency/common.gypi +13 -0
  1124. data/ext/tree-sitter/tree-sitter/externals/gyp/test/self-dependency/dep.gyp +23 -0
  1125. data/ext/tree-sitter/tree-sitter/externals/gyp/test/self-dependency/gyptest-self-dependency.py +19 -0
  1126. data/ext/tree-sitter/tree-sitter/externals/gyp/test/self-dependency/self_dependency.gyp +15 -0
  1127. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/gyptest-all.py +39 -0
  1128. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/gyptest-relocate.py +41 -0
  1129. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/src/build/all.gyp +16 -0
  1130. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/src/prog1/prog1.c +7 -0
  1131. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/src/prog1/prog1.gyp +15 -0
  1132. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/src/prog2/prog2.c +7 -0
  1133. data/ext/tree-sitter/tree-sitter/externals/gyp/test/sibling/src/prog2/prog2.gyp +15 -0
  1134. data/ext/tree-sitter/tree-sitter/externals/gyp/test/small/gyptest-small.py +55 -0
  1135. data/ext/tree-sitter/tree-sitter/externals/gyp/test/standalone-static-library/gyptest-standalone-static-library.py +52 -0
  1136. data/ext/tree-sitter/tree-sitter/externals/gyp/test/standalone-static-library/invalid.gyp +16 -0
  1137. data/ext/tree-sitter/tree-sitter/externals/gyp/test/standalone-static-library/mylib.c +7 -0
  1138. data/ext/tree-sitter/tree-sitter/externals/gyp/test/standalone-static-library/mylib.gyp +26 -0
  1139. data/ext/tree-sitter/tree-sitter/externals/gyp/test/standalone-static-library/prog.c +7 -0
  1140. data/ext/tree-sitter/tree-sitter/externals/gyp/test/standalone/gyptest-standalone.py +33 -0
  1141. data/ext/tree-sitter/tree-sitter/externals/gyp/test/standalone/standalone.gyp +12 -0
  1142. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-SYMROOT-all.py +36 -0
  1143. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-SYMROOT-default.py +37 -0
  1144. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-subdir-all.py +35 -0
  1145. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-subdir-default.py +35 -0
  1146. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-subdir2-deep.py +25 -0
  1147. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-top-all.py +43 -0
  1148. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/gyptest-top-default.py +43 -0
  1149. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/prog1.c +7 -0
  1150. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/prog1.gyp +21 -0
  1151. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/subdir/prog2.c +7 -0
  1152. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/subdir/prog2.gyp +18 -0
  1153. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/subdir/subdir2/prog3.c +7 -0
  1154. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/subdir/subdir2/prog3.gyp +18 -0
  1155. data/ext/tree-sitter/tree-sitter/externals/gyp/test/subdirectory/src/symroot.gypi +16 -0
  1156. data/ext/tree-sitter/tree-sitter/externals/gyp/test/target/gyptest-target.py +37 -0
  1157. data/ext/tree-sitter/tree-sitter/externals/gyp/test/target/hello.c +7 -0
  1158. data/ext/tree-sitter/tree-sitter/externals/gyp/test/target/target.gyp +24 -0
  1159. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toolsets/gyptest-toolsets.py +31 -0
  1160. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toolsets/main.cc +13 -0
  1161. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toolsets/toolsets.cc +11 -0
  1162. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toolsets/toolsets.gyp +62 -0
  1163. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toolsets/toolsets_shared.cc +11 -0
  1164. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/gyptest-toplevel-dir.py +31 -0
  1165. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/src/sub1/main.gyp +18 -0
  1166. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/src/sub1/prog1.c +7 -0
  1167. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/src/sub2/prog2.c +7 -0
  1168. data/ext/tree-sitter/tree-sitter/externals/gyp/test/toplevel-dir/src/sub2/prog2.gyp +15 -0
  1169. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/commands-repeated.gyp +128 -0
  1170. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/commands-repeated.gyp.stdout +136 -0
  1171. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/commands-repeated.gypd.golden +77 -0
  1172. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/commands.gyp +91 -0
  1173. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/commands.gyp.ignore-env.stdout +96 -0
  1174. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/commands.gyp.stdout +96 -0
  1175. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/commands.gypd.golden +66 -0
  1176. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/commands.gypi +23 -0
  1177. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/gyptest-commands-ignore-env.py +46 -0
  1178. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/gyptest-commands-repeated.py +38 -0
  1179. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/gyptest-commands.py +39 -0
  1180. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/test.py +1 -0
  1181. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/commands/update_golden +11 -0
  1182. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/filelist/filelist.gyp.stdout +26 -0
  1183. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/filelist/filelist.gypd.golden +43 -0
  1184. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/filelist/gyptest-filelist-golden.py +51 -0
  1185. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/filelist/gyptest-filelist.py +29 -0
  1186. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/filelist/src/dummy.py +5 -0
  1187. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/filelist/src/filelist.gyp +93 -0
  1188. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/filelist/src/filelist2.gyp +40 -0
  1189. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/filelist/update_golden +8 -0
  1190. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/latelate/gyptest-latelate.py +25 -0
  1191. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/latelate/src/latelate.gyp +34 -0
  1192. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/latelate/src/program.cc +13 -0
  1193. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/variable-in-path/C1/hello.cc +7 -0
  1194. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/variable-in-path/gyptest-variable-in-path.py +23 -0
  1195. data/ext/tree-sitter/tree-sitter/externals/gyp/test/variables/variable-in-path/variable-in-path.gyp +31 -0
  1196. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/asm-files/asm-files.gyp +17 -0
  1197. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/asm-files/b.s +0 -0
  1198. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/asm-files/c.S +0 -0
  1199. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/asm-files/hello.cc +7 -0
  1200. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/batch-file-action/batch-file-action.gyp +21 -0
  1201. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/batch-file-action/infile +1 -0
  1202. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/batch-file-action/somecmd.bat +5 -0
  1203. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/command-quote/a.S +0 -0
  1204. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/command-quote/bat with spaces.bat +7 -0
  1205. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/command-quote/command-quote.gyp +84 -0
  1206. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/command-quote/go.bat +7 -0
  1207. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/command-quote/subdir/and/another/in-subdir.gyp +28 -0
  1208. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/additional-include-dirs.cc +10 -0
  1209. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/additional-include-dirs.gyp +20 -0
  1210. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/additional-options.cc +10 -0
  1211. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/additional-options.gyp +31 -0
  1212. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/analysis.gyp +40 -0
  1213. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/buffer-security-check.gyp +51 -0
  1214. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/buffer-security.cc +12 -0
  1215. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/character-set-mbcs.cc +11 -0
  1216. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/character-set-unicode.cc +15 -0
  1217. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/character-set.gyp +35 -0
  1218. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/debug-format.gyp +48 -0
  1219. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/default-char-is-unsigned.cc +15 -0
  1220. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/default-char-is-unsigned.gyp +20 -0
  1221. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/disable-specific-warnings.cc +9 -0
  1222. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/disable-specific-warnings.gyp +29 -0
  1223. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/exception-handling-on.cc +24 -0
  1224. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/exception-handling.gyp +46 -0
  1225. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/force-include-files-with-precompiled.cc +10 -0
  1226. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/force-include-files.cc +8 -0
  1227. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/force-include-files.gyp +36 -0
  1228. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/function-level-linking.cc +11 -0
  1229. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/function-level-linking.gyp +28 -0
  1230. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/hello.cc +7 -0
  1231. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/optimizations.gyp +207 -0
  1232. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/pdbname-override.gyp +26 -0
  1233. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/pdbname.cc +7 -0
  1234. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/pdbname.gyp +24 -0
  1235. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/precomp.cc +6 -0
  1236. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/rtti-on.cc +11 -0
  1237. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/rtti.gyp +37 -0
  1238. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/runtime-checks.cc +11 -0
  1239. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/runtime-checks.gyp +29 -0
  1240. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/runtime-library-md.cc +19 -0
  1241. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/runtime-library-mdd.cc +19 -0
  1242. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/runtime-library-mt.cc +19 -0
  1243. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/runtime-library-mtd.cc +19 -0
  1244. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/runtime-library.gyp +48 -0
  1245. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/subdir/header.h +0 -0
  1246. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type.gyp +33 -0
  1247. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type1.cc +11 -0
  1248. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type2.cc +11 -0
  1249. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/uninit.cc +13 -0
  1250. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/warning-as-error.cc +9 -0
  1251. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/warning-as-error.gyp +37 -0
  1252. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/warning-level.gyp +115 -0
  1253. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/warning-level1.cc +8 -0
  1254. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/warning-level2.cc +14 -0
  1255. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/warning-level3.cc +11 -0
  1256. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/compiler-flags/warning-level4.cc +10 -0
  1257. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/generator-output-different-drive/gyptest-generator-output-different-drive.py +44 -0
  1258. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/generator-output-different-drive/prog.c +10 -0
  1259. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/generator-output-different-drive/prog.gyp +15 -0
  1260. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-asm-files.py +26 -0
  1261. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-additional-include-dirs.py +22 -0
  1262. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-additional-options.py +28 -0
  1263. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-analysis.py +30 -0
  1264. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-buffer-security-check.py +53 -0
  1265. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-character-set.py +22 -0
  1266. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-debug-format.py +43 -0
  1267. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-default-char-is-unsigned.py +22 -0
  1268. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-disable-specific-warnings.py +32 -0
  1269. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-exception-handling.py +33 -0
  1270. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-force-include-files.py +22 -0
  1271. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-function-level-linking.py +52 -0
  1272. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-optimizations.py +105 -0
  1273. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-pdbname-override.py +27 -0
  1274. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-pdbname.py +30 -0
  1275. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-rtti.py +30 -0
  1276. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-runtime-checks.py +30 -0
  1277. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-runtime-library.py +22 -0
  1278. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-treat-wchar-t-as-built-in-type.py +22 -0
  1279. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-warning-as-error.py +30 -0
  1280. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-cl-warning-level.py +41 -0
  1281. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-command-quote.py +37 -0
  1282. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-lib-ltcg.py +22 -0
  1283. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-additional-deps.py +22 -0
  1284. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-additional-options.py +22 -0
  1285. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-aslr.py +35 -0
  1286. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-base-address.py +62 -0
  1287. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-debug-info.py +26 -0
  1288. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-default-libs.py +22 -0
  1289. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-deffile.py +43 -0
  1290. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-defrelink.py +51 -0
  1291. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-delay-load-dlls.py +35 -0
  1292. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-embed-manifest.py +99 -0
  1293. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-enable-uac.py +95 -0
  1294. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-entrypointsymbol.py +24 -0
  1295. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-fixed-base.py +40 -0
  1296. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-force-symbol-reference.py +26 -0
  1297. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-generate-manifest.py +127 -0
  1298. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-incremental.py +37 -0
  1299. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-large-address-aware.py +35 -0
  1300. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-large-pdb.py +70 -0
  1301. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-library-adjust.py +21 -0
  1302. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-library-directories.py +35 -0
  1303. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-ltcg.py +36 -0
  1304. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-mapfile.py +44 -0
  1305. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-nodefaultlib.py +24 -0
  1306. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-nxcompat.py +37 -0
  1307. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-opt-icf.py +41 -0
  1308. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-opt-ref.py +40 -0
  1309. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-ordering.py +101 -0
  1310. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-outputfile.py +28 -0
  1311. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-pdb-output.py +34 -0
  1312. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-pdb.py +35 -0
  1313. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-pgo.py +75 -0
  1314. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-profile.py +37 -0
  1315. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-restat-importlib.py +39 -0
  1316. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-shard.py +27 -0
  1317. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-subsystem.py +38 -0
  1318. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-target-machine.py +28 -0
  1319. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-tsaware.py +33 -0
  1320. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-uldi.py +28 -0
  1321. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-unsupported-manifest.py +27 -0
  1322. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-update-manifest.py +103 -0
  1323. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-link-warnings-as-errors.py +24 -0
  1324. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-long-command-line.py +23 -0
  1325. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macro-projectname.py +24 -0
  1326. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macro-targetname.py +29 -0
  1327. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macro-vcinstalldir.py +24 -0
  1328. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macros-containing-gyp.py +21 -0
  1329. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-macros-in-inputs-and-outputs.py +27 -0
  1330. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-midl-rules.py +24 -0
  1331. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-quoting-commands.py +25 -0
  1332. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/gyptest-rc-build.py +24 -0
  1333. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-rules/basic-idl.gyp +42 -0
  1334. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-rules/history_indexer.idl +17 -0
  1335. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/idl-rules/history_indexer_user.cc +15 -0
  1336. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/importlib/has-exports.cc +10 -0
  1337. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/importlib/hello.cc +9 -0
  1338. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/importlib/importlib.gyp +30 -0
  1339. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/large-pdb/dllmain.cc +9 -0
  1340. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/large-pdb/large-pdb.gyp +98 -0
  1341. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/large-pdb/main.cc +7 -0
  1342. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/lib-flags/answer.cc +9 -0
  1343. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/lib-flags/answer.h +5 -0
  1344. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/lib-flags/ltcg.gyp +21 -0
  1345. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/a/x.cc +7 -0
  1346. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/a/z.cc +7 -0
  1347. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/additional-deps.cc +10 -0
  1348. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/additional-deps.gyp +30 -0
  1349. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/additional-options.gyp +29 -0
  1350. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/aslr.gyp +35 -0
  1351. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/b/y.cc +7 -0
  1352. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/base-address.gyp +38 -0
  1353. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/debug-info.gyp +28 -0
  1354. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/deffile-multiple.gyp +17 -0
  1355. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/deffile.cc +13 -0
  1356. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/deffile.def +8 -0
  1357. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/deffile.gyp +38 -0
  1358. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/delay-load-dlls.gyp +35 -0
  1359. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/delay-load.cc +10 -0
  1360. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/embed-manifest.gyp +109 -0
  1361. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/enable-uac.gyp +45 -0
  1362. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/entrypointsymbol.cc +13 -0
  1363. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/entrypointsymbol.gyp +28 -0
  1364. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/extra.manifest +11 -0
  1365. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/extra2.manifest +11 -0
  1366. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/fixed-base.gyp +52 -0
  1367. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/force-symbol-reference.gyp +39 -0
  1368. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/generate-manifest.gyp +166 -0
  1369. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/hello.cc +7 -0
  1370. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/incremental.gyp +65 -0
  1371. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/inline_test.cc +12 -0
  1372. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/inline_test.h +5 -0
  1373. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/inline_test_main.cc +15 -0
  1374. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/large-address-aware.gyp +28 -0
  1375. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/library-adjust.cc +10 -0
  1376. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/library-adjust.gyp +16 -0
  1377. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/library-directories-define.cc +7 -0
  1378. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/library-directories-reference.cc +10 -0
  1379. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/library-directories.gyp +42 -0
  1380. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/link-ordering.gyp +95 -0
  1381. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/link-warning.cc +10 -0
  1382. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/ltcg.gyp +42 -0
  1383. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/main-crt.c +8 -0
  1384. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/manifest-in-comment.cc +13 -0
  1385. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/mapfile.cc +12 -0
  1386. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/mapfile.gyp +45 -0
  1387. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/no-default-libs.cc +18 -0
  1388. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/no-default-libs.gyp +13 -0
  1389. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/nodefaultlib.cc +13 -0
  1390. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/nodefaultlib.gyp +30 -0
  1391. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/nxcompat.gyp +35 -0
  1392. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/opt-icf.cc +29 -0
  1393. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/opt-icf.gyp +63 -0
  1394. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/opt-ref.cc +11 -0
  1395. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/opt-ref.gyp +56 -0
  1396. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/outputfile.gyp +58 -0
  1397. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/pdb-output.gyp +36 -0
  1398. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/pgo.gyp +143 -0
  1399. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/profile.gyp +50 -0
  1400. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/program-database.gyp +40 -0
  1401. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/subdir/library.gyp +13 -0
  1402. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/subsystem-windows.cc +9 -0
  1403. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/subsystem.gyp +70 -0
  1404. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/target-machine.gyp +48 -0
  1405. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/tsaware.gyp +28 -0
  1406. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/unsupported-manifest.gyp +13 -0
  1407. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/update_pgd.py +35 -0
  1408. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/warn-as-error.gyp +33 -0
  1409. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/x.cc +7 -0
  1410. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/y.cc +7 -0
  1411. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/linker-flags/z.cc +7 -0
  1412. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/long-command-line/function.cc +7 -0
  1413. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/long-command-line/hello.cc +7 -0
  1414. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/long-command-line/long-command-line.gyp +54 -0
  1415. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/precompiled/gyptest-all.py +21 -0
  1416. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/precompiled/hello.c +14 -0
  1417. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/precompiled/hello.gyp +28 -0
  1418. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/precompiled/hello2.c +13 -0
  1419. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/precompiled/precomp.c +8 -0
  1420. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/Resource.h +26 -0
  1421. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/hello.cpp +30 -0
  1422. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/hello.gyp +92 -0
  1423. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/hello.h +3 -0
  1424. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/hello.ico +0 -0
  1425. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/hello.rc +86 -0
  1426. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/hello3.rc +87 -0
  1427. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/small.ico +0 -0
  1428. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/subdir/hello2.rc +87 -0
  1429. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/subdir/include.h +1 -0
  1430. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/rc-build/targetver.h +24 -0
  1431. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/hello1.cc +7 -0
  1432. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/hello2.cc +7 -0
  1433. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/hello3.cc +7 -0
  1434. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/hello4.cc +7 -0
  1435. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/shard/shard.gyp +20 -0
  1436. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/uldi/a.cc +7 -0
  1437. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/uldi/b.cc +7 -0
  1438. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/uldi/main.cc +10 -0
  1439. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/uldi/uldi.gyp +45 -0
  1440. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/as.py +18 -0
  1441. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/containing-gyp.gyp +40 -0
  1442. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/do_stuff.py +8 -0
  1443. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/hello.cc +7 -0
  1444. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/input-output-macros.gyp +33 -0
  1445. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/input.S +0 -0
  1446. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/projectname.gyp +29 -0
  1447. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/stuff.blah +1 -0
  1448. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/targetname.gyp +52 -0
  1449. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/test_exists.py +10 -0
  1450. data/ext/tree-sitter/tree-sitter/externals/gyp/test/win/vs-macros/vcinstalldir.gyp +41 -0
  1451. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/README +15 -0
  1452. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/Xcode/README +5 -0
  1453. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
  1454. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
  1455. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/emacs/README +12 -0
  1456. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/emacs/gyp-tests.el +63 -0
  1457. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/emacs/gyp.el +252 -0
  1458. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/emacs/run-unit-tests.sh +7 -0
  1459. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/emacs/testdata/media.gyp +1105 -0
  1460. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/emacs/testdata/media.gyp.fontified +1107 -0
  1461. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/graphviz.py +100 -0
  1462. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/pretty_gyp.py +155 -0
  1463. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/pretty_sln.py +168 -0
  1464. data/ext/tree-sitter/tree-sitter/externals/gyp/tools/pretty_vcproj.py +329 -0
  1465. data/ext/tree-sitter/tree-sitter/externals/json-parser/AUTHORS +20 -0
  1466. data/ext/tree-sitter/tree-sitter/externals/json-parser/LICENSE +26 -0
  1467. data/ext/tree-sitter/tree-sitter/externals/json-parser/Makefile.in +68 -0
  1468. data/ext/tree-sitter/tree-sitter/externals/json-parser/README.md +97 -0
  1469. data/ext/tree-sitter/tree-sitter/externals/json-parser/bindings/python/example/test.json +88 -0
  1470. data/ext/tree-sitter/tree-sitter/externals/json-parser/bindings/python/example/test.py +11 -0
  1471. data/ext/tree-sitter/tree-sitter/externals/json-parser/bindings/python/jsonparser.pyx +9 -0
  1472. data/ext/tree-sitter/tree-sitter/externals/json-parser/bindings/python/setup.py +14 -0
  1473. data/ext/tree-sitter/tree-sitter/externals/json-parser/bindings/python/wrap_json.c +95 -0
  1474. data/ext/tree-sitter/tree-sitter/externals/json-parser/configure +3796 -0
  1475. data/ext/tree-sitter/tree-sitter/externals/json-parser/configure.ac +30 -0
  1476. data/ext/tree-sitter/tree-sitter/externals/json-parser/examples/test_json.c +180 -0
  1477. data/ext/tree-sitter/tree-sitter/externals/json-parser/json-parser.pc.in +10 -0
  1478. data/ext/tree-sitter/tree-sitter/externals/json-parser/json.c +1011 -0
  1479. data/ext/tree-sitter/tree-sitter/externals/json-parser/json.h +283 -0
  1480. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/ext-invalid-0001.json +3 -0
  1481. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/ext-invalid-0002.json +1 -0
  1482. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/ext-valid-0001.json +9 -0
  1483. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/ext-valid-0002.json +4 -0
  1484. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/ext-valid-0003.json +3 -0
  1485. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0000.json +0 -0
  1486. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0001.json +2 -0
  1487. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0002.json +2 -0
  1488. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0003.json +88 -0
  1489. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0004.json +2 -0
  1490. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0005.json +2 -0
  1491. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0006.json +3 -0
  1492. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0007.json +1 -0
  1493. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0008.json +1 -0
  1494. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0009.json +1 -0
  1495. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/invalid-0010.json +1 -0
  1496. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/test.py +70 -0
  1497. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0000.json +88 -0
  1498. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0001.json +2 -0
  1499. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0002.json +2 -0
  1500. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0003.json +3 -0
  1501. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0004.json +1 -0
  1502. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0005.json +15 -0
  1503. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0006.json +1 -0
  1504. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0007.json +2 -0
  1505. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0008.json +8 -0
  1506. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0009.json +1 -0
  1507. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0010.json +1 -0
  1508. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0011.json +1 -0
  1509. data/ext/tree-sitter/tree-sitter/externals/json-parser/tests/valid-0012.json +5 -0
  1510. data/ext/tree-sitter/tree-sitter/externals/utf8proc/CMakeLists.txt +31 -0
  1511. data/ext/tree-sitter/tree-sitter/externals/utf8proc/Doxyfile +1528 -0
  1512. data/ext/tree-sitter/tree-sitter/externals/utf8proc/LICENSE.md +93 -0
  1513. data/ext/tree-sitter/tree-sitter/externals/utf8proc/MANIFEST +7 -0
  1514. data/ext/tree-sitter/tree-sitter/externals/utf8proc/Makefile +145 -0
  1515. data/ext/tree-sitter/tree-sitter/externals/utf8proc/NEWS.md +234 -0
  1516. data/ext/tree-sitter/tree-sitter/externals/utf8proc/README.md +67 -0
  1517. data/ext/tree-sitter/tree-sitter/externals/utf8proc/appveyor.yml +42 -0
  1518. data/ext/tree-sitter/tree-sitter/externals/utf8proc/bench/Makefile +39 -0
  1519. data/ext/tree-sitter/tree-sitter/externals/utf8proc/bench/bench.c +56 -0
  1520. data/ext/tree-sitter/tree-sitter/externals/utf8proc/bench/icu.c +61 -0
  1521. data/ext/tree-sitter/tree-sitter/externals/utf8proc/bench/unistring.c +60 -0
  1522. data/ext/tree-sitter/tree-sitter/externals/utf8proc/bench/util.c +39 -0
  1523. data/ext/tree-sitter/tree-sitter/externals/utf8proc/bench/util.h +22 -0
  1524. data/ext/tree-sitter/tree-sitter/externals/utf8proc/data/Makefile +63 -0
  1525. data/ext/tree-sitter/tree-sitter/externals/utf8proc/data/charwidths.jl +190 -0
  1526. data/ext/tree-sitter/tree-sitter/externals/utf8proc/data/data_generator.rb +328 -0
  1527. data/ext/tree-sitter/tree-sitter/externals/utf8proc/lump.md +27 -0
  1528. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/case.c +50 -0
  1529. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/charwidth.c +71 -0
  1530. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/graphemetest.c +74 -0
  1531. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/iterate.c +160 -0
  1532. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/normtest.c +64 -0
  1533. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/printproperty.c +51 -0
  1534. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/tests.c +46 -0
  1535. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/tests.h +23 -0
  1536. data/ext/tree-sitter/tree-sitter/externals/utf8proc/test/valid.c +41 -0
  1537. data/ext/tree-sitter/tree-sitter/externals/utf8proc/utf8proc.c +644 -0
  1538. data/ext/tree-sitter/tree-sitter/externals/utf8proc/utf8proc.h +601 -0
  1539. data/ext/tree-sitter/tree-sitter/externals/utf8proc/utf8proc_data.c +16752 -0
  1540. data/ext/tree-sitter/tree-sitter/externals/utf8proc/utils.cmake +20 -0
  1541. data/ext/tree-sitter/tree-sitter/gyp-mac-tool +511 -0
  1542. data/ext/tree-sitter/tree-sitter/include/tree_sitter/compiler.h +32 -0
  1543. data/ext/tree-sitter/tree-sitter/include/tree_sitter/parser.h +188 -0
  1544. data/ext/tree-sitter/tree-sitter/include/tree_sitter/runtime.h +126 -0
  1545. data/ext/tree-sitter/tree-sitter/out/Release/libcompiler.a +0 -0
  1546. data/ext/tree-sitter/tree-sitter/out/Release/libruntime.a +0 -0
  1547. data/ext/tree-sitter/tree-sitter/out/Release/linker.lock +0 -0
  1548. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/externals/json-parser/json.o +0 -0
  1549. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/externals/utf8proc/utf8proc.o +0 -0
  1550. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/build_lex_table.o +0 -0
  1551. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/build_parse_table.o +0 -0
  1552. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/build_tables.o +0 -0
  1553. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lex_conflict_manager.o +0 -0
  1554. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lex_item.o +0 -0
  1555. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lex_item_transitions.o +0 -0
  1556. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/lookahead_set.o +0 -0
  1557. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/parse_item.o +0 -0
  1558. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/parse_item_set_builder.o +0 -0
  1559. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/recovery_tokens.o +0 -0
  1560. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/build_tables/rule_can_be_blank.o +0 -0
  1561. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/compile.o +0 -0
  1562. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/generate_code/c_code.o +0 -0
  1563. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/lex_table.o +0 -0
  1564. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/parse_grammar.o +0 -0
  1565. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/parse_table.o +0 -0
  1566. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/precedence_range.o +0 -0
  1567. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/expand_repeats.o +0 -0
  1568. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/expand_tokens.o +0 -0
  1569. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/extract_choices.o +0 -0
  1570. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/extract_tokens.o +0 -0
  1571. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/flatten_grammar.o +0 -0
  1572. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/intern_symbols.o +0 -0
  1573. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/is_token.o +0 -0
  1574. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/normalize_rules.o +0 -0
  1575. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/parse_regex.o +0 -0
  1576. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/prepare_grammar.o +0 -0
  1577. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/prepare_grammar/token_description.o +0 -0
  1578. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rule.o +0 -0
  1579. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/blank.o +0 -0
  1580. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/built_in_symbols.o +0 -0
  1581. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/character_range.o +0 -0
  1582. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/character_set.o +0 -0
  1583. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/choice.o +0 -0
  1584. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/metadata.o +0 -0
  1585. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/named_symbol.o +0 -0
  1586. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/pattern.o +0 -0
  1587. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/repeat.o +0 -0
  1588. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/rules.o +0 -0
  1589. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/seq.o +0 -0
  1590. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/string.o +0 -0
  1591. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/symbol.o +0 -0
  1592. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/rules/visitor.o +0 -0
  1593. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/syntax_grammar.o +0 -0
  1594. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/util/string_helpers.o +0 -0
  1595. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/compiler/src/compiler/variable.o +0 -0
  1596. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/externals/utf8proc/utf8proc.o +0 -0
  1597. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/document.o +0 -0
  1598. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/error_costs.o +0 -0
  1599. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/language.o +0 -0
  1600. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/lexer.o +0 -0
  1601. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/node.o +0 -0
  1602. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/parser.o +0 -0
  1603. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/stack.o +0 -0
  1604. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/string_input.o +0 -0
  1605. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/tree.o +0 -0
  1606. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/runtime/src/runtime/utf16.o +0 -0
  1607. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/distinctive_tokens_spec.o +0 -0
  1608. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/lex_conflict_manager_spec.o +0 -0
  1609. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/lex_item_spec.o +0 -0
  1610. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/parse_item_set_builder_spec.o +0 -0
  1611. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/build_tables/rule_can_be_blank_spec.o +0 -0
  1612. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/expand_repeats_spec.o +0 -0
  1613. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/expand_tokens_spec.o +0 -0
  1614. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/extract_choices_spec.o +0 -0
  1615. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/extract_tokens_spec.o +0 -0
  1616. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/flatten_grammar_spec.o +0 -0
  1617. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/intern_symbols_spec.o +0 -0
  1618. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/prepare_grammar/parse_regex_spec.o +0 -0
  1619. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/rules/character_set_spec.o +0 -0
  1620. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/rules/choice_spec.o +0 -0
  1621. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/rules/repeat_spec.o +0 -0
  1622. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/compiler/util/string_helpers_spec.o +0 -0
  1623. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/encoding_helpers.o +0 -0
  1624. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/load_language.o +0 -0
  1625. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/point_helpers.o +0 -0
  1626. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/random_helpers.o +0 -0
  1627. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/read_test_entries.o +0 -0
  1628. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/record_alloc.o +0 -0
  1629. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/rule_helpers.o +0 -0
  1630. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/scope_sequence.o +0 -0
  1631. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/spy_input.o +0 -0
  1632. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/spy_logger.o +0 -0
  1633. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/stderr_logger.o +0 -0
  1634. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/stream_methods.o +0 -0
  1635. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/helpers/tree_helpers.o +0 -0
  1636. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/integration/compile_grammar_spec.o +0 -0
  1637. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/integration/corpus_specs.o +0 -0
  1638. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/document_spec.o +0 -0
  1639. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/node_spec.o +0 -0
  1640. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/parser_spec.o +0 -0
  1641. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/stack_spec.o +0 -0
  1642. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/runtime/tree_spec.o +0 -0
  1643. data/ext/tree-sitter/tree-sitter/out/Release/obj.target/tests/spec/specs.o +0 -0
  1644. data/ext/tree-sitter/tree-sitter/out/Release/tests +0 -0
  1645. data/ext/tree-sitter/tree-sitter/project.Makefile +6 -0
  1646. data/ext/tree-sitter/tree-sitter/project.gyp +175 -0
  1647. data/ext/tree-sitter/tree-sitter/runtime.target.mk +174 -0
  1648. data/ext/tree-sitter/tree-sitter/script/check-mallocs +20 -0
  1649. data/ext/tree-sitter/tree-sitter/script/ci +7 -0
  1650. data/ext/tree-sitter/tree-sitter/script/clean +7 -0
  1651. data/ext/tree-sitter/tree-sitter/script/configure +7 -0
  1652. data/ext/tree-sitter/tree-sitter/script/fetch-fixtures +28 -0
  1653. data/ext/tree-sitter/tree-sitter/script/format +7 -0
  1654. data/ext/tree-sitter/tree-sitter/script/lint +14 -0
  1655. data/ext/tree-sitter/tree-sitter/script/test +122 -0
  1656. data/ext/tree-sitter/tree-sitter/script/trim-whitespace +3 -0
  1657. data/ext/tree-sitter/tree-sitter/script/util/valgrind.supp +256 -0
  1658. data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/distinctive_tokens_spec.cc +34 -0
  1659. data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/lex_conflict_manager_spec.cc +88 -0
  1660. data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/lex_item_spec.cc +517 -0
  1661. data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/parse_item_set_builder_spec.cc +133 -0
  1662. data/ext/tree-sitter/tree-sitter/spec/compiler/build_tables/rule_can_be_blank_spec.cc +60 -0
  1663. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/expand_repeats_spec.cc +152 -0
  1664. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/expand_tokens_spec.cc +109 -0
  1665. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/extract_choices_spec.cc +106 -0
  1666. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/extract_tokens_spec.cc +251 -0
  1667. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/flatten_grammar_spec.cc +89 -0
  1668. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/intern_symbols_spec.cc +89 -0
  1669. data/ext/tree-sitter/tree-sitter/spec/compiler/prepare_grammar/parse_regex_spec.cc +245 -0
  1670. data/ext/tree-sitter/tree-sitter/spec/compiler/rules/character_set_spec.cc +337 -0
  1671. data/ext/tree-sitter/tree-sitter/spec/compiler/rules/choice_spec.cc +53 -0
  1672. data/ext/tree-sitter/tree-sitter/spec/compiler/rules/repeat_spec.cc +22 -0
  1673. data/ext/tree-sitter/tree-sitter/spec/compiler/util/string_helpers_spec.cc +26 -0
  1674. data/ext/tree-sitter/tree-sitter/spec/fixtures/error_corpus/c_errors.txt +130 -0
  1675. data/ext/tree-sitter/tree-sitter/spec/fixtures/error_corpus/javascript_errors.txt +157 -0
  1676. data/ext/tree-sitter/tree-sitter/spec/fixtures/error_corpus/json_errors.txt +56 -0
  1677. data/ext/tree-sitter/tree-sitter/spec/fixtures/error_corpus/python_errors.txt +29 -0
  1678. data/ext/tree-sitter/tree-sitter/spec/fixtures/external_scanners/extra_external_tokens.c +42 -0
  1679. data/ext/tree-sitter/tree-sitter/spec/fixtures/external_scanners/percent_strings.c +118 -0
  1680. data/ext/tree-sitter/tree-sitter/spec/fixtures/external_scanners/shared_external_tokens.c +63 -0
  1681. data/ext/tree-sitter/tree-sitter/spec/helpers/dedent.h +12 -0
  1682. data/ext/tree-sitter/tree-sitter/spec/helpers/encoding_helpers.cc +58 -0
  1683. data/ext/tree-sitter/tree-sitter/spec/helpers/encoding_helpers.h +15 -0
  1684. data/ext/tree-sitter/tree-sitter/spec/helpers/equals_pointer.h +37 -0
  1685. data/ext/tree-sitter/tree-sitter/spec/helpers/load_language.cc +206 -0
  1686. data/ext/tree-sitter/tree-sitter/spec/helpers/load_language.h +12 -0
  1687. data/ext/tree-sitter/tree-sitter/spec/helpers/point_helpers.cc +45 -0
  1688. data/ext/tree-sitter/tree-sitter/spec/helpers/point_helpers.h +23 -0
  1689. data/ext/tree-sitter/tree-sitter/spec/helpers/random_helpers.cc +35 -0
  1690. data/ext/tree-sitter/tree-sitter/spec/helpers/random_helpers.h +8 -0
  1691. data/ext/tree-sitter/tree-sitter/spec/helpers/read_test_entries.cc +105 -0
  1692. data/ext/tree-sitter/tree-sitter/spec/helpers/read_test_entries.h +15 -0
  1693. data/ext/tree-sitter/tree-sitter/spec/helpers/record_alloc.cc +84 -0
  1694. data/ext/tree-sitter/tree-sitter/spec/helpers/record_alloc.h +16 -0
  1695. data/ext/tree-sitter/tree-sitter/spec/helpers/rule_helpers.cc +55 -0
  1696. data/ext/tree-sitter/tree-sitter/spec/helpers/rule_helpers.h +21 -0
  1697. data/ext/tree-sitter/tree-sitter/spec/helpers/scope_sequence.cc +106 -0
  1698. data/ext/tree-sitter/tree-sitter/spec/helpers/scope_sequence.h +16 -0
  1699. data/ext/tree-sitter/tree-sitter/spec/helpers/spy_input.cc +133 -0
  1700. data/ext/tree-sitter/tree-sitter/spec/helpers/spy_input.h +39 -0
  1701. data/ext/tree-sitter/tree-sitter/spec/helpers/spy_logger.cc +22 -0
  1702. data/ext/tree-sitter/tree-sitter/spec/helpers/spy_logger.h +15 -0
  1703. data/ext/tree-sitter/tree-sitter/spec/helpers/stderr_logger.cc +22 -0
  1704. data/ext/tree-sitter/tree-sitter/spec/helpers/stderr_logger.h +8 -0
  1705. data/ext/tree-sitter/tree-sitter/spec/helpers/stream_methods.cc +140 -0
  1706. data/ext/tree-sitter/tree-sitter/spec/helpers/stream_methods.h +136 -0
  1707. data/ext/tree-sitter/tree-sitter/spec/helpers/tree_helpers.cc +50 -0
  1708. data/ext/tree-sitter/tree-sitter/spec/helpers/tree_helpers.h +16 -0
  1709. data/ext/tree-sitter/tree-sitter/spec/integration/compile_grammar_spec.cc +847 -0
  1710. data/ext/tree-sitter/tree-sitter/spec/integration/corpus_specs.cc +185 -0
  1711. data/ext/tree-sitter/tree-sitter/spec/runtime/document_spec.cc +372 -0
  1712. data/ext/tree-sitter/tree-sitter/spec/runtime/node_spec.cc +436 -0
  1713. data/ext/tree-sitter/tree-sitter/spec/runtime/parser_spec.cc +479 -0
  1714. data/ext/tree-sitter/tree-sitter/spec/runtime/stack_spec.cc +571 -0
  1715. data/ext/tree-sitter/tree-sitter/spec/runtime/tree_spec.cc +439 -0
  1716. data/ext/tree-sitter/tree-sitter/spec/spec_helper.h +19 -0
  1717. data/ext/tree-sitter/tree-sitter/spec/specs.cc +16 -0
  1718. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_lex_table.cc +195 -0
  1719. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_lex_table.h +18 -0
  1720. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_parse_table.cc +604 -0
  1721. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_parse_table.h +22 -0
  1722. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_tables.cc +27 -0
  1723. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/build_tables.h +24 -0
  1724. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/conflict_type.h +16 -0
  1725. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_conflict_manager.cc +55 -0
  1726. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_conflict_manager.h +31 -0
  1727. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item.cc +118 -0
  1728. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item.h +82 -0
  1729. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item_transitions.cc +188 -0
  1730. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lex_item_transitions.h +17 -0
  1731. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lookahead_set.cc +47 -0
  1732. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/lookahead_set.h +28 -0
  1733. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item.cc +148 -0
  1734. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item.h +65 -0
  1735. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item_set_builder.cc +167 -0
  1736. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/parse_item_set_builder.h +35 -0
  1737. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/recovery_tokens.cc +89 -0
  1738. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/recovery_tokens.h +19 -0
  1739. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/remove_duplicate_states.h +65 -0
  1740. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/rule_can_be_blank.cc +44 -0
  1741. data/ext/tree-sitter/tree-sitter/src/compiler/build_tables/rule_can_be_blank.h +14 -0
  1742. data/ext/tree-sitter/tree-sitter/src/compiler/compile.cc +72 -0
  1743. data/ext/tree-sitter/tree-sitter/src/compiler/compile.h +16 -0
  1744. data/ext/tree-sitter/tree-sitter/src/compiler/compile_error.h +28 -0
  1745. data/ext/tree-sitter/tree-sitter/src/compiler/generate_code/c_code.cc +691 -0
  1746. data/ext/tree-sitter/tree-sitter/src/compiler/generate_code/c_code.h +21 -0
  1747. data/ext/tree-sitter/tree-sitter/src/compiler/grammar.h +20 -0
  1748. data/ext/tree-sitter/tree-sitter/src/compiler/lex_table.cc +78 -0
  1749. data/ext/tree-sitter/tree-sitter/src/compiler/lex_table.h +75 -0
  1750. data/ext/tree-sitter/tree-sitter/src/compiler/lexical_grammar.h +19 -0
  1751. data/ext/tree-sitter/tree-sitter/src/compiler/parse_grammar.cc +335 -0
  1752. data/ext/tree-sitter/tree-sitter/src/compiler/parse_grammar.h +20 -0
  1753. data/ext/tree-sitter/tree-sitter/src/compiler/parse_table.cc +258 -0
  1754. data/ext/tree-sitter/tree-sitter/src/compiler/parse_table.h +106 -0
  1755. data/ext/tree-sitter/tree-sitter/src/compiler/precedence_range.cc +45 -0
  1756. data/ext/tree-sitter/tree-sitter/src/compiler/precedence_range.h +23 -0
  1757. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_repeats.cc +80 -0
  1758. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_repeats.h +16 -0
  1759. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_tokens.cc +88 -0
  1760. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/expand_tokens.h +18 -0
  1761. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_choices.cc +55 -0
  1762. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_choices.h +15 -0
  1763. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_tokens.cc +213 -0
  1764. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/extract_tokens.h +19 -0
  1765. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/flatten_grammar.cc +124 -0
  1766. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/flatten_grammar.h +20 -0
  1767. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/initial_syntax_grammar.h +24 -0
  1768. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/intern_symbols.cc +110 -0
  1769. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/intern_symbols.h +20 -0
  1770. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/interned_grammar.h +24 -0
  1771. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/is_token.cc +30 -0
  1772. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/is_token.h +14 -0
  1773. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/normalize_rules.cc +19 -0
  1774. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/normalize_rules.h +14 -0
  1775. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/parse_regex.cc +252 -0
  1776. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/parse_regex.h +17 -0
  1777. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/prepare_grammar.cc +69 -0
  1778. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/prepare_grammar.h +21 -0
  1779. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/token_description.cc +69 -0
  1780. data/ext/tree-sitter/tree-sitter/src/compiler/prepare_grammar/token_description.h +15 -0
  1781. data/ext/tree-sitter/tree-sitter/src/compiler/rule.cc +15 -0
  1782. data/ext/tree-sitter/tree-sitter/src/compiler/rule.h +45 -0
  1783. data/ext/tree-sitter/tree-sitter/src/compiler/rules.h +28 -0
  1784. data/ext/tree-sitter/tree-sitter/src/compiler/rules/blank.cc +36 -0
  1785. data/ext/tree-sitter/tree-sitter/src/compiler/rules/blank.h +25 -0
  1786. data/ext/tree-sitter/tree-sitter/src/compiler/rules/built_in_symbols.cc +19 -0
  1787. data/ext/tree-sitter/tree-sitter/src/compiler/rules/built_in_symbols.h +16 -0
  1788. data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_range.cc +36 -0
  1789. data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_range.h +25 -0
  1790. data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_set.cc +220 -0
  1791. data/ext/tree-sitter/tree-sitter/src/compiler/rules/character_set.h +59 -0
  1792. data/ext/tree-sitter/tree-sitter/src/compiler/rules/choice.cc +78 -0
  1793. data/ext/tree-sitter/tree-sitter/src/compiler/rules/choice.h +28 -0
  1794. data/ext/tree-sitter/tree-sitter/src/compiler/rules/metadata.cc +98 -0
  1795. data/ext/tree-sitter/tree-sitter/src/compiler/rules/metadata.h +51 -0
  1796. data/ext/tree-sitter/tree-sitter/src/compiler/rules/named_symbol.cc +35 -0
  1797. data/ext/tree-sitter/tree-sitter/src/compiler/rules/named_symbol.h +26 -0
  1798. data/ext/tree-sitter/tree-sitter/src/compiler/rules/pattern.cc +36 -0
  1799. data/ext/tree-sitter/tree-sitter/src/compiler/rules/pattern.h +26 -0
  1800. data/ext/tree-sitter/tree-sitter/src/compiler/rules/repeat.cc +44 -0
  1801. data/ext/tree-sitter/tree-sitter/src/compiler/rules/repeat.h +27 -0
  1802. data/ext/tree-sitter/tree-sitter/src/compiler/rules/rules.cc +108 -0
  1803. data/ext/tree-sitter/tree-sitter/src/compiler/rules/seq.cc +57 -0
  1804. data/ext/tree-sitter/tree-sitter/src/compiler/rules/seq.h +29 -0
  1805. data/ext/tree-sitter/tree-sitter/src/compiler/rules/string.cc +35 -0
  1806. data/ext/tree-sitter/tree-sitter/src/compiler/rules/string.h +26 -0
  1807. data/ext/tree-sitter/tree-sitter/src/compiler/rules/symbol.cc +82 -0
  1808. data/ext/tree-sitter/tree-sitter/src/compiler/rules/symbol.h +55 -0
  1809. data/ext/tree-sitter/tree-sitter/src/compiler/rules/visitor.cc +44 -0
  1810. data/ext/tree-sitter/tree-sitter/src/compiler/rules/visitor.h +234 -0
  1811. data/ext/tree-sitter/tree-sitter/src/compiler/syntax_grammar.cc +34 -0
  1812. data/ext/tree-sitter/tree-sitter/src/compiler/syntax_grammar.h +52 -0
  1813. data/ext/tree-sitter/tree-sitter/src/compiler/util/hash_combine.h +24 -0
  1814. data/ext/tree-sitter/tree-sitter/src/compiler/util/string_helpers.cc +54 -0
  1815. data/ext/tree-sitter/tree-sitter/src/compiler/util/string_helpers.h +19 -0
  1816. data/ext/tree-sitter/tree-sitter/src/compiler/variable.cc +11 -0
  1817. data/ext/tree-sitter/tree-sitter/src/compiler/variable.h +27 -0
  1818. data/ext/tree-sitter/tree-sitter/src/runtime/alloc.h +85 -0
  1819. data/ext/tree-sitter/tree-sitter/src/runtime/array.h +137 -0
  1820. data/ext/tree-sitter/tree-sitter/src/runtime/document.c +152 -0
  1821. data/ext/tree-sitter/tree-sitter/src/runtime/document.h +17 -0
  1822. data/ext/tree-sitter/tree-sitter/src/runtime/error_costs.c +28 -0
  1823. data/ext/tree-sitter/tree-sitter/src/runtime/error_costs.h +25 -0
  1824. data/ext/tree-sitter/tree-sitter/src/runtime/language.c +56 -0
  1825. data/ext/tree-sitter/tree-sitter/src/runtime/language.h +70 -0
  1826. data/ext/tree-sitter/tree-sitter/src/runtime/length.h +59 -0
  1827. data/ext/tree-sitter/tree-sitter/src/runtime/lexer.c +131 -0
  1828. data/ext/tree-sitter/tree-sitter/src/runtime/lexer.h +40 -0
  1829. data/ext/tree-sitter/tree-sitter/src/runtime/node.c +393 -0
  1830. data/ext/tree-sitter/tree-sitter/src/runtime/node.h +8 -0
  1831. data/ext/tree-sitter/tree-sitter/src/runtime/parser.c +1227 -0
  1832. data/ext/tree-sitter/tree-sitter/src/runtime/parser.h +41 -0
  1833. data/ext/tree-sitter/tree-sitter/src/runtime/point.h +46 -0
  1834. data/ext/tree-sitter/tree-sitter/src/runtime/reduce_action.h +32 -0
  1835. data/ext/tree-sitter/tree-sitter/src/runtime/reusable_node.h +50 -0
  1836. data/ext/tree-sitter/tree-sitter/src/runtime/stack.c +658 -0
  1837. data/ext/tree-sitter/tree-sitter/src/runtime/stack.h +130 -0
  1838. data/ext/tree-sitter/tree-sitter/src/runtime/string_input.c +50 -0
  1839. data/ext/tree-sitter/tree-sitter/src/runtime/string_input.h +17 -0
  1840. data/ext/tree-sitter/tree-sitter/src/runtime/tree.c +551 -0
  1841. data/ext/tree-sitter/tree-sitter/src/runtime/tree.h +117 -0
  1842. data/ext/tree-sitter/tree-sitter/src/runtime/tree_path.h +217 -0
  1843. data/ext/tree-sitter/tree-sitter/src/runtime/utf16.c +24 -0
  1844. data/ext/tree-sitter/tree-sitter/src/runtime/utf16.h +20 -0
  1845. data/ext/tree-sitter/tree-sitter/tests.Makefile +6 -0
  1846. data/ext/tree-sitter/tree-sitter/tests.gyp +58 -0
  1847. data/ext/tree-sitter/tree-sitter/tests.target.mk +176 -0
  1848. data/lib/tree-sitter.rb +11 -0
  1849. data/lib/tree-sitter/version.rb +3 -0
  1850. data/test/test_helper.rb +9 -0
  1851. data/test/tree-sitter/fixtures/arithmetic/grammar.json +67 -0
  1852. data/test/tree-sitter/fixtures/ruby/grammar.json +4803 -0
  1853. data/test/tree-sitter/test_basic.rb +7 -0
  1854. data/test/tree-sitter/test_document.rb +7 -0
  1855. data/test/tree-sitter/test_grammar.rb +34 -0
  1856. data/tree-sitter.gemspec +33 -0
  1857. metadata +2018 -0
@@ -0,0 +1,2825 @@
1
+ /*
2
+ * The Lean Mean C++ Option Parser
3
+ *
4
+ * Copyright (C) 2012 Matthias S. Benkmann
5
+ *
6
+ * The "Software" in the following 2 paragraphs refers to this file containing
7
+ * the code to The Lean Mean C++ Option Parser.
8
+ * The "Software" does NOT refer to any other files which you
9
+ * may have received alongside this file (e.g. as part of a larger project that
10
+ * incorporates The Lean Mean C++ Option Parser).
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software, to deal in the Software without restriction, including
14
+ * without limitation the rights to use, copy, modify, merge, publish,
15
+ * distribute, sublicense, and/or sell copies of the Software, and to permit
16
+ * persons to whom the Software is furnished to do so, subject to the following
17
+ * conditions:
18
+ * The above copyright notice and this permission notice shall be included in
19
+ * all copies or substantial portions of the Software.
20
+ *
21
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ * SOFTWARE.
28
+ */
29
+
30
+ /*
31
+ * NOTE: It is recommended that you read the processed HTML doxygen documentation
32
+ * rather than this source. If you don't know doxygen, it's like javadoc for C++.
33
+ * If you don't want to install doxygen you can find a copy of the processed
34
+ * documentation at
35
+ *
36
+ * http://optionparser.sourceforge.net/
37
+ *
38
+ */
39
+
40
+ /**
41
+ * @file
42
+ *
43
+ * @brief This is the only file required to use The Lean Mean C++ Option Parser.
44
+ * Just \#include it and you're set.
45
+ *
46
+ * The Lean Mean C++ Option Parser handles the program's command line arguments
47
+ * (argc, argv).
48
+ * It supports the short and long option formats of getopt(), getopt_long()
49
+ * and getopt_long_only() but has a more convenient interface.
50
+ * The following features set it apart from other option parsers:
51
+ *
52
+ * @par Highlights:
53
+ * <ul style="padding-left:1em;margin-left:0">
54
+ * <li> It is a header-only library. Just <code>\#include "optionparser.h"</code> and you're set.
55
+ * <li> It is freestanding. There are no dependencies whatsoever, not even the
56
+ * C or C++ standard library.
57
+ * <li> It has a usage message formatter that supports column alignment and
58
+ * line wrapping. This aids localization because it adapts to
59
+ * translated strings that are shorter or longer (even if they contain
60
+ * Asian wide characters).
61
+ * <li> Unlike getopt() and derivatives it doesn't force you to loop through
62
+ * options sequentially. Instead you can access options directly like this:
63
+ * <ul style="margin-top:.5em">
64
+ * <li> Test for presence of a switch in the argument vector:
65
+ * @code if ( options[QUIET] ) ... @endcode
66
+ * <li> Evaluate --enable-foo/--disable-foo pair where the last one used wins:
67
+ * @code if ( options[FOO].last()->type() == DISABLE ) ... @endcode
68
+ * <li> Cumulative option (-v verbose, -vv more verbose, -vvv even more verbose):
69
+ * @code int verbosity = options[VERBOSE].count(); @endcode
70
+ * <li> Iterate over all --file=&lt;fname> arguments:
71
+ * @code for (Option* opt = options[FILE]; opt; opt = opt->next())
72
+ * fname = opt->arg; ... @endcode
73
+ * <li> If you really want to, you can still process all arguments in order:
74
+ * @code
75
+ * for (int i = 0; i < p.optionsCount(); ++i) {
76
+ * Option& opt = buffer[i];
77
+ * switch(opt.index()) {
78
+ * case HELP: ...
79
+ * case VERBOSE: ...
80
+ * case FILE: fname = opt.arg; ...
81
+ * case UNKNOWN: ...
82
+ * @endcode
83
+ * </ul>
84
+ * </ul> @n
85
+ * Despite these features the code size remains tiny.
86
+ * It is smaller than <a href="http://uclibc.org">uClibc</a>'s GNU getopt() and just a
87
+ * couple 100 bytes larger than uClibc's SUSv3 getopt(). @n
88
+ * (This does not include the usage formatter, of course. But you don't have to use that.)
89
+ *
90
+ * @par Download:
91
+ * Tarball with examples and test programs:
92
+ * <a style="font-size:larger;font-weight:bold" href="http://sourceforge.net/projects/optionparser/files/optionparser-1.3.tar.gz/download">optionparser-1.3.tar.gz</a> @n
93
+ * Just the header (this is all you really need):
94
+ * <a style="font-size:larger;font-weight:bold" href="http://optionparser.sourceforge.net/optionparser.h">optionparser.h</a>
95
+ *
96
+ * @par Changelog:
97
+ * <b>Version 1.3:</b> Compatible with Microsoft Visual C++. @n
98
+ * <b>Version 1.2:</b> Added @ref option::Option::namelen "Option::namelen" and removed the extraction
99
+ * of short option characters into a special buffer. @n
100
+ * Changed @ref option::Arg::Optional "Arg::Optional" to accept arguments if they are attached
101
+ * rather than separate. This is what GNU getopt() does and how POSIX recommends
102
+ * utilities should interpret their arguments.@n
103
+ * <b>Version 1.1:</b> Optional mode with argument reordering as done by GNU getopt(), so that
104
+ * options and non-options can be mixed. See
105
+ * @ref option::Parser::parse() "Parser::parse()".
106
+ *
107
+ * @par Feedback:
108
+ * Send questions, bug reports, feature requests etc. to: <tt><b>optionparser-feedback<span id="antispam">&nbsp;(a)&nbsp;</span>lists.sourceforge.net</b></tt>
109
+ * @htmlonly <script type="text/javascript">document.getElementById("antispam").innerHTML="@"</script> @endhtmlonly
110
+ *
111
+ *
112
+ * @par Example program:
113
+ * (Note: @c option::* identifiers are links that take you to their documentation.)
114
+ * @code
115
+ * #include <iostream>
116
+ * #include "optionparser.h"
117
+ *
118
+ * enum optionIndex { UNKNOWN, HELP, PLUS };
119
+ * const option::Descriptor usage[] =
120
+ * {
121
+ * {UNKNOWN, 0,"" , "" ,option::Arg::None, "USAGE: example [options]\n\n"
122
+ * "Options:" },
123
+ * {HELP, 0,"" , "help",option::Arg::None, " --help \tPrint usage and exit." },
124
+ * {PLUS, 0,"p", "plus",option::Arg::None, " --plus, -p \tIncrement count." },
125
+ * {UNKNOWN, 0,"" , "" ,option::Arg::None, "\nExamples:\n"
126
+ * " example --unknown -- --this_is_no_option\n"
127
+ * " example -unk --plus -ppp file1 file2\n" },
128
+ * {0,0,0,0,0,0}
129
+ * };
130
+ *
131
+ * int main(int argc, char* argv[])
132
+ * {
133
+ * argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present
134
+ * option::Stats stats(usage, argc, argv);
135
+ * option::Option options[stats.options_max], buffer[stats.buffer_max];
136
+ * option::Parser parse(usage, argc, argv, options, buffer);
137
+ *
138
+ * if (parse.error())
139
+ * return 1;
140
+ *
141
+ * if (options[HELP] || argc == 0) {
142
+ * option::printUsage(std::cout, usage);
143
+ * return 0;
144
+ * }
145
+ *
146
+ * std::cout << "--plus count: " <<
147
+ * options[PLUS].count() << "\n";
148
+ *
149
+ * for (option::Option* opt = options[UNKNOWN]; opt; opt = opt->next())
150
+ * std::cout << "Unknown option: " << opt->name << "\n";
151
+ *
152
+ * for (int i = 0; i < parse.nonOptionsCount(); ++i)
153
+ * std::cout << "Non-option #" << i << ": " << parse.nonOption(i) << "\n";
154
+ * }
155
+ * @endcode
156
+ *
157
+ * @par Option syntax:
158
+ * @li The Lean Mean C++ Option Parser follows POSIX <code>getopt()</code> conventions and supports
159
+ * GNU-style <code>getopt_long()</code> long options as well as Perl-style single-minus
160
+ * long options (<code>getopt_long_only()</code>).
161
+ * @li short options have the format @c -X where @c X is any character that fits in a char.
162
+ * @li short options can be grouped, i.e. <code>-X -Y</code> is equivalent to @c -XY.
163
+ * @li a short option may take an argument either separate (<code>-X foo</code>) or
164
+ * attached (@c -Xfoo). You can make the parser accept the additional format @c -X=foo by
165
+ * registering @c X as a long option (in addition to being a short option) and
166
+ * enabling single-minus long options.
167
+ * @li an argument-taking short option may be grouped if it is the last in the group, e.g.
168
+ * @c -ABCXfoo or <code> -ABCX foo </code> (@c foo is the argument to the @c -X option).
169
+ * @li a lone minus character @c '-' is not treated as an option. It is customarily used where
170
+ * a file name is expected to refer to stdin or stdout.
171
+ * @li long options have the format @c --option-name.
172
+ * @li the option-name of a long option can be anything and include any characters.
173
+ * Even @c = characters will work, but don't do that.
174
+ * @li [optional] long options may be abbreviated as long as the abbreviation is unambiguous.
175
+ * You can set a minimum length for abbreviations.
176
+ * @li [optional] long options may begin with a single minus. The double minus form is always
177
+ * accepted, too.
178
+ * @li a long option may take an argument either separate (<code> --option arg </code>) or
179
+ * attached (<code> --option=arg </code>). In the attached form the equals sign is mandatory.
180
+ * @li an empty string can be passed as an attached long option argument: <code> --option-name= </code>.
181
+ * Note the distinction between an empty string as argument and no argument at all.
182
+ * @li an empty string is permitted as separate argument to both long and short options.
183
+ * @li Arguments to both short and long options may start with a @c '-' character. E.g.
184
+ * <code> -X-X </code>, <code>-X -X</code> or <code> --long-X=-X </code>. If @c -X
185
+ * and @c --long-X take an argument, that argument will be @c "-X" in all 3 cases.
186
+ * @li If using the built-in @ref option::Arg::Optional "Arg::Optional", optional arguments must
187
+ * be attached.
188
+ * @li the special option @c -- (i.e. without a name) terminates the list of
189
+ * options. Everything that follows is a non-option argument, even if it starts with
190
+ * a @c '-' character. The @c -- itself will not appear in the parse results.
191
+ * @li the first argument that doesn't start with @c '-' or @c '--' and does not belong to
192
+ * a preceding argument-taking option, will terminate the option list and is the
193
+ * first non-option argument. All following command line arguments are treated as
194
+ * non-option arguments, even if they start with @c '-' . @n
195
+ * NOTE: This behaviour is mandated by POSIX, but GNU getopt() only honours this if it is
196
+ * explicitly requested (e.g. by setting POSIXLY_CORRECT). @n
197
+ * You can enable the GNU behaviour by passing @c true as first argument to
198
+ * e.g. @ref option::Parser::parse() "Parser::parse()".
199
+ * @li Arguments that look like options (i.e. @c '-' followed by at least 1 character) but
200
+ * aren't, are NOT treated as non-option arguments. They are treated as unknown options and
201
+ * are collected into a list of unknown options for error reporting. @n
202
+ * This means that in order to pass a first non-option
203
+ * argument beginning with the minus character it is required to use the
204
+ * @c -- special option, e.g.
205
+ * @code
206
+ * program -x -- --strange-filename
207
+ * @endcode
208
+ * In this example, @c --strange-filename is a non-option argument. If the @c --
209
+ * were omitted, it would be treated as an unknown option. @n
210
+ * See @ref option::Descriptor::longopt for information on how to collect unknown options.
211
+ *
212
+ */
213
+
214
+ #ifndef OPTIONPARSER_H_
215
+ #define OPTIONPARSER_H_
216
+
217
+ /** @brief The namespace of The Lean Mean C++ Option Parser. */
218
+ namespace option
219
+ {
220
+
221
+ #ifdef _MSC_VER
222
+ #include <intrin.h>
223
+ #pragma intrinsic(_BitScanReverse)
224
+ struct MSC_Builtin_CLZ
225
+ {
226
+ static int builtin_clz(unsigned x)
227
+ {
228
+ unsigned long index;
229
+ _BitScanReverse(&index, x);
230
+ return 32-index; // int is always 32bit on Windows, even for target x64
231
+ }
232
+ };
233
+ #define __builtin_clz(x) MSC_Builtin_CLZ::builtin_clz(x)
234
+
235
+ #pragma warning( push )
236
+ #pragma warning( disable: 4510 )
237
+ #pragma warning( disable: 4512 )
238
+ #pragma warning( disable: 4610 )
239
+ #pragma warning( disable: 4127 )
240
+ #endif
241
+
242
+ class Option;
243
+
244
+ /**
245
+ * @brief Possible results when checking if an argument is valid for a certain option.
246
+ *
247
+ * In the case that no argument is provided for an option that takes an
248
+ * optional argument, return codes @c ARG_OK and @c ARG_IGNORE are equivalent.
249
+ */
250
+ enum ArgStatus
251
+ {
252
+ //! The option does not take an argument.
253
+ ARG_NONE,
254
+ //! The argument is acceptable for the option.
255
+ ARG_OK,
256
+ //! The argument is not acceptable but that's non-fatal because the option's argument is optional.
257
+ ARG_IGNORE,
258
+ //! The argument is not acceptable and that's fatal.
259
+ ARG_ILLEGAL
260
+ };
261
+
262
+ /**
263
+ * @brief Signature of functions that check if an argument is valid for a certain type of option.
264
+ *
265
+ * Every Option has such a function assigned in its Descriptor.
266
+ * @code
267
+ * Descriptor usage[] = { {UNKNOWN, 0, "", "", Arg::None, ""}, ... };
268
+ * @endcode
269
+ *
270
+ * A CheckArg function has the following signature:
271
+ * @code ArgStatus CheckArg(const Option& option, bool msg); @endcode
272
+ *
273
+ * It is used to check if a potential argument would be acceptable for the option.
274
+ * It will even be called if there is no argument. In that case @c option.arg will be @c NULL.
275
+ *
276
+ * If @c msg is @c true and the function determines that an argument is not acceptable and
277
+ * that this is a fatal error, it should output a message to the user before
278
+ * returning @ref ARG_ILLEGAL. If @c msg is @c false the function should remain silent (or you
279
+ * will get duplicate messages).
280
+ *
281
+ * See @ref ArgStatus for the meaning of the return values.
282
+ *
283
+ * While you can provide your own functions,
284
+ * often the following pre-defined checks (which never return @ref ARG_ILLEGAL) will suffice:
285
+ *
286
+ * @li @c Arg::None @copybrief Arg::None
287
+ * @li @c Arg::Optional @copybrief Arg::Optional
288
+ *
289
+ */
290
+ typedef ArgStatus (*CheckArg)(const Option& option, bool msg);
291
+
292
+ /**
293
+ * @brief Describes an option, its help text (usage) and how it should be parsed.
294
+ *
295
+ * The main input when constructing an option::Parser is an array of Descriptors.
296
+
297
+ * @par Example:
298
+ * @code
299
+ * enum OptionIndex {CREATE, ...};
300
+ * enum OptionType {DISABLE, ENABLE, OTHER};
301
+ *
302
+ * const option::Descriptor usage[] = {
303
+ * { CREATE, // index
304
+ * OTHER, // type
305
+ * "c", // shortopt
306
+ * "create", // longopt
307
+ * Arg::None, // check_arg
308
+ * "--create Tells the program to create something." // help
309
+ * }
310
+ * , ...
311
+ * };
312
+ * @endcode
313
+ */
314
+ struct Descriptor
315
+ {
316
+ /**
317
+ * @brief Index of this option's linked list in the array filled in by the parser.
318
+ *
319
+ * Command line options whose Descriptors have the same index will end up in the same
320
+ * linked list in the order in which they appear on the command line. If you have
321
+ * multiple long option aliases that refer to the same option, give their descriptors
322
+ * the same @c index.
323
+ *
324
+ * If you have options that mean exactly opposite things
325
+ * (e.g. @c --enable-foo and @c --disable-foo ), you should also give them the same
326
+ * @c index, but distinguish them through different values for @ref type.
327
+ * That way they end up in the same list and you can just take the last element of the
328
+ * list and use its type. This way you get the usual behaviour where switches later
329
+ * on the command line override earlier ones without having to code it manually.
330
+ *
331
+ * @par Tip:
332
+ * Use an enum rather than plain ints for better readability, as shown in the example
333
+ * at Descriptor.
334
+ */
335
+ const unsigned index;
336
+
337
+ /**
338
+ * @brief Used to distinguish between options with the same @ref index.
339
+ * See @ref index for details.
340
+ *
341
+ * It is recommended that you use an enum rather than a plain int to make your
342
+ * code more readable.
343
+ */
344
+ const int type;
345
+
346
+ /**
347
+ * @brief Each char in this string will be accepted as a short option character.
348
+ *
349
+ * The string must not include the minus character @c '-' or you'll get undefined
350
+ * behaviour.
351
+ *
352
+ * If this Descriptor should not have short option characters, use the empty
353
+ * string "". NULL is not permitted here!
354
+ *
355
+ * See @ref longopt for more information.
356
+ */
357
+ const char* const shortopt;
358
+
359
+ /**
360
+ * @brief The long option name (without the leading @c -- ).
361
+ *
362
+ * If this Descriptor should not have a long option name, use the empty
363
+ * string "". NULL is not permitted here!
364
+ *
365
+ * While @ref shortopt allows multiple short option characters, each
366
+ * Descriptor can have only a single long option name. If you have multiple
367
+ * long option names referring to the same option use separate Descriptors
368
+ * that have the same @ref index and @ref type. You may repeat
369
+ * short option characters in such an alias Descriptor but there's no need to.
370
+ *
371
+ * @par Dummy Descriptors:
372
+ * You can use dummy Descriptors with an
373
+ * empty string for both @ref shortopt and @ref longopt to add text to
374
+ * the usage that is not related to a specific option. See @ref help.
375
+ * The first dummy Descriptor will be used for unknown options (see below).
376
+ *
377
+ * @par Unknown Option Descriptor:
378
+ * The first dummy Descriptor in the list of Descriptors,
379
+ * whose @ref shortopt and @ref longopt are both the empty string, will be used
380
+ * as the Descriptor for unknown options. An unknown option is a string in
381
+ * the argument vector that is not a lone minus @c '-' but starts with a minus
382
+ * character and does not match any Descriptor's @ref shortopt or @ref longopt. @n
383
+ * Note that the dummy descriptor's @ref check_arg function @e will be called and
384
+ * its return value will be evaluated as usual. I.e. if it returns @ref ARG_ILLEGAL
385
+ * the parsing will be aborted with <code>Parser::error()==true</code>. @n
386
+ * if @c check_arg does not return @ref ARG_ILLEGAL the descriptor's
387
+ * @ref index @e will be used to pick the linked list into which
388
+ * to put the unknown option. @n
389
+ * If there is no dummy descriptor, unknown options will be dropped silently.
390
+ *
391
+ */
392
+ const char* const longopt;
393
+
394
+ /**
395
+ * @brief For each option that matches @ref shortopt or @ref longopt this function
396
+ * will be called to check a potential argument to the option.
397
+ *
398
+ * This function will be called even if there is no potential argument. In that case
399
+ * it will be passed @c NULL as @c arg parameter. Do not confuse this with the empty
400
+ * string.
401
+ *
402
+ * See @ref CheckArg for more information.
403
+ */
404
+ const CheckArg check_arg;
405
+
406
+ /**
407
+ * @brief The usage text associated with the options in this Descriptor.
408
+ *
409
+ * You can use option::printUsage() to format your usage message based on
410
+ * the @c help texts. You can use dummy Descriptors where
411
+ * @ref shortopt and @ref longopt are both the empty string to add text to
412
+ * the usage that is not related to a specific option.
413
+ *
414
+ * See option::printUsage() for special formatting characters you can use in
415
+ * @c help to get a column layout.
416
+ *
417
+ * @attention
418
+ * Must be UTF-8-encoded. If your compiler supports C++11 you can use the "u8"
419
+ * prefix to make sure string literals are properly encoded.
420
+ */
421
+ const char* help;
422
+ };
423
+
424
+ /**
425
+ * @brief A parsed option from the command line together with its argument if it has one.
426
+ *
427
+ * The Parser chains all parsed options with the same Descriptor::index together
428
+ * to form a linked list. This allows you to easily implement all of the common ways
429
+ * of handling repeated options and enable/disable pairs.
430
+ *
431
+ * @li Test for presence of a switch in the argument vector:
432
+ * @code if ( options[QUIET] ) ... @endcode
433
+ * @li Evaluate --enable-foo/--disable-foo pair where the last one used wins:
434
+ * @code if ( options[FOO].last()->type() == DISABLE ) ... @endcode
435
+ * @li Cumulative option (-v verbose, -vv more verbose, -vvv even more verbose):
436
+ * @code int verbosity = options[VERBOSE].count(); @endcode
437
+ * @li Iterate over all --file=&lt;fname> arguments:
438
+ * @code for (Option* opt = options[FILE]; opt; opt = opt->next())
439
+ * fname = opt->arg; ... @endcode
440
+ */
441
+ class Option
442
+ {
443
+ Option* next_;
444
+ Option* prev_;
445
+ public:
446
+ /**
447
+ * @brief Pointer to this Option's Descriptor.
448
+ *
449
+ * Remember that the first dummy descriptor (see @ref Descriptor::longopt) is used
450
+ * for unknown options.
451
+ *
452
+ * @attention
453
+ * @c desc==NULL signals that this Option is unused. This is the default state of
454
+ * elements in the result array. You don't need to test @c desc explicitly. You
455
+ * can simply write something like this:
456
+ * @code
457
+ * if (options[CREATE])
458
+ * {
459
+ * ...
460
+ * }
461
+ * @endcode
462
+ * This works because of <code> operator const Option*() </code>.
463
+ */
464
+ const Descriptor* desc;
465
+
466
+ /**
467
+ * @brief The name of the option as used on the command line.
468
+ *
469
+ * The main purpose of this string is to be presented to the user in messages.
470
+ *
471
+ * In the case of a long option, this is the actual @c argv pointer, i.e. the first
472
+ * character is a '-'. In the case of a short option this points to the option
473
+ * character within the @c argv string.
474
+ *
475
+ * Note that in the case of a short option group or an attached option argument, this
476
+ * string will contain additional characters following the actual name. Use @ref namelen
477
+ * to filter out the actual option name only.
478
+ *
479
+ */
480
+ const char* name;
481
+
482
+ /**
483
+ * @brief Pointer to this Option's argument (if any).
484
+ *
485
+ * NULL if this option has no argument. Do not confuse this with the empty string which
486
+ * is a valid argument.
487
+ */
488
+ const char* arg;
489
+
490
+ /**
491
+ * @brief The length of the option @ref name.
492
+ *
493
+ * Because @ref name points into the actual @c argv string, the option name may be
494
+ * followed by more characters (e.g. other short options in the same short option group).
495
+ * This value is the number of bytes (not characters!) that are part of the actual name.
496
+ *
497
+ * For a short option, this length is always 1. For a long option this length is always
498
+ * at least 2 if single minus long options are permitted and at least 3 if they are disabled.
499
+ *
500
+ * @note
501
+ * In the pathological case of a minus within a short option group (e.g. @c -xf-z), this
502
+ * length is incorrect, because this case will be misinterpreted as a long option and the
503
+ * name will therefore extend to the string's 0-terminator or a following '=" character
504
+ * if there is one. This is irrelevant for most uses of @ref name and @c namelen. If you
505
+ * really need to distinguish the case of a long and a short option, compare @ref name to
506
+ * the @c argv pointers. A long option's @c name is always identical to one of them,
507
+ * whereas a short option's is never.
508
+ */
509
+ int namelen;
510
+
511
+ /**
512
+ * @brief Returns Descriptor::type of this Option's Descriptor, or 0 if this Option
513
+ * is invalid (unused).
514
+ *
515
+ * Because this method (and last(), too) can be used even on unused Options with desc==0, you can (provided
516
+ * you arrange your types properly) switch on type() without testing validity first.
517
+ * @code
518
+ * enum OptionType { UNUSED=0, DISABLED=0, ENABLED=1 };
519
+ * enum OptionIndex { FOO };
520
+ * const Descriptor usage[] = {
521
+ * { FOO, ENABLED, "", "enable-foo", Arg::None, 0 },
522
+ * { FOO, DISABLED, "", "disable-foo", Arg::None, 0 },
523
+ * { 0, 0, 0, 0, 0, 0 } };
524
+ * ...
525
+ * switch(options[FOO].last()->type()) // no validity check required!
526
+ * {
527
+ * case ENABLED: ...
528
+ * case DISABLED: ... // UNUSED==DISABLED !
529
+ * }
530
+ * @endcode
531
+ */
532
+ int type() const
533
+ {
534
+ return desc == 0 ? 0 : desc->type;
535
+ }
536
+
537
+ /**
538
+ * @brief Returns Descriptor::index of this Option's Descriptor, or -1 if this Option
539
+ * is invalid (unused).
540
+ */
541
+ int index() const
542
+ {
543
+ return desc == 0 ? -1 : desc->index;
544
+ }
545
+
546
+ /**
547
+ * @brief Returns the number of times this Option (or others with the same Descriptor::index)
548
+ * occurs in the argument vector.
549
+ *
550
+ * This corresponds to the number of elements in the linked list this Option is part of.
551
+ * It doesn't matter on which element you call count(). The return value is always the same.
552
+ *
553
+ * Use this to implement cumulative options, such as -v, -vv, -vvv for
554
+ * different verbosity levels.
555
+ *
556
+ * Returns 0 when called for an unused/invalid option.
557
+ */
558
+ int count()
559
+ {
560
+ int c = (desc == 0 ? 0 : 1);
561
+ Option* p = first();
562
+ while (!p->isLast())
563
+ {
564
+ ++c;
565
+ p = p->next_;
566
+ };
567
+ return c;
568
+ }
569
+
570
+ /**
571
+ * @brief Returns true iff this is the first element of the linked list.
572
+ *
573
+ * The first element in the linked list is the first option on the command line
574
+ * that has the respective Descriptor::index value.
575
+ *
576
+ * Returns true for an unused/invalid option.
577
+ */
578
+ bool isFirst() const
579
+ {
580
+ return isTagged(prev_);
581
+ }
582
+
583
+ /**
584
+ * @brief Returns true iff this is the last element of the linked list.
585
+ *
586
+ * The last element in the linked list is the last option on the command line
587
+ * that has the respective Descriptor::index value.
588
+ *
589
+ * Returns true for an unused/invalid option.
590
+ */
591
+ bool isLast() const
592
+ {
593
+ return isTagged(next_);
594
+ }
595
+
596
+ /**
597
+ * @brief Returns a pointer to the first element of the linked list.
598
+ *
599
+ * Use this when you want the first occurrence of an option on the command line to
600
+ * take precedence. Note that this is not the way most programs handle options.
601
+ * You should probably be using last() instead.
602
+ *
603
+ * @note
604
+ * This method may be called on an unused/invalid option and will return a pointer to the
605
+ * option itself.
606
+ */
607
+ Option* first()
608
+ {
609
+ Option* p = this;
610
+ while (!p->isFirst())
611
+ p = p->prev_;
612
+ return p;
613
+ }
614
+
615
+ /**
616
+ * @brief Returns a pointer to the last element of the linked list.
617
+ *
618
+ * Use this when you want the last occurrence of an option on the command line to
619
+ * take precedence. This is the most common way of handling conflicting options.
620
+ *
621
+ * @note
622
+ * This method may be called on an unused/invalid option and will return a pointer to the
623
+ * option itself.
624
+ *
625
+ * @par Tip:
626
+ * If you have options with opposite meanings (e.g. @c --enable-foo and @c --disable-foo), you
627
+ * can assign them the same Descriptor::index to get them into the same list. Distinguish them by
628
+ * Descriptor::type and all you have to do is check <code> last()->type() </code> to get
629
+ * the state listed last on the command line.
630
+ */
631
+ Option* last()
632
+ {
633
+ return first()->prevwrap();
634
+ }
635
+
636
+ /**
637
+ * @brief Returns a pointer to the previous element of the linked list or NULL if
638
+ * called on first().
639
+ *
640
+ * If called on first() this method returns NULL. Otherwise it will return the
641
+ * option with the same Descriptor::index that precedes this option on the command
642
+ * line.
643
+ */
644
+ Option* prev()
645
+ {
646
+ return isFirst() ? 0 : prev_;
647
+ }
648
+
649
+ /**
650
+ * @brief Returns a pointer to the previous element of the linked list with wrap-around from
651
+ * first() to last().
652
+ *
653
+ * If called on first() this method returns last(). Otherwise it will return the
654
+ * option with the same Descriptor::index that precedes this option on the command
655
+ * line.
656
+ */
657
+ Option* prevwrap()
658
+ {
659
+ return untag(prev_);
660
+ }
661
+
662
+ /**
663
+ * @brief Returns a pointer to the next element of the linked list or NULL if called
664
+ * on last().
665
+ *
666
+ * If called on last() this method returns NULL. Otherwise it will return the
667
+ * option with the same Descriptor::index that follows this option on the command
668
+ * line.
669
+ */
670
+ Option* next()
671
+ {
672
+ return isLast() ? 0 : next_;
673
+ }
674
+
675
+ /**
676
+ * @brief Returns a pointer to the next element of the linked list with wrap-around from
677
+ * last() to first().
678
+ *
679
+ * If called on last() this method returns first(). Otherwise it will return the
680
+ * option with the same Descriptor::index that follows this option on the command
681
+ * line.
682
+ */
683
+ Option* nextwrap()
684
+ {
685
+ return untag(next_);
686
+ }
687
+
688
+ /**
689
+ * @brief Makes @c new_last the new last() by chaining it into the list after last().
690
+ *
691
+ * It doesn't matter which element you call append() on. The new element will always
692
+ * be appended to last().
693
+ *
694
+ * @attention
695
+ * @c new_last must not yet be part of a list, or that list will become corrupted, because
696
+ * this method does not unchain @c new_last from an existing list.
697
+ */
698
+ void append(Option* new_last)
699
+ {
700
+ Option* p = last();
701
+ Option* f = first();
702
+ p->next_ = new_last;
703
+ new_last->prev_ = p;
704
+ new_last->next_ = tag(f);
705
+ f->prev_ = tag(new_last);
706
+ }
707
+
708
+ /**
709
+ * @brief Casts from Option to const Option* but only if this Option is valid.
710
+ *
711
+ * If this Option is valid (i.e. @c desc!=NULL), returns this.
712
+ * Otherwise returns NULL. This allows testing an Option directly
713
+ * in an if-clause to see if it is used:
714
+ * @code
715
+ * if (options[CREATE])
716
+ * {
717
+ * ...
718
+ * }
719
+ * @endcode
720
+ * It also allows you to write loops like this:
721
+ * @code for (Option* opt = options[FILE]; opt; opt = opt->next())
722
+ * fname = opt->arg; ... @endcode
723
+ */
724
+ operator const Option*() const
725
+ {
726
+ return desc ? this : 0;
727
+ }
728
+
729
+ /**
730
+ * @brief Casts from Option to Option* but only if this Option is valid.
731
+ *
732
+ * If this Option is valid (i.e. @c desc!=NULL), returns this.
733
+ * Otherwise returns NULL. This allows testing an Option directly
734
+ * in an if-clause to see if it is used:
735
+ * @code
736
+ * if (options[CREATE])
737
+ * {
738
+ * ...
739
+ * }
740
+ * @endcode
741
+ * It also allows you to write loops like this:
742
+ * @code for (Option* opt = options[FILE]; opt; opt = opt->next())
743
+ * fname = opt->arg; ... @endcode
744
+ */
745
+ operator Option*()
746
+ {
747
+ return desc ? this : 0;
748
+ }
749
+
750
+ /**
751
+ * @brief Creates a new Option that is a one-element linked list and has NULL
752
+ * @ref desc, @ref name, @ref arg and @ref namelen.
753
+ */
754
+ Option() :
755
+ desc(0), name(0), arg(0), namelen(0)
756
+ {
757
+ prev_ = tag(this);
758
+ next_ = tag(this);
759
+ }
760
+
761
+ /**
762
+ * @brief Creates a new Option that is a one-element linked list and has the given
763
+ * values for @ref desc, @ref name and @ref arg.
764
+ *
765
+ * If @c name_ points at a character other than '-' it will be assumed to refer to a
766
+ * short option and @ref namelen will be set to 1. Otherwise the length will extend to
767
+ * the first '=' character or the string's 0-terminator.
768
+ */
769
+ Option(const Descriptor* desc_, const char* name_, const char* arg_)
770
+ {
771
+ init(desc_, name_, arg_);
772
+ }
773
+
774
+ /**
775
+ * @brief Makes @c *this a copy of @c orig except for the linked list pointers.
776
+ *
777
+ * After this operation @c *this will be a one-element linked list.
778
+ */
779
+ void operator=(const Option& orig)
780
+ {
781
+ init(orig.desc, orig.name, orig.arg);
782
+ }
783
+
784
+ /**
785
+ * @brief Makes @c *this a copy of @c orig except for the linked list pointers.
786
+ *
787
+ * After this operation @c *this will be a one-element linked list.
788
+ */
789
+ Option(const Option& orig)
790
+ {
791
+ init(orig.desc, orig.name, orig.arg);
792
+ }
793
+
794
+ private:
795
+ /**
796
+ * @internal
797
+ * @brief Sets the fields of this Option to the given values (extracting @c name if necessary).
798
+ *
799
+ * If @c name_ points at a character other than '-' it will be assumed to refer to a
800
+ * short option and @ref namelen will be set to 1. Otherwise the length will extend to
801
+ * the first '=' character or the string's 0-terminator.
802
+ */
803
+ void init(const Descriptor* desc_, const char* name_, const char* arg_)
804
+ {
805
+ desc = desc_;
806
+ name = name_;
807
+ arg = arg_;
808
+ prev_ = tag(this);
809
+ next_ = tag(this);
810
+ namelen = 0;
811
+ if (name == 0)
812
+ return;
813
+ namelen = 1;
814
+ if (name[0] != '-')
815
+ return;
816
+ while (name[namelen] != 0 && name[namelen] != '=')
817
+ ++namelen;
818
+ }
819
+
820
+ static Option* tag(Option* ptr)
821
+ {
822
+ return (Option*) ((unsigned long long) ptr | 1);
823
+ }
824
+
825
+ static Option* untag(Option* ptr)
826
+ {
827
+ return (Option*) ((unsigned long long) ptr & ~1ull);
828
+ }
829
+
830
+ static bool isTagged(Option* ptr)
831
+ {
832
+ return ((unsigned long long) ptr & 1);
833
+ }
834
+ };
835
+
836
+ /**
837
+ * @brief Functions for checking the validity of option arguments.
838
+ *
839
+ * @copydetails CheckArg
840
+ *
841
+ * The following example code
842
+ * can serve as starting place for writing your own more complex CheckArg functions:
843
+ * @code
844
+ * struct Arg: public option::Arg
845
+ * {
846
+ * static void printError(const char* msg1, const option::Option& opt, const char* msg2)
847
+ * {
848
+ * fprintf(stderr, "ERROR: %s", msg1);
849
+ * fwrite(opt.name, opt.namelen, 1, stderr);
850
+ * fprintf(stderr, "%s", msg2);
851
+ * }
852
+ *
853
+ * static option::ArgStatus Unknown(const option::Option& option, bool msg)
854
+ * {
855
+ * if (msg) printError("Unknown option '", option, "'\n");
856
+ * return option::ARG_ILLEGAL;
857
+ * }
858
+ *
859
+ * static option::ArgStatus Required(const option::Option& option, bool msg)
860
+ * {
861
+ * if (option.arg != 0)
862
+ * return option::ARG_OK;
863
+ *
864
+ * if (msg) printError("Option '", option, "' requires an argument\n");
865
+ * return option::ARG_ILLEGAL;
866
+ * }
867
+ *
868
+ * static option::ArgStatus NonEmpty(const option::Option& option, bool msg)
869
+ * {
870
+ * if (option.arg != 0 && option.arg[0] != 0)
871
+ * return option::ARG_OK;
872
+ *
873
+ * if (msg) printError("Option '", option, "' requires a non-empty argument\n");
874
+ * return option::ARG_ILLEGAL;
875
+ * }
876
+ *
877
+ * static option::ArgStatus Numeric(const option::Option& option, bool msg)
878
+ * {
879
+ * char* endptr = 0;
880
+ * if (option.arg != 0 && strtol(option.arg, &endptr, 10)){};
881
+ * if (endptr != option.arg && *endptr == 0)
882
+ * return option::ARG_OK;
883
+ *
884
+ * if (msg) printError("Option '", option, "' requires a numeric argument\n");
885
+ * return option::ARG_ILLEGAL;
886
+ * }
887
+ * };
888
+ * @endcode
889
+ */
890
+ struct Arg
891
+ {
892
+ //! @brief For options that don't take an argument: Returns ARG_NONE.
893
+ static ArgStatus None(const Option&, bool)
894
+ {
895
+ return ARG_NONE;
896
+ }
897
+
898
+ //! @brief Returns ARG_OK if the argument is attached and ARG_IGNORE otherwise.
899
+ static ArgStatus Optional(const Option& option, bool)
900
+ {
901
+ if (option.arg && option.name[option.namelen] != 0)
902
+ return ARG_OK;
903
+ else
904
+ return ARG_IGNORE;
905
+ }
906
+ };
907
+
908
+ /**
909
+ * @brief Determines the minimum lengths of the buffer and options arrays used for Parser.
910
+ *
911
+ * Because Parser doesn't use dynamic memory its output arrays have to be pre-allocated.
912
+ * If you don't want to use fixed size arrays (which may turn out too small, causing
913
+ * command line arguments to be dropped), you can use Stats to determine the correct sizes.
914
+ * Stats work cumulative. You can first pass in your default options and then the real
915
+ * options and afterwards the counts will reflect the union.
916
+ */
917
+ struct Stats
918
+ {
919
+ /**
920
+ * @brief Number of elements needed for a @c buffer[] array to be used for
921
+ * @ref Parser::parse() "parsing" the same argument vectors that were fed
922
+ * into this Stats object.
923
+ *
924
+ * @note
925
+ * This number is always 1 greater than the actual number needed, to give
926
+ * you a sentinel element.
927
+ */
928
+ unsigned buffer_max;
929
+
930
+ /**
931
+ * @brief Number of elements needed for an @c options[] array to be used for
932
+ * @ref Parser::parse() "parsing" the same argument vectors that were fed
933
+ * into this Stats object.
934
+ *
935
+ * @note
936
+ * @li This number is always 1 greater than the actual number needed, to give
937
+ * you a sentinel element.
938
+ * @li This number depends only on the @c usage, not the argument vectors, because
939
+ * the @c options array needs exactly one slot for each possible Descriptor::index.
940
+ */
941
+ unsigned options_max;
942
+
943
+ /**
944
+ * @brief Creates a Stats object with counts set to 1 (for the sentinel element).
945
+ */
946
+ Stats() :
947
+ buffer_max(1), options_max(1) // 1 more than necessary as sentinel
948
+ {
949
+ }
950
+
951
+ /**
952
+ * @brief Creates a new Stats object and immediately updates it for the
953
+ * given @c usage and argument vector. You may pass 0 for @c argc and/or @c argv,
954
+ * if you just want to update @ref options_max.
955
+ *
956
+ * @note
957
+ * The calls to Stats methods must match the later calls to Parser methods.
958
+ * See Parser::parse() for the meaning of the arguments.
959
+ */
960
+ Stats(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, //
961
+ bool single_minus_longopt = false) :
962
+ buffer_max(1), options_max(1) // 1 more than necessary as sentinel
963
+ {
964
+ add(gnu, usage, argc, argv, min_abbr_len, single_minus_longopt);
965
+ }
966
+
967
+ //! @brief Stats(...) with non-const argv.
968
+ Stats(bool gnu, const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, //
969
+ bool single_minus_longopt = false) :
970
+ buffer_max(1), options_max(1) // 1 more than necessary as sentinel
971
+ {
972
+ add(gnu, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt);
973
+ }
974
+
975
+ //! @brief POSIX Stats(...) (gnu==false).
976
+ Stats(const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, //
977
+ bool single_minus_longopt = false) :
978
+ buffer_max(1), options_max(1) // 1 more than necessary as sentinel
979
+ {
980
+ add(false, usage, argc, argv, min_abbr_len, single_minus_longopt);
981
+ }
982
+
983
+ //! @brief POSIX Stats(...) (gnu==false) with non-const argv.
984
+ Stats(const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, //
985
+ bool single_minus_longopt = false) :
986
+ buffer_max(1), options_max(1) // 1 more than necessary as sentinel
987
+ {
988
+ add(false, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt);
989
+ }
990
+
991
+ /**
992
+ * @brief Updates this Stats object for the
993
+ * given @c usage and argument vector. You may pass 0 for @c argc and/or @c argv,
994
+ * if you just want to update @ref options_max.
995
+ *
996
+ * @note
997
+ * The calls to Stats methods must match the later calls to Parser methods.
998
+ * See Parser::parse() for the meaning of the arguments.
999
+ */
1000
+ void add(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, //
1001
+ bool single_minus_longopt = false);
1002
+
1003
+ //! @brief add() with non-const argv.
1004
+ void add(bool gnu, const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, //
1005
+ bool single_minus_longopt = false)
1006
+ {
1007
+ add(gnu, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt);
1008
+ }
1009
+
1010
+ //! @brief POSIX add() (gnu==false).
1011
+ void add(const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, //
1012
+ bool single_minus_longopt = false)
1013
+ {
1014
+ add(false, usage, argc, argv, min_abbr_len, single_minus_longopt);
1015
+ }
1016
+
1017
+ //! @brief POSIX add() (gnu==false) with non-const argv.
1018
+ void add(const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, //
1019
+ bool single_minus_longopt = false)
1020
+ {
1021
+ add(false, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt);
1022
+ }
1023
+ private:
1024
+ class CountOptionsAction;
1025
+ };
1026
+
1027
+ /**
1028
+ * @brief Checks argument vectors for validity and parses them into data
1029
+ * structures that are easier to work with.
1030
+ *
1031
+ * @par Example:
1032
+ * @code
1033
+ * int main(int argc, char* argv[])
1034
+ * {
1035
+ * argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present
1036
+ * option::Stats stats(usage, argc, argv);
1037
+ * option::Option options[stats.options_max], buffer[stats.buffer_max];
1038
+ * option::Parser parse(usage, argc, argv, options, buffer);
1039
+ *
1040
+ * if (parse.error())
1041
+ * return 1;
1042
+ *
1043
+ * if (options[HELP])
1044
+ * ...
1045
+ * @endcode
1046
+ */
1047
+ class Parser
1048
+ {
1049
+ int op_count; //!< @internal @brief see optionsCount()
1050
+ int nonop_count; //!< @internal @brief see nonOptionsCount()
1051
+ const char** nonop_args; //!< @internal @brief see nonOptions()
1052
+ bool err; //!< @internal @brief see error()
1053
+ public:
1054
+
1055
+ /**
1056
+ * @brief Creates a new Parser.
1057
+ */
1058
+ Parser() :
1059
+ op_count(0), nonop_count(0), nonop_args(0), err(false)
1060
+ {
1061
+ }
1062
+
1063
+ /**
1064
+ * @brief Creates a new Parser and immediately parses the given argument vector.
1065
+ * @copydetails parse()
1066
+ */
1067
+ Parser(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[],
1068
+ int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) :
1069
+ op_count(0), nonop_count(0), nonop_args(0), err(false)
1070
+ {
1071
+ parse(gnu, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1072
+ }
1073
+
1074
+ //! @brief Parser(...) with non-const argv.
1075
+ Parser(bool gnu, const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[],
1076
+ int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) :
1077
+ op_count(0), nonop_count(0), nonop_args(0), err(false)
1078
+ {
1079
+ parse(gnu, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1080
+ }
1081
+
1082
+ //! @brief POSIX Parser(...) (gnu==false).
1083
+ Parser(const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], int min_abbr_len = 0,
1084
+ bool single_minus_longopt = false, int bufmax = -1) :
1085
+ op_count(0), nonop_count(0), nonop_args(0), err(false)
1086
+ {
1087
+ parse(false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1088
+ }
1089
+
1090
+ //! @brief POSIX Parser(...) (gnu==false) with non-const argv.
1091
+ Parser(const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], int min_abbr_len = 0,
1092
+ bool single_minus_longopt = false, int bufmax = -1) :
1093
+ op_count(0), nonop_count(0), nonop_args(0), err(false)
1094
+ {
1095
+ parse(false, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1096
+ }
1097
+
1098
+ /**
1099
+ * @brief Parses the given argument vector.
1100
+ *
1101
+ * @param gnu if true, parse() will not stop at the first non-option argument. Instead it will
1102
+ * reorder arguments so that all non-options are at the end. This is the default behaviour
1103
+ * of GNU getopt() but is not conforming to POSIX. @n
1104
+ * Note, that once the argument vector has been reordered, the @c gnu flag will have
1105
+ * no further effect on this argument vector. So it is enough to pass @c gnu==true when
1106
+ * creating Stats.
1107
+ * @param usage Array of Descriptor objects that describe the options to support. The last entry
1108
+ * of this array must have 0 in all fields.
1109
+ * @param argc The number of elements from @c argv that are to be parsed. If you pass -1, the number
1110
+ * will be determined automatically. In that case the @c argv list must end with a NULL
1111
+ * pointer.
1112
+ * @param argv The arguments to be parsed. If you pass -1 as @c argc the last pointer in the @c argv
1113
+ * list must be NULL to mark the end.
1114
+ * @param options Each entry is the first element of a linked list of Options. Each new option
1115
+ * that is parsed will be appended to the list specified by that Option's
1116
+ * Descriptor::index. If an entry is not yet used (i.e. the Option is invalid),
1117
+ * it will be replaced rather than appended to. @n
1118
+ * The minimum length of this array is the greatest Descriptor::index value that
1119
+ * occurs in @c usage @e PLUS ONE.
1120
+ * @param buffer Each argument that is successfully parsed (including unknown arguments, if they
1121
+ * have a Descriptor whose CheckArg does not return @ref ARG_ILLEGAL) will be stored in this
1122
+ * array. parse() scans the array for the first invalid entry and begins writing at that
1123
+ * index. You can pass @c bufmax to limit the number of options stored.
1124
+ * @param min_abbr_len Passing a value <code> min_abbr_len > 0 </code> enables abbreviated long
1125
+ * options. The parser will match a prefix of a long option as if it was
1126
+ * the full long option (e.g. @c --foob=10 will be interpreted as if it was
1127
+ * @c --foobar=10 ), as long as the prefix has at least @c min_abbr_len characters
1128
+ * (not counting the @c -- ) and is unambiguous.
1129
+ * @n Be careful if combining @c min_abbr_len=1 with @c single_minus_longopt=true
1130
+ * because the ambiguity check does not consider short options and abbreviated
1131
+ * single minus long options will take precedence over short options.
1132
+ * @param single_minus_longopt Passing @c true for this option allows long options to begin with
1133
+ * a single minus. The double minus form will still be recognized. Note that
1134
+ * single minus long options take precedence over short options and short option
1135
+ * groups. E.g. @c -file would be interpreted as @c --file and not as
1136
+ * <code> -f -i -l -e </code> (assuming a long option named @c "file" exists).
1137
+ * @param bufmax The greatest index in the @c buffer[] array that parse() will write to is
1138
+ * @c bufmax-1. If there are more options, they will be processed (in particular
1139
+ * their CheckArg will be called) but not stored. @n
1140
+ * If you used Stats::buffer_max to dimension this array, you can pass
1141
+ * -1 (or not pass @c bufmax at all) which tells parse() that the buffer is
1142
+ * "large enough".
1143
+ * @attention
1144
+ * Remember that @c options and @c buffer store Option @e objects, not pointers. Therefore it
1145
+ * is not possible for the same object to be in both arrays. For those options that are found in
1146
+ * both @c buffer[] and @c options[] the respective objects are independent copies. And only the
1147
+ * objects in @c options[] are properly linked via Option::next() and Option::prev().
1148
+ * You can iterate over @c buffer[] to
1149
+ * process all options in the order they appear in the argument vector, but if you want access to
1150
+ * the other Options with the same Descriptor::index, then you @e must access the linked list via
1151
+ * @c options[]. You can get the linked list in options from a buffer object via something like
1152
+ * @c options[buffer[i].index()].
1153
+ */
1154
+ void parse(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[],
1155
+ int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1);
1156
+
1157
+ //! @brief parse() with non-const argv.
1158
+ void parse(bool gnu, const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[],
1159
+ int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1)
1160
+ {
1161
+ parse(gnu, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1162
+ }
1163
+
1164
+ //! @brief POSIX parse() (gnu==false).
1165
+ void parse(const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[],
1166
+ int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1)
1167
+ {
1168
+ parse(false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1169
+ }
1170
+
1171
+ //! @brief POSIX parse() (gnu==false) with non-const argv.
1172
+ void parse(const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], int min_abbr_len = 0,
1173
+ bool single_minus_longopt = false, int bufmax = -1)
1174
+ {
1175
+ parse(false, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax);
1176
+ }
1177
+
1178
+ /**
1179
+ * @brief Returns the number of valid Option objects in @c buffer[].
1180
+ *
1181
+ * @note
1182
+ * @li The returned value always reflects the number of Options in the buffer[] array used for
1183
+ * the most recent call to parse().
1184
+ * @li The count (and the buffer[]) includes unknown options if they are collected
1185
+ * (see Descriptor::longopt).
1186
+ */
1187
+ int optionsCount()
1188
+ {
1189
+ return op_count;
1190
+ }
1191
+
1192
+ /**
1193
+ * @brief Returns the number of non-option arguments that remained at the end of the
1194
+ * most recent parse() that actually encountered non-option arguments.
1195
+ *
1196
+ * @note
1197
+ * A parse() that does not encounter non-option arguments will leave this value
1198
+ * as well as nonOptions() undisturbed. This means you can feed the Parser a
1199
+ * default argument vector that contains non-option arguments (e.g. a default filename).
1200
+ * Then you feed it the actual arguments from the user. If the user has supplied at
1201
+ * least one non-option argument, all of the non-option arguments from the default
1202
+ * disappear and are replaced by the user's non-option arguments. However, if the
1203
+ * user does not supply any non-option arguments the defaults will still be in
1204
+ * effect.
1205
+ */
1206
+ int nonOptionsCount()
1207
+ {
1208
+ return nonop_count;
1209
+ }
1210
+
1211
+ /**
1212
+ * @brief Returns a pointer to an array of non-option arguments (only valid
1213
+ * if <code>nonOptionsCount() >0 </code>).
1214
+ *
1215
+ * @note
1216
+ * @li parse() does not copy arguments, so this pointer points into the actual argument
1217
+ * vector as passed to parse().
1218
+ * @li As explained at nonOptionsCount() this pointer is only changed by parse() calls
1219
+ * that actually encounter non-option arguments. A parse() call that encounters only
1220
+ * options, will not change nonOptions().
1221
+ */
1222
+ const char** nonOptions()
1223
+ {
1224
+ return nonop_args;
1225
+ }
1226
+
1227
+ /**
1228
+ * @brief Returns <b><code>nonOptions()[i]</code></b> (@e without checking if i is in range!).
1229
+ */
1230
+ const char* nonOption(int i)
1231
+ {
1232
+ return nonOptions()[i];
1233
+ }
1234
+
1235
+ /**
1236
+ * @brief Returns @c true if an unrecoverable error occurred while parsing options.
1237
+ *
1238
+ * An illegal argument to an option (i.e. CheckArg returns @ref ARG_ILLEGAL) is an
1239
+ * unrecoverable error that aborts the parse. Unknown options are only an error if
1240
+ * their CheckArg function returns @ref ARG_ILLEGAL. Otherwise they are collected.
1241
+ * In that case if you want to exit the program if either an illegal argument
1242
+ * or an unknown option has been passed, use code like this
1243
+ *
1244
+ * @code
1245
+ * if (parser.error() || options[UNKNOWN])
1246
+ * exit(1);
1247
+ * @endcode
1248
+ *
1249
+ */
1250
+ bool error()
1251
+ {
1252
+ return err;
1253
+ }
1254
+
1255
+ private:
1256
+ friend struct Stats;
1257
+ class StoreOptionAction;
1258
+ struct Action;
1259
+
1260
+ /**
1261
+ * @internal
1262
+ * @brief This is the core function that does all the parsing.
1263
+ * @retval false iff an unrecoverable error occurred.
1264
+ */
1265
+ static bool workhorse(bool gnu, const Descriptor usage[], int numargs, const char** args, Action& action,
1266
+ bool single_minus_longopt, bool print_errors, int min_abbr_len);
1267
+
1268
+ /**
1269
+ * @internal
1270
+ * @brief Returns true iff @c st1 is a prefix of @c st2 and
1271
+ * in case @c st2 is longer than @c st1, then
1272
+ * the first additional character is '='.
1273
+ *
1274
+ * @par Examples:
1275
+ * @code
1276
+ * streq("foo", "foo=bar") == true
1277
+ * streq("foo", "foobar") == false
1278
+ * streq("foo", "foo") == true
1279
+ * streq("foo=bar", "foo") == false
1280
+ * @endcode
1281
+ */
1282
+ static bool streq(const char* st1, const char* st2)
1283
+ {
1284
+ while (*st1 != 0)
1285
+ if (*st1++ != *st2++)
1286
+ return false;
1287
+ return (*st2 == 0 || *st2 == '=');
1288
+ }
1289
+
1290
+ /**
1291
+ * @internal
1292
+ * @brief Like streq() but handles abbreviations.
1293
+ *
1294
+ * Returns true iff @c st1 and @c st2 have a common
1295
+ * prefix with the following properties:
1296
+ * @li (if min > 0) its length is at least @c min characters or the same length as @c st1 (whichever is smaller).
1297
+ * @li (if min <= 0) its length is the same as that of @c st1
1298
+ * @li within @c st2 the character following the common prefix is either '=' or end-of-string.
1299
+ *
1300
+ * Examples:
1301
+ * @code
1302
+ * streqabbr("foo", "foo=bar",<anything>) == true
1303
+ * streqabbr("foo", "fo=bar" , 2) == true
1304
+ * streqabbr("foo", "fo" , 2) == true
1305
+ * streqabbr("foo", "fo" , 0) == false
1306
+ * streqabbr("foo", "f=bar" , 2) == false
1307
+ * streqabbr("foo", "f" , 2) == false
1308
+ * streqabbr("fo" , "foo=bar",<anything>) == false
1309
+ * streqabbr("foo", "foobar" ,<anything>) == false
1310
+ * streqabbr("foo", "fobar" ,<anything>) == false
1311
+ * streqabbr("foo", "foo" ,<anything>) == true
1312
+ * @endcode
1313
+ */
1314
+ static bool streqabbr(const char* st1, const char* st2, long long min)
1315
+ {
1316
+ const char* st1start = st1;
1317
+ while (*st1 != 0 && (*st1 == *st2))
1318
+ {
1319
+ ++st1;
1320
+ ++st2;
1321
+ }
1322
+
1323
+ return (*st1 == 0 || (min > 0 && (st1 - st1start) >= min)) && (*st2 == 0 || *st2 == '=');
1324
+ }
1325
+
1326
+ /**
1327
+ * @internal
1328
+ * @brief Returns true iff character @c ch is contained in the string @c st.
1329
+ *
1330
+ * Returns @c true for @c ch==0 .
1331
+ */
1332
+ static bool instr(char ch, const char* st)
1333
+ {
1334
+ while (*st != 0 && *st != ch)
1335
+ ++st;
1336
+ return *st == ch;
1337
+ }
1338
+
1339
+ /**
1340
+ * @internal
1341
+ * @brief Rotates <code>args[-count],...,args[-1],args[0]</code> to become
1342
+ * <code>args[0],args[-count],...,args[-1]</code>.
1343
+ */
1344
+ static void shift(const char** args, int count)
1345
+ {
1346
+ for (int i = 0; i > -count; --i)
1347
+ {
1348
+ const char* temp = args[i];
1349
+ args[i] = args[i - 1];
1350
+ args[i - 1] = temp;
1351
+ }
1352
+ }
1353
+ };
1354
+
1355
+ /**
1356
+ * @internal
1357
+ * @brief Interface for actions Parser::workhorse() should perform for each Option it
1358
+ * parses.
1359
+ */
1360
+ struct Parser::Action
1361
+ {
1362
+ /**
1363
+ * @brief Called by Parser::workhorse() for each Option that has been successfully
1364
+ * parsed (including unknown
1365
+ * options if they have a Descriptor whose Descriptor::check_arg does not return
1366
+ * @ref ARG_ILLEGAL.
1367
+ *
1368
+ * Returns @c false iff a fatal error has occured and the parse should be aborted.
1369
+ */
1370
+ virtual bool perform(Option&)
1371
+ {
1372
+ return true;
1373
+ }
1374
+
1375
+ /**
1376
+ * @brief Called by Parser::workhorse() after finishing the parse.
1377
+ * @param numargs the number of non-option arguments remaining
1378
+ * @param args pointer to the first remaining non-option argument (if numargs > 0).
1379
+ *
1380
+ * @return
1381
+ * @c false iff a fatal error has occurred.
1382
+ */
1383
+ virtual bool finished(int numargs, const char** args)
1384
+ {
1385
+ (void) numargs;
1386
+ (void) args;
1387
+ return true;
1388
+ }
1389
+ };
1390
+
1391
+ /**
1392
+ * @internal
1393
+ * @brief An Action to pass to Parser::workhorse() that will increment a counter for
1394
+ * each parsed Option.
1395
+ */
1396
+ class Stats::CountOptionsAction: public Parser::Action
1397
+ {
1398
+ unsigned* buffer_max;
1399
+ public:
1400
+ /**
1401
+ * Creates a new CountOptionsAction that will increase @c *buffer_max_ for each
1402
+ * parsed Option.
1403
+ */
1404
+ CountOptionsAction(unsigned* buffer_max_) :
1405
+ buffer_max(buffer_max_)
1406
+ {
1407
+ }
1408
+
1409
+ bool perform(Option&)
1410
+ {
1411
+ if (*buffer_max == 0x7fffffff)
1412
+ return false; // overflow protection: don't accept number of options that doesn't fit signed int
1413
+ ++*buffer_max;
1414
+ return true;
1415
+ }
1416
+ };
1417
+
1418
+ /**
1419
+ * @internal
1420
+ * @brief An Action to pass to Parser::workhorse() that will store each parsed Option in
1421
+ * appropriate arrays (see Parser::parse()).
1422
+ */
1423
+ class Parser::StoreOptionAction: public Parser::Action
1424
+ {
1425
+ Parser& parser;
1426
+ Option* options;
1427
+ Option* buffer;
1428
+ int bufmax; //! Number of slots in @c buffer. @c -1 means "large enough".
1429
+ public:
1430
+ /**
1431
+ * @brief Creates a new StoreOption action.
1432
+ * @param parser_ the parser whose op_count should be updated.
1433
+ * @param options_ each Option @c o is chained into the linked list @c options_[o.desc->index]
1434
+ * @param buffer_ each Option is appended to this array as long as there's a free slot.
1435
+ * @param bufmax_ number of slots in @c buffer_. @c -1 means "large enough".
1436
+ */
1437
+ StoreOptionAction(Parser& parser_, Option options_[], Option buffer_[], int bufmax_) :
1438
+ parser(parser_), options(options_), buffer(buffer_), bufmax(bufmax_)
1439
+ {
1440
+ // find first empty slot in buffer (if any)
1441
+ int bufidx = 0;
1442
+ while ((bufmax < 0 || bufidx < bufmax) && buffer[bufidx])
1443
+ ++bufidx;
1444
+
1445
+ // set parser's optionCount
1446
+ parser.op_count = bufidx;
1447
+ }
1448
+
1449
+ bool perform(Option& option)
1450
+ {
1451
+ if (bufmax < 0 || parser.op_count < bufmax)
1452
+ {
1453
+ if (parser.op_count == 0x7fffffff)
1454
+ return false; // overflow protection: don't accept number of options that doesn't fit signed int
1455
+
1456
+ buffer[parser.op_count] = option;
1457
+ int idx = buffer[parser.op_count].desc->index;
1458
+ if (options[idx])
1459
+ options[idx].append(buffer[parser.op_count]);
1460
+ else
1461
+ options[idx] = buffer[parser.op_count];
1462
+ ++parser.op_count;
1463
+ }
1464
+ return true; // NOTE: an option that is discarded because of a full buffer is not fatal
1465
+ }
1466
+
1467
+ bool finished(int numargs, const char** args)
1468
+ {
1469
+ // only overwrite non-option argument list if there's at least 1
1470
+ // new non-option argument. Otherwise we keep the old list. This
1471
+ // makes it easy to use default non-option arguments.
1472
+ if (numargs > 0)
1473
+ {
1474
+ parser.nonop_count = numargs;
1475
+ parser.nonop_args = args;
1476
+ }
1477
+
1478
+ return true;
1479
+ }
1480
+ };
1481
+
1482
+ inline void Parser::parse(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[],
1483
+ Option buffer[], int min_abbr_len, bool single_minus_longopt, int bufmax)
1484
+ {
1485
+ StoreOptionAction action(*this, options, buffer, bufmax);
1486
+ err = !workhorse(gnu, usage, argc, argv, action, single_minus_longopt, true, min_abbr_len);
1487
+ }
1488
+
1489
+ inline void Stats::add(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len,
1490
+ bool single_minus_longopt)
1491
+ {
1492
+ // determine size of options array. This is the greatest index used in the usage + 1
1493
+ int i = 0;
1494
+ while (usage[i].shortopt != 0)
1495
+ {
1496
+ if (usage[i].index + 1 >= options_max)
1497
+ options_max = (usage[i].index + 1) + 1; // 1 more than necessary as sentinel
1498
+
1499
+ ++i;
1500
+ }
1501
+
1502
+ CountOptionsAction action(&buffer_max);
1503
+ Parser::workhorse(gnu, usage, argc, argv, action, single_minus_longopt, false, min_abbr_len);
1504
+ }
1505
+
1506
+ inline bool Parser::workhorse(bool gnu, const Descriptor usage[], int numargs, const char** args, Action& action,
1507
+ bool single_minus_longopt, bool print_errors, int min_abbr_len)
1508
+ {
1509
+ // protect against NULL pointer
1510
+ if (args == 0)
1511
+ numargs = 0;
1512
+
1513
+ int nonops = 0;
1514
+
1515
+ while (numargs != 0 && *args != 0)
1516
+ {
1517
+ const char* param = *args; // param can be --long-option, -srto or non-option argument
1518
+
1519
+ // in POSIX mode the first non-option argument terminates the option list
1520
+ // a lone minus character is a non-option argument
1521
+ if (param[0] != '-' || param[1] == 0)
1522
+ {
1523
+ if (gnu)
1524
+ {
1525
+ ++nonops;
1526
+ ++args;
1527
+ if (numargs > 0)
1528
+ --numargs;
1529
+ continue;
1530
+ }
1531
+ else
1532
+ break;
1533
+ }
1534
+
1535
+ // -- terminates the option list. The -- itself is skipped.
1536
+ if (param[1] == '-' && param[2] == 0)
1537
+ {
1538
+ shift(args, nonops);
1539
+ ++args;
1540
+ if (numargs > 0)
1541
+ --numargs;
1542
+ break;
1543
+ }
1544
+
1545
+ bool handle_short_options;
1546
+ const char* longopt_name;
1547
+ if (param[1] == '-') // if --long-option
1548
+ {
1549
+ handle_short_options = false;
1550
+ longopt_name = param + 2;
1551
+ }
1552
+ else
1553
+ {
1554
+ handle_short_options = true;
1555
+ longopt_name = param + 1; //for testing a potential -long-option
1556
+ }
1557
+
1558
+ bool try_single_minus_longopt = single_minus_longopt;
1559
+ bool have_more_args = (numargs > 1 || numargs < 0); // is referencing argv[1] valid?
1560
+
1561
+ do // loop over short options in group, for long options the body is executed only once
1562
+ {
1563
+ int idx = 0;
1564
+
1565
+ const char* optarg = 0;
1566
+
1567
+ /******************** long option **********************/
1568
+ if (handle_short_options == false || try_single_minus_longopt)
1569
+ {
1570
+ idx = 0;
1571
+ while (usage[idx].longopt != 0 && !streq(usage[idx].longopt, longopt_name))
1572
+ ++idx;
1573
+
1574
+ if (usage[idx].longopt == 0 && min_abbr_len > 0) // if we should try to match abbreviated long options
1575
+ {
1576
+ int i1 = 0;
1577
+ while (usage[i1].longopt != 0 && !streqabbr(usage[i1].longopt, longopt_name, min_abbr_len))
1578
+ ++i1;
1579
+ if (usage[i1].longopt != 0)
1580
+ { // now test if the match is unambiguous by checking for another match
1581
+ int i2 = i1 + 1;
1582
+ while (usage[i2].longopt != 0 && !streqabbr(usage[i2].longopt, longopt_name, min_abbr_len))
1583
+ ++i2;
1584
+
1585
+ if (usage[i2].longopt == 0) // if there was no second match it's unambiguous, so accept i1 as idx
1586
+ idx = i1;
1587
+ }
1588
+ }
1589
+
1590
+ // if we found something, disable handle_short_options (only relevant if single_minus_longopt)
1591
+ if (usage[idx].longopt != 0)
1592
+ handle_short_options = false;
1593
+
1594
+ try_single_minus_longopt = false; // prevent looking for longopt in the middle of shortopt group
1595
+
1596
+ optarg = longopt_name;
1597
+ while (*optarg != 0 && *optarg != '=')
1598
+ ++optarg;
1599
+ if (*optarg == '=') // attached argument
1600
+ ++optarg;
1601
+ else
1602
+ // possibly detached argument
1603
+ optarg = (have_more_args ? args[1] : 0);
1604
+ }
1605
+
1606
+ /************************ short option ***********************************/
1607
+ if (handle_short_options)
1608
+ {
1609
+ if (*++param == 0) // point at the 1st/next option character
1610
+ break; // end of short option group
1611
+
1612
+ idx = 0;
1613
+ while (usage[idx].shortopt != 0 && !instr(*param, usage[idx].shortopt))
1614
+ ++idx;
1615
+
1616
+ if (param[1] == 0) // if the potential argument is separate
1617
+ optarg = (have_more_args ? args[1] : 0);
1618
+ else
1619
+ // if the potential argument is attached
1620
+ optarg = param + 1;
1621
+ }
1622
+
1623
+ const Descriptor* descriptor = &usage[idx];
1624
+
1625
+ if (descriptor->shortopt == 0) /************** unknown option ********************/
1626
+ {
1627
+ // look for dummy entry (shortopt == "" and longopt == "") to use as Descriptor for unknown options
1628
+ idx = 0;
1629
+ while (usage[idx].shortopt != 0 && (usage[idx].shortopt[0] != 0 || usage[idx].longopt[0] != 0))
1630
+ ++idx;
1631
+ descriptor = (usage[idx].shortopt == 0 ? 0 : &usage[idx]);
1632
+ }
1633
+
1634
+ if (descriptor != 0)
1635
+ {
1636
+ Option option(descriptor, param, optarg);
1637
+ switch (descriptor->check_arg(option, print_errors))
1638
+ {
1639
+ case ARG_ILLEGAL:
1640
+ return false; // fatal
1641
+ case ARG_OK:
1642
+ // skip one element of the argument vector, if it's a separated argument
1643
+ if (optarg != 0 && have_more_args && optarg == args[1])
1644
+ {
1645
+ shift(args, nonops);
1646
+ if (numargs > 0)
1647
+ --numargs;
1648
+ ++args;
1649
+ }
1650
+
1651
+ // No further short options are possible after an argument
1652
+ handle_short_options = false;
1653
+
1654
+ break;
1655
+ case ARG_IGNORE:
1656
+ case ARG_NONE:
1657
+ option.arg = 0;
1658
+ break;
1659
+ }
1660
+
1661
+ if (!action.perform(option))
1662
+ return false;
1663
+ }
1664
+
1665
+ } while (handle_short_options);
1666
+
1667
+ shift(args, nonops);
1668
+ ++args;
1669
+ if (numargs > 0)
1670
+ --numargs;
1671
+
1672
+ } // while
1673
+
1674
+ if (numargs > 0 && *args == 0) // It's a bug in the caller if numargs is greater than the actual number
1675
+ numargs = 0; // of arguments, but as a service to the user we fix this if we spot it.
1676
+
1677
+ if (numargs < 0) // if we don't know the number of remaining non-option arguments
1678
+ { // we need to count them
1679
+ numargs = 0;
1680
+ while (args[numargs] != 0)
1681
+ ++numargs;
1682
+ }
1683
+
1684
+ return action.finished(numargs + nonops, args - nonops);
1685
+ }
1686
+
1687
+ /**
1688
+ * @internal
1689
+ * @brief The implementation of option::printUsage().
1690
+ */
1691
+ struct PrintUsageImplementation
1692
+ {
1693
+ /**
1694
+ * @internal
1695
+ * @brief Interface for Functors that write (part of) a string somewhere.
1696
+ */
1697
+ struct IStringWriter
1698
+ {
1699
+ /**
1700
+ * @brief Writes the given number of chars beginning at the given pointer somewhere.
1701
+ */
1702
+ virtual void operator()(const char*, int)
1703
+ {
1704
+ }
1705
+ };
1706
+
1707
+ /**
1708
+ * @internal
1709
+ * @brief Encapsulates a function with signature <code>func(string, size)</code> where
1710
+ * string can be initialized with a const char* and size with an int.
1711
+ */
1712
+ template<typename Function>
1713
+ struct FunctionWriter: public IStringWriter
1714
+ {
1715
+ Function* write;
1716
+
1717
+ virtual void operator()(const char* str, int size)
1718
+ {
1719
+ (*write)(str, size);
1720
+ }
1721
+
1722
+ FunctionWriter(Function* w) :
1723
+ write(w)
1724
+ {
1725
+ }
1726
+ };
1727
+
1728
+ /**
1729
+ * @internal
1730
+ * @brief Encapsulates a reference to an object with a <code>write(string, size)</code>
1731
+ * method like that of @c std::ostream.
1732
+ */
1733
+ template<typename OStream>
1734
+ struct OStreamWriter: public IStringWriter
1735
+ {
1736
+ OStream& ostream;
1737
+
1738
+ virtual void operator()(const char* str, int size)
1739
+ {
1740
+ ostream.write(str, size);
1741
+ }
1742
+
1743
+ OStreamWriter(OStream& o) :
1744
+ ostream(o)
1745
+ {
1746
+ }
1747
+ };
1748
+
1749
+ /**
1750
+ * @internal
1751
+ * @brief Like OStreamWriter but encapsulates a @c const reference, which is
1752
+ * typically a temporary object of a user class.
1753
+ */
1754
+ template<typename Temporary>
1755
+ struct TemporaryWriter: public IStringWriter
1756
+ {
1757
+ const Temporary& userstream;
1758
+
1759
+ virtual void operator()(const char* str, int size)
1760
+ {
1761
+ userstream.write(str, size);
1762
+ }
1763
+
1764
+ TemporaryWriter(const Temporary& u) :
1765
+ userstream(u)
1766
+ {
1767
+ }
1768
+ };
1769
+
1770
+ /**
1771
+ * @internal
1772
+ * @brief Encapsulates a function with the signature <code>func(fd, string, size)</code> (the
1773
+ * signature of the @c write() system call)
1774
+ * where fd can be initialized from an int, string from a const char* and size from an int.
1775
+ */
1776
+ template<typename Syscall>
1777
+ struct SyscallWriter: public IStringWriter
1778
+ {
1779
+ Syscall* write;
1780
+ int fd;
1781
+
1782
+ virtual void operator()(const char* str, int size)
1783
+ {
1784
+ (*write)(fd, str, size);
1785
+ }
1786
+
1787
+ SyscallWriter(Syscall* w, int f) :
1788
+ write(w), fd(f)
1789
+ {
1790
+ }
1791
+ };
1792
+
1793
+ /**
1794
+ * @internal
1795
+ * @brief Encapsulates a function with the same signature as @c std::fwrite().
1796
+ */
1797
+ template<typename Function, typename Stream>
1798
+ struct StreamWriter: public IStringWriter
1799
+ {
1800
+ Function* fwrite;
1801
+ Stream* stream;
1802
+
1803
+ virtual void operator()(const char* str, int size)
1804
+ {
1805
+ (*fwrite)(str, size, 1, stream);
1806
+ }
1807
+
1808
+ StreamWriter(Function* w, Stream* s) :
1809
+ fwrite(w), stream(s)
1810
+ {
1811
+ }
1812
+ };
1813
+
1814
+ /**
1815
+ * @internal
1816
+ * @brief Sets <code> i1 = max(i1, i2) </code>
1817
+ */
1818
+ static void upmax(int& i1, int i2)
1819
+ {
1820
+ i1 = (i1 >= i2 ? i1 : i2);
1821
+ }
1822
+
1823
+ /**
1824
+ * @internal
1825
+ * @brief Moves the "cursor" to column @c want_x assuming it is currently at column @c x
1826
+ * and sets @c x=want_x .
1827
+ * If <code> x > want_x </code>, a line break is output before indenting.
1828
+ *
1829
+ * @param write Spaces and possibly a line break are written via this functor to get
1830
+ * the desired indentation @c want_x .
1831
+ * @param[in,out] x the current indentation. Set to @c want_x by this method.
1832
+ * @param want_x the desired indentation.
1833
+ */
1834
+ static void indent(IStringWriter& write, int& x, int want_x)
1835
+ {
1836
+ int indent = want_x - x;
1837
+ if (indent < 0)
1838
+ {
1839
+ write("\n", 1);
1840
+ indent = want_x;
1841
+ }
1842
+
1843
+ if (indent > 0)
1844
+ {
1845
+ char space = ' ';
1846
+ for (int i = 0; i < indent; ++i)
1847
+ write(&space, 1);
1848
+ x = want_x;
1849
+ }
1850
+ }
1851
+
1852
+ /**
1853
+ * @brief Returns true if ch is the unicode code point of a wide character.
1854
+ *
1855
+ * @note
1856
+ * The following character ranges are treated as wide
1857
+ * @code
1858
+ * 1100..115F
1859
+ * 2329..232A (just 2 characters!)
1860
+ * 2E80..A4C6 except for 303F
1861
+ * A960..A97C
1862
+ * AC00..D7FB
1863
+ * F900..FAFF
1864
+ * FE10..FE6B
1865
+ * FF01..FF60
1866
+ * FFE0..FFE6
1867
+ * 1B000......
1868
+ * @endcode
1869
+ */
1870
+ static bool isWideChar(unsigned ch)
1871
+ {
1872
+ if (ch == 0x303F)
1873
+ return false;
1874
+
1875
+ return ((0x1100 <= ch && ch <= 0x115F) || (0x2329 <= ch && ch <= 0x232A) || (0x2E80 <= ch && ch <= 0xA4C6)
1876
+ || (0xA960 <= ch && ch <= 0xA97C) || (0xAC00 <= ch && ch <= 0xD7FB) || (0xF900 <= ch && ch <= 0xFAFF)
1877
+ || (0xFE10 <= ch && ch <= 0xFE6B) || (0xFF01 <= ch && ch <= 0xFF60) || (0xFFE0 <= ch && ch <= 0xFFE6)
1878
+ || (0x1B000 <= ch));
1879
+ }
1880
+
1881
+ /**
1882
+ * @internal
1883
+ * @brief Splits a @c Descriptor[] array into tables, rows, lines and columns and
1884
+ * iterates over these components.
1885
+ *
1886
+ * The top-level organizational unit is the @e table.
1887
+ * A table begins at a Descriptor with @c help!=NULL and extends up to
1888
+ * a Descriptor with @c help==NULL.
1889
+ *
1890
+ * A table consists of @e rows. Due to line-wrapping and explicit breaks
1891
+ * a row may take multiple lines on screen. Rows within the table are separated
1892
+ * by \\n. They never cross Descriptor boundaries. This means a row ends either
1893
+ * at \\n or the 0 at the end of the help string.
1894
+ *
1895
+ * A row consists of columns/cells. Columns/cells within a row are separated by \\t.
1896
+ * Line breaks within a cell are marked by \\v.
1897
+ *
1898
+ * Rows in the same table need not have the same number of columns/cells. The
1899
+ * extreme case are interjections, which are rows that contain neither \\t nor \\v.
1900
+ * These are NOT treated specially by LinePartIterator, but they are treated
1901
+ * specially by printUsage().
1902
+ *
1903
+ * LinePartIterator iterates through the usage at 3 levels: table, row and part.
1904
+ * Tables and rows are as described above. A @e part is a line within a cell.
1905
+ * LinePartIterator iterates through 1st parts of all cells, then through the 2nd
1906
+ * parts of all cells (if any),... @n
1907
+ * Example: The row <code> "1 \v 3 \t 2 \v 4" </code> has 2 cells/columns and 4 parts.
1908
+ * The parts will be returned in the order 1, 2, 3, 4.
1909
+ *
1910
+ * It is possible that some cells have fewer parts than others. In this case
1911
+ * LinePartIterator will "fill up" these cells with 0-length parts. IOW, LinePartIterator
1912
+ * always returns the same number of parts for each column. Note that this is different
1913
+ * from the way rows and columns are handled. LinePartIterator does @e not guarantee that
1914
+ * the same number of columns will be returned for each row.
1915
+ *
1916
+ */
1917
+ class LinePartIterator
1918
+ {
1919
+ const Descriptor* tablestart; //!< The 1st descriptor of the current table.
1920
+ const Descriptor* rowdesc; //!< The Descriptor that contains the current row.
1921
+ const char* rowstart; //!< Ptr to 1st character of current row within rowdesc->help.
1922
+ const char* ptr; //!< Ptr to current part within the current row.
1923
+ int col; //!< Index of current column.
1924
+ int len; //!< Length of the current part (that ptr points at) in BYTES
1925
+ int screenlen; //!< Length of the current part in screen columns (taking narrow/wide chars into account).
1926
+ int max_line_in_block; //!< Greatest index of a line within the block. This is the number of \\v within the cell with the most \\vs.
1927
+ int line_in_block; //!< Line index within the current cell of the current part.
1928
+ int target_line_in_block; //!< Line index of the parts we should return to the user on this iteration.
1929
+ bool hit_target_line; //!< Flag whether we encountered a part with line index target_line_in_block in the current cell.
1930
+
1931
+ /**
1932
+ * @brief Determines the byte and character lengths of the part at @ref ptr and
1933
+ * stores them in @ref len and @ref screenlen respectively.
1934
+ */
1935
+ void update_length()
1936
+ {
1937
+ screenlen = 0;
1938
+ for (len = 0; ptr[len] != 0 && ptr[len] != '\v' && ptr[len] != '\t' && ptr[len] != '\n'; ++len)
1939
+ {
1940
+ ++screenlen;
1941
+ unsigned ch = (unsigned char) ptr[len];
1942
+ if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte
1943
+ {
1944
+ // int __builtin_clz (unsigned int x)
1945
+ // Returns the number of leading 0-bits in x, starting at the most significant bit
1946
+ unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff);
1947
+ ch = ch & mask; // mask out length bits, we don't verify their correctness
1948
+ while (((unsigned char) ptr[len + 1] ^ 0x80) <= 0x3F) // while next byte is continuation byte
1949
+ {
1950
+ ch = (ch << 6) ^ (unsigned char) ptr[len + 1] ^ 0x80; // add continuation to char code
1951
+ ++len;
1952
+ }
1953
+ // ch is the decoded unicode code point
1954
+ if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case
1955
+ ++screenlen;
1956
+ }
1957
+ }
1958
+ }
1959
+
1960
+ public:
1961
+ //! @brief Creates an iterator for @c usage.
1962
+ LinePartIterator(const Descriptor usage[]) :
1963
+ tablestart(usage), rowdesc(0), rowstart(0), ptr(0), col(-1), len(0), max_line_in_block(0), line_in_block(0),
1964
+ target_line_in_block(0), hit_target_line(true)
1965
+ {
1966
+ }
1967
+
1968
+ /**
1969
+ * @brief Moves iteration to the next table (if any). Has to be called once on a new
1970
+ * LinePartIterator to move to the 1st table.
1971
+ * @retval false if moving to next table failed because no further table exists.
1972
+ */
1973
+ bool nextTable()
1974
+ {
1975
+ // If this is NOT the first time nextTable() is called after the constructor,
1976
+ // then skip to the next table break (i.e. a Descriptor with help == 0)
1977
+ if (rowdesc != 0)
1978
+ {
1979
+ while (tablestart->help != 0 && tablestart->shortopt != 0)
1980
+ ++tablestart;
1981
+ }
1982
+
1983
+ // Find the next table after the break (if any)
1984
+ while (tablestart->help == 0 && tablestart->shortopt != 0)
1985
+ ++tablestart;
1986
+
1987
+ restartTable();
1988
+ return rowstart != 0;
1989
+ }
1990
+
1991
+ /**
1992
+ * @brief Reset iteration to the beginning of the current table.
1993
+ */
1994
+ void restartTable()
1995
+ {
1996
+ rowdesc = tablestart;
1997
+ rowstart = tablestart->help;
1998
+ ptr = 0;
1999
+ }
2000
+
2001
+ /**
2002
+ * @brief Moves iteration to the next row (if any). Has to be called once after each call to
2003
+ * @ref nextTable() to move to the 1st row of the table.
2004
+ * @retval false if moving to next row failed because no further row exists.
2005
+ */
2006
+ bool nextRow()
2007
+ {
2008
+ if (ptr == 0)
2009
+ {
2010
+ restartRow();
2011
+ return rowstart != 0;
2012
+ }
2013
+
2014
+ while (*ptr != 0 && *ptr != '\n')
2015
+ ++ptr;
2016
+
2017
+ if (*ptr == 0)
2018
+ {
2019
+ if ((rowdesc + 1)->help == 0) // table break
2020
+ return false;
2021
+
2022
+ ++rowdesc;
2023
+ rowstart = rowdesc->help;
2024
+ }
2025
+ else // if (*ptr == '\n')
2026
+ {
2027
+ rowstart = ptr + 1;
2028
+ }
2029
+
2030
+ restartRow();
2031
+ return true;
2032
+ }
2033
+
2034
+ /**
2035
+ * @brief Reset iteration to the beginning of the current row.
2036
+ */
2037
+ void restartRow()
2038
+ {
2039
+ ptr = rowstart;
2040
+ col = -1;
2041
+ len = 0;
2042
+ screenlen = 0;
2043
+ max_line_in_block = 0;
2044
+ line_in_block = 0;
2045
+ target_line_in_block = 0;
2046
+ hit_target_line = true;
2047
+ }
2048
+
2049
+ /**
2050
+ * @brief Moves iteration to the next part (if any). Has to be called once after each call to
2051
+ * @ref nextRow() to move to the 1st part of the row.
2052
+ * @retval false if moving to next part failed because no further part exists.
2053
+ *
2054
+ * See @ref LinePartIterator for details about the iteration.
2055
+ */
2056
+ bool next()
2057
+ {
2058
+ if (ptr == 0)
2059
+ return false;
2060
+
2061
+ if (col == -1)
2062
+ {
2063
+ col = 0;
2064
+ update_length();
2065
+ return true;
2066
+ }
2067
+
2068
+ ptr += len;
2069
+ while (true)
2070
+ {
2071
+ switch (*ptr)
2072
+ {
2073
+ case '\v':
2074
+ upmax(max_line_in_block, ++line_in_block);
2075
+ ++ptr;
2076
+ break;
2077
+ case '\t':
2078
+ if (!hit_target_line) // if previous column did not have the targetline
2079
+ { // then "insert" a 0-length part
2080
+ update_length();
2081
+ hit_target_line = true;
2082
+ return true;
2083
+ }
2084
+
2085
+ hit_target_line = false;
2086
+ line_in_block = 0;
2087
+ ++col;
2088
+ ++ptr;
2089
+ break;
2090
+ case 0:
2091
+ case '\n':
2092
+ if (!hit_target_line) // if previous column did not have the targetline
2093
+ { // then "insert" a 0-length part
2094
+ update_length();
2095
+ hit_target_line = true;
2096
+ return true;
2097
+ }
2098
+
2099
+ if (++target_line_in_block > max_line_in_block)
2100
+ {
2101
+ update_length();
2102
+ return false;
2103
+ }
2104
+
2105
+ hit_target_line = false;
2106
+ line_in_block = 0;
2107
+ col = 0;
2108
+ ptr = rowstart;
2109
+ continue;
2110
+ default:
2111
+ ++ptr;
2112
+ continue;
2113
+ } // switch
2114
+
2115
+ if (line_in_block == target_line_in_block)
2116
+ {
2117
+ update_length();
2118
+ hit_target_line = true;
2119
+ return true;
2120
+ }
2121
+ } // while
2122
+ }
2123
+
2124
+ /**
2125
+ * @brief Returns the index (counting from 0) of the column in which
2126
+ * the part pointed to by @ref data() is located.
2127
+ */
2128
+ int column()
2129
+ {
2130
+ return col;
2131
+ }
2132
+
2133
+ /**
2134
+ * @brief Returns the index (counting from 0) of the line within the current column
2135
+ * this part belongs to.
2136
+ */
2137
+ int line()
2138
+ {
2139
+ return target_line_in_block; // NOT line_in_block !!! It would be wrong if !hit_target_line
2140
+ }
2141
+
2142
+ /**
2143
+ * @brief Returns the length of the part pointed to by @ref data() in raw chars (not UTF-8 characters).
2144
+ */
2145
+ int length()
2146
+ {
2147
+ return len;
2148
+ }
2149
+
2150
+ /**
2151
+ * @brief Returns the width in screen columns of the part pointed to by @ref data().
2152
+ * Takes multi-byte UTF-8 sequences and wide characters into account.
2153
+ */
2154
+ int screenLength()
2155
+ {
2156
+ return screenlen;
2157
+ }
2158
+
2159
+ /**
2160
+ * @brief Returns the current part of the iteration.
2161
+ */
2162
+ const char* data()
2163
+ {
2164
+ return ptr;
2165
+ }
2166
+ };
2167
+
2168
+ /**
2169
+ * @internal
2170
+ * @brief Takes input and line wraps it, writing out one line at a time so that
2171
+ * it can be interleaved with output from other columns.
2172
+ *
2173
+ * The LineWrapper is used to handle the last column of each table as well as interjections.
2174
+ * The LineWrapper is called once for each line of output. If the data given to it fits
2175
+ * into the designated width of the last column it is simply written out. If there
2176
+ * is too much data, an appropriate split point is located and only the data up to this
2177
+ * split point is written out. The rest of the data is queued for the next line.
2178
+ * That way the last column can be line wrapped and interleaved with data from
2179
+ * other columns. The following example makes this clearer:
2180
+ * @code
2181
+ * Column 1,1 Column 2,1 This is a long text
2182
+ * Column 1,2 Column 2,2 that does not fit into
2183
+ * a single line.
2184
+ * @endcode
2185
+ *
2186
+ * The difficulty in producing this output is that the whole string
2187
+ * "This is a long text that does not fit into a single line" is the
2188
+ * 1st and only part of column 3. In order to produce the above
2189
+ * output the string must be output piecemeal, interleaved with
2190
+ * the data from the other columns.
2191
+ */
2192
+ class LineWrapper
2193
+ {
2194
+ static const int bufmask = 15; //!< Must be a power of 2 minus 1.
2195
+ /**
2196
+ * @brief Ring buffer for length component of pair (data, length).
2197
+ */
2198
+ int lenbuf[bufmask + 1];
2199
+ /**
2200
+ * @brief Ring buffer for data component of pair (data, length).
2201
+ */
2202
+ const char* datbuf[bufmask + 1];
2203
+ /**
2204
+ * @brief The indentation of the column to which the LineBuffer outputs. LineBuffer
2205
+ * assumes that the indentation has already been written when @ref process()
2206
+ * is called, so this value is only used when a buffer flush requires writing
2207
+ * additional lines of output.
2208
+ */
2209
+ int x;
2210
+ /**
2211
+ * @brief The width of the column to line wrap.
2212
+ */
2213
+ int width;
2214
+ int head; //!< @brief index for next write
2215
+ int tail; //!< @brief index for next read - 1 (i.e. increment tail BEFORE read)
2216
+
2217
+ /**
2218
+ * @brief Multiple methods of LineWrapper may decide to flush part of the buffer to
2219
+ * free up space. The contract of process() says that only 1 line is output. So
2220
+ * this variable is used to track whether something has output a line. It is
2221
+ * reset at the beginning of process() and checked at the end to decide if
2222
+ * output has already occurred or is still needed.
2223
+ */
2224
+ bool wrote_something;
2225
+
2226
+ bool buf_empty()
2227
+ {
2228
+ return ((tail + 1) & bufmask) == head;
2229
+ }
2230
+
2231
+ bool buf_full()
2232
+ {
2233
+ return tail == head;
2234
+ }
2235
+
2236
+ void buf_store(const char* data, int len)
2237
+ {
2238
+ lenbuf[head] = len;
2239
+ datbuf[head] = data;
2240
+ head = (head + 1) & bufmask;
2241
+ }
2242
+
2243
+ //! @brief Call BEFORE reading ...buf[tail].
2244
+ void buf_next()
2245
+ {
2246
+ tail = (tail + 1) & bufmask;
2247
+ }
2248
+
2249
+ /**
2250
+ * @brief Writes (data,len) into the ring buffer. If the buffer is full, a single line
2251
+ * is flushed out of the buffer into @c write.
2252
+ */
2253
+ void output(IStringWriter& write, const char* data, int len)
2254
+ {
2255
+ if (buf_full())
2256
+ write_one_line(write);
2257
+
2258
+ buf_store(data, len);
2259
+ }
2260
+
2261
+ /**
2262
+ * @brief Writes a single line of output from the buffer to @c write.
2263
+ */
2264
+ void write_one_line(IStringWriter& write)
2265
+ {
2266
+ if (wrote_something) // if we already wrote something, we need to start a new line
2267
+ {
2268
+ write("\n", 1);
2269
+ int _ = 0;
2270
+ indent(write, _, x);
2271
+ }
2272
+
2273
+ if (!buf_empty())
2274
+ {
2275
+ buf_next();
2276
+ write(datbuf[tail], lenbuf[tail]);
2277
+ }
2278
+
2279
+ wrote_something = true;
2280
+ }
2281
+ public:
2282
+
2283
+ /**
2284
+ * @brief Writes out all remaining data from the LineWrapper using @c write.
2285
+ * Unlike @ref process() this method indents all lines including the first and
2286
+ * will output a \\n at the end (but only if something has been written).
2287
+ */
2288
+ void flush(IStringWriter& write)
2289
+ {
2290
+ if (buf_empty())
2291
+ return;
2292
+ int _ = 0;
2293
+ indent(write, _, x);
2294
+ wrote_something = false;
2295
+ while (!buf_empty())
2296
+ write_one_line(write);
2297
+ write("\n", 1);
2298
+ }
2299
+
2300
+ /**
2301
+ * @brief Process, wrap and output the next piece of data.
2302
+ *
2303
+ * process() will output at least one line of output. This is not necessarily
2304
+ * the @c data passed in. It may be data queued from a prior call to process().
2305
+ * If the internal buffer is full, more than 1 line will be output.
2306
+ *
2307
+ * process() assumes that the a proper amount of indentation has already been
2308
+ * output. It won't write any further indentation before the 1st line. If
2309
+ * more than 1 line is written due to buffer constraints, the lines following
2310
+ * the first will be indented by this method, though.
2311
+ *
2312
+ * No \\n is written by this method after the last line that is written.
2313
+ *
2314
+ * @param write where to write the data.
2315
+ * @param data the new chunk of data to write.
2316
+ * @param len the length of the chunk of data to write.
2317
+ */
2318
+ void process(IStringWriter& write, const char* data, int len)
2319
+ {
2320
+ wrote_something = false;
2321
+
2322
+ while (len > 0)
2323
+ {
2324
+ if (len <= width) // quick test that works because utf8width <= len (all wide chars have at least 2 bytes)
2325
+ {
2326
+ output(write, data, len);
2327
+ len = 0;
2328
+ }
2329
+ else // if (len > width) it's possible (but not guaranteed) that utf8len > width
2330
+ {
2331
+ int utf8width = 0;
2332
+ int maxi = 0;
2333
+ while (maxi < len && utf8width < width)
2334
+ {
2335
+ int charbytes = 1;
2336
+ unsigned ch = (unsigned char) data[maxi];
2337
+ if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte
2338
+ {
2339
+ // int __builtin_clz (unsigned int x)
2340
+ // Returns the number of leading 0-bits in x, starting at the most significant bit
2341
+ unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff);
2342
+ ch = ch & mask; // mask out length bits, we don't verify their correctness
2343
+ while ((maxi + charbytes < len) && //
2344
+ (((unsigned char) data[maxi + charbytes] ^ 0x80) <= 0x3F)) // while next byte is continuation byte
2345
+ {
2346
+ ch = (ch << 6) ^ (unsigned char) data[maxi + charbytes] ^ 0x80; // add continuation to char code
2347
+ ++charbytes;
2348
+ }
2349
+ // ch is the decoded unicode code point
2350
+ if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case
2351
+ {
2352
+ if (utf8width + 2 > width)
2353
+ break;
2354
+ ++utf8width;
2355
+ }
2356
+ }
2357
+ ++utf8width;
2358
+ maxi += charbytes;
2359
+ }
2360
+
2361
+ // data[maxi-1] is the last byte of the UTF-8 sequence of the last character that fits
2362
+ // onto the 1st line. If maxi == len, all characters fit on the line.
2363
+
2364
+ if (maxi == len)
2365
+ {
2366
+ output(write, data, len);
2367
+ len = 0;
2368
+ }
2369
+ else // if (maxi < len) at least 1 character (data[maxi] that is) doesn't fit on the line
2370
+ {
2371
+ int i;
2372
+ for (i = maxi; i >= 0; --i)
2373
+ if (data[i] == ' ')
2374
+ break;
2375
+
2376
+ if (i >= 0)
2377
+ {
2378
+ output(write, data, i);
2379
+ data += i + 1;
2380
+ len -= i + 1;
2381
+ }
2382
+ else // did not find a space to split at => split before data[maxi]
2383
+ { // data[maxi] is always the beginning of a character, never a continuation byte
2384
+ output(write, data, maxi);
2385
+ data += maxi;
2386
+ len -= maxi;
2387
+ }
2388
+ }
2389
+ }
2390
+ }
2391
+ if (!wrote_something) // if we didn't already write something to make space in the buffer
2392
+ write_one_line(write); // write at most one line of actual output
2393
+ }
2394
+
2395
+ /**
2396
+ * @brief Constructs a LineWrapper that wraps its output to fit into
2397
+ * screen columns @c x1 (incl.) to @c x2 (excl.).
2398
+ *
2399
+ * @c x1 gives the indentation LineWrapper uses if it needs to indent.
2400
+ */
2401
+ LineWrapper(int x1, int x2) :
2402
+ x(x1), width(x2 - x1), head(0), tail(bufmask)
2403
+ {
2404
+ if (width < 2) // because of wide characters we need at least width 2 or the code breaks
2405
+ width = 2;
2406
+ }
2407
+ };
2408
+
2409
+ /**
2410
+ * @internal
2411
+ * @brief This is the implementation that is shared between all printUsage() templates.
2412
+ * Because all printUsage() templates share this implementation, there is no template bloat.
2413
+ */
2414
+ static void printUsage(IStringWriter& write, const Descriptor usage[], int width = 80, //
2415
+ int last_column_min_percent = 50, int last_column_own_line_max_percent = 75)
2416
+ {
2417
+ if (width < 1) // protect against nonsense values
2418
+ width = 80;
2419
+
2420
+ if (width > 10000) // protect against overflow in the following computation
2421
+ width = 10000;
2422
+
2423
+ int last_column_min_width = ((width * last_column_min_percent) + 50) / 100;
2424
+ int last_column_own_line_max_width = ((width * last_column_own_line_max_percent) + 50) / 100;
2425
+ if (last_column_own_line_max_width == 0)
2426
+ last_column_own_line_max_width = 1;
2427
+
2428
+ LinePartIterator part(usage);
2429
+ while (part.nextTable())
2430
+ {
2431
+
2432
+ /***************** Determine column widths *******************************/
2433
+
2434
+ const int maxcolumns = 8; // 8 columns are enough for everyone
2435
+ int col_width[maxcolumns];
2436
+ int lastcolumn;
2437
+ int leftwidth;
2438
+ int overlong_column_threshold = 10000;
2439
+ do
2440
+ {
2441
+ lastcolumn = 0;
2442
+ for (int i = 0; i < maxcolumns; ++i)
2443
+ col_width[i] = 0;
2444
+
2445
+ part.restartTable();
2446
+ while (part.nextRow())
2447
+ {
2448
+ while (part.next())
2449
+ {
2450
+ if (part.column() < maxcolumns)
2451
+ {
2452
+ upmax(lastcolumn, part.column());
2453
+ if (part.screenLength() < overlong_column_threshold)
2454
+ // We don't let rows that don't use table separators (\t or \v) influence
2455
+ // the width of column 0. This allows the user to interject section headers
2456
+ // or explanatory paragraphs that do not participate in the table layout.
2457
+ if (part.column() > 0 || part.line() > 0 || part.data()[part.length()] == '\t'
2458
+ || part.data()[part.length()] == '\v')
2459
+ upmax(col_width[part.column()], part.screenLength());
2460
+ }
2461
+ }
2462
+ }
2463
+
2464
+ /*
2465
+ * If the last column doesn't fit on the same
2466
+ * line as the other columns, we can fix that by starting it on its own line.
2467
+ * However we can't do this for any of the columns 0..lastcolumn-1.
2468
+ * If their sum exceeds the maximum width we try to fix this by iteratively
2469
+ * ignoring the widest line parts in the width determination until
2470
+ * we arrive at a series of column widths that fit into one line.
2471
+ * The result is a layout where everything is nicely formatted
2472
+ * except for a few overlong fragments.
2473
+ * */
2474
+
2475
+ leftwidth = 0;
2476
+ overlong_column_threshold = 0;
2477
+ for (int i = 0; i < lastcolumn; ++i)
2478
+ {
2479
+ leftwidth += col_width[i];
2480
+ upmax(overlong_column_threshold, col_width[i]);
2481
+ }
2482
+
2483
+ } while (leftwidth > width);
2484
+
2485
+ /**************** Determine tab stops and last column handling **********************/
2486
+
2487
+ int tabstop[maxcolumns];
2488
+ tabstop[0] = 0;
2489
+ for (int i = 1; i < maxcolumns; ++i)
2490
+ tabstop[i] = tabstop[i - 1] + col_width[i - 1];
2491
+
2492
+ int rightwidth = width - tabstop[lastcolumn];
2493
+ bool print_last_column_on_own_line = false;
2494
+ if (rightwidth < last_column_min_width && rightwidth < col_width[lastcolumn])
2495
+ {
2496
+ print_last_column_on_own_line = true;
2497
+ rightwidth = last_column_own_line_max_width;
2498
+ }
2499
+
2500
+ // If lastcolumn == 0 we must disable print_last_column_on_own_line because
2501
+ // otherwise 2 copies of the last (and only) column would be output.
2502
+ // Actually this is just defensive programming. It is currently not
2503
+ // possible that lastcolumn==0 and print_last_column_on_own_line==true
2504
+ // at the same time, because lastcolumn==0 => tabstop[lastcolumn] == 0 =>
2505
+ // rightwidth==width => rightwidth>=last_column_min_width (unless someone passes
2506
+ // a bullshit value >100 for last_column_min_percent) => the above if condition
2507
+ // is false => print_last_column_on_own_line==false
2508
+ if (lastcolumn == 0)
2509
+ print_last_column_on_own_line = false;
2510
+
2511
+ LineWrapper lastColumnLineWrapper(width - rightwidth, width);
2512
+ LineWrapper interjectionLineWrapper(0, width);
2513
+
2514
+ part.restartTable();
2515
+
2516
+ /***************** Print out all rows of the table *************************************/
2517
+
2518
+ while (part.nextRow())
2519
+ {
2520
+ int x = -1;
2521
+ while (part.next())
2522
+ {
2523
+ if (part.column() > lastcolumn)
2524
+ continue; // drop excess columns (can happen if lastcolumn == maxcolumns-1)
2525
+
2526
+ if (part.column() == 0)
2527
+ {
2528
+ if (x >= 0)
2529
+ write("\n", 1);
2530
+ x = 0;
2531
+ }
2532
+
2533
+ indent(write, x, tabstop[part.column()]);
2534
+
2535
+ if ((part.column() < lastcolumn)
2536
+ && (part.column() > 0 || part.line() > 0 || part.data()[part.length()] == '\t'
2537
+ || part.data()[part.length()] == '\v'))
2538
+ {
2539
+ write(part.data(), part.length());
2540
+ x += part.screenLength();
2541
+ }
2542
+ else // either part.column() == lastcolumn or we are in the special case of
2543
+ // an interjection that doesn't contain \v or \t
2544
+ {
2545
+ // NOTE: This code block is not necessarily executed for
2546
+ // each line, because some rows may have fewer columns.
2547
+
2548
+ LineWrapper& lineWrapper = (part.column() == 0) ? interjectionLineWrapper : lastColumnLineWrapper;
2549
+
2550
+ if (!print_last_column_on_own_line)
2551
+ lineWrapper.process(write, part.data(), part.length());
2552
+ }
2553
+ } // while
2554
+
2555
+ if (print_last_column_on_own_line)
2556
+ {
2557
+ part.restartRow();
2558
+ while (part.next())
2559
+ {
2560
+ if (part.column() == lastcolumn)
2561
+ {
2562
+ write("\n", 1);
2563
+ int _ = 0;
2564
+ indent(write, _, width - rightwidth);
2565
+ lastColumnLineWrapper.process(write, part.data(), part.length());
2566
+ }
2567
+ }
2568
+ }
2569
+
2570
+ write("\n", 1);
2571
+ lastColumnLineWrapper.flush(write);
2572
+ interjectionLineWrapper.flush(write);
2573
+ }
2574
+ }
2575
+ }
2576
+
2577
+ }
2578
+ ;
2579
+
2580
+ /**
2581
+ * @brief Outputs a nicely formatted usage string with support for multi-column formatting
2582
+ * and line-wrapping.
2583
+ *
2584
+ * printUsage() takes the @c help texts of a Descriptor[] array and formats them into
2585
+ * a usage message, wrapping lines to achieve the desired output width.
2586
+ *
2587
+ * <b>Table formatting:</b>
2588
+ *
2589
+ * Aside from plain strings which are simply line-wrapped, the usage may contain tables. Tables
2590
+ * are used to align elements in the output.
2591
+ *
2592
+ * @code
2593
+ * // Without a table. The explanatory texts are not aligned.
2594
+ * -c, --create |Creates something.
2595
+ * -k, --kill |Destroys something.
2596
+ *
2597
+ * // With table formatting. The explanatory texts are aligned.
2598
+ * -c, --create |Creates something.
2599
+ * -k, --kill |Destroys something.
2600
+ * @endcode
2601
+ *
2602
+ * Table formatting removes the need to pad help texts manually with spaces to achieve
2603
+ * alignment. To create a table, simply insert \\t (tab) characters to separate the cells
2604
+ * within a row.
2605
+ *
2606
+ * @code
2607
+ * const option::Descriptor usage[] = {
2608
+ * {..., "-c, --create \tCreates something." },
2609
+ * {..., "-k, --kill \tDestroys something." }, ...
2610
+ * @endcode
2611
+ *
2612
+ * Note that you must include the minimum amount of space desired between cells yourself.
2613
+ * Table formatting will insert further spaces as needed to achieve alignment.
2614
+ *
2615
+ * You can insert line breaks within cells by using \\v (vertical tab).
2616
+ *
2617
+ * @code
2618
+ * const option::Descriptor usage[] = {
2619
+ * {..., "-c,\v--create \tCreates\vsomething." },
2620
+ * {..., "-k,\v--kill \tDestroys\vsomething." }, ...
2621
+ *
2622
+ * // results in
2623
+ *
2624
+ * -c, Creates
2625
+ * --create something.
2626
+ * -k, Destroys
2627
+ * --kill something.
2628
+ * @endcode
2629
+ *
2630
+ * You can mix lines that do not use \\t or \\v with those that do. The plain
2631
+ * lines will not mess up the table layout. Alignment of the table columns will
2632
+ * be maintained even across these interjections.
2633
+ *
2634
+ * @code
2635
+ * const option::Descriptor usage[] = {
2636
+ * {..., "-c, --create \tCreates something." },
2637
+ * {..., "----------------------------------" },
2638
+ * {..., "-k, --kill \tDestroys something." }, ...
2639
+ *
2640
+ * // results in
2641
+ *
2642
+ * -c, --create Creates something.
2643
+ * ----------------------------------
2644
+ * -k, --kill Destroys something.
2645
+ * @endcode
2646
+ *
2647
+ * You can have multiple tables within the same usage whose columns are
2648
+ * aligned independently. Simply insert a dummy Descriptor with @c help==0.
2649
+ *
2650
+ * @code
2651
+ * const option::Descriptor usage[] = {
2652
+ * {..., "Long options:" },
2653
+ * {..., "--very-long-option \tDoes something long." },
2654
+ * {..., "--ultra-super-mega-long-option \tTakes forever to complete." },
2655
+ * {..., 0 }, // ---------- table break -----------
2656
+ * {..., "Short options:" },
2657
+ * {..., "-s \tShort." },
2658
+ * {..., "-q \tQuick." }, ...
2659
+ *
2660
+ * // results in
2661
+ *
2662
+ * Long options:
2663
+ * --very-long-option Does something long.
2664
+ * --ultra-super-mega-long-option Takes forever to complete.
2665
+ * Short options:
2666
+ * -s Short.
2667
+ * -q Quick.
2668
+ *
2669
+ * // Without the table break it would be
2670
+ *
2671
+ * Long options:
2672
+ * --very-long-option Does something long.
2673
+ * --ultra-super-mega-long-option Takes forever to complete.
2674
+ * Short options:
2675
+ * -s Short.
2676
+ * -q Quick.
2677
+ * @endcode
2678
+ *
2679
+ * <b>Output methods:</b>
2680
+ *
2681
+ * Because TheLeanMeanC++Option parser is freestanding, you have to provide the means for
2682
+ * output in the first argument(s) to printUsage(). Because printUsage() is implemented as
2683
+ * a set of template functions, you have great flexibility in your choice of output
2684
+ * method. The following example demonstrates typical uses. Anything that's similar enough
2685
+ * will work.
2686
+ *
2687
+ * @code
2688
+ * #include <unistd.h> // write()
2689
+ * #include <iostream> // cout
2690
+ * #include <sstream> // ostringstream
2691
+ * #include <cstdio> // fwrite()
2692
+ * using namespace std;
2693
+ *
2694
+ * void my_write(const char* str, int size) {
2695
+ * fwrite(str, size, 1, stdout);
2696
+ * }
2697
+ *
2698
+ * struct MyWriter {
2699
+ * void write(const char* buf, size_t size) const {
2700
+ * fwrite(str, size, 1, stdout);
2701
+ * }
2702
+ * };
2703
+ *
2704
+ * struct MyWriteFunctor {
2705
+ * void operator()(const char* buf, size_t size) {
2706
+ * fwrite(str, size, 1, stdout);
2707
+ * }
2708
+ * };
2709
+ * ...
2710
+ * printUsage(my_write, usage); // custom write function
2711
+ * printUsage(MyWriter(), usage); // temporary of a custom class
2712
+ * MyWriter writer;
2713
+ * printUsage(writer, usage); // custom class object
2714
+ * MyWriteFunctor wfunctor;
2715
+ * printUsage(&wfunctor, usage); // custom functor
2716
+ * printUsage(write, 1, usage); // write() to file descriptor 1
2717
+ * printUsage(cout, usage); // an ostream&
2718
+ * printUsage(fwrite, stdout, usage); // fwrite() to stdout
2719
+ * ostringstream sstr;
2720
+ * printUsage(sstr, usage); // an ostringstream&
2721
+ *
2722
+ * @endcode
2723
+ *
2724
+ * @par Notes:
2725
+ * @li the @c write() method of a class that is to be passed as a temporary
2726
+ * as @c MyWriter() is in the example, must be a @c const method, because
2727
+ * temporary objects are passed as const reference. This only applies to
2728
+ * temporary objects that are created and destroyed in the same statement.
2729
+ * If you create an object like @c writer in the example, this restriction
2730
+ * does not apply.
2731
+ * @li a functor like @c MyWriteFunctor in the example must be passed as a pointer.
2732
+ * This differs from the way functors are passed to e.g. the STL algorithms.
2733
+ * @li All printUsage() templates are tiny wrappers around a shared non-template implementation.
2734
+ * So there's no penalty for using different versions in the same program.
2735
+ * @li printUsage() always interprets Descriptor::help as UTF-8 and always produces UTF-8-encoded
2736
+ * output. If your system uses a different charset, you must do your own conversion. You
2737
+ * may also need to change the font of the console to see non-ASCII characters properly.
2738
+ * This is particularly true for Windows.
2739
+ * @li @b Security @b warning: Do not insert untrusted strings (such as user-supplied arguments)
2740
+ * into the usage. printUsage() has no protection against malicious UTF-8 sequences.
2741
+ *
2742
+ * @param prn The output method to use. See the examples above.
2743
+ * @param usage the Descriptor[] array whose @c help texts will be formatted.
2744
+ * @param width the maximum number of characters per output line. Note that this number is
2745
+ * in actual characters, not bytes. printUsage() supports UTF-8 in @c help and will
2746
+ * count multi-byte UTF-8 sequences properly. Asian wide characters are counted
2747
+ * as 2 characters.
2748
+ * @param last_column_min_percent (0-100) The minimum percentage of @c width that should be available
2749
+ * for the last column (which typically contains the textual explanation of an option).
2750
+ * If less space is available, the last column will be printed on its own line, indented
2751
+ * according to @c last_column_own_line_max_percent.
2752
+ * @param last_column_own_line_max_percent (0-100) If the last column is printed on its own line due to
2753
+ * less than @c last_column_min_percent of the width being available, then only
2754
+ * @c last_column_own_line_max_percent of the extra line(s) will be used for the
2755
+ * last column's text. This ensures an indentation. See example below.
2756
+ *
2757
+ * @code
2758
+ * // width=20, last_column_min_percent=50 (i.e. last col. min. width=10)
2759
+ * --3456789 1234567890
2760
+ * 1234567890
2761
+ *
2762
+ * // width=20, last_column_min_percent=75 (i.e. last col. min. width=15)
2763
+ * // last_column_own_line_max_percent=75
2764
+ * --3456789
2765
+ * 123456789012345
2766
+ * 67890
2767
+ *
2768
+ * // width=20, last_column_min_percent=75 (i.e. last col. min. width=15)
2769
+ * // last_column_own_line_max_percent=33 (i.e. max. 5)
2770
+ * --3456789
2771
+ * 12345
2772
+ * 67890
2773
+ * 12345
2774
+ * 67890
2775
+ * @endcode
2776
+ */
2777
+ template<typename OStream>
2778
+ void printUsage(OStream& prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50,
2779
+ int last_column_own_line_max_percent = 75)
2780
+ {
2781
+ PrintUsageImplementation::OStreamWriter<OStream> write(prn);
2782
+ PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent);
2783
+ }
2784
+
2785
+ template<typename Function>
2786
+ void printUsage(Function* prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50,
2787
+ int last_column_own_line_max_percent = 75)
2788
+ {
2789
+ PrintUsageImplementation::FunctionWriter<Function> write(prn);
2790
+ PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent);
2791
+ }
2792
+
2793
+ template<typename Temporary>
2794
+ void printUsage(const Temporary& prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50,
2795
+ int last_column_own_line_max_percent = 75)
2796
+ {
2797
+ PrintUsageImplementation::TemporaryWriter<Temporary> write(prn);
2798
+ PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent);
2799
+ }
2800
+
2801
+ template<typename Syscall>
2802
+ void printUsage(Syscall* prn, int fd, const Descriptor usage[], int width = 80, int last_column_min_percent = 50,
2803
+ int last_column_own_line_max_percent = 75)
2804
+ {
2805
+ PrintUsageImplementation::SyscallWriter<Syscall> write(prn, fd);
2806
+ PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent);
2807
+ }
2808
+
2809
+ template<typename Function, typename Stream>
2810
+ void printUsage(Function* prn, Stream* stream, const Descriptor usage[], int width = 80, int last_column_min_percent =
2811
+ 50,
2812
+ int last_column_own_line_max_percent = 75)
2813
+ {
2814
+ PrintUsageImplementation::StreamWriter<Function, Stream> write(prn, stream);
2815
+ PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent);
2816
+ }
2817
+
2818
+ }
2819
+ // namespace option
2820
+
2821
+ #ifdef _MSC_VER
2822
+ #pragma warning(pop)
2823
+ #endif
2824
+
2825
+ #endif /* OPTIONPARSER_H_ */