script_core 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (381) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +8 -6
  4. data/.ruby-version +1 -1
  5. data/Gemfile +2 -1
  6. data/bin/sandbox +1 -1
  7. data/ext/enterprise_script_service/Rakefile +1 -1
  8. data/ext/enterprise_script_service/flags.rb +5 -0
  9. data/ext/enterprise_script_service/libseccomp/CHANGELOG +15 -0
  10. data/ext/enterprise_script_service/libseccomp/CREDITS +3 -0
  11. data/ext/enterprise_script_service/libseccomp/Makefile.am +1 -1
  12. data/ext/enterprise_script_service/libseccomp/README.md +1 -1
  13. data/ext/enterprise_script_service/libseccomp/SECURITY.md +45 -0
  14. data/ext/enterprise_script_service/libseccomp/configure.ac +3 -3
  15. data/ext/enterprise_script_service/libseccomp/doc/admin/MAINTAINER_PROCESS.md +95 -0
  16. data/ext/enterprise_script_service/libseccomp/{RELEASE_PROCESS.md → doc/admin/RELEASE_PROCESS.md} +9 -1
  17. data/ext/enterprise_script_service/libseccomp/include/Makefile.am +1 -1
  18. data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +2292 -0
  19. data/ext/enterprise_script_service/libseccomp/include/seccomp.h.in +3 -1065
  20. data/ext/enterprise_script_service/libseccomp/src/arch-aarch64-syscalls.c +35 -3
  21. data/ext/enterprise_script_service/libseccomp/src/arch-arm-syscalls.c +35 -3
  22. data/ext/enterprise_script_service/libseccomp/src/arch-mips-syscalls.c +43 -11
  23. data/ext/enterprise_script_service/libseccomp/src/arch-mips64-syscalls.c +33 -1
  24. data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32-syscalls.c +33 -1
  25. data/ext/enterprise_script_service/libseccomp/src/arch-parisc-syscalls.c +34 -2
  26. data/ext/enterprise_script_service/libseccomp/src/arch-ppc-syscalls.c +43 -11
  27. data/ext/enterprise_script_service/libseccomp/src/arch-ppc64-syscalls.c +44 -12
  28. data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +46 -14
  29. data/ext/enterprise_script_service/libseccomp/src/arch-s390.c +142 -18
  30. data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +47 -15
  31. data/ext/enterprise_script_service/libseccomp/src/arch-s390x.c +143 -17
  32. data/ext/enterprise_script_service/libseccomp/src/arch-x32-syscalls.c +33 -1
  33. data/ext/enterprise_script_service/libseccomp/src/arch-x86-syscalls.c +94 -12
  34. data/ext/enterprise_script_service/libseccomp/src/arch-x86.c +142 -19
  35. data/ext/enterprise_script_service/libseccomp/src/arch-x86_64-syscalls.c +33 -1
  36. data/ext/enterprise_script_service/libseccomp/src/db.c +1 -0
  37. data/ext/enterprise_script_service/libseccomp/src/gen_bpf.c +10 -3
  38. data/ext/enterprise_script_service/libseccomp/src/python/Makefile.am +4 -4
  39. data/ext/enterprise_script_service/libseccomp/src/python/seccomp.pyx +2 -0
  40. data/ext/enterprise_script_service/libseccomp/tests/.gitignore +1 -0
  41. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.c +98 -0
  42. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.py +61 -0
  43. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.tests +18 -0
  44. data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +6 -3
  45. data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -2
  46. data/ext/enterprise_script_service/libseccomp/tools/check-syntax +1 -0
  47. data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +2 -0
  48. data/ext/enterprise_script_service/mruby-mpdecimal/src/ext.c +1 -1
  49. data/ext/enterprise_script_service/mruby/.gitignore +2 -2
  50. data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +10 -3
  51. data/ext/enterprise_script_service/mruby/Doxyfile +2408 -0
  52. data/ext/enterprise_script_service/mruby/README.md +21 -8
  53. data/ext/enterprise_script_service/mruby/Rakefile +4 -13
  54. data/ext/enterprise_script_service/mruby/appveyor_config.rb +1 -1
  55. data/ext/enterprise_script_service/mruby/build_config.rb +3 -3
  56. data/ext/enterprise_script_service/mruby/doc/guides/compile.md +42 -42
  57. data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
  58. data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +45 -6
  59. data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +5 -0
  60. data/ext/enterprise_script_service/mruby/doc/limitations.md +88 -38
  61. data/ext/enterprise_script_service/mruby/doc/mruby_logo_red_icon.png +0 -0
  62. data/ext/enterprise_script_service/mruby/doc/opcode.md +94 -94
  63. data/ext/enterprise_script_service/mruby/include/mrbconf.h +74 -11
  64. data/ext/enterprise_script_service/mruby/include/mruby.h +242 -146
  65. data/ext/enterprise_script_service/mruby/include/mruby/array.h +7 -7
  66. data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +2 -9
  67. data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +11 -10
  68. data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +104 -69
  69. data/ext/enterprise_script_service/mruby/include/mruby/class.h +7 -5
  70. data/ext/enterprise_script_service/mruby/include/mruby/common.h +9 -7
  71. data/ext/enterprise_script_service/mruby/include/mruby/compile.h +6 -6
  72. data/ext/enterprise_script_service/mruby/include/mruby/data.h +5 -5
  73. data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
  74. data/ext/enterprise_script_service/mruby/include/mruby/dump.h +3 -7
  75. data/ext/enterprise_script_service/mruby/include/mruby/error.h +34 -6
  76. data/ext/enterprise_script_service/mruby/include/mruby/gc.h +2 -2
  77. data/ext/enterprise_script_service/mruby/include/mruby/hash.h +4 -11
  78. data/ext/enterprise_script_service/mruby/include/mruby/irep.h +16 -4
  79. data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -4
  80. data/ext/enterprise_script_service/mruby/include/mruby/khash.h +2 -2
  81. data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +41 -7
  82. data/ext/enterprise_script_service/mruby/include/mruby/object.h +8 -9
  83. data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +2 -2
  84. data/ext/enterprise_script_service/mruby/include/mruby/ops.h +6 -6
  85. data/ext/enterprise_script_service/mruby/include/mruby/proc.h +19 -13
  86. data/ext/enterprise_script_service/mruby/include/mruby/range.h +10 -4
  87. data/ext/enterprise_script_service/mruby/include/mruby/re.h +2 -2
  88. data/ext/enterprise_script_service/mruby/include/mruby/string.h +130 -107
  89. data/ext/enterprise_script_service/mruby/include/mruby/throw.h +2 -2
  90. data/ext/enterprise_script_service/mruby/include/mruby/value.h +137 -49
  91. data/ext/enterprise_script_service/mruby/include/mruby/variable.h +3 -5
  92. data/ext/enterprise_script_service/mruby/include/mruby/version.h +24 -10
  93. data/ext/enterprise_script_service/mruby/lib/mruby-core-ext.rb +2 -39
  94. data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +32 -15
  95. data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +63 -17
  96. data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +24 -10
  97. data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +11 -7
  98. data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +81 -0
  99. data/ext/enterprise_script_service/mruby/minirake +27 -11
  100. data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +3 -0
  101. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrbgem.rake +0 -1
  102. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +47 -9
  103. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +3 -3
  104. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +50 -29
  105. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +3 -3
  106. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +2 -2
  107. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c +3 -3
  108. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +2 -2
  109. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +1 -1
  110. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -0
  111. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +28 -1
  112. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +1 -2
  113. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +75 -8
  114. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +134 -90
  115. data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +7 -8
  116. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +69 -46
  117. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +0 -3
  118. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +51 -59
  119. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +430 -241
  120. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrbgem.rake +10 -0
  121. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +122 -0
  122. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +249 -0
  123. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +153 -0
  124. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/mrblib/chain.rb +19 -17
  125. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/test/enum_chain.rb +41 -9
  126. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +30 -4
  127. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/test/enum.rb +8 -3
  128. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrbgem.rake +0 -1
  129. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +46 -14
  130. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +51 -2
  131. data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +10 -0
  132. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +47 -44
  133. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +2 -2
  134. data/ext/enterprise_script_service/mruby/mrbgems/mruby-exit/src/mruby-exit.c +9 -4
  135. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +16 -12
  136. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/test/fiber.rb +1 -1
  137. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +0 -2
  138. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +3 -0
  139. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +3 -7
  140. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +1 -3
  141. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +1 -1
  142. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +0 -5
  143. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +24 -38
  144. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/kernel.rb +16 -0
  145. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +19 -18
  146. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +5 -16
  147. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +54 -42
  148. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +24 -20
  149. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file_test.rb +4 -9
  150. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +41 -35
  151. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +9 -36
  152. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrbgem.rake +1 -1
  153. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +9 -27
  154. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/test/kernel.rb +2 -0
  155. data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +5 -2
  156. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +39 -24
  157. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +48 -17
  158. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/method.rb +0 -12
  159. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +134 -101
  160. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +9 -1
  161. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +1 -5
  162. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +17 -37
  163. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +0 -8
  164. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrbgem.rake +1 -1
  165. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrblib/object.rb +15 -1
  166. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +35 -6
  167. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/test/nil.rb +4 -0
  168. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +1 -5
  169. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +1 -1
  170. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +28 -23
  171. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/test/pack.rb +43 -49
  172. data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +3 -9
  173. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +6 -9
  174. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.rb +21 -5
  175. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +157 -124
  176. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +72 -26
  177. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +38 -0
  178. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +26 -11
  179. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +111 -1
  180. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrbgem.rake +5 -0
  181. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +117 -0
  182. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +209 -0
  183. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +308 -0
  184. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +1 -1
  185. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +10 -9
  186. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +2 -2
  187. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +22 -24
  188. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrbgem.rake +0 -1
  189. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +8 -4
  190. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +116 -117
  191. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/numeric.rb +29 -0
  192. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/range.rb +26 -0
  193. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/string.rb +32 -50
  194. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +5 -7
  195. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +43 -57
  196. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/test/struct.rb +16 -11
  197. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +2 -2
  198. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
  199. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +152 -1
  200. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +4 -3
  201. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +200 -0
  202. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/include/mruby/time.h +2 -1
  203. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +199 -68
  204. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/test/time.rb +81 -46
  205. data/ext/enterprise_script_service/mruby/mrblib/array.rb +14 -16
  206. data/ext/enterprise_script_service/mruby/mrblib/enum.rb +13 -9
  207. data/ext/enterprise_script_service/mruby/mrblib/hash.rb +5 -7
  208. data/ext/enterprise_script_service/mruby/mrblib/kernel.rb +1 -1
  209. data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +4 -4
  210. data/ext/enterprise_script_service/mruby/mrblib/range.rb +1 -1
  211. data/ext/enterprise_script_service/mruby/mrblib/string.rb +55 -112
  212. data/ext/enterprise_script_service/mruby/mruby-source.gemspec +1 -1
  213. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby.dict +105 -0
  214. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_fuzzer.options +5 -0
  215. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_proto_fuzzer.options +4 -0
  216. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_fuzzer.c +18 -0
  217. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +44 -0
  218. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.cpp +455 -0
  219. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +55 -0
  220. data/ext/enterprise_script_service/mruby/oss-fuzz/ruby.proto +201 -0
  221. data/ext/enterprise_script_service/mruby/src/array.c +95 -46
  222. data/ext/enterprise_script_service/mruby/src/backtrace.c +6 -8
  223. data/ext/enterprise_script_service/mruby/src/class.c +370 -278
  224. data/ext/enterprise_script_service/mruby/src/codedump.c +34 -34
  225. data/ext/enterprise_script_service/mruby/src/debug.c +2 -2
  226. data/ext/enterprise_script_service/mruby/src/dump.c +8 -6
  227. data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
  228. data/ext/enterprise_script_service/mruby/src/error.c +157 -55
  229. data/ext/enterprise_script_service/mruby/src/etc.c +13 -46
  230. data/ext/enterprise_script_service/mruby/src/fmt_fp.c +2 -2
  231. data/ext/enterprise_script_service/mruby/src/gc.c +30 -11
  232. data/ext/enterprise_script_service/mruby/src/hash.c +23 -14
  233. data/ext/enterprise_script_service/mruby/src/kernel.c +16 -54
  234. data/ext/enterprise_script_service/mruby/src/load.c +40 -76
  235. data/ext/enterprise_script_service/mruby/src/numeric.c +164 -94
  236. data/ext/enterprise_script_service/mruby/src/object.c +16 -39
  237. data/ext/enterprise_script_service/mruby/src/pool.c +0 -2
  238. data/ext/enterprise_script_service/mruby/src/proc.c +47 -48
  239. data/ext/enterprise_script_service/mruby/src/range.c +22 -35
  240. data/ext/enterprise_script_service/mruby/src/state.c +5 -94
  241. data/ext/enterprise_script_service/mruby/src/string.c +874 -710
  242. data/ext/enterprise_script_service/mruby/src/symbol.c +73 -48
  243. data/ext/enterprise_script_service/mruby/src/variable.c +58 -38
  244. data/ext/enterprise_script_service/mruby/src/vm.c +133 -304
  245. data/ext/enterprise_script_service/mruby/tasks/doc.rake +48 -0
  246. data/ext/enterprise_script_service/mruby/tasks/toolchains/clang.rake +3 -4
  247. data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +20 -19
  248. data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +0 -12
  249. data/ext/enterprise_script_service/mruby/test/assert.rb +186 -25
  250. data/ext/enterprise_script_service/mruby/test/t/array.rb +34 -6
  251. data/ext/enterprise_script_service/mruby/test/t/class.rb +26 -0
  252. data/ext/enterprise_script_service/mruby/test/t/enumerable.rb +2 -2
  253. data/ext/enterprise_script_service/mruby/test/t/float.rb +17 -17
  254. data/ext/enterprise_script_service/mruby/test/t/hash.rb +2 -0
  255. data/ext/enterprise_script_service/mruby/test/t/integer.rb +14 -6
  256. data/ext/enterprise_script_service/mruby/test/t/kernel.rb +38 -19
  257. data/ext/enterprise_script_service/mruby/test/t/module.rb +87 -14
  258. data/ext/enterprise_script_service/mruby/test/t/numeric.rb +65 -23
  259. data/ext/enterprise_script_service/mruby/test/t/range.rb +4 -4
  260. data/ext/enterprise_script_service/mruby/test/t/string.rb +211 -49
  261. data/ext/enterprise_script_service/mruby/test/t/syntax.rb +19 -2
  262. data/ext/enterprise_script_service/mruby/test/t/vformat.rb +92 -0
  263. data/ext/enterprise_script_service/mruby/travis_config.rb +2 -2
  264. data/ext/enterprise_script_service/mruby_config.rb +10 -0
  265. data/ext/enterprise_script_service/mruby_engine.cpp +2 -2
  266. data/ext/enterprise_script_service/mruby_engine.gembox +1 -0
  267. data/ext/enterprise_script_service/msgpack/CHANGELOG.md +14 -0
  268. data/ext/enterprise_script_service/msgpack/Files.cmake +4 -0
  269. data/ext/enterprise_script_service/msgpack/README.md +1 -1
  270. data/ext/enterprise_script_service/msgpack/appveyor.yml +1 -1
  271. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple.hpp.erb +1 -1
  272. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple_decl.hpp.erb +1 -1
  273. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_zone.hpp.erb +3 -3
  274. data/ext/enterprise_script_service/msgpack/example/boost/asio_send_recv.cpp +1 -1
  275. data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/cpp11/timespec.hpp +16 -0
  276. data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/wstring.hpp +15 -0
  277. data/ext/enterprise_script_service/msgpack/include/msgpack/object.h +2 -0
  278. data/ext/enterprise_script_service/msgpack/include/msgpack/pack_template.h +17 -9
  279. data/ext/enterprise_script_service/msgpack/include/msgpack/sysdep.h +27 -16
  280. data/ext/enterprise_script_service/msgpack/include/msgpack/type.hpp +2 -0
  281. data/ext/enterprise_script_service/msgpack/include/msgpack/unpack_template.h +5 -0
  282. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +0 -1
  283. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/check_container_size.hpp +1 -1
  284. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/chrono.hpp +5 -5
  285. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/timespec.hpp +140 -0
  286. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple.hpp +32 -32
  287. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple_decl.hpp +32 -32
  288. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple.hpp +6 -6
  289. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple_decl.hpp +10 -10
  290. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/ext.hpp +1 -1
  291. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/fixint.hpp +5 -4
  292. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int.hpp +40 -13
  293. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int_decl.hpp +3 -2
  294. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +121 -0
  295. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp03_zone.hpp +3 -3
  296. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp11_zone.hpp +3 -3
  297. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object.hpp +6 -6
  298. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object_fwd.hpp +1 -1
  299. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/pack.hpp +40 -5
  300. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/unpack.hpp +11 -11
  301. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/vrefbuffer.hpp +7 -7
  302. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/zbuffer.hpp +5 -5
  303. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/adaptor/int_decl.hpp +1 -1
  304. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/create_object_visitor.hpp +1 -1
  305. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/parse.hpp +13 -13
  306. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/x3_parse.hpp +28 -26
  307. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/adaptor/int_decl.hpp +1 -1
  308. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/parse.hpp +13 -13
  309. data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
  310. data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +6 -6
  311. data/ext/enterprise_script_service/msgpack/include/msgpack/zone.h +1 -1
  312. data/ext/enterprise_script_service/msgpack/src/objectc.c +83 -148
  313. data/ext/enterprise_script_service/msgpack/src/unpack.c +73 -47
  314. data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +1 -1
  315. data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +5 -0
  316. data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +5 -0
  317. data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +7 -0
  318. data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +7 -0
  319. data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +6 -0
  320. data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +15 -9
  321. data/ext/enterprise_script_service/msgpack/test/buffer.cpp +7 -0
  322. data/ext/enterprise_script_service/msgpack/test/carray.cpp +7 -0
  323. data/ext/enterprise_script_service/msgpack/test/cases.cpp +7 -1
  324. data/ext/enterprise_script_service/msgpack/test/convert.cpp +6 -0
  325. data/ext/enterprise_script_service/msgpack/test/fixint.cpp +7 -1
  326. data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +6 -1
  327. data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +5 -0
  328. data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +8 -2
  329. data/ext/enterprise_script_service/msgpack/test/json.cpp +6 -0
  330. data/ext/enterprise_script_service/msgpack/test/limit.cpp +7 -0
  331. data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +128 -6
  332. data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +7 -2
  333. data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +20 -3
  334. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +159 -0
  335. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +5 -0
  336. data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +8 -3
  337. data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +6 -0
  338. data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +5 -0
  339. data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +23 -18
  340. data/ext/enterprise_script_service/msgpack/test/object.cpp +77 -45
  341. data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +28 -10
  342. data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +25 -18
  343. data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +7 -0
  344. data/ext/enterprise_script_service/msgpack/test/raw.cpp +17 -12
  345. data/ext/enterprise_script_service/msgpack/test/reference.cpp +6 -0
  346. data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +6 -0
  347. data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +6 -0
  348. data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +6 -0
  349. data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +6 -2
  350. data/ext/enterprise_script_service/msgpack/test/streaming.cpp +10 -3
  351. data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +7 -0
  352. data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +6 -0
  353. data/ext/enterprise_script_service/msgpack/test/user_class.cpp +5 -0
  354. data/ext/enterprise_script_service/msgpack/test/version.cpp +6 -0
  355. data/ext/enterprise_script_service/msgpack/test/visitor.cpp +7 -0
  356. data/ext/enterprise_script_service/msgpack/test/zone.cpp +6 -0
  357. data/lib/script_core/version.rb +1 -1
  358. data/lib/tasks/mruby/engine.gembox.example +1 -0
  359. data/lib/tasks/script_core.rake +21 -3
  360. data/spec/dummy/app/helpers/fields_helper.rb +2 -2
  361. data/spec/dummy/mruby/engine.gembox +1 -0
  362. data/spec/script_core_spec.rb +1 -1
  363. metadata +38 -22
  364. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.gitignore +0 -1
  365. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.travis.yml +0 -2
  366. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/run_test.rb +0 -26
  367. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrblib/kernel.rb +0 -15
  368. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/unbound_method.rb +0 -9
  369. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.gitignore +0 -5
  370. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.travis.yml +0 -2
  371. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/packtest.rb +0 -157
  372. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/run_test.rb +0 -26
  373. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.c +0 -224
  374. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.h +0 -80
  375. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.h +0 -12
  376. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.gitignore +0 -4
  377. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis.yml +0 -29
  378. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis_build_config.rb +0 -6
  379. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/Rakefile +0 -29
  380. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/.travis.yml +0 -4
  381. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/run_test.rb +0 -28
