@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,1060 @@
1
+ <?php declare(strict_types=1);
2
+
3
+ namespace PhpParser;
4
+
5
+ /*
6
+ * This parser is based on a skeleton written by Moriyoshi Koizumi, which in
7
+ * turn is based on work by Masato Bito.
8
+ */
9
+ use PhpParser\Node\Expr;
10
+ use PhpParser\Node\Expr\Cast\Double;
11
+ use PhpParser\Node\Name;
12
+ use PhpParser\Node\Param;
13
+ use PhpParser\Node\Scalar\Encapsed;
14
+ use PhpParser\Node\Scalar\LNumber;
15
+ use PhpParser\Node\Scalar\String_;
16
+ use PhpParser\Node\Stmt\Class_;
17
+ use PhpParser\Node\Stmt\ClassConst;
18
+ use PhpParser\Node\Stmt\ClassMethod;
19
+ use PhpParser\Node\Stmt\Else_;
20
+ use PhpParser\Node\Stmt\ElseIf_;
21
+ use PhpParser\Node\Stmt\Enum_;
22
+ use PhpParser\Node\Stmt\Interface_;
23
+ use PhpParser\Node\Stmt\Namespace_;
24
+ use PhpParser\Node\Stmt\Nop;
25
+ use PhpParser\Node\Stmt\Property;
26
+ use PhpParser\Node\Stmt\TryCatch;
27
+ use PhpParser\Node\Stmt\UseUse;
28
+ use PhpParser\Node\VarLikeIdentifier;
29
+
30
+ abstract class ParserAbstract implements Parser
31
+ {
32
+ const SYMBOL_NONE = -1;
33
+
34
+ /*
35
+ * The following members will be filled with generated parsing data:
36
+ */
37
+
38
+ /** @var int Size of $tokenToSymbol map */
39
+ protected $tokenToSymbolMapSize;
40
+ /** @var int Size of $action table */
41
+ protected $actionTableSize;
42
+ /** @var int Size of $goto table */
43
+ protected $gotoTableSize;
44
+
45
+ /** @var int Symbol number signifying an invalid token */
46
+ protected $invalidSymbol;
47
+ /** @var int Symbol number of error recovery token */
48
+ protected $errorSymbol;
49
+ /** @var int Action number signifying default action */
50
+ protected $defaultAction;
51
+ /** @var int Rule number signifying that an unexpected token was encountered */
52
+ protected $unexpectedTokenRule;
53
+
54
+ protected $YY2TBLSTATE;
55
+ /** @var int Number of non-leaf states */
56
+ protected $numNonLeafStates;
57
+
58
+ /** @var int[] Map of lexer tokens to internal symbols */
59
+ protected $tokenToSymbol;
60
+ /** @var string[] Map of symbols to their names */
61
+ protected $symbolToName;
62
+ /** @var array Names of the production rules (only necessary for debugging) */
63
+ protected $productions;
64
+
65
+ /** @var int[] Map of states to a displacement into the $action table. The corresponding action for this
66
+ * state/symbol pair is $action[$actionBase[$state] + $symbol]. If $actionBase[$state] is 0, the
67
+ * action is defaulted, i.e. $actionDefault[$state] should be used instead. */
68
+ protected $actionBase;
69
+ /** @var int[] Table of actions. Indexed according to $actionBase comment. */
70
+ protected $action;
71
+ /** @var int[] Table indexed analogously to $action. If $actionCheck[$actionBase[$state] + $symbol] != $symbol
72
+ * then the action is defaulted, i.e. $actionDefault[$state] should be used instead. */
73
+ protected $actionCheck;
74
+ /** @var int[] Map of states to their default action */
75
+ protected $actionDefault;
76
+ /** @var callable[] Semantic action callbacks */
77
+ protected $reduceCallbacks;
78
+
79
+ /** @var int[] Map of non-terminals to a displacement into the $goto table. The corresponding goto state for this
80
+ * non-terminal/state pair is $goto[$gotoBase[$nonTerminal] + $state] (unless defaulted) */
81
+ protected $gotoBase;
82
+ /** @var int[] Table of states to goto after reduction. Indexed according to $gotoBase comment. */
83
+ protected $goto;
84
+ /** @var int[] Table indexed analogously to $goto. If $gotoCheck[$gotoBase[$nonTerminal] + $state] != $nonTerminal
85
+ * then the goto state is defaulted, i.e. $gotoDefault[$nonTerminal] should be used. */
86
+ protected $gotoCheck;
87
+ /** @var int[] Map of non-terminals to the default state to goto after their reduction */
88
+ protected $gotoDefault;
89
+
90
+ /** @var int[] Map of rules to the non-terminal on their left-hand side, i.e. the non-terminal to use for
91
+ * determining the state to goto after reduction. */
92
+ protected $ruleToNonTerminal;
93
+ /** @var int[] Map of rules to the length of their right-hand side, which is the number of elements that have to
94
+ * be popped from the stack(s) on reduction. */
95
+ protected $ruleToLength;
96
+
97
+ /*
98
+ * The following members are part of the parser state:
99
+ */
100
+
101
+ /** @var Lexer Lexer that is used when parsing */
102
+ protected $lexer;
103
+ /** @var mixed Temporary value containing the result of last semantic action (reduction) */
104
+ protected $semValue;
105
+ /** @var array Semantic value stack (contains values of tokens and semantic action results) */
106
+ protected $semStack;
107
+ /** @var array[] Start attribute stack */
108
+ protected $startAttributeStack;
109
+ /** @var array[] End attribute stack */
110
+ protected $endAttributeStack;
111
+ /** @var array End attributes of last *shifted* token */
112
+ protected $endAttributes;
113
+ /** @var array Start attributes of last *read* token */
114
+ protected $lookaheadStartAttributes;
115
+
116
+ /** @var ErrorHandler Error handler */
117
+ protected $errorHandler;
118
+ /** @var int Error state, used to avoid error floods */
119
+ protected $errorState;
120
+
121
+ /**
122
+ * Initialize $reduceCallbacks map.
123
+ */
124
+ abstract protected function initReduceCallbacks();
125
+
126
+ /**
127
+ * Creates a parser instance.
128
+ *
129
+ * Options: Currently none.
130
+ *
131
+ * @param Lexer $lexer A lexer
132
+ * @param array $options Options array.
133
+ */
134
+ public function __construct(Lexer $lexer, array $options = []) {
135
+ $this->lexer = $lexer;
136
+
137
+ if (isset($options['throwOnError'])) {
138
+ throw new \LogicException(
139
+ '"throwOnError" is no longer supported, use "errorHandler" instead');
140
+ }
141
+
142
+ $this->initReduceCallbacks();
143
+ }
144
+
145
+ /**
146
+ * Parses PHP code into a node tree.
147
+ *
148
+ * If a non-throwing error handler is used, the parser will continue parsing after an error
149
+ * occurred and attempt to build a partial AST.
150
+ *
151
+ * @param string $code The source code to parse
152
+ * @param ErrorHandler|null $errorHandler Error handler to use for lexer/parser errors, defaults
153
+ * to ErrorHandler\Throwing.
154
+ *
155
+ * @return Node\Stmt[]|null Array of statements (or null non-throwing error handler is used and
156
+ * the parser was unable to recover from an error).
157
+ */
158
+ public function parse(string $code, ErrorHandler $errorHandler = null) {
159
+ $this->errorHandler = $errorHandler ?: new ErrorHandler\Throwing;
160
+
161
+ $this->lexer->startLexing($code, $this->errorHandler);
162
+ $result = $this->doParse();
163
+
164
+ // Clear out some of the interior state, so we don't hold onto unnecessary
165
+ // memory between uses of the parser
166
+ $this->startAttributeStack = [];
167
+ $this->endAttributeStack = [];
168
+ $this->semStack = [];
169
+ $this->semValue = null;
170
+
171
+ return $result;
172
+ }
173
+
174
+ protected function doParse() {
175
+ // We start off with no lookahead-token
176
+ $symbol = self::SYMBOL_NONE;
177
+
178
+ // The attributes for a node are taken from the first and last token of the node.
179
+ // From the first token only the startAttributes are taken and from the last only
180
+ // the endAttributes. Both are merged using the array union operator (+).
181
+ $startAttributes = [];
182
+ $endAttributes = [];
183
+ $this->endAttributes = $endAttributes;
184
+
185
+ // Keep stack of start and end attributes
186
+ $this->startAttributeStack = [];
187
+ $this->endAttributeStack = [$endAttributes];
188
+
189
+ // Start off in the initial state and keep a stack of previous states
190
+ $state = 0;
191
+ $stateStack = [$state];
192
+
193
+ // Semantic value stack (contains values of tokens and semantic action results)
194
+ $this->semStack = [];
195
+
196
+ // Current position in the stack(s)
197
+ $stackPos = 0;
198
+
199
+ $this->errorState = 0;
200
+
201
+ for (;;) {
202
+ //$this->traceNewState($state, $symbol);
203
+
204
+ if ($this->actionBase[$state] === 0) {
205
+ $rule = $this->actionDefault[$state];
206
+ } else {
207
+ if ($symbol === self::SYMBOL_NONE) {
208
+ // Fetch the next token id from the lexer and fetch additional info by-ref.
209
+ // The end attributes are fetched into a temporary variable and only set once the token is really
210
+ // shifted (not during read). Otherwise you would sometimes get off-by-one errors, when a rule is
211
+ // reduced after a token was read but not yet shifted.
212
+ $tokenId = $this->lexer->getNextToken($tokenValue, $startAttributes, $endAttributes);
213
+
214
+ // map the lexer token id to the internally used symbols
215
+ $symbol = $tokenId >= 0 && $tokenId < $this->tokenToSymbolMapSize
216
+ ? $this->tokenToSymbol[$tokenId]
217
+ : $this->invalidSymbol;
218
+
219
+ if ($symbol === $this->invalidSymbol) {
220
+ throw new \RangeException(sprintf(
221
+ 'The lexer returned an invalid token (id=%d, value=%s)',
222
+ $tokenId, $tokenValue
223
+ ));
224
+ }
225
+
226
+ // Allow productions to access the start attributes of the lookahead token.
227
+ $this->lookaheadStartAttributes = $startAttributes;
228
+
229
+ //$this->traceRead($symbol);
230
+ }
231
+
232
+ $idx = $this->actionBase[$state] + $symbol;
233
+ if ((($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol)
234
+ || ($state < $this->YY2TBLSTATE
235
+ && ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $symbol) >= 0
236
+ && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol))
237
+ && ($action = $this->action[$idx]) !== $this->defaultAction) {
238
+ /*
239
+ * >= numNonLeafStates: shift and reduce
240
+ * > 0: shift
241
+ * = 0: accept
242
+ * < 0: reduce
243
+ * = -YYUNEXPECTED: error
244
+ */
245
+ if ($action > 0) {
246
+ /* shift */
247
+ //$this->traceShift($symbol);
248
+
249
+ ++$stackPos;
250
+ $stateStack[$stackPos] = $state = $action;
251
+ $this->semStack[$stackPos] = $tokenValue;
252
+ $this->startAttributeStack[$stackPos] = $startAttributes;
253
+ $this->endAttributeStack[$stackPos] = $endAttributes;
254
+ $this->endAttributes = $endAttributes;
255
+ $symbol = self::SYMBOL_NONE;
256
+
257
+ if ($this->errorState) {
258
+ --$this->errorState;
259
+ }
260
+
261
+ if ($action < $this->numNonLeafStates) {
262
+ continue;
263
+ }
264
+
265
+ /* $yyn >= numNonLeafStates means shift-and-reduce */
266
+ $rule = $action - $this->numNonLeafStates;
267
+ } else {
268
+ $rule = -$action;
269
+ }
270
+ } else {
271
+ $rule = $this->actionDefault[$state];
272
+ }
273
+ }
274
+
275
+ for (;;) {
276
+ if ($rule === 0) {
277
+ /* accept */
278
+ //$this->traceAccept();
279
+ return $this->semValue;
280
+ } elseif ($rule !== $this->unexpectedTokenRule) {
281
+ /* reduce */
282
+ //$this->traceReduce($rule);
283
+
284
+ try {
285
+ $this->reduceCallbacks[$rule]($stackPos);
286
+ } catch (Error $e) {
287
+ if (-1 === $e->getStartLine() && isset($startAttributes['startLine'])) {
288
+ $e->setStartLine($startAttributes['startLine']);
289
+ }
290
+
291
+ $this->emitError($e);
292
+ // Can't recover from this type of error
293
+ return null;
294
+ }
295
+
296
+ /* Goto - shift nonterminal */
297
+ $lastEndAttributes = $this->endAttributeStack[$stackPos];
298
+ $ruleLength = $this->ruleToLength[$rule];
299
+ $stackPos -= $ruleLength;
300
+ $nonTerminal = $this->ruleToNonTerminal[$rule];
301
+ $idx = $this->gotoBase[$nonTerminal] + $stateStack[$stackPos];
302
+ if ($idx >= 0 && $idx < $this->gotoTableSize && $this->gotoCheck[$idx] === $nonTerminal) {
303
+ $state = $this->goto[$idx];
304
+ } else {
305
+ $state = $this->gotoDefault[$nonTerminal];
306
+ }
307
+
308
+ ++$stackPos;
309
+ $stateStack[$stackPos] = $state;
310
+ $this->semStack[$stackPos] = $this->semValue;
311
+ $this->endAttributeStack[$stackPos] = $lastEndAttributes;
312
+ if ($ruleLength === 0) {
313
+ // Empty productions use the start attributes of the lookahead token.
314
+ $this->startAttributeStack[$stackPos] = $this->lookaheadStartAttributes;
315
+ }
316
+ } else {
317
+ /* error */
318
+ switch ($this->errorState) {
319
+ case 0:
320
+ $msg = $this->getErrorMessage($symbol, $state);
321
+ $this->emitError(new Error($msg, $startAttributes + $endAttributes));
322
+ // Break missing intentionally
323
+ case 1:
324
+ case 2:
325
+ $this->errorState = 3;
326
+
327
+ // Pop until error-expecting state uncovered
328
+ while (!(
329
+ (($idx = $this->actionBase[$state] + $this->errorSymbol) >= 0
330
+ && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $this->errorSymbol)
331
+ || ($state < $this->YY2TBLSTATE
332
+ && ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $this->errorSymbol) >= 0
333
+ && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $this->errorSymbol)
334
+ ) || ($action = $this->action[$idx]) === $this->defaultAction) { // Not totally sure about this
335
+ if ($stackPos <= 0) {
336
+ // Could not recover from error
337
+ return null;
338
+ }
339
+ $state = $stateStack[--$stackPos];
340
+ //$this->tracePop($state);
341
+ }
342
+
343
+ //$this->traceShift($this->errorSymbol);
344
+ ++$stackPos;
345
+ $stateStack[$stackPos] = $state = $action;
346
+
347
+ // We treat the error symbol as being empty, so we reset the end attributes
348
+ // to the end attributes of the last non-error symbol
349
+ $this->startAttributeStack[$stackPos] = $this->lookaheadStartAttributes;
350
+ $this->endAttributeStack[$stackPos] = $this->endAttributeStack[$stackPos - 1];
351
+ $this->endAttributes = $this->endAttributeStack[$stackPos - 1];
352
+ break;
353
+
354
+ case 3:
355
+ if ($symbol === 0) {
356
+ // Reached EOF without recovering from error
357
+ return null;
358
+ }
359
+
360
+ //$this->traceDiscard($symbol);
361
+ $symbol = self::SYMBOL_NONE;
362
+ break 2;
363
+ }
364
+ }
365
+
366
+ if ($state < $this->numNonLeafStates) {
367
+ break;
368
+ }
369
+
370
+ /* >= numNonLeafStates means shift-and-reduce */
371
+ $rule = $state - $this->numNonLeafStates;
372
+ }
373
+ }
374
+
375
+ throw new \RuntimeException('Reached end of parser loop');
376
+ }
377
+
378
+ protected function emitError(Error $error) {
379
+ $this->errorHandler->handleError($error);
380
+ }
381
+
382
+ /**
383
+ * Format error message including expected tokens.
384
+ *
385
+ * @param int $symbol Unexpected symbol
386
+ * @param int $state State at time of error
387
+ *
388
+ * @return string Formatted error message
389
+ */
390
+ protected function getErrorMessage(int $symbol, int $state) : string {
391
+ $expectedString = '';
392
+ if ($expected = $this->getExpectedTokens($state)) {
393
+ $expectedString = ', expecting ' . implode(' or ', $expected);
394
+ }
395
+
396
+ return 'Syntax error, unexpected ' . $this->symbolToName[$symbol] . $expectedString;
397
+ }
398
+
399
+ /**
400
+ * Get limited number of expected tokens in given state.
401
+ *
402
+ * @param int $state State
403
+ *
404
+ * @return string[] Expected tokens. If too many, an empty array is returned.
405
+ */
406
+ protected function getExpectedTokens(int $state) : array {
407
+ $expected = [];
408
+
409
+ $base = $this->actionBase[$state];
410
+ foreach ($this->symbolToName as $symbol => $name) {
411
+ $idx = $base + $symbol;
412
+ if ($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol
413
+ || $state < $this->YY2TBLSTATE
414
+ && ($idx = $this->actionBase[$state + $this->numNonLeafStates] + $symbol) >= 0
415
+ && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol
416
+ ) {
417
+ if ($this->action[$idx] !== $this->unexpectedTokenRule
418
+ && $this->action[$idx] !== $this->defaultAction
419
+ && $symbol !== $this->errorSymbol
420
+ ) {
421
+ if (count($expected) === 4) {
422
+ /* Too many expected tokens */
423
+ return [];
424
+ }
425
+
426
+ $expected[] = $name;
427
+ }
428
+ }
429
+ }
430
+
431
+ return $expected;
432
+ }
433
+
434
+ /*
435
+ * Tracing functions used for debugging the parser.
436
+ */
437
+
438
+ /*
439
+ protected function traceNewState($state, $symbol) {
440
+ echo '% State ' . $state
441
+ . ', Lookahead ' . ($symbol == self::SYMBOL_NONE ? '--none--' : $this->symbolToName[$symbol]) . "\n";
442
+ }
443
+
444
+ protected function traceRead($symbol) {
445
+ echo '% Reading ' . $this->symbolToName[$symbol] . "\n";
446
+ }
447
+
448
+ protected function traceShift($symbol) {
449
+ echo '% Shift ' . $this->symbolToName[$symbol] . "\n";
450
+ }
451
+
452
+ protected function traceAccept() {
453
+ echo "% Accepted.\n";
454
+ }
455
+
456
+ protected function traceReduce($n) {
457
+ echo '% Reduce by (' . $n . ') ' . $this->productions[$n] . "\n";
458
+ }
459
+
460
+ protected function tracePop($state) {
461
+ echo '% Recovering, uncovered state ' . $state . "\n";
462
+ }
463
+
464
+ protected function traceDiscard($symbol) {
465
+ echo '% Discard ' . $this->symbolToName[$symbol] . "\n";
466
+ }
467
+ */
468
+
469
+ /*
470
+ * Helper functions invoked by semantic actions
471
+ */
472
+
473
+ /**
474
+ * Moves statements of semicolon-style namespaces into $ns->stmts and checks various error conditions.
475
+ *
476
+ * @param Node\Stmt[] $stmts
477
+ * @return Node\Stmt[]
478
+ */
479
+ protected function handleNamespaces(array $stmts) : array {
480
+ $hasErrored = false;
481
+ $style = $this->getNamespacingStyle($stmts);
482
+ if (null === $style) {
483
+ // not namespaced, nothing to do
484
+ return $stmts;
485
+ } elseif ('brace' === $style) {
486
+ // For braced namespaces we only have to check that there are no invalid statements between the namespaces
487
+ $afterFirstNamespace = false;
488
+ foreach ($stmts as $stmt) {
489
+ if ($stmt instanceof Node\Stmt\Namespace_) {
490
+ $afterFirstNamespace = true;
491
+ } elseif (!$stmt instanceof Node\Stmt\HaltCompiler
492
+ && !$stmt instanceof Node\Stmt\Nop
493
+ && $afterFirstNamespace && !$hasErrored) {
494
+ $this->emitError(new Error(
495
+ 'No code may exist outside of namespace {}', $stmt->getAttributes()));
496
+ $hasErrored = true; // Avoid one error for every statement
497
+ }
498
+ }
499
+ return $stmts;
500
+ } else {
501
+ // For semicolon namespaces we have to move the statements after a namespace declaration into ->stmts
502
+ $resultStmts = [];
503
+ $targetStmts =& $resultStmts;
504
+ $lastNs = null;
505
+ foreach ($stmts as $stmt) {
506
+ if ($stmt instanceof Node\Stmt\Namespace_) {
507
+ if ($lastNs !== null) {
508
+ $this->fixupNamespaceAttributes($lastNs);
509
+ }
510
+ if ($stmt->stmts === null) {
511
+ $stmt->stmts = [];
512
+ $targetStmts =& $stmt->stmts;
513
+ $resultStmts[] = $stmt;
514
+ } else {
515
+ // This handles the invalid case of mixed style namespaces
516
+ $resultStmts[] = $stmt;
517
+ $targetStmts =& $resultStmts;
518
+ }
519
+ $lastNs = $stmt;
520
+ } elseif ($stmt instanceof Node\Stmt\HaltCompiler) {
521
+ // __halt_compiler() is not moved into the namespace
522
+ $resultStmts[] = $stmt;
523
+ } else {
524
+ $targetStmts[] = $stmt;
525
+ }
526
+ }
527
+ if ($lastNs !== null) {
528
+ $this->fixupNamespaceAttributes($lastNs);
529
+ }
530
+ return $resultStmts;
531
+ }
532
+ }
533
+
534
+ private function fixupNamespaceAttributes(Node\Stmt\Namespace_ $stmt) {
535
+ // We moved the statements into the namespace node, as such the end of the namespace node
536
+ // needs to be extended to the end of the statements.
537
+ if (empty($stmt->stmts)) {
538
+ return;
539
+ }
540
+
541
+ // We only move the builtin end attributes here. This is the best we can do with the
542
+ // knowledge we have.
543
+ $endAttributes = ['endLine', 'endFilePos', 'endTokenPos'];
544
+ $lastStmt = $stmt->stmts[count($stmt->stmts) - 1];
545
+ foreach ($endAttributes as $endAttribute) {
546
+ if ($lastStmt->hasAttribute($endAttribute)) {
547
+ $stmt->setAttribute($endAttribute, $lastStmt->getAttribute($endAttribute));
548
+ }
549
+ }
550
+ }
551
+
552
+ /**
553
+ * Determine namespacing style (semicolon or brace)
554
+ *
555
+ * @param Node[] $stmts Top-level statements.
556
+ *
557
+ * @return null|string One of "semicolon", "brace" or null (no namespaces)
558
+ */
559
+ private function getNamespacingStyle(array $stmts) {
560
+ $style = null;
561
+ $hasNotAllowedStmts = false;
562
+ foreach ($stmts as $i => $stmt) {
563
+ if ($stmt instanceof Node\Stmt\Namespace_) {
564
+ $currentStyle = null === $stmt->stmts ? 'semicolon' : 'brace';
565
+ if (null === $style) {
566
+ $style = $currentStyle;
567
+ if ($hasNotAllowedStmts) {
568
+ $this->emitError(new Error(
569
+ 'Namespace declaration statement has to be the very first statement in the script',
570
+ $stmt->getLine() // Avoid marking the entire namespace as an error
571
+ ));
572
+ }
573
+ } elseif ($style !== $currentStyle) {
574
+ $this->emitError(new Error(
575
+ 'Cannot mix bracketed namespace declarations with unbracketed namespace declarations',
576
+ $stmt->getLine() // Avoid marking the entire namespace as an error
577
+ ));
578
+ // Treat like semicolon style for namespace normalization
579
+ return 'semicolon';
580
+ }
581
+ continue;
582
+ }
583
+
584
+ /* declare(), __halt_compiler() and nops can be used before a namespace declaration */
585
+ if ($stmt instanceof Node\Stmt\Declare_
586
+ || $stmt instanceof Node\Stmt\HaltCompiler
587
+ || $stmt instanceof Node\Stmt\Nop) {
588
+ continue;
589
+ }
590
+
591
+ /* There may be a hashbang line at the very start of the file */
592
+ if ($i === 0 && $stmt instanceof Node\Stmt\InlineHTML && preg_match('/\A#!.*\r?\n\z/', $stmt->value)) {
593
+ continue;
594
+ }
595
+
596
+ /* Everything else if forbidden before namespace declarations */
597
+ $hasNotAllowedStmts = true;
598
+ }
599
+ return $style;
600
+ }
601
+
602
+ /**
603
+ * Fix up parsing of static property calls in PHP 5.
604
+ *
605
+ * In PHP 5 A::$b[c][d] and A::$b[c][d]() have very different interpretation. The former is
606
+ * interpreted as (A::$b)[c][d], while the latter is the same as A::{$b[c][d]}(). We parse the
607
+ * latter as the former initially and this method fixes the AST into the correct form when we
608
+ * encounter the "()".
609
+ *
610
+ * @param Node\Expr\StaticPropertyFetch|Node\Expr\ArrayDimFetch $prop
611
+ * @param Node\Arg[] $args
612
+ * @param array $attributes
613
+ *
614
+ * @return Expr\StaticCall
615
+ */
616
+ protected function fixupPhp5StaticPropCall($prop, array $args, array $attributes) : Expr\StaticCall {
617
+ if ($prop instanceof Node\Expr\StaticPropertyFetch) {
618
+ $name = $prop->name instanceof VarLikeIdentifier
619
+ ? $prop->name->toString() : $prop->name;
620
+ $var = new Expr\Variable($name, $prop->name->getAttributes());
621
+ return new Expr\StaticCall($prop->class, $var, $args, $attributes);
622
+ } elseif ($prop instanceof Node\Expr\ArrayDimFetch) {
623
+ $tmp = $prop;
624
+ while ($tmp->var instanceof Node\Expr\ArrayDimFetch) {
625
+ $tmp = $tmp->var;
626
+ }
627
+
628
+ /** @var Expr\StaticPropertyFetch $staticProp */
629
+ $staticProp = $tmp->var;
630
+
631
+ // Set start attributes to attributes of innermost node
632
+ $tmp = $prop;
633
+ $this->fixupStartAttributes($tmp, $staticProp->name);
634
+ while ($tmp->var instanceof Node\Expr\ArrayDimFetch) {
635
+ $tmp = $tmp->var;
636
+ $this->fixupStartAttributes($tmp, $staticProp->name);
637
+ }
638
+
639
+ $name = $staticProp->name instanceof VarLikeIdentifier
640
+ ? $staticProp->name->toString() : $staticProp->name;
641
+ $tmp->var = new Expr\Variable($name, $staticProp->name->getAttributes());
642
+ return new Expr\StaticCall($staticProp->class, $prop, $args, $attributes);
643
+ } else {
644
+ throw new \Exception;
645
+ }
646
+ }
647
+
648
+ protected function fixupStartAttributes(Node $to, Node $from) {
649
+ $startAttributes = ['startLine', 'startFilePos', 'startTokenPos'];
650
+ foreach ($startAttributes as $startAttribute) {
651
+ if ($from->hasAttribute($startAttribute)) {
652
+ $to->setAttribute($startAttribute, $from->getAttribute($startAttribute));
653
+ }
654
+ }
655
+ }
656
+
657
+ protected function handleBuiltinTypes(Name $name) {
658
+ $builtinTypes = [
659
+ 'bool' => true,
660
+ 'int' => true,
661
+ 'float' => true,
662
+ 'string' => true,
663
+ 'iterable' => true,
664
+ 'void' => true,
665
+ 'object' => true,
666
+ 'null' => true,
667
+ 'false' => true,
668
+ 'mixed' => true,
669
+ 'never' => true,
670
+ 'true' => true,
671
+ ];
672
+
673
+ if (!$name->isUnqualified()) {
674
+ return $name;
675
+ }
676
+
677
+ $lowerName = $name->toLowerString();
678
+ if (!isset($builtinTypes[$lowerName])) {
679
+ return $name;
680
+ }
681
+
682
+ return new Node\Identifier($lowerName, $name->getAttributes());
683
+ }
684
+
685
+ /**
686
+ * Get combined start and end attributes at a stack location
687
+ *
688
+ * @param int $pos Stack location
689
+ *
690
+ * @return array Combined start and end attributes
691
+ */
692
+ protected function getAttributesAt(int $pos) : array {
693
+ return $this->startAttributeStack[$pos] + $this->endAttributeStack[$pos];
694
+ }
695
+
696
+ protected function getFloatCastKind(string $cast): int
697
+ {
698
+ $cast = strtolower($cast);
699
+ if (strpos($cast, 'float') !== false) {
700
+ return Double::KIND_FLOAT;
701
+ }
702
+
703
+ if (strpos($cast, 'real') !== false) {
704
+ return Double::KIND_REAL;
705
+ }
706
+
707
+ return Double::KIND_DOUBLE;
708
+ }
709
+
710
+ protected function parseLNumber($str, $attributes, $allowInvalidOctal = false) {
711
+ try {
712
+ return LNumber::fromString($str, $attributes, $allowInvalidOctal);
713
+ } catch (Error $error) {
714
+ $this->emitError($error);
715
+ // Use dummy value
716
+ return new LNumber(0, $attributes);
717
+ }
718
+ }
719
+
720
+ /**
721
+ * Parse a T_NUM_STRING token into either an integer or string node.
722
+ *
723
+ * @param string $str Number string
724
+ * @param array $attributes Attributes
725
+ *
726
+ * @return LNumber|String_ Integer or string node.
727
+ */
728
+ protected function parseNumString(string $str, array $attributes) {
729
+ if (!preg_match('/^(?:0|-?[1-9][0-9]*)$/', $str)) {
730
+ return new String_($str, $attributes);
731
+ }
732
+
733
+ $num = +$str;
734
+ if (!is_int($num)) {
735
+ return new String_($str, $attributes);
736
+ }
737
+
738
+ return new LNumber($num, $attributes);
739
+ }
740
+
741
+ protected function stripIndentation(
742
+ string $string, int $indentLen, string $indentChar,
743
+ bool $newlineAtStart, bool $newlineAtEnd, array $attributes
744
+ ) {
745
+ if ($indentLen === 0) {
746
+ return $string;
747
+ }
748
+
749
+ $start = $newlineAtStart ? '(?:(?<=\n)|\A)' : '(?<=\n)';
750
+ $end = $newlineAtEnd ? '(?:(?=[\r\n])|\z)' : '(?=[\r\n])';
751
+ $regex = '/' . $start . '([ \t]*)(' . $end . ')?/';
752
+ return preg_replace_callback(
753
+ $regex,
754
+ function ($matches) use ($indentLen, $indentChar, $attributes) {
755
+ $prefix = substr($matches[1], 0, $indentLen);
756
+ if (false !== strpos($prefix, $indentChar === " " ? "\t" : " ")) {
757
+ $this->emitError(new Error(
758
+ 'Invalid indentation - tabs and spaces cannot be mixed', $attributes
759
+ ));
760
+ } elseif (strlen($prefix) < $indentLen && !isset($matches[2])) {
761
+ $this->emitError(new Error(
762
+ 'Invalid body indentation level ' .
763
+ '(expecting an indentation level of at least ' . $indentLen . ')',
764
+ $attributes
765
+ ));
766
+ }
767
+ return substr($matches[0], strlen($prefix));
768
+ },
769
+ $string
770
+ );
771
+ }
772
+
773
+ protected function parseDocString(
774
+ string $startToken, $contents, string $endToken,
775
+ array $attributes, array $endTokenAttributes, bool $parseUnicodeEscape
776
+ ) {
777
+ $kind = strpos($startToken, "'") === false
778
+ ? String_::KIND_HEREDOC : String_::KIND_NOWDOC;
779
+
780
+ $regex = '/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/';
781
+ $result = preg_match($regex, $startToken, $matches);
782
+ assert($result === 1);
783
+ $label = $matches[1];
784
+
785
+ $result = preg_match('/\A[ \t]*/', $endToken, $matches);
786
+ assert($result === 1);
787
+ $indentation = $matches[0];
788
+
789
+ $attributes['kind'] = $kind;
790
+ $attributes['docLabel'] = $label;
791
+ $attributes['docIndentation'] = $indentation;
792
+
793
+ $indentHasSpaces = false !== strpos($indentation, " ");
794
+ $indentHasTabs = false !== strpos($indentation, "\t");
795
+ if ($indentHasSpaces && $indentHasTabs) {
796
+ $this->emitError(new Error(
797
+ 'Invalid indentation - tabs and spaces cannot be mixed',
798
+ $endTokenAttributes
799
+ ));
800
+
801
+ // Proceed processing as if this doc string is not indented
802
+ $indentation = '';
803
+ }
804
+
805
+ $indentLen = \strlen($indentation);
806
+ $indentChar = $indentHasSpaces ? " " : "\t";
807
+
808
+ if (\is_string($contents)) {
809
+ if ($contents === '') {
810
+ return new String_('', $attributes);
811
+ }
812
+
813
+ $contents = $this->stripIndentation(
814
+ $contents, $indentLen, $indentChar, true, true, $attributes
815
+ );
816
+ $contents = preg_replace('~(\r\n|\n|\r)\z~', '', $contents);
817
+
818
+ if ($kind === String_::KIND_HEREDOC) {
819
+ $contents = String_::parseEscapeSequences($contents, null, $parseUnicodeEscape);
820
+ }
821
+
822
+ return new String_($contents, $attributes);
823
+ } else {
824
+ assert(count($contents) > 0);
825
+ if (!$contents[0] instanceof Node\Scalar\EncapsedStringPart) {
826
+ // If there is no leading encapsed string part, pretend there is an empty one
827
+ $this->stripIndentation(
828
+ '', $indentLen, $indentChar, true, false, $contents[0]->getAttributes()
829
+ );
830
+ }
831
+
832
+ $newContents = [];
833
+ foreach ($contents as $i => $part) {
834
+ if ($part instanceof Node\Scalar\EncapsedStringPart) {
835
+ $isLast = $i === \count($contents) - 1;
836
+ $part->value = $this->stripIndentation(
837
+ $part->value, $indentLen, $indentChar,
838
+ $i === 0, $isLast, $part->getAttributes()
839
+ );
840
+ $part->value = String_::parseEscapeSequences($part->value, null, $parseUnicodeEscape);
841
+ if ($isLast) {
842
+ $part->value = preg_replace('~(\r\n|\n|\r)\z~', '', $part->value);
843
+ }
844
+ if ('' === $part->value) {
845
+ continue;
846
+ }
847
+ }
848
+ $newContents[] = $part;
849
+ }
850
+ return new Encapsed($newContents, $attributes);
851
+ }
852
+ }
853
+
854
+ /**
855
+ * Create attributes for a zero-length common-capturing nop.
856
+ *
857
+ * @param Comment[] $comments
858
+ * @return array
859
+ */
860
+ protected function createCommentNopAttributes(array $comments) {
861
+ $comment = $comments[count($comments) - 1];
862
+ $commentEndLine = $comment->getEndLine();
863
+ $commentEndFilePos = $comment->getEndFilePos();
864
+ $commentEndTokenPos = $comment->getEndTokenPos();
865
+
866
+ $attributes = ['comments' => $comments];
867
+ if (-1 !== $commentEndLine) {
868
+ $attributes['startLine'] = $commentEndLine;
869
+ $attributes['endLine'] = $commentEndLine;
870
+ }
871
+ if (-1 !== $commentEndFilePos) {
872
+ $attributes['startFilePos'] = $commentEndFilePos + 1;
873
+ $attributes['endFilePos'] = $commentEndFilePos;
874
+ }
875
+ if (-1 !== $commentEndTokenPos) {
876
+ $attributes['startTokenPos'] = $commentEndTokenPos + 1;
877
+ $attributes['endTokenPos'] = $commentEndTokenPos;
878
+ }
879
+ return $attributes;
880
+ }
881
+
882
+ /** @param ElseIf_|Else_ $node */
883
+ protected function fixupAlternativeElse($node) {
884
+ // Make sure a trailing nop statement carrying comments is part of the node.
885
+ $numStmts = \count($node->stmts);
886
+ if ($numStmts !== 0 && $node->stmts[$numStmts - 1] instanceof Nop) {
887
+ $nopAttrs = $node->stmts[$numStmts - 1]->getAttributes();
888
+ if (isset($nopAttrs['endLine'])) {
889
+ $node->setAttribute('endLine', $nopAttrs['endLine']);
890
+ }
891
+ if (isset($nopAttrs['endFilePos'])) {
892
+ $node->setAttribute('endFilePos', $nopAttrs['endFilePos']);
893
+ }
894
+ if (isset($nopAttrs['endTokenPos'])) {
895
+ $node->setAttribute('endTokenPos', $nopAttrs['endTokenPos']);
896
+ }
897
+ }
898
+ }
899
+
900
+ protected function checkClassModifier($a, $b, $modifierPos) {
901
+ try {
902
+ Class_::verifyClassModifier($a, $b);
903
+ } catch (Error $error) {
904
+ $error->setAttributes($this->getAttributesAt($modifierPos));
905
+ $this->emitError($error);
906
+ }
907
+ }
908
+
909
+ protected function checkModifier($a, $b, $modifierPos) {
910
+ // Jumping through some hoops here because verifyModifier() is also used elsewhere
911
+ try {
912
+ Class_::verifyModifier($a, $b);
913
+ } catch (Error $error) {
914
+ $error->setAttributes($this->getAttributesAt($modifierPos));
915
+ $this->emitError($error);
916
+ }
917
+ }
918
+
919
+ protected function checkParam(Param $node) {
920
+ if ($node->variadic && null !== $node->default) {
921
+ $this->emitError(new Error(
922
+ 'Variadic parameter cannot have a default value',
923
+ $node->default->getAttributes()
924
+ ));
925
+ }
926
+ }
927
+
928
+ protected function checkTryCatch(TryCatch $node) {
929
+ if (empty($node->catches) && null === $node->finally) {
930
+ $this->emitError(new Error(
931
+ 'Cannot use try without catch or finally', $node->getAttributes()
932
+ ));
933
+ }
934
+ }
935
+
936
+ protected function checkNamespace(Namespace_ $node) {
937
+ if (null !== $node->stmts) {
938
+ foreach ($node->stmts as $stmt) {
939
+ if ($stmt instanceof Namespace_) {
940
+ $this->emitError(new Error(
941
+ 'Namespace declarations cannot be nested', $stmt->getAttributes()
942
+ ));
943
+ }
944
+ }
945
+ }
946
+ }
947
+
948
+ private function checkClassName($name, $namePos) {
949
+ if (null !== $name && $name->isSpecialClassName()) {
950
+ $this->emitError(new Error(
951
+ sprintf('Cannot use \'%s\' as class name as it is reserved', $name),
952
+ $this->getAttributesAt($namePos)
953
+ ));
954
+ }
955
+ }
956
+
957
+ private function checkImplementedInterfaces(array $interfaces) {
958
+ foreach ($interfaces as $interface) {
959
+ if ($interface->isSpecialClassName()) {
960
+ $this->emitError(new Error(
961
+ sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface),
962
+ $interface->getAttributes()
963
+ ));
964
+ }
965
+ }
966
+ }
967
+
968
+ protected function checkClass(Class_ $node, $namePos) {
969
+ $this->checkClassName($node->name, $namePos);
970
+
971
+ if ($node->extends && $node->extends->isSpecialClassName()) {
972
+ $this->emitError(new Error(
973
+ sprintf('Cannot use \'%s\' as class name as it is reserved', $node->extends),
974
+ $node->extends->getAttributes()
975
+ ));
976
+ }
977
+
978
+ $this->checkImplementedInterfaces($node->implements);
979
+ }
980
+
981
+ protected function checkInterface(Interface_ $node, $namePos) {
982
+ $this->checkClassName($node->name, $namePos);
983
+ $this->checkImplementedInterfaces($node->extends);
984
+ }
985
+
986
+ protected function checkEnum(Enum_ $node, $namePos) {
987
+ $this->checkClassName($node->name, $namePos);
988
+ $this->checkImplementedInterfaces($node->implements);
989
+ }
990
+
991
+ protected function checkClassMethod(ClassMethod $node, $modifierPos) {
992
+ if ($node->flags & Class_::MODIFIER_STATIC) {
993
+ switch ($node->name->toLowerString()) {
994
+ case '__construct':
995
+ $this->emitError(new Error(
996
+ sprintf('Constructor %s() cannot be static', $node->name),
997
+ $this->getAttributesAt($modifierPos)));
998
+ break;
999
+ case '__destruct':
1000
+ $this->emitError(new Error(
1001
+ sprintf('Destructor %s() cannot be static', $node->name),
1002
+ $this->getAttributesAt($modifierPos)));
1003
+ break;
1004
+ case '__clone':
1005
+ $this->emitError(new Error(
1006
+ sprintf('Clone method %s() cannot be static', $node->name),
1007
+ $this->getAttributesAt($modifierPos)));
1008
+ break;
1009
+ }
1010
+ }
1011
+
1012
+ if ($node->flags & Class_::MODIFIER_READONLY) {
1013
+ $this->emitError(new Error(
1014
+ sprintf('Method %s() cannot be readonly', $node->name),
1015
+ $this->getAttributesAt($modifierPos)));
1016
+ }
1017
+ }
1018
+
1019
+ protected function checkClassConst(ClassConst $node, $modifierPos) {
1020
+ if ($node->flags & Class_::MODIFIER_STATIC) {
1021
+ $this->emitError(new Error(
1022
+ "Cannot use 'static' as constant modifier",
1023
+ $this->getAttributesAt($modifierPos)));
1024
+ }
1025
+ if ($node->flags & Class_::MODIFIER_ABSTRACT) {
1026
+ $this->emitError(new Error(
1027
+ "Cannot use 'abstract' as constant modifier",
1028
+ $this->getAttributesAt($modifierPos)));
1029
+ }
1030
+ if ($node->flags & Class_::MODIFIER_READONLY) {
1031
+ $this->emitError(new Error(
1032
+ "Cannot use 'readonly' as constant modifier",
1033
+ $this->getAttributesAt($modifierPos)));
1034
+ }
1035
+ }
1036
+
1037
+ protected function checkProperty(Property $node, $modifierPos) {
1038
+ if ($node->flags & Class_::MODIFIER_ABSTRACT) {
1039
+ $this->emitError(new Error('Properties cannot be declared abstract',
1040
+ $this->getAttributesAt($modifierPos)));
1041
+ }
1042
+
1043
+ if ($node->flags & Class_::MODIFIER_FINAL) {
1044
+ $this->emitError(new Error('Properties cannot be declared final',
1045
+ $this->getAttributesAt($modifierPos)));
1046
+ }
1047
+ }
1048
+
1049
+ protected function checkUseUse(UseUse $node, $namePos) {
1050
+ if ($node->alias && $node->alias->isSpecialClassName()) {
1051
+ $this->emitError(new Error(
1052
+ sprintf(
1053
+ 'Cannot use %s as %s because \'%2$s\' is a special class name',
1054
+ $node->name, $node->alias
1055
+ ),
1056
+ $this->getAttributesAt($namePos)
1057
+ ));
1058
+ }
1059
+ }
1060
+ }