@appthreat/atom-parsetools 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (441) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +78 -0
  3. package/astgen.js +421 -0
  4. package/index.js +1 -0
  5. package/package.json +53 -0
  6. package/phpastgen.js +33 -0
  7. package/plugins/.gitkeep +0 -0
  8. package/plugins/autoload.php +22 -0
  9. package/plugins/bin/bundler +14 -0
  10. package/plugins/bin/php-parse +119 -0
  11. package/plugins/bin/ruby_ast_gen +14 -0
  12. package/plugins/composer/ClassLoader.php +579 -0
  13. package/plugins/composer/InstalledVersions.php +396 -0
  14. package/plugins/composer/LICENSE +21 -0
  15. package/plugins/composer/autoload_classmap.php +260 -0
  16. package/plugins/composer/autoload_namespaces.php +9 -0
  17. package/plugins/composer/autoload_psr4.php +10 -0
  18. package/plugins/composer/autoload_real.php +36 -0
  19. package/plugins/composer/autoload_static.php +286 -0
  20. package/plugins/composer/installed.json +65 -0
  21. package/plugins/composer/installed.php +32 -0
  22. package/plugins/log4j2.xml +13 -0
  23. package/plugins/nikic/php-parser/LICENSE +29 -0
  24. package/plugins/nikic/php-parser/README.md +225 -0
  25. package/plugins/nikic/php-parser/bin/php-parse +205 -0
  26. package/plugins/nikic/php-parser/composer.json +41 -0
  27. package/plugins/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php +148 -0
  28. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Class_.php +146 -0
  29. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Declaration.php +43 -0
  30. package/plugins/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php +85 -0
  31. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Enum_.php +117 -0
  32. package/plugins/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php +73 -0
  33. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Function_.php +67 -0
  34. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Interface_.php +93 -0
  35. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Method.php +146 -0
  36. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php +45 -0
  37. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Param.php +168 -0
  38. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Property.php +161 -0
  39. package/plugins/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php +64 -0
  40. package/plugins/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php +148 -0
  41. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Trait_.php +78 -0
  42. package/plugins/nikic/php-parser/lib/PhpParser/Builder/Use_.php +49 -0
  43. package/plugins/nikic/php-parser/lib/PhpParser/Builder.php +13 -0
  44. package/plugins/nikic/php-parser/lib/PhpParser/BuilderFactory.php +399 -0
  45. package/plugins/nikic/php-parser/lib/PhpParser/BuilderHelpers.php +335 -0
  46. package/plugins/nikic/php-parser/lib/PhpParser/Comment/Doc.php +7 -0
  47. package/plugins/nikic/php-parser/lib/PhpParser/Comment.php +239 -0
  48. package/plugins/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php +6 -0
  49. package/plugins/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php +229 -0
  50. package/plugins/nikic/php-parser/lib/PhpParser/Error.php +180 -0
  51. package/plugins/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php +46 -0
  52. package/plugins/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php +18 -0
  53. package/plugins/nikic/php-parser/lib/PhpParser/ErrorHandler.php +13 -0
  54. package/plugins/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php +27 -0
  55. package/plugins/nikic/php-parser/lib/PhpParser/Internal/Differ.php +164 -0
  56. package/plugins/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php +64 -0
  57. package/plugins/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php +286 -0
  58. package/plugins/nikic/php-parser/lib/PhpParser/JsonDecoder.php +103 -0
  59. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php +251 -0
  60. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php +56 -0
  61. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php +47 -0
  62. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php +31 -0
  63. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php +44 -0
  64. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php +76 -0
  65. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php +23 -0
  66. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php +62 -0
  67. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php +23 -0
  68. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php +67 -0
  69. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php +105 -0
  70. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php +31 -0
  71. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php +36 -0
  72. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php +36 -0
  73. package/plugins/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php +25 -0
  74. package/plugins/nikic/php-parser/lib/PhpParser/Lexer.php +560 -0
  75. package/plugins/nikic/php-parser/lib/PhpParser/NameContext.php +285 -0
  76. package/plugins/nikic/php-parser/lib/PhpParser/Node/Arg.php +46 -0
  77. package/plugins/nikic/php-parser/lib/PhpParser/Node/Attribute.php +34 -0
  78. package/plugins/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php +29 -0
  79. package/plugins/nikic/php-parser/lib/PhpParser/Node/ComplexType.php +14 -0
  80. package/plugins/nikic/php-parser/lib/PhpParser/Node/Const_.php +37 -0
  81. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php +34 -0
  82. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php +41 -0
  83. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php +34 -0
  84. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php +79 -0
  85. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php +34 -0
  86. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php +12 -0
  87. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php +12 -0
  88. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php +12 -0
  89. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php +12 -0
  90. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php +12 -0
  91. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php +12 -0
  92. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php +12 -0
  93. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php +12 -0
  94. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php +12 -0
  95. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php +12 -0
  96. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php +12 -0
  97. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php +12 -0
  98. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php +12 -0
  99. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php +30 -0
  100. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php +34 -0
  101. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php +16 -0
  102. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php +16 -0
  103. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php +16 -0
  104. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php +16 -0
  105. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php +16 -0
  106. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php +16 -0
  107. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php +16 -0
  108. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php +16 -0
  109. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php +16 -0
  110. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php +16 -0
  111. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php +16 -0
  112. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php +16 -0
  113. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php +16 -0
  114. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php +16 -0
  115. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php +16 -0
  116. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php +16 -0
  117. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php +16 -0
  118. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php +16 -0
  119. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php +16 -0
  120. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php +16 -0
  121. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php +16 -0
  122. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php +16 -0
  123. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php +16 -0
  124. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php +16 -0
  125. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php +16 -0
  126. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php +16 -0
  127. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php +16 -0
  128. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php +40 -0
  129. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php +30 -0
  130. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php +30 -0
  131. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php +39 -0
  132. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php +12 -0
  133. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php +12 -0
  134. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php +17 -0
  135. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php +12 -0
  136. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php +12 -0
  137. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php +12 -0
  138. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php +12 -0
  139. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php +26 -0
  140. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php +36 -0
  141. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php +30 -0
  142. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php +79 -0
  143. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php +34 -0
  144. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php +31 -0
  145. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php +30 -0
  146. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php +31 -0
  147. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php +30 -0
  148. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php +30 -0
  149. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php +34 -0
  150. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php +39 -0
  151. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php +39 -0
  152. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php +35 -0
  153. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php +30 -0
  154. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php +30 -0
  155. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php +31 -0
  156. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php +45 -0
  157. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php +41 -0
  158. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php +45 -0
  159. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php +35 -0
  160. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php +30 -0
  161. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php +30 -0
  162. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php +30 -0
  163. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php +30 -0
  164. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php +30 -0
  165. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php +35 -0
  166. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php +30 -0
  167. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php +46 -0
  168. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php +36 -0
  169. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php +38 -0
  170. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php +30 -0
  171. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php +30 -0
  172. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php +30 -0
  173. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php +30 -0
  174. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php +30 -0
  175. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php +34 -0
  176. package/plugins/nikic/php-parser/lib/PhpParser/Node/Expr.php +9 -0
  177. package/plugins/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php +43 -0
  178. package/plugins/nikic/php-parser/lib/PhpParser/Node/Identifier.php +75 -0
  179. package/plugins/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php +30 -0
  180. package/plugins/nikic/php-parser/lib/PhpParser/Node/MatchArm.php +31 -0
  181. package/plugins/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php +50 -0
  182. package/plugins/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php +50 -0
  183. package/plugins/nikic/php-parser/lib/PhpParser/Node/Name.php +254 -0
  184. package/plugins/nikic/php-parser/lib/PhpParser/Node/NullableType.php +28 -0
  185. package/plugins/nikic/php-parser/lib/PhpParser/Node/Param.php +60 -0
  186. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php +77 -0
  187. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php +31 -0
  188. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php +30 -0
  189. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php +80 -0
  190. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php +16 -0
  191. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php +16 -0
  192. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php +16 -0
  193. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php +16 -0
  194. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php +16 -0
  195. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php +16 -0
  196. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php +16 -0
  197. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php +16 -0
  198. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php +28 -0
  199. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php +157 -0
  200. package/plugins/nikic/php-parser/lib/PhpParser/Node/Scalar.php +7 -0
  201. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php +30 -0
  202. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php +34 -0
  203. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php +41 -0
  204. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php +85 -0
  205. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php +109 -0
  206. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php +161 -0
  207. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php +137 -0
  208. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php +30 -0
  209. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php +30 -0
  210. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php +34 -0
  211. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php +34 -0
  212. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php +34 -0
  213. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php +30 -0
  214. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php +34 -0
  215. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php +30 -0
  216. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php +37 -0
  217. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php +40 -0
  218. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php +33 -0
  219. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php +30 -0
  220. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php +43 -0
  221. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php +47 -0
  222. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php +77 -0
  223. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php +30 -0
  224. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php +31 -0
  225. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php +39 -0
  226. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php +30 -0
  227. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php +43 -0
  228. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php +30 -0
  229. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php +37 -0
  230. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php +31 -0
  231. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php +38 -0
  232. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php +17 -0
  233. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php +91 -0
  234. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php +34 -0
  235. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php +30 -0
  236. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php +37 -0
  237. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php +30 -0
  238. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php +34 -0
  239. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php +30 -0
  240. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php +34 -0
  241. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php +38 -0
  242. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php +34 -0
  243. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php +13 -0
  244. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php +32 -0
  245. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php +38 -0
  246. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php +30 -0
  247. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php +52 -0
  248. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php +47 -0
  249. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php +34 -0
  250. package/plugins/nikic/php-parser/lib/PhpParser/Node/Stmt.php +9 -0
  251. package/plugins/nikic/php-parser/lib/PhpParser/Node/UnionType.php +28 -0
  252. package/plugins/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php +17 -0
  253. package/plugins/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php +27 -0
  254. package/plugins/nikic/php-parser/lib/PhpParser/Node.php +151 -0
  255. package/plugins/nikic/php-parser/lib/PhpParser/NodeAbstract.php +178 -0
  256. package/plugins/nikic/php-parser/lib/PhpParser/NodeDumper.php +206 -0
  257. package/plugins/nikic/php-parser/lib/PhpParser/NodeFinder.php +81 -0
  258. package/plugins/nikic/php-parser/lib/PhpParser/NodeTraverser.php +291 -0
  259. package/plugins/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php +29 -0
  260. package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php +20 -0
  261. package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php +48 -0
  262. package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php +50 -0
  263. package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php +260 -0
  264. package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php +52 -0
  265. package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php +41 -0
  266. package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitor.php +72 -0
  267. package/plugins/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php +25 -0
  268. package/plugins/nikic/php-parser/lib/PhpParser/Parser/Multiple.php +55 -0
  269. package/plugins/nikic/php-parser/lib/PhpParser/Parser/Php5.php +2682 -0
  270. package/plugins/nikic/php-parser/lib/PhpParser/Parser/Php7.php +2898 -0
  271. package/plugins/nikic/php-parser/lib/PhpParser/Parser/Tokens.php +148 -0
  272. package/plugins/nikic/php-parser/lib/PhpParser/Parser.php +18 -0
  273. package/plugins/nikic/php-parser/lib/PhpParser/ParserAbstract.php +1060 -0
  274. package/plugins/nikic/php-parser/lib/PhpParser/ParserFactory.php +76 -0
  275. package/plugins/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php +1126 -0
  276. package/plugins/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php +1576 -0
  277. package/plugins/rubyastgen/.bundle/config +5 -0
  278. package/plugins/rubyastgen/Gemfile +12 -0
  279. package/plugins/rubyastgen/Gemfile.lock +34 -0
  280. package/plugins/rubyastgen/bundle/bundler/setup.rb +42 -0
  281. package/plugins/rubyastgen/bundle/ruby/3.4.0/bin/racc +29 -0
  282. package/plugins/rubyastgen/bundle/ruby/3.4.0/bin/ruby-parse +29 -0
  283. package/plugins/rubyastgen/bundle/ruby/3.4.0/bin/ruby-rewrite +29 -0
  284. package/plugins/rubyastgen/bundle/ruby/3.4.0/bin/ruby_ast_gen +29 -0
  285. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/.rspec +3 -0
  286. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/Gemfile +10 -0
  287. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/LICENSE.txt +213 -0
  288. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/README.md +46 -0
  289. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/Rakefile +8 -0
  290. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/bin/console +11 -0
  291. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/bin/setup +6 -0
  292. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/exe/ruby_ast_gen +59 -0
  293. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/lib/ruby_ast_gen/node_handling.rb +232 -0
  294. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/lib/ruby_ast_gen/version.rb +5 -0
  295. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/lib/ruby_ast_gen.rb +140 -0
  296. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/ruby_ast_gen.gemspec +25 -0
  297. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/spec/ruby_ast_gen_spec.rb +175 -0
  298. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/spec/spec_helper.rb +15 -0
  299. package/plugins/rubyastgen/bundle/ruby/3.4.0/bundler/gems/ruby_ast_gen-d8b5c5740b5a/update_version.rb +36 -0
  300. package/plugins/rubyastgen/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/racc-1.8.1/gem.build_complete +0 -0
  301. package/plugins/rubyastgen/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/racc-1.8.1/gem_make.out +18 -0
  302. package/plugins/rubyastgen/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/racc-1.8.1/racc/cparse.so +0 -0
  303. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.3/LICENSE.MIT +20 -0
  304. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.3/README.YARD.md +12 -0
  305. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.3/lib/ast/node.rb +268 -0
  306. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.3/lib/ast/processor/mixin.rb +288 -0
  307. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.3/lib/ast/processor.rb +12 -0
  308. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.3/lib/ast/sexp.rb +30 -0
  309. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ast-2.4.3/lib/ast.rb +17 -0
  310. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/BSDL +22 -0
  311. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/COPYING +56 -0
  312. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/Gemfile +10 -0
  313. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/README.md +69 -0
  314. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/Rakefile +18 -0
  315. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/bin/console +14 -0
  316. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/bin/setup +8 -0
  317. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/lib/ostruct.rb +489 -0
  318. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/ostruct-0.6.1/ostruct.gemspec +24 -0
  319. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/LICENSE.txt +26 -0
  320. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/bin/ruby-parse +7 -0
  321. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/bin/ruby-rewrite +7 -0
  322. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/gauntlet_parser.rb +123 -0
  323. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/all.rb +17 -0
  324. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ast/node.rb +40 -0
  325. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ast/processor.rb +293 -0
  326. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/base.rb +294 -0
  327. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/builders/default.rb +2351 -0
  328. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/clobbering_error.rb +13 -0
  329. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/color.rb +32 -0
  330. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/context.rb +51 -0
  331. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/current.rb +146 -0
  332. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/current_arg_stack.rb +46 -0
  333. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/deprecation.rb +13 -0
  334. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/diagnostic/engine.rb +104 -0
  335. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/diagnostic.rb +163 -0
  336. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/lexer/dedenter.rb +88 -0
  337. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/lexer/explanation.rb +55 -0
  338. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/lexer/literal.rb +284 -0
  339. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/lexer/stack_state.rb +49 -0
  340. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/lexer-F0.rb +12931 -0
  341. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/lexer-F1.rb +14884 -0
  342. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/lexer-strings.rb +5433 -0
  343. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/macruby.rb +9634 -0
  344. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/max_numparam_stack.rb +56 -0
  345. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/messages.rb +125 -0
  346. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/meta.rb +48 -0
  347. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/rewriter.rb +105 -0
  348. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby18.rb +9272 -0
  349. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby19.rb +9558 -0
  350. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby20.rb +10229 -0
  351. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby21.rb +10203 -0
  352. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby22.rb +10302 -0
  353. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby23.rb +10322 -0
  354. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby24.rb +10454 -0
  355. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby25.rb +10374 -0
  356. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby26.rb +10352 -0
  357. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby27.rb +11948 -0
  358. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby30.rb +12244 -0
  359. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby31.rb +12717 -0
  360. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby32.rb +12705 -0
  361. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby33.rb +12590 -0
  362. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/ruby34.rb +12597 -0
  363. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/rubymotion.rb +9515 -0
  364. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/runner/ruby_parse.rb +157 -0
  365. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/runner/ruby_rewrite.rb +101 -0
  366. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/runner.rb +299 -0
  367. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/buffer.rb +369 -0
  368. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/comment/associator.rb +233 -0
  369. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/comment.rb +134 -0
  370. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/collection.rb +18 -0
  371. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/condition.rb +21 -0
  372. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/constant.rb +32 -0
  373. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/definition.rb +23 -0
  374. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/for.rb +19 -0
  375. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/heredoc.rb +19 -0
  376. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/index.rb +33 -0
  377. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/keyword.rb +20 -0
  378. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/method_definition.rb +25 -0
  379. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/objc_kwarg.rb +19 -0
  380. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/operator.rb +17 -0
  381. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/rescue_body.rb +21 -0
  382. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/send.rb +36 -0
  383. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/ternary.rb +18 -0
  384. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map/variable.rb +31 -0
  385. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/map.rb +186 -0
  386. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/range.rb +326 -0
  387. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/rewriter/action.rb +44 -0
  388. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/rewriter.rb +513 -0
  389. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/tree_rewriter/action.rb +243 -0
  390. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/source/tree_rewriter.rb +431 -0
  391. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/static_environment.rb +134 -0
  392. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/syntax_error.rb +21 -0
  393. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/tree_rewriter.rb +133 -0
  394. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/unknown_encoding_in_magic_comment_error.rb +15 -0
  395. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/variables_stack.rb +36 -0
  396. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser/version.rb +5 -0
  397. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/lib/parser.rb +91 -0
  398. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/parser-3.3.8.0/parser.gemspec +43 -0
  399. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/BSDL +22 -0
  400. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/COPYING +56 -0
  401. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/ChangeLog +846 -0
  402. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
  403. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/README.rdoc +60 -0
  404. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/TODO +5 -0
  405. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/bin/racc +320 -0
  406. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/en/grammar.en.rdoc +218 -0
  407. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/en/grammar2.en.rdoc +219 -0
  408. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/command.ja.html +99 -0
  409. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/debug.ja.rdoc +36 -0
  410. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/grammar.ja.rdoc +348 -0
  411. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/index.ja.html +10 -0
  412. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/parser.ja.rdoc +125 -0
  413. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/doc/ja/usage.ja.html +414 -0
  414. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/ext/racc/cparse/Makefile +273 -0
  415. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/ext/racc/cparse/cparse.c +840 -0
  416. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/ext/racc/cparse/extconf.rb +8 -0
  417. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/compat.rb +33 -0
  418. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/cparse.so +0 -0
  419. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/debugflags.rb +60 -0
  420. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/exception.rb +16 -0
  421. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/grammar.rb +1191 -0
  422. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/grammarfileparser.rb +667 -0
  423. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/info.rb +18 -0
  424. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/iset.rb +92 -0
  425. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/logfilegenerator.rb +212 -0
  426. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/parser-text.rb +644 -0
  427. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/parser.rb +630 -0
  428. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/parserfilegenerator.rb +473 -0
  429. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/sourcetext.rb +35 -0
  430. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/state.rb +976 -0
  431. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/statetransitiontable.rb +311 -0
  432. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc/static.rb +5 -0
  433. package/plugins/rubyastgen/bundle/ruby/3.4.0/gems/racc-1.8.1/lib/racc.rb +6 -0
  434. package/plugins/rubyastgen/bundle/ruby/3.4.0/specifications/ast-2.4.3.gemspec +29 -0
  435. package/plugins/rubyastgen/bundle/ruby/3.4.0/specifications/ostruct-0.6.1.gemspec +21 -0
  436. package/plugins/rubyastgen/bundle/ruby/3.4.0/specifications/parser-3.3.8.0.gemspec +37 -0
  437. package/plugins/rubyastgen/bundle/ruby/3.4.0/specifications/racc-1.8.1.gemspec +28 -0
  438. package/plugins/rubyastgen/setup.ps1 +4 -0
  439. package/plugins/rubyastgen/setup.sh +6 -0
  440. package/rbastgen.js +53 -0
  441. package/scalasem.js +365 -0