@@ -10,13 +10,7 @@
10
10
  # define YYDEBUG 1
11
11
  #endif
12
12
  #define YYERROR_VERBOSE 1
13
- /*
14
- * Force yacc to use our memory management. This is a little evil because
15
- * the macros assume that "parser_state *p" is in scope
16
- */
17
- #define YYMALLOC(n) mrb_malloc(p->mrb, (n))
18
- #define YYFREE(o) mrb_free(p->mrb, (o))
19
- #define YYSTACK_USE_ALLOCA 0
13
+ #define YYSTACK_USE_ALLOCA 1
20
14
 
21
15
  #include <ctype.h>
22
16
  #include <errno.h>
@@ -27,6 +21,7 @@
27
21
  #include <mruby/proc.h>
28
22
  #include <mruby/error.h>
29
23
  #include <mruby/throw.h>
24
+ #include <mruby/string.h>
30
25
  #include "node.h"
31
26
 
32
27
  #define YYLEX_PARAM p
@@ -76,6 +71,9 @@ typedef unsigned int stack_type;
76
71
  #define nint(x) ((node*)(intptr_t)(x))
77
72
  #define intn(x) ((int)(intptr_t)(x))
78
73
 
74
+ #define NUM_SUFFIX_R (1<<0)
75
+ #define NUM_SUFFIX_I (1<<1)
76
+
79
77
  static inline mrb_sym
80
78
  intern_cstr_gen(parser_state *p, const char *s)
81
79
  {
@@ -90,12 +88,7 @@ intern_gen(parser_state *p, const char *s, size_t len)
90
88
  }
91
89
  #define intern(s,len) intern_gen(p,(s),(len))
92
90
 
93
- static inline mrb_sym
94
- intern_gen_c(parser_state *p, const char c)
95
- {
96
- return mrb_intern(p->mrb, &c, 1);
97
- }
98
- #define intern_c(c) intern_gen_c(p,(c))
91
+ #define intern_lit(s) mrb_intern_lit(p->mrb, s)
99
92
 
100
93
  static void
101
94
  cons_free_gen(parser_state *p, node *cons)
@@ -189,12 +182,11 @@ append_gen(parser_state *p, node *a, node *b)
189
182
  node *c = a;
190
183
 
191
184
  if (!a) return b;
185
+ if (!b) return a;
192
186
  while (c->cdr) {
193
187
  c = c->cdr;
194
188
  }
195
- if (b) {
196
- c->cdr = b;
197
- }
189
+ c->cdr = b;
198
190
  return a;
199
191
  }
200
192
  #define append(a,b) append_gen(p,(a),(b))
@@ -220,6 +212,26 @@ parser_strdup(parser_state *p, const char *s)
220
212
  #undef strdup
221
213
  #define strdup(s) parser_strdup(p, s)
222
214
 
215
+ static void
216
+ dump_int(uint16_t i, char *s)
217
+ {
218
+ char *p = s;
219
+ char *t = s;
220
+
221
+ while (i > 0) {
222
+ *p++ = (i % 10)+'0';
223
+ i /= 10;
224
+ }
225
+ if (p == s) *p++ = '0';
226
+ *p = 0;
227
+ p--; /* point the last char */
228
+ while (t < p) {
229
+ char c = *t;
230
+ *t++ = *p;
231
+ *p-- = c;
232
+ }
233
+ }
234
+
223
235
  /* xxx ----------------------------- */
224
236
 
225
237
  static node*
@@ -715,6 +727,15 @@ local_add_margs(parser_state *p, node *n)
715
727
  }
716
728
  }
717
729
 
730
+ static void
731
+ local_add_lv(parser_state *p, node *lv)
732
+ {
733
+ while (lv) {
734
+ local_add_f(p, sym(lv->car));
735
+ lv = lv->cdr;
736
+ }
737
+ }
738
+
718
739
  /* (m o r m2 tail) */
719
740
  /* m: (a b c) */
720
741
  /* o: ((a . e1) (b . e2)) */
@@ -731,6 +752,12 @@ new_args(parser_state *p, node *m, node *opt, mrb_sym rest, node *m2, node *tail
731
752
  n = cons(m2, tail);
732
753
  n = cons(nsym(rest), n);
733
754
  n = cons(opt, n);
755
+ while (opt) {
756
+ /* opt: (sym . (opt . lv)) -> (sym . opt) */
757
+ local_add_lv(p, opt->car->cdr->cdr);
758
+ opt->car->cdr = opt->car->cdr->car;
759
+ opt = opt->cdr;
760
+ }
734
761
  return cons(m, n);
735
762
  }
736
763
 
@@ -746,15 +773,17 @@ new_args_tail(parser_state *p, node *kws, node *kwrest, mrb_sym blk)
746
773
 
747
774
  local_add_blk(p, blk);
748
775
 
749
- // allocate register for keywords arguments
750
- // order is for Proc#parameters
776
+ /* allocate register for keywords arguments */
777
+ /* order is for Proc#parameters */
751
778
  for (k = kws; k; k = k->cdr) {
752
- if (!k->car->cdr->cdr->car) { // allocate required keywords
779
+ if (!k->car->cdr->cdr->car) { /* allocate required keywords */
753
780
  local_add_f(p, sym(k->car->cdr->car));
754
781
  }
755
782
  }
756
783
  for (k = kws; k; k = k->cdr) {
757
- if (k->car->cdr->cdr->car) { // allocate keywords with default
784
+ if (k->car->cdr->cdr->car) { /* allocate keywords with default */
785
+ local_add_lv(p, k->car->cdr->cdr->car->cdr);
786
+ k->car->cdr->cdr->car = k->car->cdr->cdr->car->car;
758
787
  local_add_f(p, sym(k->car->cdr->car));
759
788
  }
760
789
  }
@@ -822,19 +851,45 @@ new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b)
822
851
  return list4((node*)NODE_OP_ASGN, a, nsym(op), b);
823
852
  }
824
853
 
854
+ static node*
855
+ new_imaginary(parser_state *p, node *imaginary)
856
+ {
857
+ return new_call(p, new_const(p, intern_lit("Kernel")), intern_lit("Complex"), list1(list2(list3((node*)NODE_INT, (node*)strdup("0"), nint(10)), imaginary)), 1);
858
+ }
859
+
860
+ static node*
861
+ new_rational(parser_state *p, node *rational)
862
+ {
863
+ return new_call(p, new_const(p, intern_lit("Kernel")), intern_lit("Rational"), list1(list1(rational)), 1);
864
+ }
865
+
825
866
  /* (:int . i) */
826
867
  static node*
827
- new_int(parser_state *p, const char *s, int base)
868
+ new_int(parser_state *p, const char *s, int base, int suffix)
828
869
  {
829
- return list3((node*)NODE_INT, (node*)strdup(s), nint(base));
870
+ node* result = list3((node*)NODE_INT, (node*)strdup(s), nint(base));
871
+ if (suffix & NUM_SUFFIX_R) {
872
+ result = new_rational(p, result);
873
+ }
874
+ if (suffix & NUM_SUFFIX_I) {
875
+ result = new_imaginary(p, result);
876
+ }
877
+ return result;
830
878
  }
831
879
 
832
880
  #ifndef MRB_WITHOUT_FLOAT
833
881
  /* (:float . i) */
834
882
  static node*
835
- new_float(parser_state *p, const char *s)
883
+ new_float(parser_state *p, const char *s, int suffix)
836
884
  {
837
- return cons((node*)NODE_FLOAT, (node*)strdup(s));
885
+ node* result = cons((node*)NODE_FLOAT, (node*)strdup(s));
886
+ if (suffix & NUM_SUFFIX_R) {
887
+ result = new_rational(p, result);
888
+ }
889
+ if (suffix & NUM_SUFFIX_I) {
890
+ result = new_imaginary(p, result);
891
+ }
892
+ return result;
838
893
  }
839
894
  #endif
840
895
 
@@ -893,40 +948,39 @@ concat_string(parser_state *p, node *a, node *b)
893
948
  }
894
949
  }
895
950
  }