@@ -0,0 +1,229 @@
1
+ <?php
2
+
3
+ namespace PhpParser;
4
+
5
+ use function array_merge;
6
+ use PhpParser\Node\Expr;
7
+ use PhpParser\Node\Scalar;
8
+
9
+ /**
10
+ * Evaluates constant expressions.
11
+ *
12
+ * This evaluator is able to evaluate all constant expressions (as defined by PHP), which can be
13
+ * evaluated without further context. If a subexpression is not of this type, a user-provided
14
+ * fallback evaluator is invoked. To support all constant expressions that are also supported by
15
+ * PHP (and not already handled by this class), the fallback evaluator must be able to handle the
16
+ * following node types:
17
+ *
18
+ * * All Scalar\MagicConst\* nodes.
19
+ * * Expr\ConstFetch nodes. Only null/false/true are already handled by this class.
20
+ * * Expr\ClassConstFetch nodes.
21
+ *
22
+ * The fallback evaluator should throw ConstExprEvaluationException for nodes it cannot evaluate.
23
+ *
24
+ * The evaluation is dependent on runtime configuration in two respects: Firstly, floating
25
+ * point to string conversions are affected by the precision ini setting. Secondly, they are also
26
+ * affected by the LC_NUMERIC locale.
27
+ */
28
+ class ConstExprEvaluator
29
+ {
30
+ private $fallbackEvaluator;
31
+
32
+ /**
33
+ * Create a constant expression evaluator.
34
+ *
35
+ * The provided fallback evaluator is invoked whenever a subexpression cannot be evaluated. See
36
+ * class doc comment for more information.
37
+ *
38
+ * @param callable|null $fallbackEvaluator To call if subexpression cannot be evaluated
39
+ */
40
+ public function __construct(callable $fallbackEvaluator = null) {
41
+ $this->fallbackEvaluator = $fallbackEvaluator ?? function(Expr $expr) {
42
+ throw new ConstExprEvaluationException(
43
+ "Expression of type {$expr->getType()} cannot be evaluated"
44
+ );
45
+ };
46
+ }
47
+
48
+ /**
49
+ * Silently evaluates a constant expression into a PHP value.
50
+ *
51
+ * Thrown Errors, warnings or notices will be converted into a ConstExprEvaluationException.
52
+ * The original source of the exception is available through getPrevious().
53
+ *
54
+ * If some part of the expression cannot be evaluated, the fallback evaluator passed to the
55
+ * constructor will be invoked. By default, if no fallback is provided, an exception of type
56
+ * ConstExprEvaluationException is thrown.
57
+ *
58
+ * See class doc comment for caveats and limitations.
59
+ *
60
+ * @param Expr $expr Constant expression to evaluate
61
+ * @return mixed Result of evaluation
62
+ *
63
+ * @throws ConstExprEvaluationException if the expression cannot be evaluated or an error occurred
64
+ */
65
+ public function evaluateSilently(Expr $expr) {
66
+ set_error_handler(function($num, $str, $file, $line) {
67
+ throw new \ErrorException($str, 0, $num, $file, $line);
68
+ });
69
+
70
+ try {
71
+ return $this->evaluate($expr);
72
+ } catch (\Throwable $e) {
73
+ if (!$e instanceof ConstExprEvaluationException) {
74
+ $e = new ConstExprEvaluationException(
75
+ "An error occurred during constant expression evaluation", 0, $e);
76
+ }
77
+ throw $e;
78
+ } finally {
79
+ restore_error_handler();
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Directly evaluates a constant expression into a PHP value.
85
+ *
86
+ * May generate Error exceptions, warnings or notices. Use evaluateSilently() to convert these
87
+ * into a ConstExprEvaluationException.
88
+ *
89
+ * If some part of the expression cannot be evaluated, the fallback evaluator passed to the
90
+ * constructor will be invoked. By default, if no fallback is provided, an exception of type
91
+ * ConstExprEvaluationException is thrown.
92
+ *
93
+ * See class doc comment for caveats and limitations.
94
+ *
95
+ * @param Expr $expr Constant expression to evaluate
96
+ * @return mixed Result of evaluation
97
+ *
98
+ * @throws ConstExprEvaluationException if the expression cannot be evaluated
99
+ */
100
+ public function evaluateDirectly(Expr $expr) {
101
+ return $this->evaluate($expr);
102
+ }
103
+
104
+ private function evaluate(Expr $expr) {
105
+ if ($expr instanceof Scalar\LNumber
106
+ || $expr instanceof Scalar\DNumber
107
+ || $expr instanceof Scalar\String_
108
+ ) {
109
+ return $expr->value;
110
+ }
111
+
112
+ if ($expr instanceof Expr\Array_) {
113
+ return $this->evaluateArray($expr);
114
+ }
115
+
116
+ // Unary operators
117
+ if ($expr instanceof Expr\UnaryPlus) {
118
+ return +$this->evaluate($expr->expr);
119
+ }
120
+ if ($expr instanceof Expr\UnaryMinus) {
121
+ return -$this->evaluate($expr->expr);
122
+ }
123
+ if ($expr instanceof Expr\BooleanNot) {
124
+ return !$this->evaluate($expr->expr);
125
+ }
126
+ if ($expr instanceof Expr\BitwiseNot) {
127
+ return ~$this->evaluate($expr->expr);
128
+ }
129
+
130
+ if ($expr instanceof Expr\BinaryOp) {
131
+ return $this->evaluateBinaryOp($expr);
132
+ }
133
+
134
+ if ($expr instanceof Expr\Ternary) {
135
+ return $this->evaluateTernary($expr);
136
+ }
137
+
138
+ if ($expr instanceof Expr\ArrayDimFetch && null !== $expr->dim) {
139
+ return $this->evaluate($expr->var)[$this->evaluate($expr->dim)];
140
+ }
141
+
142
+ if ($expr instanceof Expr\ConstFetch) {
143
+ return $this->evaluateConstFetch($expr);
144
+ }
145
+
146
+ return ($this->fallbackEvaluator)($expr);
147
+ }
148
+
149
+ private function evaluateArray(Expr\Array_ $expr) {
150
+ $array = [];
151
+ foreach ($expr->items as $item) {
152
+ if (null !== $item->key) {
153
+ $array[$this->evaluate($item->key)] = $this->evaluate($item->value);
154
+ } elseif ($item->unpack) {
155
+ $array = array_merge($array, $this->evaluate($item->value));
156
+ } else {
157
+ $array[] = $this->evaluate($item->value);
158
+ }
159
+ }
160
+ return $array;
161
+ }
162
+
163
+ private function evaluateTernary(Expr\Ternary $expr) {
164
+ if (null === $expr->if) {
165
+ return $this->evaluate($expr->cond) ?: $this->evaluate($expr->else);
166
+ }
167
+
168
+ return $this->evaluate($expr->cond)
169
+ ? $this->evaluate($expr->if)
170
+ : $this->evaluate($expr->else);
171
+ }
172
+
173
+ private function evaluateBinaryOp(Expr\BinaryOp $expr) {
174
+ if ($expr instanceof Expr\BinaryOp\Coalesce
175
+ && $expr->left instanceof Expr\ArrayDimFetch
176
+ ) {
177
+ // This needs to be special cased to respect BP_VAR_IS fetch semantics
178
+ return $this->evaluate($expr->left->var)[$this->evaluate($expr->left->dim)]
179
+ ?? $this->evaluate($expr->right);
180
+ }
181
+
182
+ // The evaluate() calls are repeated in each branch, because some of the operators are
183
+ // short-circuiting and evaluating the RHS in advance may be illegal in that case
184
+ $l = $expr->left;
185
+ $r = $expr->right;
186
+ switch ($expr->getOperatorSigil()) {
187
+ case '&': return $this->evaluate($l) & $this->evaluate($r);
188
+ case '|': return $this->evaluate($l) | $this->evaluate($r);
189
+ case '^': return $this->evaluate($l) ^ $this->evaluate($r);
190
+ case '&&': return $this->evaluate($l) && $this->evaluate($r);
191
+ case '||': return $this->evaluate($l) || $this->evaluate($r);
192
+ case '??': return $this->evaluate($l) ?? $this->evaluate($r);
193
+ case '.': return $this->evaluate($l) . $this->evaluate($r);
194
+ case '/': return $this->evaluate($l) / $this->evaluate($r);
195
+ case '==': return $this->evaluate($l) == $this->evaluate($r);
196
+ case '>': return $this->evaluate($l) > $this->evaluate($r);
197
+ case '>=': return $this->evaluate($l) >= $this->evaluate($r);
198
+ case '===': return $this->evaluate($l) === $this->evaluate($r);
199
+ case 'and': return $this->evaluate($l) and $this->evaluate($r);
200
+ case 'or': return $this->evaluate($l) or $this->evaluate($r);
201
+ case 'xor': return $this->evaluate($l) xor $this->evaluate($r);
202
+ case '-': return $this->evaluate($l) - $this->evaluate($r);
203
+ case '%': return $this->evaluate($l) % $this->evaluate($r);
204
+ case '*': return $this->evaluate($l) * $this->evaluate($r);
205
+ case '!=': return $this->evaluate($l) != $this->evaluate($r);
206
+ case '!==': return $this->evaluate($l) !== $this->evaluate($r);
207
+ case '+': return $this->evaluate($l) + $this->evaluate($r);
208
+ case '**': return $this->evaluate($l) ** $this->evaluate($r);
209
+ case '<<': return $this->evaluate($l) << $this->evaluate($r);
210
+ case '>>': return $this->evaluate($l) >> $this->evaluate($r);
211
+ case '<': return $this->evaluate($l) < $this->evaluate($r);
212
+ case '<=': return $this->evaluate($l) <= $this->evaluate($r);
213
+ case '<=>': return $this->evaluate($l) <=> $this->evaluate($r);
214
+ }
215
+
216
+ throw new \Exception('Should not happen');
217
+ }
218
+
219
+ private function evaluateConstFetch(Expr\ConstFetch $expr) {
220
+ $name = $expr->name->toLowerString();
221
+ switch ($name) {
222
+ case 'null': return null;
223
+ case 'false': return false;
224
+ case 'true': return true;
225
+ }
226
+
227
+ return ($this->fallbackEvaluator)($expr);
228
+ }
229
+ }
@@ -0,0 +1,180 @@
1
+ <?php declare(strict_types=1);
2
+
3
+ namespace PhpParser;
4
+
5
+ class Error extends \RuntimeException
6
+ {
7
+ protected $rawMessage;
8
+ protected $attributes;
9
+
10
+ /**
11
+ * Creates an Exception signifying a parse error.
12
+ *
13
+ * @param string $message Error message
14
+ * @param array|int $attributes Attributes of node/token where error occurred
15
+ * (or start line of error -- deprecated)
16
+ */
17
+ public function __construct(string $message, $attributes = []) {
18
+ $this->rawMessage = $message;
19
+ if (is_array($attributes)) {
20
+ $this->attributes = $attributes;
21
+ } else {
22
+ $this->attributes = ['startLine' => $attributes];
23
+ }
24
+ $this->updateMessage();
25
+ }
26
+
27
+ /**
28
+ * Gets the error message
29
+ *
30
+ * @return string Error message
31
+ */
32
+ public function getRawMessage() : string {
33
+ return $this->rawMessage;
34
+ }
35
+
36
+ /**
37
+ * Gets the line the error starts in.
38
+ *
39
+ * @return int Error start line
40
+ */
41
+ public function getStartLine() : int {
42
+ return $this->attributes['startLine'] ?? -1;
43
+ }
44
+
45
+ /**
46
+ * Gets the line the error ends in.
47
+ *
48
+ * @return int Error end line
49
+ */
50
+ public function getEndLine() : int {
51
+ return $this->attributes['endLine'] ?? -1;
52
+ }
53
+
54
+ /**
55
+ * Gets the attributes of the node/token the error occurred at.
56
+ *
57
+ * @return array
58
+ */
59
+ public function getAttributes() : array {
60
+ return $this->attributes;
61
+ }
62
+
63
+ /**
64
+ * Sets the attributes of the node/token the error occurred at.
65
+ *
66
+ * @param array $attributes
67
+ */
68
+ public function setAttributes(array $attributes) {
69
+ $this->attributes = $attributes;
70
+ $this->updateMessage();
71
+ }
72
+
73
+ /**
74
+ * Sets the line of the PHP file the error occurred in.
75
+ *
76
+ * @param string $message Error message
77
+ */
78
+ public function setRawMessage(string $message) {
79
+ $this->rawMessage = $message;
80
+ $this->updateMessage();
81
+ }
82
+
83
+ /**
84
+ * Sets the line the error starts in.
85
+ *
86
+ * @param int $line Error start line
87
+ */
88
+ public function setStartLine(int $line) {
89
+ $this->attributes['startLine'] = $line;
90
+ $this->updateMessage();
91
+ }
92
+
93
+ /**
94
+ * Returns whether the error has start and end column information.
95
+ *
96
+ * For column information enable the startFilePos and endFilePos in the lexer options.
97
+ *
98
+ * @return bool
99
+ */
100
+ public function hasColumnInfo() : bool {
101
+ return isset($this->attributes['startFilePos'], $this->attributes['endFilePos']);
102
+ }
103
+
104
+ /**
105
+ * Gets the start column (1-based) into the line where the error started.
106
+ *
107
+ * @param string $code Source code of the file
108
+ * @return int
109
+ */
110
+ public function getStartColumn(string $code) : int {
111
+ if (!$this->hasColumnInfo()) {
112
+ throw new \RuntimeException('Error does not have column information');
113
+ }
114
+
115
+ return $this->toColumn($code, $this->attributes['startFilePos']);
116
+ }
117
+
118
+ /**
119
+ * Gets the end column (1-based) into the line where the error ended.
120
+ *
121
+ * @param string $code Source code of the file
122
+ * @return int
123
+ */
124
+ public function getEndColumn(string $code) : int {
125
+ if (!$this->hasColumnInfo()) {
126
+ throw new \RuntimeException('Error does not have column information');
127
+ }
128
+
129
+ return $this->toColumn($code, $this->attributes['endFilePos']);
130
+ }
131
+
132
+ /**
133
+ * Formats message including line and column information.
134
+ *
135
+ * @param string $code Source code associated with the error, for calculation of the columns
136
+ *
137
+ * @return string Formatted message
138
+ */
139
+ public function getMessageWithColumnInfo(string $code) : string {
140
+ return sprintf(
141
+ '%s from %d:%d to %d:%d', $this->getRawMessage(),
142
+ $this->getStartLine(), $this->getStartColumn($code),
143
+ $this->getEndLine(), $this->getEndColumn($code)
144
+ );
145
+ }
146
+
147
+ /**
148
+ * Converts a file offset into a column.
149
+ *
150
+ * @param string $code Source code that $pos indexes into
151
+ * @param int $pos 0-based position in $code
152
+ *
153
+ * @return int 1-based column (relative to start of line)
154
+ */
155
+ private function toColumn(string $code, int $pos) : int {
156
+ if ($pos > strlen($code)) {
157
+ throw new \RuntimeException('Invalid position information');
158
+ }
159
+
160
+ $lineStartPos = strrpos($code, "\n", $pos - strlen($code));
161
+ if (false === $lineStartPos) {
162
+ $lineStartPos = -1;
163
+ }
164
+
165
+ return $pos - $lineStartPos;
166
+ }
167
+
168
+ /**
169
+ * Updates the exception message after a change to rawMessage or rawLine.
170
+ */
171
+ protected function updateMessage() {
172
+ $this->message = $this->rawMessage;
173
+
174
+ if (-1 === $this->getStartLine()) {
175
+ $this->message .= ' on unknown line';
176
+ } else {
177
+ $this->message .= ' on line ' . $this->getStartLine();
178
+ }
179
+ }
180
+ }
@@ -0,0 +1,46 @@
1
+ <?php declare(strict_types=1);
2
+
3
+ namespace PhpParser\ErrorHandler;
4
+
5
+ use PhpParser\Error;
6
+ use PhpParser\ErrorHandler;
7
+
8
+ /**
9
+ * Error handler that collects all errors into an array.
10
+ *
11
+ * This allows graceful handling of errors.
12
+ */
13
+ class Collecting implements ErrorHandler
14
+ {
15
+ /** @var Error[] Collected errors */
16
+ private $errors = [];
17
+
18
+ public function handleError(Error $error) {
19
+ $this->errors[] = $error;
20
+ }
21
+
22
+ /**
23
+ * Get collected errors.
24
+ *
25
+ * @return Error[]
26
+ */
27
+ public function getErrors() : array {
28
+ return $this->errors;
29
+ }
30
+
31
+ /**
32
+ * Check whether there are any errors.
33
+ *
34
+ * @return bool
35
+ */
36
+ public function hasErrors() : bool {
37
+ return !empty($this->errors);
38
+ }
39
+
40
+ /**
41
+ * Reset/clear collected errors.
42
+ */
43
+ public function clearErrors() {
44
+ $this->errors = [];
45
+ }
46
+ }
@@ -0,0 +1,18 @@
1
+ <?php declare(strict_types=1);
2
+
3
+ namespace PhpParser\ErrorHandler;
4
+
5
+ use PhpParser\Error;
6
+ use PhpParser\ErrorHandler;
7
+
8
+ /**
9
+ * Error handler that handles all errors by throwing them.
10
+ *
11
+ * This is the default strategy used by all components.
12
+ */
13
+ class Throwing implements ErrorHandler
14
+ {
15
+ public function handleError(Error $error) {
16
+ throw $error;
17
+ }
18
+ }
@@ -0,0 +1,13 @@
1
+ <?php declare(strict_types=1);
2
+
3
+ namespace PhpParser;
4
+
5
+ interface ErrorHandler
6
+ {
7
+ /**
8
+ * Handle an error generated during lexing, parsing or some other operation.
9
+ *
10
+ * @param Error $error The error that needs to be handled
11
+ */
12
+ public function handleError(Error $error);
13
+ }
@@ -0,0 +1,27 @@
1
+ <?php declare(strict_types=1);
2
+
3
+ namespace PhpParser\Internal;
4
+
5
+ /**
6
+ * @internal
7
+ */
8
+ class DiffElem
9
+ {
10
+ const TYPE_KEEP = 0;
11
+ const TYPE_REMOVE = 1;
12
+ const TYPE_ADD = 2;
13
+ const TYPE_REPLACE = 3;
14
+
15
+ /** @var int One of the TYPE_* constants */
16
+ public $type;
17
+ /** @var mixed Is null for add operations */
18
+ public $old;
19
+ /** @var mixed Is null for remove operations */
20
+ public $new;
21
+
22
+ public function __construct(int $type, $old, $new) {
23
+ $this->type = $type;
24
+ $this->old = $old;
25
+ $this->new = $new;
26
+ }
27
+ }
@@ -0,0 +1,164 @@
1
+ <?php declare(strict_types=1);
2
+
3
+ namespace PhpParser\Internal;
4
+
5
+ /**
6
+ * Implements the Myers diff algorithm.
7
+ *
8
+ * Myers, Eugene W. "An O (ND) difference algorithm and its variations."
9
+ * Algorithmica 1.1 (1986): 251-266.
10
+ *
11
+ * @internal
12
+ */
13
+ class Differ
14
+ {
15
+ private $isEqual;
16
+
17
+ /**
18
+ * Create differ over the given equality relation.
19
+ *
20
+ * @param callable $isEqual Equality relation with signature function($a, $b) : bool
21
+ */
22
+ public function __construct(callable $isEqual) {
23
+ $this->isEqual = $isEqual;
24
+ }
25
+
26
+ /**
27
+ * Calculate diff (edit script) from $old to $new.
28
+ *
29
+ * @param array $old Original array
30
+ * @param array $new New array
31
+ *
32
+ * @return DiffElem[] Diff (edit script)
33
+ */
34
+ public function diff(array $old, array $new) {
35
+ list($trace, $x, $y) = $this->calculateTrace($old, $new);
36
+ return $this->extractDiff($trace, $x, $y, $old, $new);
37
+ }
38
+
39
+ /**
40
+ * Calculate diff, including "replace" operations.
41
+ *
42
+ * If a sequence of remove operations is followed by the same number of add operations, these
43
+ * will be coalesced into replace operations.
44
+ *
45
+ * @param array $old Original array
46
+ * @param array $new New array
47
+ *
48
+ * @return DiffElem[] Diff (edit script), including replace operations
49
+ */
50
+ public function diffWithReplacements(array $old, array $new) {
51
+ return $this->coalesceReplacements($this->diff($old, $new));
52
+ }
53
+
54
+ private function calculateTrace(array $a, array $b) {
55
+ $n = \count($a);
56
+ $m = \count($b);
57
+ $max = $n + $m;
58
+ $v = [1 => 0];
59
+ $trace = [];
60
+ for ($d = 0; $d <= $max; $d++) {
61
+ $trace[] = $v;
62
+ for ($k = -$d; $k <= $d; $k += 2) {
63
+ if ($k === -$d || ($k !== $d && $v[$k-1] < $v[$k+1])) {
64
+ $x = $v[$k+1];
65
+ } else {
66
+ $x = $v[$k-1] + 1;
67
+ }
68
+
69
+ $y = $x - $k;
70
+ while ($x < $n && $y < $m && ($this->isEqual)($a[$x], $b[$y])) {
71
+ $x++;
72
+ $y++;
73
+ }
74
+
75
+ $v[$k] = $x;
76
+ if ($x >= $n && $y >= $m) {
77
+ return [$trace, $x, $y];
78
+ }
79
+ }
80
+ }
81
+ throw new \Exception('Should not happen');
82
+ }
83
+
84
+ private function extractDiff(array $trace, int $x, int $y, array $a, array $b) {
85
+ $result = [];
86
+ for ($d = \count($trace) - 1; $d >= 0; $d--) {
87
+ $v = $trace[$d];
88
+ $k = $x - $y;
89
+
90
+ if ($k === -$d || ($k !== $d && $v[$k-1] < $v[$k+1])) {
91
+ $prevK = $k + 1;
92
+ } else {
93
+ $prevK = $k - 1;
94
+ }
95
+
96
+ $prevX = $v[$prevK];
97
+ $prevY = $prevX - $prevK;
98
+
99
+ while ($x > $prevX && $y > $prevY) {
100
+ $result[] = new DiffElem(DiffElem::TYPE_KEEP, $a[$x-1], $b[$y-1]);
101
+ $x--;
102
+ $y--;
103
+ }
104
+
105
+ if ($d === 0) {
106
+ break;
107
+ }
108
+
109
+ while ($x > $prevX) {
110
+ $result[] = new DiffElem(DiffElem::TYPE_REMOVE, $a[$x-1], null);
111
+ $x--;
112
+ }
113
+
114
+ while ($y > $prevY) {
115
+ $result[] = new DiffElem(DiffElem::TYPE_ADD, null, $b[$y-1]);
116
+ $y--;
117
+ }
118
+ }
119
+ return array_reverse($result);
120
+ }
121
+
122
+ /**
123
+ * Coalesce equal-length sequences of remove+add into a replace operation.
124
+ *
125
+ * @param DiffElem[] $diff
126
+ * @return DiffElem[]
127
+ */
128
+ private function coalesceReplacements(array $diff) {
129
+ $newDiff = [];
130
+ $c = \count($diff);
131
+ for ($i = 0; $i < $c; $i++) {
132
+ $diffType = $diff[$i]->type;
133
+ if ($diffType !== DiffElem::TYPE_REMOVE) {
134
+ $newDiff[] = $diff[$i];
135
+ continue;
136
+ }
137
+
138
+ $j = $i;
139
+ while ($j < $c && $diff[$j]->type === DiffElem::TYPE_REMOVE) {
140
+ $j++;
141
+ }
142
+
143
+ $k = $j;
144
+ while ($k < $c && $diff[$k]->type === DiffElem::TYPE_ADD) {
145
+ $k++;
146
+ }
147
+
148
+ if ($j - $i === $k - $j) {
149
+ $len = $j - $i;
150
+ for ($n = 0; $n < $len; $n++) {
151
+ $newDiff[] = new DiffElem(
152
+ DiffElem::TYPE_REPLACE, $diff[$i + $n]->old, $diff[$j + $n]->new
153
+ );
154
+ }
155
+ } else {
156
+ for (; $i < $k; $i++) {
157
+ $newDiff[] = $diff[$i];
158
+ }
159
+ }
160
+ $i = $k - 1;
161
+ }
162
+ return $newDiff;
163
+ }
164
+ }