896
- else if (string_node_p(b)) {
897
- /* a == NODE_DSTR && b == NODE_STR */
898
-
899
- node *c;
951
+ else {
952
+ node *c; /* last node of a */
900
953
  for (c = a; c->cdr != NULL; c = c->cdr) ;
901
- if (string_node_p(c->car)) {
902
- /* a->[..., NODE_STR] && b == NODE_STR */
903
- composite_string_node(p, c->car->cdr, b->cdr);
904
- cons_free(b);
905
- return a;
906
- }
907
954
 
908
- push(a, b);
909
- return a;
910
- }
911
- else {
912
- /* a == NODE_DSTR && b == NODE_DSTR */
955
+ if (string_node_p(b)) {
956
+ /* a == NODE_DSTR && b == NODE_STR */
957
+ if (string_node_p(c->car)) {
958
+ /* a->[..., NODE_STR] && b == NODE_STR */
959
+ composite_string_node(p, c->car->cdr, b->cdr);
960
+ cons_free(b);
961
+ return a;
962
+ }
913
963
 
914
- node *c, *d;
915
- for (c = a; c->cdr != NULL; c = c->cdr) ;
916
- if (string_node_p(c->car) && string_node_p(b->cdr->car)) {
917
- /* a->[..., NODE_STR] && b->[NODE_STR, ...] */
918
- d = b->cdr;
919
- cons_free(b);
920
- composite_string_node(p, c->car->cdr, d->car->cdr);
921
- cons_free(d->car);
922
- c->cdr = d->cdr;
923
- cons_free(d);
964
+ push(a, b);
924
965
  return a;
925
966
  }
926
967
  else {
927
- c->cdr = b->cdr;
928
- cons_free(b);
929
- return a;
968
+ /* a == NODE_DSTR && b == NODE_DSTR */
969
+ if (string_node_p(c->car) && string_node_p(b->cdr->car)) {
970
+ /* a->[..., NODE_STR] && b->[NODE_STR, ...] */
971
+ node *d = b->cdr;
972
+ cons_free(b);
973
+ composite_string_node(p, c->car->cdr, d->car->cdr);
974
+ cons_free(d->car);
975
+ c->cdr = d->cdr;
976
+ cons_free(d);
977
+ return a;
978
+ }
979
+ else {
980
+ c->cdr = b->cdr;
981
+ cons_free(b);
982
+ return a;
983
+ }
930
984
  }
931
985
  }
932
986
 
@@ -1534,9 +1588,9 @@ command_asgn : lhs '=' command_rhs
1534
1588
  {
1535
1589
  $$ = new_op_asgn(p, $1, $2, $3);
1536
1590
  }
1537
- | primary_value '[' opt_call_args rbracket tOP_ASGN command_rhs
1591
+ | primary_value '[' opt_call_args ']' tOP_ASGN command_rhs
1538
1592
  {
1539
- $$ = new_op_asgn(p, new_call(p, $1, intern("[]",2), $3, '.'), $5, $6);
1593
+ $$ = new_op_asgn(p, new_call(p, $1, intern_lit("[]"), $3, '.'), $5, $6);
1540
1594
  }
1541
1595
  | primary_value call_op tIDENTIFIER tOP_ASGN command_rhs
1542
1596
  {
@@ -1763,9 +1817,9 @@ mlhs_node : variable
1763
1817
  {
1764
1818
  assignable(p, $1);
1765
1819
  }
1766
- | primary_value '[' opt_call_args rbracket
1820
+ | primary_value '[' opt_call_args ']'
1767
1821
  {
1768
- $$ = new_call(p, $1, intern("[]",2), $3, '.');
1822
+ $$ = new_call(p, $1, intern_lit("[]"), $3, '.');
1769
1823
  }
1770
1824
  | primary_value call_op tIDENTIFIER
1771
1825
  {
@@ -1802,9 +1856,9 @@ lhs : variable
1802
1856
  {
1803
1857
  assignable(p, $1);
1804
1858
  }
1805
- | primary_value '[' opt_call_args rbracket
1859
+ | primary_value '[' opt_call_args ']'
1806
1860
  {
1807
- $$ = new_call(p, $1, intern("[]",2), $3, '.');
1861
+ $$ = new_call(p, $1, intern_lit("[]"), $3, '.');
1808
1862
  }
1809
1863
  | primary_value call_op tIDENTIFIER
1810
1864
  {
@@ -1888,36 +1942,36 @@ undef_list : fsym
1888
1942
  }
1889
1943
  ;
1890
1944
 
1891
- op : '|' { $$ = intern_c('|'); }
1892
- | '^' { $$ = intern_c('^'); }
1893
- | '&' { $$ = intern_c('&'); }
1894
- | tCMP { $$ = intern("<=>",3); }
1895
- | tEQ { $$ = intern("==",2); }
1896
- | tEQQ { $$ = intern("===",3); }
1897
- | tMATCH { $$ = intern("=~",2); }
1898
- | tNMATCH { $$ = intern("!~",2); }
1899
- | '>' { $$ = intern_c('>'); }
1900
- | tGEQ { $$ = intern(">=",2); }
1901
- | '<' { $$ = intern_c('<'); }
1902
- | tLEQ { $$ = intern("<=",2); }
1903
- | tNEQ { $$ = intern("!=",2); }
1904
- | tLSHFT { $$ = intern("<<",2); }
1905
- | tRSHFT { $$ = intern(">>",2); }
1906
- | '+' { $$ = intern_c('+'); }
1907
- | '-' { $$ = intern_c('-'); }
1908
- | '*' { $$ = intern_c('*'); }
1909
- | tSTAR { $$ = intern_c('*'); }
1910
- | '/' { $$ = intern_c('/'); }
1911
- | '%' { $$ = intern_c('%'); }
1912
- | tPOW { $$ = intern("**",2); }
1913
- | tDSTAR { $$ = intern("**",2); }
1914
- | '!' { $$ = intern_c('!'); }
1915
- | '~' { $$ = intern_c('~'); }
1916
- | tUPLUS { $$ = intern("+@",2); }
1917
- | tUMINUS { $$ = intern("-@",2); }
1918
- | tAREF { $$ = intern("[]",2); }
1919
- | tASET { $$ = intern("[]=",3); }
1920
- | '`' { $$ = intern_c('`'); }
1945
+ op : '|' { $$ = intern_lit("|"); }
1946
+ | '^' { $$ = intern_lit("^"); }
1947
+ | '&' { $$ = intern_lit("&"); }
1948
+ | tCMP { $$ = intern_lit("<=>"); }
1949
+ | tEQ { $$ = intern_lit("=="); }
1950
+ | tEQQ { $$ = intern_lit("==="); }
1951
+ | tMATCH { $$ = intern_lit("=~"); }
1952
+ | tNMATCH { $$ = intern_lit("!~"); }
1953
+ | '>' { $$ = intern_lit(">"); }
1954
+ | tGEQ { $$ = intern_lit(">="); }
1955
+ | '<' { $$ = intern_lit("<"); }
1956
+ | tLEQ { $$ = intern_lit("<="); }
1957
+ | tNEQ { $$ = intern_lit("!="); }
1958
+ | tLSHFT { $$ = intern_lit("<<"); }
1959
+ | tRSHFT { $$ = intern_lit(">>"); }
1960
+ | '+' { $$ = intern_lit("+"); }
1961
+ | '-' { $$ = intern_lit("-"); }
1962
+ | '*' { $$ = intern_lit("*"); }
1963
+ | tSTAR { $$ = intern_lit("*"); }
1964
+ | '/' { $$ = intern_lit("/"); }
1965
+ | '%' { $$ = intern_lit("%"); }
1966
+ | tPOW { $$ = intern_lit("**"); }
1967
+ | tDSTAR { $$ = intern_lit("**"); }
1968
+ | '!' { $$ = intern_lit("!"); }
1969
+ | '~' { $$ = intern_lit("~"); }
1970
+ | tUPLUS { $$ = intern_lit("+@"); }
1971
+ | tUMINUS { $$ = intern_lit("-@"); }
1972
+ | tAREF { $$ = intern_lit("[]"); }
1973
+ | tASET { $$ = intern_lit("[]="); }
1974
+ | '`' { $$ = intern_lit("`"); }
1921
1975
  ;
1922
1976
 
1923
1977
  reswords : keyword__LINE__ | keyword__FILE__ | keyword__ENCODING__
@@ -1942,9 +1996,9 @@ arg : lhs '=' arg_rhs
1942
1996
  {
1943
1997
  $$ = new_op_asgn(p, $1, $2, $3);
1944
1998
  }
1945
- | primary_value '[' opt_call_args rbracket tOP_ASGN arg_rhs
1999
+ | primary_value '[' opt_call_args ']' tOP_ASGN arg_rhs
1946
2000
  {
1947
- $$ = new_op_asgn(p, new_call(p, $1, intern("[]",2), $3, '.'), $5, $6);
2001
+ $$ = new_op_asgn(p, new_call(p, $1, intern_lit("[]"), $3, '.'), $5, $6);
1948
2002
  }
1949
2003
  | primary_value call_op tIDENTIFIER tOP_ASGN arg_rhs
1950
2004
  {
@@ -2140,7 +2194,7 @@ arg_rhs : arg %prec tOP_ASGN
2140
2194
  }
2141
2195
  ;
2142
2196
 
2143
- paren_args : '(' opt_call_args rparen
2197
+ paren_args : '(' opt_call_args ')'
2144
2198
  {
2145
2199
  $$ = $2;
2146
2200
  }
@@ -2151,18 +2205,18 @@ opt_paren_args : none
2151
2205
  ;
2152
2206
 
2153
2207
  opt_call_args : none
2154
- | call_args
2155
- | args ','
2208
+ | call_args opt_terms
2209
+ | args comma
2156
2210
  {
2157
2211
  $$ = cons($1,0);
2158
2212
  NODE_LINENO($$, $1);
2159
2213
  }
2160
- | args comma assocs ','
2214
+ | args comma assocs comma
2161
2215
  {
2162
2216
  $$ = cons(push($1, new_kw_hash(p, $3)), 0);
2163
2217
  NODE_LINENO($$, $1);
2164
2218
  }
2165
- | assocs ','
2219
+ | assocs comma
2166
2220
  {
2167
2221
  $$ = cons(list1(new_kw_hash(p, $1)), 0);
2168
2222
  NODE_LINENO($$, $1);
@@ -2829,11 +2883,11 @@ method_call : operation paren_args
2829
2883
  }
2830
2884
  | primary_value call_op paren_args
2831
2885
  {
2832
- $$ = new_call(p, $1, intern("call",4), $3, $2);
2886
+ $$ = new_call(p, $1, intern_lit("call"), $3, $2);
2833
2887
  }
2834
2888
  | primary_value tCOLON2 paren_args
2835
2889
  {
2836
- $$ = new_call(p, $1, intern("call",4), $3, tCOLON2);
2890
+ $$ = new_call(p, $1, intern_lit("call"), $3, tCOLON2);
2837
2891
  }
2838
2892
  | keyword_super paren_args
2839
2893
  {
@@ -2843,9 +2897,9 @@ method_call : operation paren_args
2843
2897
  {
2844
2898
  $$ = new_zsuper(p);
2845
2899
  }
2846
- | primary_value '[' opt_call_args rbracket
2900
+ | primary_value '[' opt_call_args ']'
2847
2901
  {
2848
- $$ = new_call(p, $1, intern("[]",2), $3, '.');
2902
+ $$ = new_call(p, $1, intern_lit("[]"), $3, '.');
2849
2903
  }
2850
2904
  ;
2851
2905
 
@@ -3162,7 +3216,7 @@ var_ref : variable
3162
3216
  }
3163
3217
  | keyword__FILE__
3164
3218
  {
3165
- const char *fn = mrb_sym2name_len(p->mrb, p->filename_sym, NULL);
3219
+ const char *fn = mrb_sym_name_len(p->mrb, p->filename_sym, NULL);
3166
3220
  if (!fn) {
3167
3221
  fn = "(null)";
3168
3222
  }
@@ -3172,8 +3226,8 @@ var_ref : variable
3172
3226
  {
3173
3227
  char buf[16];
3174
3228
 
3175
- snprintf(buf, sizeof(buf), "%d", p->lineno);
3176
- $$ = new_int(p, buf, 10);
3229
+ dump_int(p->lineno, buf);
3230
+ $$ = new_int(p, buf, 10, 0);
3177
3231
  }
3178
3232
  | keyword__ENCODING__
3179
3233
  {
@@ -3223,26 +3277,33 @@ f_arglist : '(' f_args rparen
3223
3277
  ;
3224
3278
 
3225
3279
  f_label : tIDENTIFIER tLABEL_TAG
3280
+ {
3281
+ local_nest(p);
3282
+ }
3226
3283
  ;
3227
3284
 
3228
3285
  f_kw : f_label arg
3229
3286
  {
3230
3287
  void_expr_error(p, $2);
3231
- $$ = new_kw_arg(p, $1, $2);
3288
+ $$ = new_kw_arg(p, $1, cons($2, locals_node(p)));
3289
+ local_unnest(p);
3232
3290
  }
3233
3291
  | f_label
3234
3292
  {
3235
3293
  $$ = new_kw_arg(p, $1, 0);
3294
+ local_unnest(p);
3236
3295
  }
3237
3296
  ;
3238
3297
 
3239
3298
  f_block_kw : f_label primary_value
3240
3299
  {
3241
- $$ = new_kw_arg(p, $1, $2);
3300
+ $$ = new_kw_arg(p, $1, cons($2, locals_node(p)));
3301
+ local_unnest(p);
3242
3302
  }
3243
3303
  | f_label
3244
3304
  {
3245
3305
  $$ = new_kw_arg(p, $1, 0);
3306
+ local_unnest(p);
3246
3307
  }
3247
3308
  ;
3248
3309
 
@@ -3433,6 +3494,7 @@ f_arg : f_arg_item
3433
3494
  f_opt_asgn : tIDENTIFIER '='
3434
3495
  {
3435
3496
  local_add_f(p, $1);
3497
+ local_nest(p);
3436
3498
  $$ = $1;
3437
3499
  }
3438
3500
  ;
@@ -3440,14 +3502,16 @@ f_opt_asgn : tIDENTIFIER '='
3440
3502
  f_opt : f_opt_asgn arg
3441
3503
  {
3442
3504
  void_expr_error(p, $2);
3443
- $$ = cons(nsym($1), $2);
3505
+ $$ = cons(nsym($1), cons($2, locals_node(p)));
3506
+ local_unnest(p);
3444
3507
  }
3445
3508
  ;
3446
3509
 
3447
3510
  f_block_opt : f_opt_asgn primary_value
3448
3511
  {
3449
3512
  void_expr_error(p, $2);
3450
- $$ = cons(nsym($1), $2);
3513
+ $$ = cons(nsym($1), cons($2, locals_node(p)));
3514
+ local_unnest(p);
3451
3515
  }
3452
3516
  ;
3453
3517
 
@@ -3628,14 +3692,11 @@ opt_nl : /* none */
3628
3692
  | nl
3629
3693
  ;
3630
3694
 
3631
- rparen : opt_nl ')'
3632
- ;
3633
-
3634
- rbracket : opt_nl ']'
3695
+ rparen : opt_terms ')'
3635
3696
  ;
3636
3697
 
3637
3698
  trailer : /* none */
3638
- | nl
3699
+ | terms
3639
3700
  | comma
3640
3701
  ;
3641
3702
 
@@ -3672,7 +3733,7 @@ yyerror(parser_state *p, const char *s)
3672
3733
  if (! p->capture_errors) {
3673
3734
  #ifndef MRB_DISABLE_STDIO
3674
3735
  if (p->filename_sym) {
3675
- const char *filename = mrb_sym2name_len(p->mrb, p->filename_sym, NULL);
3736
+ const char *filename = mrb_sym_name_len(p->mrb, p->filename_sym, NULL);
3676
3737
  fprintf(stderr, "%s:%d:%d: %s\n", filename, p->lineno, p->column, s);
3677
3738
  }
3678
3739
  else {
@@ -3692,11 +3753,13 @@ yyerror(parser_state *p, const char *s)
3692
3753
  }
3693
3754
 
3694
3755
  static void
3695
- yyerror_i(parser_state *p, const char *fmt, int i)
3756
+ yyerror_c(parser_state *p, const char *msg, char c)
3696
3757
  {
3697
3758
  char buf[256];
3698
3759
 
3699
- snprintf(buf, sizeof(buf), fmt, i);
3760
+ strncpy(buf, msg, sizeof(buf) - 2);
3761
+ buf[sizeof(buf) - 2] = '\0';
3762
+ strncat(buf, &c, 1);
3700
3763
  yyerror(p, buf);
3701
3764
  }
3702
3765
 
@@ -3709,7 +3772,7 @@ yywarn(parser_state *p, const char *s)
3709
3772
  if (! p->capture_errors) {
3710
3773
  #ifndef MRB_DISABLE_STDIO
3711
3774
  if (p->filename_sym) {
3712
- const char *filename = mrb_sym2name_len(p->mrb, p->filename_sym, NULL);
3775
+ const char *filename = mrb_sym_name_len(p->mrb, p->filename_sym, NULL);
3713
3776
  fprintf(stderr, "%s:%d:%d: warning: %s\n", filename, p->lineno, p->column, s);
3714
3777
  }
3715
3778
  else {
@@ -3735,11 +3798,14 @@ yywarning(parser_state *p, const char *s)
3735
3798
  }
3736
3799
 
3737
3800
  static void
3738
- yywarning_s(parser_state *p, const char *fmt, const char *s)
3801
+ yywarning_s(parser_state *p, const char *msg, const char *s)
3739
3802
  {
3740
3803
  char buf[256];
3741
3804
 
3742
- snprintf(buf, sizeof(buf), fmt, s);
3805
+ strncpy(buf, msg, sizeof(buf) - 1);
3806
+ buf[sizeof(buf) - 1] = '\0';
3807
+ strncat(buf, ": ", sizeof(buf) - strlen(buf) - 1);
3808
+ strncat(buf, s, sizeof(buf) - strlen(buf) - 1);
3743
3809
  yywarning(p, buf);
3744
3810
  }
3745
3811
 
@@ -3751,13 +3817,13 @@ backref_error(parser_state *p, node *n)
3751
3817
  c = intn(n->car);
3752
3818
 
3753
3819
  if (c == NODE_NTH_REF) {
3754
- yyerror_i(p, "can't set variable $%" MRB_PRId, intn(n->cdr));
3820
+ yyerror_c(p, "can't set variable $", (char)intn(n->cdr)+'0');
3755
3821
  }
3756
3822
  else if (c == NODE_BACK_REF) {
3757
- yyerror_i(p, "can't set variable $%c", intn(n->cdr));
3823
+ yyerror_c(p, "can't set variable $", (char)intn(n->cdr));
3758
3824
  }
3759
3825
  else {
3760
- mrb_bug(p->mrb, "Internal error in backref_error() : n=>car == %S", mrb_fixnum_value(c));
3826
+ mrb_bug(p->mrb, "Internal error in backref_error() : n=>car == %d", c);
3761
3827
  }
3762
3828
  }
3763
3829
 
@@ -4288,18 +4354,22 @@ parse_string(parser_state *p)
4288
4354
  }
4289
4355
  }
4290
4356
  if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) {
4291
- if (c < 0) {
4292
- p->parsing_heredoc = NULL;
4293
- }
4294
- else {
4295
- return tHEREDOC_END;
4296
- }
4357
+ return tHEREDOC_END;
4297
4358
  }
4298
4359
  }
4299
4360
  if (c < 0) {
4300
4361
  char buf[256];
4301
- snprintf(buf, sizeof(buf), "can't find heredoc delimiter \"%s\" anywhere before EOF", hinf->term);
4302
- yyerror(p, buf);
4362
+ const char s1[] = "can't find heredoc delimiter \"";
4363
+ const char s2[] = "\" anywhere before EOF";
4364
+
4365
+ if (sizeof(s1)+sizeof(s2)+strlen(hinf->term)+1 >= sizeof(buf)) {
4366
+ yyerror(p, "can't find heredoc delimiter anywhere before EOF");
4367
+ } else {
4368
+ strcpy(buf, s1);
4369
+ strcat(buf, hinf->term);
4370
+ strcat(buf, s2);
4371
+ yyerror(p, buf);
4372
+ }
4303
4373
  return 0;
4304
4374
  }
4305
4375
  pylval.nd = new_str(p, tok(p), toklen(p));
@@ -4443,15 +4513,21 @@ parse_string(parser_state *p)
4443
4513
  case 'm': f |= 4; break;
4444
4514
  case 'u': f |= 16; break;
4445
4515
  case 'n': f |= 32; break;
4516
+ case 'o': break;
4446
4517
  default: tokadd(p, re_opt); break;
4447
4518
  }
4448
4519
  }
4449
4520
  pushback(p, re_opt);
4450
4521
  if (toklen(p)) {
4451
4522
  char msg[128];
4523
+
4524
+ strcpy(msg, "unknown regexp option");
4452
4525
  tokfix(p);
4453
- snprintf(msg, sizeof(msg), "unknown regexp option%s - %s",
4454
- toklen(p) > 1 ? "s" : "", tok(p));
4526
+ if (toklen(p) > 1) {
4527
+ strcat(msg, "s");
4528
+ }
4529
+ strcat(msg, " - ");
4530
+ strncat(msg, tok(p), sizeof(msg) - strlen(msg) - 1);
4455
4531
  yyerror(p, msg);
4456
4532
  }
4457
4533
  if (f != 0) {
@@ -4482,6 +4558,44 @@ parse_string(parser_state *p)
4482
4558
  return tSTRING;
4483
4559
  }
4484
4560
 
4561
+ static int
4562
+ number_literal_suffix(parser_state *p)
4563
+ {
4564
+ int c, result = 0;
4565
+ node *list = 0;
4566
+ int column = p->column;
4567
+ int mask = NUM_SUFFIX_R|NUM_SUFFIX_I;
4568
+
4569
+ while ((c = nextc(p)) != -1) {
4570
+ list = push(list, (node*)(intptr_t)c);
4571
+
4572
+ if ((mask & NUM_SUFFIX_I) && c == 'i') {
4573
+ result |= (mask & NUM_SUFFIX_I);
4574
+ mask &= ~NUM_SUFFIX_I;
4575
+ /* r after i, rational of complex is disallowed */
4576
+ mask &= ~NUM_SUFFIX_R;
4577
+ continue;
4578
+ }
4579
+ if ((mask & NUM_SUFFIX_R) && c == 'r') {
4580
+ result |= (mask & NUM_SUFFIX_R);
4581
+ mask &= ~NUM_SUFFIX_R;
4582
+ continue;
4583
+ }
4584
+ if (!ISASCII(c) || ISALPHA(c) || c == '_') {
4585
+ p->column = column;
4586
+ if (p->pb) {
4587
+ p->pb = append((node*)list, p->pb);
4588
+ }
4589
+ else {
4590
+ p->pb = list;
4591
+ }
4592
+ return 0;
4593
+ }
4594
+ pushback(p, c);
4595
+ break;
4596
+ }
4597
+ return result;
4598
+ }
4485
4599
 
4486
4600
  static int
4487
4601
  heredoc_identifier(parser_state *p)
@@ -4602,57 +4716,71 @@ parser_yylex(parser_state *p)
4602
4716
  /* fall through */
4603
4717
  case -2: /* end of a file */
4604
4718
  case '\n':
4605
- maybe_heredoc:
4719
+ maybe_heredoc:
4606
4720
  heredoc_treat_nextline(p);
4607
- switch (p->lstate) {
4608
- case EXPR_BEG:
4609
- case EXPR_FNAME:
4610
- case EXPR_DOT:
4611
- case EXPR_CLASS:
4612
- case EXPR_VALUE:
4613
- p->lineno++;
4614
4721
  p->column = 0;
4615
- if (p->parsing_heredoc != NULL) {
4616
- if (p->lex_strterm) {
4617
- return parse_string(p);
4722
+ switch (p->lstate) {
4723
+ case EXPR_BEG:
4724
+ case EXPR_FNAME:
4725
+ case EXPR_DOT:
4726
+ case EXPR_CLASS:
4727
+ case EXPR_VALUE:
4728
+ p->lineno++;
4729
+ if (p->parsing_heredoc != NULL) {
4730
+ if (p->lex_strterm) {
4731
+ return parse_string(p);
4732
+ }
4618
4733
  }
4619
- }
4620
- goto retry;
4621
- default:
4622
- break;
4623
- }
4624
- if (p->parsing_heredoc != NULL) {
4625
- return '\n';
4626
- }
4627
- while ((c = nextc(p))) {
4628
- switch (c) {
4629
- case ' ': case '\t': case '\f': case '\r':
4630
- case '\13': /* '\v' */
4631
- space_seen = 1;
4734
+ goto retry;
4735
+ default:
4632
4736
  break;
4633
- case '.':
4634
- if ((c = nextc(p)) != '.') {
4635
- pushback(p, c);
4636
- pushback(p, '.');
4737
+ }
4738
+ if (p->parsing_heredoc != NULL) {
4739
+ return '\n';
4740
+ }
4741
+ while ((c = nextc(p))) {
4742
+ switch (c) {
4743
+ case ' ': case '\t': case '\f': case '\r':
4744
+ case '\13': /* '\v' */
4745
+ space_seen = 1;
4746
+ break;
4747
+ case '#': /* comment as a whitespace */
4748
+ pushback(p, '#');
4749
+ p->lineno++;
4637
4750
  goto retry;
4751
+ case '.':
4752
+ if (!peek(p, '.')) {
4753
+ pushback(p, '.');
4754
+ p->lineno++;
4755
+ goto retry;
4756
+ }
4757
+ pushback(p, c);
4758
+ goto normal_newline;
4759
+ case '&':
4760
+ if (peek(p, '.')) {
4761
+ pushback(p, '&');
4762
+ p->lineno++;
4763
+ goto retry;
4764
+ }
4765
+ pushback(p, c);
4766
+ goto normal_newline;
4767
+ case -1: /* EOF */
4768
+ case -2: /* end of a file */
4769
+ goto normal_newline;
4770
+ default:
4771
+ pushback(p, c);
4772
+ goto normal_newline;
4638
4773
  }
4639
- case -1: /* EOF */
4640
- case -2: /* end of a file */
4641
- goto normal_newline;
4642
- default:
4643
- pushback(p, c);
4644
- goto normal_newline;
4645
4774
  }
4646
- }
4647
4775
  normal_newline:
4648
- p->cmd_start = TRUE;
4649
- p->lstate = EXPR_BEG;
4650
- return '\n';
4776
+ p->cmd_start = TRUE;
4777
+ p->lstate = EXPR_BEG;
4778
+ return '\n';
4651
4779
 
4652
4780
  case '*':
4653
4781
  if ((c = nextc(p)) == '*') {
4654
4782
  if ((c = nextc(p)) == '=') {
4655
- pylval.id = intern("**",2);
4783
+ pylval.id = intern_lit("**");
4656
4784
  p->lstate = EXPR_BEG;
4657
4785
  return tOP_ASGN;
4658
4786
  }
@@ -4670,7 +4798,7 @@ parser_yylex(parser_state *p)
4670
4798
  }
4671
4799
  else {
4672
4800
  if (c == '=') {
4673
- pylval.id = intern_c('*');
4801
+ pylval.id = intern_lit("*");
4674
4802
  p->lstate = EXPR_BEG;
4675
4803
  return tOP_ASGN;
4676
4804
  }
@@ -4786,7 +4914,7 @@ parser_yylex(parser_state *p)
4786
4914
  }
4787
4915
  if (c == '<') {
4788
4916
  if ((c = nextc(p)) == '=') {
4789
- pylval.id = intern("<<",2);
4917
+ pylval.id = intern_lit("<<");
4790
4918
  p->lstate = EXPR_BEG;
4791
4919
  return tOP_ASGN;
4792
4920
  }
@@ -4808,7 +4936,7 @@ parser_yylex(parser_state *p)
4808
4936
  }
4809
4937
  if (c == '>') {
4810
4938
  if ((c = nextc(p)) == '=') {
4811
- pylval.id = intern(">>",2);
4939
+ pylval.id = intern_lit(">>");
4812
4940
  p->lstate = EXPR_BEG;
4813
4941
  return tOP_ASGN;
4814
4942
  }
@@ -4879,7 +5007,10 @@ parser_yylex(parser_state *p)
4879
5007
  }
4880
5008
  if (c2) {
4881
5009
  char buf[256];
4882
- snprintf(buf, sizeof(buf), "invalid character syntax; use ?\\%c", c2);
5010
+ char cc[] = { (char)c2, '\0' };
5011
+
5012
+ strcpy(buf, "invalid character syntax; use ?\\");
5013
+ strncat(buf, cc, 2);
4883
5014
  yyerror(p, buf);
4884
5015
  }
4885
5016
  }
@@ -4913,7 +5044,7 @@ parser_yylex(parser_state *p)
4913
5044
  if ((c = nextc(p)) == '&') {
4914
5045
  p->lstate = EXPR_BEG;
4915
5046
  if ((c = nextc(p)) == '=') {
4916
- pylval.id = intern("&&",2);
5047
+ pylval.id = intern_lit("&&");
4917
5048
  p->lstate = EXPR_BEG;
4918
5049
  return tOP_ASGN;
4919
5050
  }
@@ -4925,7 +5056,7 @@ parser_yylex(parser_state *p)
4925
5056
  return tANDDOT;
4926
5057
  }
4927
5058
  else if (c == '=') {
4928
- pylval.id = intern_c('&');
5059
+ pylval.id = intern_lit("&");
4929
5060
  p->lstate = EXPR_BEG;
4930
5061
  return tOP_ASGN;
4931
5062
  }
@@ -4952,7 +5083,7 @@ parser_yylex(parser_state *p)
4952
5083
  if ((c = nextc(p)) == '|') {
4953
5084
  p->lstate = EXPR_BEG;
4954
5085
  if ((c = nextc(p)) == '=') {
4955
- pylval.id = intern("||",2);
5086
+ pylval.id = intern_lit("||");
4956
5087
  p->lstate = EXPR_BEG;
4957
5088
  return tOP_ASGN;
4958
5089
  }
@@ -4960,7 +5091,7 @@ parser_yylex(parser_state *p)
4960
5091
  return tOROP;
4961
5092
  }
4962
5093
  if (c == '=') {
4963
- pylval.id = intern_c('|');
5094
+ pylval.id = intern_lit("|");
4964
5095
  p->lstate = EXPR_BEG;
4965
5096
  return tOP_ASGN;
4966
5097
  }
@@ -4984,7 +5115,7 @@ parser_yylex(parser_state *p)
4984
5115
  return '+';
4985
5116
  }
4986
5117
  if (c == '=') {
4987
- pylval.id = intern_c('+');
5118
+ pylval.id = intern_lit("+");
4988
5119
  p->lstate = EXPR_BEG;
4989
5120
  return tOP_ASGN;
4990
5121
  }
@@ -5012,7 +5143,7 @@ parser_yylex(parser_state *p)
5012
5143
  return '-';
5013
5144
  }
5014
5145
  if (c == '=') {
5015
- pylval.id = intern_c('-');
5146
+ pylval.id = intern_lit("-");
5016
5147
  p->lstate = EXPR_BEG;
5017
5148
  return tOP_ASGN;
5018
5149
  }
@@ -5053,6 +5184,7 @@ parser_yylex(parser_state *p)
5053
5184
  case '5': case '6': case '7': case '8': case '9':
5054
5185
  {
5055
5186
  int is_float, seen_point, seen_e, nondigit;
5187
+ int suffix = 0;
5056
5188
 
5057
5189
  is_float = seen_point = seen_e = nondigit = 0;
5058
5190
  p->lstate = EXPR_ENDARG;
@@ -5086,7 +5218,8 @@ parser_yylex(parser_state *p)
5086
5218
  no_digits();
5087
5219
  }
5088
5220
  else if (nondigit) goto trailing_uc;
5089
- pylval.nd = new_int(p, tok(p), 16);
5221
+ suffix = number_literal_suffix(p);
5222
+ pylval.nd = new_int(p, tok(p), 16, suffix);
5090
5223
  return tINTEGER;
5091
5224
  }
5092
5225
  if (c == 'b' || c == 'B') {
@@ -5110,7 +5243,8 @@ parser_yylex(parser_state *p)
5110
5243
  no_digits();
5111
5244
  }
5112
5245
  else if (nondigit) goto trailing_uc;
5113
- pylval.nd = new_int(p, tok(p), 2);
5246
+ suffix = number_literal_suffix(p);
5247
+ pylval.nd = new_int(p, tok(p), 2, suffix);
5114
5248
  return tINTEGER;
5115
5249
  }
5116
5250
  if (c == 'd' || c == 'D') {
@@ -5134,7 +5268,8 @@ parser_yylex(parser_state *p)
5134
5268
  no_digits();
5135
5269
  }
5136
5270
  else if (nondigit) goto trailing_uc;
5137
- pylval.nd = new_int(p, tok(p), 10);
5271
+ suffix = number_literal_suffix(p);
5272
+ pylval.nd = new_int(p, tok(p), 10, suffix);
5138
5273
  return tINTEGER;
5139
5274
  }
5140
5275
  if (c == '_') {
@@ -5167,7 +5302,8 @@ parser_yylex(parser_state *p)
5167
5302
  pushback(p, c);
5168
5303
  tokfix(p);
5169
5304
  if (nondigit) goto trailing_uc;
5170
- pylval.nd = new_int(p, tok(p), 8);
5305
+ suffix = number_literal_suffix(p);
5306
+ pylval.nd = new_int(p, tok(p), 8, suffix);
5171
5307
  return tINTEGER;
5172
5308
  }
5173
5309
  if (nondigit) {
@@ -5184,7 +5320,8 @@ parser_yylex(parser_state *p)
5184
5320
  }
5185
5321
  else {
5186
5322
  pushback(p, c);
5187
- pylval.nd = new_int(p, "0", 10);
5323
+ suffix = number_literal_suffix(p);
5324
+ pylval.nd = new_int(p, "0", 10, suffix);
5188
5325
  return tINTEGER;
5189
5326
  }
5190
5327
  }
@@ -5252,13 +5389,13 @@ parser_yylex(parser_state *p)
5252
5389
  pushback(p, c);
5253
5390
  if (nondigit) {
5254
5391
  trailing_uc:
5255
- yyerror_i(p, "trailing '%c' in number", nondigit);
5392
+ yyerror_c(p, "trailing non digit in number: ", (char)nondigit);
5256
5393
  }
5257
5394
  tokfix(p);
5258
5395
  if (is_float) {
5259
5396
  #ifdef MRB_WITHOUT_FLOAT
5260
- yywarning(p, "floating point numbers are not supported");
5261
- pylval.nd = new_int(p, "0", 10);
5397
+ yywarning_s(p, "floating point numbers are not supported", tok(p));
5398
+ pylval.nd = new_int(p, "0", 10, 0);
5262
5399
  return tINTEGER;
5263
5400
  #else
5264
5401
  double d;
@@ -5267,17 +5404,19 @@ parser_yylex(parser_state *p)
5267
5404
  errno = 0;
5268
5405
  d = mrb_float_read(tok(p), &endp);
5269
5406
  if (d == 0 && endp == tok(p)) {
5270
- yywarning_s(p, "corrupted float value %s", tok(p));
5407
+ yywarning_s(p, "corrupted float value", tok(p));
5271
5408
  }
5272
5409
  else if (errno == ERANGE) {
5273
- yywarning_s(p, "float %s out of range", tok(p));
5410
+ yywarning_s(p, "float out of range", tok(p));
5274
5411
  errno = 0;
5275
5412
  }
5276
- pylval.nd = new_float(p, tok(p));
5413
+ suffix = number_literal_suffix(p);
5414
+ pylval.nd = new_float(p, tok(p), suffix);
5277
5415
  return tFLOAT;
5278
5416
  #endif
5279
5417
  }
5280
- pylval.nd = new_int(p, tok(p), 10);
5418
+ suffix = number_literal_suffix(p);
5419
+ pylval.nd = new_int(p, tok(p), 10, suffix);
5281
5420
  return tINTEGER;
5282
5421
  }
5283
5422
 
@@ -5324,7 +5463,7 @@ parser_yylex(parser_state *p)
5324
5463
  return tREGEXP_BEG;
5325
5464
  }
5326
5465
  if ((c = nextc(p)) == '=') {
5327
- pylval.id = intern_c('/');
5466
+ pylval.id = intern_lit("/");
5328
5467
  p->lstate = EXPR_BEG;
5329
5468
  return tOP_ASGN;
5330
5469
  }
@@ -5343,7 +5482,7 @@ parser_yylex(parser_state *p)
5343
5482
 
5344
5483
  case '^':
5345
5484
  if ((c = nextc(p)) == '=') {
5346
- pylval.id = intern_c('^');
5485
+ pylval.id = intern_lit("^");
5347
5486
  p->lstate = EXPR_BEG;
5348
5487
  return tOP_ASGN;
5349
5488
  }
@@ -5520,7 +5659,7 @@ parser_yylex(parser_state *p)
5520
5659
  }
5521
5660
  }
5522
5661
  if ((c = nextc(p)) == '=') {
5523
- pylval.id = intern_c('%');
5662
+ pylval.id = intern_lit("%");
5524
5663
  p->lstate = EXPR_BEG;
5525
5664
  return tOP_ASGN;
5526
5665
  }
@@ -5574,7 +5713,7 @@ parser_yylex(parser_state *p)
5574
5713
  tokadd(p, '$');
5575
5714
  tokadd(p, c);
5576
5715
  tokfix(p);
5577
- pylval.id = intern_cstr(tok(p));
5716
+ pylval.id = intern(tok(p), toklen(p));
5578
5717
  return tGVAR;
5579
5718
 
5580
5719
  case '-':
@@ -5584,7 +5723,7 @@ parser_yylex(parser_state *p)
5584
5723
  pushback(p, c);
5585
5724
  gvar:
5586
5725
  tokfix(p);
5587
- pylval.id = intern_cstr(tok(p));
5726
+ pylval.id = intern(tok(p), toklen(p));
5588
5727
  return tGVAR;
5589
5728
 
5590
5729
  case '&': /* $&: last match */
@@ -5612,7 +5751,7 @@ parser_yylex(parser_state *p)
5612
5751
  {
5613
5752
  unsigned long n = strtoul(tok(p), NULL, 10);
5614
5753
  if (n > INT_MAX) {
5615
- yyerror_i(p, "capture group index must be <= %d", INT_MAX);
5754
+ yyerror(p, "capture group index must be <= " MRB_STRINGIZE(INT_MAX));
5616
5755
  return 0;
5617
5756
  }
5618
5757
  pylval.nd = new_nth_ref(p, (int)n);
@@ -5649,10 +5788,10 @@ parser_yylex(parser_state *p)
5649
5788
  }
5650
5789
  else if (ISDIGIT(c)) {
5651
5790
  if (p->tidx == 1) {
5652
- yyerror_i(p, "'@%c' is not allowed as an instance variable name", c);
5791
+ yyerror_c(p, "wrong instance variable name: @", c);
5653
5792
  }
5654
5793
  else {
5655
- yyerror_i(p, "'@@%c' is not allowed as a class variable name", c);
5794
+ yyerror_c(p, "wrong class variable name: @@", c);
5656
5795
  }
5657
5796
  return 0;
5658
5797
  }
@@ -5668,7 +5807,15 @@ parser_yylex(parser_state *p)
5668
5807
 
5669
5808
  default:
5670
5809
  if (!identchar(c)) {
5671
- yyerror_i(p, "Invalid char '\\x%02X' in expression", c);
5810
+ char buf[36];
5811
+ const char s[] = "Invalid char in expression: 0x";
5812
+ const char hexdigits[] = "0123456789ABCDEF";
5813
+
5814
+ strcpy(buf, s);
5815
+ buf[sizeof(s)-1] = hexdigits[(c & 0xf0) >> 4];
5816
+ buf[sizeof(s)] = hexdigits[(c & 0x0f)];
5817
+ buf[sizeof(s)+1] = 0;
5818
+ yyerror(p, buf);
5672
5819
  goto retry;
5673
5820
  }
5674
5821
 
@@ -5742,7 +5889,7 @@ parser_yylex(parser_state *p)
5742
5889
  if (IS_LABEL_SUFFIX(0)) {
5743
5890
  p->lstate = EXPR_END;
5744
5891
  tokfix(p);
5745
- pylval.id = intern_cstr(tok(p));
5892
+ pylval.id = intern(tok(p), toklen(p));
5746
5893
  return tIDENTIFIER;
5747
5894
  }
5748
5895
  }
@@ -5801,7 +5948,7 @@ parser_yylex(parser_state *p)
5801
5948
  }
5802
5949
  }
5803
5950
  {
5804
- mrb_sym ident = intern_cstr(tok(p));
5951
+ mrb_sym ident = intern(tok(p), toklen(p));
5805
5952
 
5806
5953
  pylval.id = ident;
5807
5954
  if (last_state != EXPR_DOT && ISLOWER(tok(p)[0]) && local_var_p(p, ident)) {
@@ -6097,11 +6244,12 @@ mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c)
6097
6244
  if (c) c->parser_nerr = p->nerr;
6098
6245
  if (p->capture_errors) {
6099
6246
  char buf[256];
6100
- int n;
6101
6247
 
6102
- n = snprintf(buf, sizeof(buf), "line %d: %s\n",
6103
- p->error_buffer[0].lineno, p->error_buffer[0].message);
6104
- mrb->exc = mrb_obj_ptr(mrb_exc_new(mrb, E_SYNTAX_ERROR, buf, n));
6248
+ strcpy(buf, "line ");
6249
+ dump_int(p->error_buffer[0].lineno, buf+5);
6250
+ strcat(buf, ": ");
6251
+ strncat(buf, p->error_buffer[0].message, sizeof(buf) - strlen(buf) - 1);
6252
+ mrb->exc = mrb_obj_ptr(mrb_exc_new(mrb, E_SYNTAX_ERROR, buf, strlen(buf)));
6105
6253
  mrb_parser_free(p);
6106
6254
  return mrb_undef_value();
6107
6255
  }
@@ -6219,7 +6367,7 @@ dump_args(mrb_state *mrb, node *n, int offset)
6219
6367
 
6220
6368
  while (n2) {
6221
6369
  dump_prefix(n2, offset+2);
6222
- printf("%s=\n", mrb_sym2name(mrb, sym(n2->car->car)));
6370
+ printf("%s=\n", mrb_sym_name(mrb, sym(n2->car->car)));
6223
6371
  mrb_parser_dump(mrb, n2->car->cdr, offset+3);
6224
6372
  n2 = n2->cdr;
6225
6373
  }
@@ -6228,7 +6376,7 @@ dump_args(mrb_state *mrb, node *n, int offset)
6228
6376
  n = n->cdr;
6229
6377
  if (n->car) {
6230
6378
  dump_prefix(n, offset+1);
6231
- printf("rest=*%s\n", mrb_sym2name(mrb, sym(n->car)));
6379
+ printf("rest=*%s\n", mrb_sym_name(mrb, sym(n->car)));
6232
6380
  }
6233
6381
  n = n->cdr;
6234
6382
  if (n->car) {
@@ -6244,6 +6392,28 @@ dump_args(mrb_state *mrb, node *n, int offset)
6244
6392
  }
6245
6393
  }
6246
6394
 
6395
+ /*
6396
+ * This function restores the GC arena on return.
6397
+ * For this reason, if a process that further generates an object is
6398
+ * performed at the caller, the string pointer returned as the return
6399
+ * value may become invalid.
6400
+ */
6401
+ static const char*
6402
+ str_dump(mrb_state *mrb, const char *str, int len)
6403
+ {
6404
+ mrb_int ai = mrb_gc_arena_save(mrb);
6405
+ mrb_value s;
6406
+ # if INT_MAX > MRB_INT_MAX / 4
6407
+ /* check maximum length with "\xNN" charactor */
6408
+ if (len > MRB_INT_MAX / 4) {
6409
+ len = MRB_INT_MAX / 4;
6410
+ }
6411
+ # endif
6412
+ s = mrb_str_new(mrb, str, (mrb_int)len);
6413
+ s = mrb_str_dump(mrb, s);
6414
+ mrb_gc_arena_restore(mrb, ai);
6415
+ return RSTRING_PTR(s);
6416
+ }
6247
6417
  #endif
6248
6418
 
6249
6419
  void
@@ -6447,7 +6617,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6447
6617
  while (n2) {
6448
6618
  if (n2->car) {
6449
6619
  if (!first_lval) printf(", ");
6450
- printf("%s", mrb_sym2name(mrb, sym(n2->car)));
6620
+ printf("%s", mrb_sym_name(mrb, sym(n2->car)));
6451
6621
  first_lval = FALSE;
6452
6622
  }
6453
6623
  n2 = n2->cdr;
@@ -6475,7 +6645,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6475
6645
  mrb_parser_dump(mrb, tree->car, offset+1);
6476
6646
  dump_prefix(tree, offset+1);
6477
6647
  printf("method='%s' (%d)\n",
6478
- mrb_sym2name(mrb, sym(tree->cdr->car)),
6648
+ mrb_sym_dump(mrb, sym(tree->cdr->car)),
6479
6649
  intn(tree->cdr->car));
6480
6650
  tree = tree->cdr->cdr->car;
6481
6651
  if (tree) {
@@ -6506,11 +6676,11 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6506
6676
  printf("NODE_COLON2:\n");
6507
6677
  mrb_parser_dump(mrb, tree->car, offset+1);
6508
6678
  dump_prefix(tree, offset+1);
6509
- printf("::%s\n", mrb_sym2name(mrb, sym(tree->cdr)));
6679
+ printf("::%s\n", mrb_sym_name(mrb, sym(tree->cdr)));
6510
6680
  break;
6511
6681
 
6512
6682
  case NODE_COLON3:
6513
- printf("NODE_COLON3: ::%s\n", mrb_sym2name(mrb, sym(tree)));
6683
+ printf("NODE_COLON3: ::%s\n", mrb_sym_name(mrb, sym(tree)));
6514
6684
  break;
6515
6685
 
6516
6686
  case NODE_ARRAY:
@@ -6606,7 +6776,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6606
6776
  mrb_parser_dump(mrb, tree->car, offset+2);
6607
6777
  tree = tree->cdr;
6608
6778
  dump_prefix(tree, offset+1);
6609
- printf("op='%s' (%d)\n", mrb_sym2name(mrb, sym(tree->car)), intn(tree->car));
6779
+ printf("op='%s' (%d)\n", mrb_sym_name(mrb, sym(tree->car)), intn(tree->car));
6610
6780
  tree = tree->cdr;
6611
6781
  mrb_parser_dump(mrb, tree->car, offset+1);
6612
6782
  break;
@@ -6658,23 +6828,23 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6658
6828
  break;
6659
6829
 
6660
6830
  case NODE_LVAR:
6661
- printf("NODE_LVAR %s\n", mrb_sym2name(mrb, sym(tree)));
6831
+ printf("NODE_LVAR %s\n", mrb_sym_name(mrb, sym(tree)));
6662
6832
  break;
6663
6833
 
6664
6834
  case NODE_GVAR:
6665
- printf("NODE_GVAR %s\n", mrb_sym2name(mrb, sym(tree)));
6835
+ printf("NODE_GVAR %s\n", mrb_sym_name(mrb, sym(tree)));
6666
6836
  break;
6667
6837
 
6668
6838
  case NODE_IVAR:
6669
- printf("NODE_IVAR %s\n", mrb_sym2name(mrb, sym(tree)));
6839
+ printf("NODE_IVAR %s\n", mrb_sym_name(mrb, sym(tree)));
6670
6840
  break;
6671
6841
 
6672
6842
  case NODE_CVAR:
6673
- printf("NODE_CVAR %s\n", mrb_sym2name(mrb, sym(tree)));
6843
+ printf("NODE_CVAR %s\n", mrb_sym_name(mrb, sym(tree)));
6674
6844
  break;
6675
6845
 
6676
6846
  case NODE_CONST:
6677
- printf("NODE_CONST %s\n", mrb_sym2name(mrb, sym(tree)));
6847
+ printf("NODE_CONST %s\n", mrb_sym_name(mrb, sym(tree)));
6678
6848
  break;
6679
6849
 
6680
6850
  case NODE_MATCH:
@@ -6696,7 +6866,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6696
6866
  break;
6697
6867
 
6698
6868
  case NODE_ARG:
6699
- printf("NODE_ARG %s\n", mrb_sym2name(mrb, sym(tree)));
6869
+ printf("NODE_ARG %s\n", mrb_sym_name(mrb, sym(tree)));
6700
6870
  break;
6701
6871
 
6702
6872
  case NODE_BLOCK_ARG:
@@ -6713,25 +6883,25 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6713
6883
  break;
6714
6884
 
6715
6885
  case NODE_NEGATE:
6716
- printf("NODE_NEGATE\n");
6886
+ printf("NODE_NEGATE:\n");
6717
6887
  mrb_parser_dump(mrb, tree, offset+1);
6718
6888
  break;
6719
6889
 
6720
6890
  case NODE_STR:
6721
- printf("NODE_STR \"%s\" len %d\n", (char*)tree->car, intn(tree->cdr));
6891
+ printf("NODE_STR %s len %d\n", str_dump(mrb, (char*)tree->car, intn(tree->cdr)), intn(tree->cdr));
6722
6892
  break;
6723
6893
 
6724
6894
  case NODE_DSTR:
6725
- printf("NODE_DSTR\n");
6895
+ printf("NODE_DSTR:\n");
6726
6896
  dump_recur(mrb, tree, offset+1);
6727
6897
  break;
6728
6898
 
6729
6899
  case NODE_XSTR:
6730
- printf("NODE_XSTR \"%s\" len %d\n", (char*)tree->car, intn(tree->cdr));
6900
+ printf("NODE_XSTR %s len %d\n", str_dump(mrb, (char*)tree->car, intn(tree->cdr)), intn(tree->cdr));
6731
6901
  break;
6732
6902
 
6733
6903
  case NODE_DXSTR:
6734
- printf("NODE_DXSTR\n");
6904
+ printf("NODE_DXSTR:\n");
6735
6905
  dump_recur(mrb, tree, offset+1);
6736
6906
  break;
6737
6907
 
@@ -6740,7 +6910,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6740
6910
  break;
6741
6911
 
6742
6912
  case NODE_DREGX:
6743
- printf("NODE_DREGX\n");
6913
+ printf("NODE_DREGX:\n");
6744
6914
  dump_recur(mrb, tree->car, offset+1);
6745
6915
  dump_prefix(tree, offset);
6746
6916
  printf("tail: %s\n", (char*)tree->cdr->cdr->car);
@@ -6755,10 +6925,29 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6755
6925
  break;
6756
6926
 
6757
6927
  case NODE_SYM:
6758
- printf("NODE_SYM :%s (%d)\n", mrb_sym2name(mrb, sym(tree)),
6928
+ printf("NODE_SYM :%s (%d)\n", mrb_sym_dump(mrb, sym(tree)),
6759
6929
  intn(tree));
6760
6930
  break;
6761
6931
 
6932
+ case NODE_DSYM:
6933
+ printf("NODE_DSYM:\n");
6934
+ mrb_parser_dump(mrb, tree, offset+1);
6935
+ break;
6936
+
6937
+ case NODE_WORDS:
6938
+ printf("NODE_WORDS:\n");
6939
+ dump_recur(mrb, tree, offset+1);
6940
+ break;
6941
+
6942
+ case NODE_SYMBOLS:
6943
+ printf("NODE_SYMBOLS:\n");
6944
+ dump_recur(mrb, tree, offset+1);
6945
+ break;
6946
+
6947
+ case NODE_LITERAL_DELIM:
6948
+ printf("NODE_LITERAL_DELIM\n");
6949
+ break;
6950
+
6762
6951
  case NODE_SELF:
6763
6952
  printf("NODE_SELF\n");
6764
6953
  break;
@@ -6777,8 +6966,8 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6777
6966
 
6778
6967
  case NODE_ALIAS:
6779
6968
  printf("NODE_ALIAS %s %s:\n",
6780
- mrb_sym2name(mrb, sym(tree->car)),
6781
- mrb_sym2name(mrb, sym(tree->cdr)));
6969
+ mrb_sym_dump(mrb, sym(tree->car)),
6970
+ mrb_sym_dump(mrb, sym(tree->cdr)));
6782
6971
  break;
6783
6972
 
6784
6973
  case NODE_UNDEF:
@@ -6786,7 +6975,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6786
6975
  {
6787
6976
  node *t = tree;
6788
6977
  while (t) {
6789
- printf(" %s", mrb_sym2name(mrb, sym(t->car)));
6978
+ printf(" %s", mrb_sym_dump(mrb, sym(t->car)));
6790
6979
  t = t->cdr;
6791
6980
  }
6792
6981
  }
@@ -6797,16 +6986,16 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6797
6986
  printf("NODE_CLASS:\n");
6798
6987
  if (tree->car->car == (node*)0) {
6799
6988
  dump_prefix(tree, offset+1);
6800
- printf(":%s\n", mrb_sym2name(mrb, sym(tree->car->cdr)));
6989
+ printf(":%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
6801
6990
  }
6802
6991
  else if (tree->car->car == (node*)1) {
6803
6992
  dump_prefix(tree, offset+1);
6804
- printf("::%s\n", mrb_sym2name(mrb, sym(tree->car->cdr)));
6993
+ printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
6805
6994
  }
6806
6995
  else {
6807
6996
  mrb_parser_dump(mrb, tree->car->car, offset+1);
6808
6997
  dump_prefix(tree, offset+1);
6809
- printf("::%s\n", mrb_sym2name(mrb, sym(tree->car->cdr)));
6998
+ printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
6810
6999
  }
6811
7000
  if (tree->cdr->car) {
6812
7001
  dump_prefix(tree, offset+1);
@@ -6822,16 +7011,16 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6822
7011
  printf("NODE_MODULE:\n");
6823
7012
  if (tree->car->car == (node*)0) {
6824
7013
  dump_prefix(tree, offset+1);
6825
- printf(":%s\n", mrb_sym2name(mrb, sym(tree->car->cdr)));
7014
+ printf(":%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
6826
7015
  }
6827
7016
  else if (tree->car->car == (node*)1) {
6828
7017
  dump_prefix(tree, offset+1);
6829
- printf("::%s\n", mrb_sym2name(mrb, sym(tree->car->cdr)));
7018
+ printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
6830
7019
  }
6831
7020
  else {
6832
7021
  mrb_parser_dump(mrb, tree->car->car, offset+1);
6833
7022
  dump_prefix(tree, offset+1);
6834
- printf("::%s\n", mrb_sym2name(mrb, sym(tree->car->cdr)));
7023
+ printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
6835
7024
  }
6836
7025
  dump_prefix(tree, offset+1);
6837
7026
  printf("body:\n");
@@ -6849,7 +7038,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6849
7038
  case NODE_DEF:
6850
7039
  printf("NODE_DEF:\n");
6851
7040
  dump_prefix(tree, offset+1);
6852
- printf("%s\n", mrb_sym2name(mrb, sym(tree->car)));
7041
+ printf("%s\n", mrb_sym_dump(mrb, sym(tree->car)));
6853
7042
  tree = tree->cdr;
6854
7043
  {
6855
7044
  node *n2 = tree->car;
@@ -6862,7 +7051,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6862
7051
  while (n2) {
6863
7052
  if (n2->car) {
6864
7053
  if (!first_lval) printf(", ");
6865
- printf("%s", mrb_sym2name(mrb, sym(n2->car)));
7054
+ printf("%s", mrb_sym_name(mrb, sym(n2->car)));
6866
7055
  first_lval = FALSE;
6867
7056
  }
6868
7057
  n2 = n2->cdr;
@@ -6882,7 +7071,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6882
7071
  mrb_parser_dump(mrb, tree->car, offset+1);
6883
7072
  tree = tree->cdr;
6884
7073
  dump_prefix(tree, offset+1);
6885
- printf(":%s\n", mrb_sym2name(mrb, sym(tree->car)));
7074
+ printf(":%s\n", mrb_sym_dump(mrb, sym(tree->car)));
6886
7075
  tree = tree->cdr->cdr;
6887
7076
  if (tree->car) {
6888
7077
  dump_args(mrb, tree->car, offset+1);
@@ -6919,17 +7108,17 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
6919
7108
  tree = tree->cdr;
6920
7109
  if (tree->car) {
6921
7110
  dump_prefix(tree, offset+1);
6922
- printf("block='%s'\n", mrb_sym2name(mrb, sym(tree->car)));
7111
+ printf("block='%s'\n", mrb_sym_name(mrb, sym(tree->car)));
6923
7112
  }
6924
7113
  break;
6925
7114
 
6926
7115
  case NODE_KW_ARG:
6927
- printf("NODE_KW_ARG %s\n", mrb_sym2name(mrb, sym(tree->car)));
7116
+ printf("NODE_KW_ARG %s:\n", mrb_sym_name(mrb, sym(tree->car)));
6928
7117
  mrb_parser_dump(mrb, tree->cdr->car, offset + 1);
6929
7118
  break;
6930
7119
 
6931
7120
  case NODE_KW_REST_ARGS:
6932
- printf("NODE_KW_REST_ARGS %s\n", mrb_sym2name(mrb, sym(tree)));
7121
+ printf("NODE_KW_REST_ARGS %s\n", mrb_sym_name(mrb, sym(tree)));
6933
7122
  break;
6934
7123
 
6935
7124
  default: