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
@@ -102,12 +102,13 @@ codegen_error(codegen_scope *s, const char *message)
102
102
  while (s->prev) {
103
103
  codegen_scope *tmp = s->prev;
104
104
  mrb_free(s->mrb, s->iseq);
105
+ mrb_free(s->mrb, s->lines);
105
106
  mrb_pool_close(s->mpool);
106
107
  s = tmp;
107
108
  }
108
109
  #ifndef MRB_DISABLE_STDIO
109
110
  if (s->filename_sym && s->lineno) {
110
- const char *filename = mrb_sym2name_len(s->mrb, s->filename_sym, NULL);
111
+ const char *filename = mrb_sym_name_len(s->mrb, s->filename_sym, NULL);
111
112
  fprintf(stderr, "codegen error:%s:%d: %s\n", filename, s->lineno, message);
112
113
  }
113
114
  else {
@@ -272,8 +273,7 @@ genop_W(codegen_scope *s, mrb_code i, uint32_t a)
272
273
  #define NOVAL 0
273
274
  #define VAL 1
274
275
 
275
- //static
276
- mrb_bool
276
+ static mrb_bool
277
277
  no_optimize(codegen_scope *s)
278
278
  {
279
279
  if (s && s->parser && s->parser->no_optimize)
@@ -291,7 +291,7 @@ on_eval(codegen_scope *s)
291
291
  }
292
292
 
293
293
  struct mrb_insn_data
294
- mrb_decode_insn(mrb_code *pc)
294
+ mrb_decode_insn(const mrb_code *pc)
295
295
  {
296
296
  struct mrb_insn_data data = { 0 };
297
297
  mrb_code insn = READ_B();
@@ -559,7 +559,7 @@ new_lit(codegen_scope *s, mrb_value val)
559
559
  mrb_int len;
560
560
  pv = &s->irep->pool[i];
561
561
 
562
- if (mrb_type(*pv) != MRB_TT_STRING) continue;
562
+ if (!mrb_string_p(*pv)) continue;
563
563
  if ((len = RSTRING_LEN(*pv)) != RSTRING_LEN(val)) continue;
564
564
  if (memcmp(RSTRING_PTR(*pv), RSTRING_PTR(val), len) == 0)
565
565
  return i;
@@ -570,7 +570,7 @@ new_lit(codegen_scope *s, mrb_value val)
570
570
  for (i=0; i<s->irep->plen; i++) {
571
571
  mrb_float f1, f2;
572
572
  pv = &s->irep->pool[i];
573
- if (mrb_type(*pv) != MRB_TT_FLOAT) continue;
573
+ if (!mrb_float_p(*pv)) continue;
574
574
  f1 = mrb_float(*pv);
575
575
  f2 = mrb_float(val);
576
576
  if (f1 == f2 && !signbit(f1) == !signbit(f2)) return i;
@@ -686,9 +686,6 @@ for_body(codegen_scope *s, node *tree)
686
686
  codegen(s, tree->cdr->car, VAL);
687
687
  /* generate loop-block */
688
688
  s = scope_new(s->mrb, s, NULL);
689
- if (s == NULL) {
690
- raise_error(prev, "unexpected scope");
691
- }
692
689
 
693
690
  push(); /* push for a block parameter */
694
691
 
@@ -724,9 +721,6 @@ lambda_body(codegen_scope *s, node *tree, int blk)
724
721
  {
725
722
  codegen_scope *parent = s;
726
723
  s = scope_new(s->mrb, s, tree->car);
727
- if (s == NULL) {
728
- raise_error(parent, "unexpected scope");
729
- }
730
724
 
731
725
  s->mscope = !blk;
732
726
 
@@ -888,9 +882,6 @@ static int
888
882
  scope_body(codegen_scope *s, node *tree, int val)
889
883
  {
890
884
  codegen_scope *scope = scope_new(s->mrb, s, tree->car);
891
- if (scope == NULL) {
892
- codegen_error(s, "unexpected scope");
893
- }
894
885
 
895
886
  codegen(scope, tree->cdr, VAL);
896
887
  gen_return(scope, OP_RETURN, scope->sp-1);
@@ -922,7 +913,7 @@ attrsym(codegen_scope *s, mrb_sym a)
922
913
  mrb_int len;
923
914
  char *name2;
924
915
 
925
- name = mrb_sym2name_len(s->mrb, a, &len);
916
+ name = mrb_sym_name_len(s->mrb, a, &len);
926
917
  name2 = (char *)codegen_palloc(s,
927
918
  (size_t)len
928
919
  + 1 /* '=' */
@@ -956,7 +947,12 @@ gen_values(codegen_scope *s, node *t, int val, int extra)
956
947
  }
957
948
  else {
958
949
  pop_n(n);
959
- genop_2(s, OP_ARRAY, cursp(), n);
950
+ if (n == 0 && is_splat) {
951
+ genop_1(s, OP_LOADNIL, cursp());
952
+ }
953
+ else {
954
+ genop_2(s, OP_ARRAY, cursp(), n);
955
+ }
960
956
  push();
961
957
  codegen(s, t->car, VAL);
962
958
  pop(); pop();
@@ -1041,7 +1037,7 @@ gen_call(codegen_scope *s, node *tree, mrb_sym name, int sp, int val, int safe)
1041
1037
  pop_n(n+1);
1042
1038
  {
1043
1039
  mrb_int symlen;
1044
- const char *symname = mrb_sym2name_len(s->mrb, sym, &symlen);
1040
+ const char *symname = mrb_sym_name_len(s->mrb, sym, &symlen);
1045
1041
 
1046
1042
  if (!noop && symlen == 1 && symname[0] == '+' && n == 1) {
1047
1043
  gen_addsub(s, OP_ADD, cursp());
@@ -1401,7 +1397,7 @@ codegen(codegen_scope *s, node *tree, int val)
1401
1397
  }
1402
1398
  if (s->irep && s->filename_index != tree->filename_index) {
1403
1399
  mrb_sym fname = mrb_parser_get_filename(s->parser, s->filename_index);
1404
- const char *filename = mrb_sym2name_len(s->mrb, fname, NULL);
1400
+ const char *filename = mrb_sym_name_len(s->mrb, fname, NULL);
1405
1401
 
1406
1402
  mrb_debug_info_append_file(s->mrb, s->irep->debug_info,
1407
1403
  filename, s->lines, s->debug_start_pos, s->pc);
@@ -1553,7 +1549,7 @@ codegen(codegen_scope *s, node *tree, int val)
1553
1549
 
1554
1550
  case NODE_IF:
1555
1551
  {
1556
- int pos1, pos2;
1552
+ int pos1, pos2, nil_p = FALSE;
1557
1553
  node *elsepart = tree->cdr->cdr->car;
1558
1554
 
1559
1555
  if (!tree->car) {
@@ -1570,32 +1566,59 @@ codegen(codegen_scope *s, node *tree, int val)
1570
1566
  case NODE_NIL:
1571
1567
  codegen(s, elsepart, val);
1572
1568
  goto exit;
1569
+ case NODE_CALL:
1570
+ {
1571
+ node *n = tree->car->cdr;
1572
+ mrb_sym mid = nsym(n->cdr->car);
1573
+ mrb_sym mnil = mrb_intern_lit(s->mrb, "nil?");
1574
+ if (mid == mnil && n->cdr->cdr->car == NULL) {
1575
+ nil_p = TRUE;
1576
+ codegen(s, n->car, VAL);
1577
+ }
1578
+ }
1579
+ break;
1580
+ }
1581
+ if (!nil_p) {
1582
+ codegen(s, tree->car, VAL);
1573
1583
  }
1574
- codegen(s, tree->car, VAL);
1575
1584
  pop();
1576
- pos1 = genjmp2(s, OP_JMPNOT, cursp(), 0, val);
1577
-
1578
- codegen(s, tree->cdr->car, val);
1579
- if (elsepart) {
1585
+ if (val || tree->cdr->car) {
1586
+ if (nil_p) {
1587
+ pos2 = genjmp2(s, OP_JMPNIL, cursp(), 0, val);
1588
+ pos1 = genjmp(s, OP_JMP, 0);
1589
+ dispatch(s, pos2);
1590
+ }
1591
+ else {
1592
+ pos1 = genjmp2(s, OP_JMPNOT, cursp(), 0, val);
1593
+ }
1594
+ codegen(s, tree->cdr->car, val);
1580
1595
  if (val) pop();
1581
- pos2 = genjmp(s, OP_JMP, 0);
1582
- dispatch(s, pos1);
1583
- codegen(s, elsepart, val);
1584
- dispatch(s, pos2);
1585
- }
1586
- else {
1587
- if (val) {
1588
- pop();
1596
+ if (elsepart || val) {
1589
1597
  pos2 = genjmp(s, OP_JMP, 0);
1590
1598
  dispatch(s, pos1);
1591
- genop_1(s, OP_LOADNIL, cursp());
1599
+ codegen(s, elsepart, val);
1592
1600
  dispatch(s, pos2);
1593
- push();
1594
1601
  }
1595
1602
  else {
1596
1603
  dispatch(s, pos1);
1597
1604
  }
1598
1605
  }
1606
+ else { /* empty then-part */
1607
+ if (elsepart) {
1608
+ if (nil_p) {
1609
+ pos1 = genjmp2(s, OP_JMPNIL, cursp(), 0, val);
1610
+ }
1611
+ else {
1612
+ pos1 = genjmp2(s, OP_JMPIF, cursp(), 0, val);
1613
+ }
1614
+ codegen(s, elsepart, val);
1615
+ dispatch(s, pos1);
1616
+ }
1617
+ else if (val && !nil_p) {
1618
+ genop_1(s, OP_LOADNIL, cursp());
1619
+ push();
1620
+ }
1621
+ }
1599
1622
  }
1600
1623
  break;
1601
1624
 
@@ -1955,7 +1978,7 @@ codegen(codegen_scope *s, node *tree, int val)
1955
1978
  {
1956
1979
  mrb_sym sym = nsym(tree->cdr->car);
1957
1980
  mrb_int len;
1958
- const char *name = mrb_sym2name_len(s->mrb, sym, &len);
1981
+ const char *name = mrb_sym_name_len(s->mrb, sym, &len);
1959
1982
  int idx, callargs = -1, vsp = -1;
1960
1983
 
1961
1984
  if ((len == 2 && name[0] == '|' && name[1] == '|') &&
@@ -2353,10 +2376,6 @@ codegen(codegen_scope *s, node *tree, int val)
2353
2376
  }
2354
2377
  break;
2355
2378
 
2356
- case NODE_DEFINED:
2357
- codegen(s, tree, val);
2358
- break;
2359
-
2360
2379
  case NODE_BACK_REF:
2361
2380
  if (val) {
2362
2381
  char buf[] = {'$', nchar(tree)};
@@ -2373,7 +2392,7 @@ codegen(codegen_scope *s, node *tree, int val)
2373
2392
  mrb_value str;
2374
2393
  int sym;
2375
2394
 
2376
- str = mrb_format(mrb, "$%S", mrb_fixnum_value(nint(tree)));
2395
+ str = mrb_format(mrb, "$%d", nint(tree));
2377
2396
  sym = new_sym(s, mrb_intern_str(mrb, str));
2378
2397
  genop_2(s, OP_GETGV, cursp(), sym);
2379
2398
  push();
@@ -2944,7 +2963,11 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *lv)
2944
2963
  mrb_pool *pool = mrb_pool_open(mrb);
2945
2964
  codegen_scope *p = (codegen_scope *)mrb_pool_alloc(pool, sizeof(codegen_scope));
2946
2965
 
2947
- if (!p) return NULL;
2966
+ if (!p) {
2967
+ if (prev)
2968
+ codegen_error(prev, "unexpected scope");
2969
+ return NULL;
2970
+ }
2948
2971
  *p = codegen_scope_zero;
2949
2972
  p->mrb = mrb;
2950
2973
  p->mpool = pool;
@@ -3020,6 +3043,9 @@ scope_finish(codegen_scope *s)
3020
3043
  mrb_state *mrb = s->mrb;
3021
3044
  mrb_irep *irep = s->irep;
3022
3045
 
3046
+ if (s->nlocals >= 0x3ff) {
3047
+ codegen_error(s, "too many local variables");
3048
+ }
3023
3049
  irep->flags = 0;
3024
3050
  if (s->iseq) {
3025
3051
  irep->iseq = (mrb_code *)codegen_realloc(s, s->iseq, sizeof(mrb_code)*s->pc);
@@ -3030,7 +3056,7 @@ scope_finish(codegen_scope *s)
3030
3056
  irep->reps = (mrb_irep**)codegen_realloc(s, irep->reps, sizeof(mrb_irep*)*irep->rlen);
3031
3057
  if (s->filename_sym) {
3032
3058
  mrb_sym fname = mrb_parser_get_filename(s->parser, s->filename_index);
3033
- const char *filename = mrb_sym2name_len(s->mrb, fname, NULL);
3059
+ const char *filename = mrb_sym_name_len(s->mrb, fname, NULL);
3034
3060
 
3035
3061
  mrb_debug_info_append_file(s->mrb, s->irep->debug_info,
3036
3062
  filename, s->lines, s->debug_start_pos, s->pc);
@@ -3134,9 +3160,6 @@ generate_code(mrb_state *mrb, parser_state *p, int val)
3134
3160
  struct RProc *proc;
3135
3161
  struct mrb_jmpbuf *prev_jmp = mrb->jmp;
3136
3162
 
3137
- if (!scope) {
3138
- return NULL;
3139
- }
3140
3163
  scope->mrb = mrb;
3141
3164
  scope->parser = p;
3142
3165
  scope->filename_sym = p->filename_sym;
@@ -1,8 +1,5 @@
1
1
  %{
2
2
  struct kwtable {const char *name; int id[2]; enum mrb_lex_state_enum state;};
3
- const struct kwtable *mrb_reserved_word(const char *, unsigned int);
4
- static const struct kwtable *reserved_word(const char *, unsigned int);
5
- #define mrb_reserved_word(str, len) reserved_word(str, len)
6
3
  %}
7
4
 
8
5
  struct kwtable;
@@ -1,4 +1,4 @@
1
- /* ANSI-C code produced by gperf version 3.0.4 */
1
+ /* ANSI-C code produced by gperf version 3.1 */
2
2
  /* Command-line: gperf -L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k'1,3,$' /home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords */
3
3
 
4
4
  #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -25,16 +25,13 @@
25
25
  && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
26
26
  && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
27
27
  /* The character set is not based on ISO-646. */
28
- #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
28
+ #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
29
29
  #endif
30
30
 
31
31
  #line 1 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
32
32
 
33
33
  struct kwtable {const char *name; int id[2]; enum mrb_lex_state_enum state;};
34
- const struct kwtable *mrb_reserved_word(const char *, unsigned int);
35
- static const struct kwtable *reserved_word(const char *, unsigned int);
36
- #define mrb_reserved_word(str, len) reserved_word(str, len)
37
- #line 8 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
34
+ #line 5 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
38
35
  struct kwtable;
39
36
 
40
37
  #define TOTAL_KEYWORDS 40
@@ -52,7 +49,7 @@ inline
52
49
  #endif
53
50
  #endif
54
51
  static unsigned int
55
- hash (const char *str, unsigned int len)
52
+ hash (register const char *str, register size_t len)
56
53
  {
57
54
  static const unsigned char asso_values[] =
58
55
  {
@@ -83,7 +80,7 @@ hash (const char *str, unsigned int len)
83
80
  51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
84
81
  51, 51, 51, 51, 51, 51
85
82
  };
86
- int hval = len;
83
+ register unsigned int hval = len;
87
84
 
88
85
  switch (hval)
89
86
  {
@@ -98,109 +95,103 @@ hash (const char *str, unsigned int len)
98
95
  return hval + asso_values[(unsigned char)str[len - 1]];
99
96
  }
100
97
 
101
- #ifdef __GNUC__
102
- __inline
103
- #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
104
- __attribute__ ((__gnu_inline__))
105
- #endif
106
- #endif
107
98
  const struct kwtable *
108
- mrb_reserved_word (const char *str, unsigned int len)
99
+ mrb_reserved_word (register const char *str, register size_t len)
109
100
  {
110
101
  static const struct kwtable wordlist[] =
111
102
  {
112
103
  {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
113
- #line 18 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
104
+ #line 15 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
114
105
  {"break", {keyword_break, keyword_break}, EXPR_MID},
115
- #line 23 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
106
+ #line 20 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
116
107
  {"else", {keyword_else, keyword_else}, EXPR_BEG},
117
- #line 33 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
108
+ #line 30 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
118
109
  {"nil", {keyword_nil, keyword_nil}, EXPR_END},
119
- #line 26 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
110
+ #line 23 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
120
111
  {"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG},
121
- #line 25 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
112
+ #line 22 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
122
113
  {"end", {keyword_end, keyword_end}, EXPR_END},
123
- #line 42 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
114
+ #line 39 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
124
115
  {"then", {keyword_then, keyword_then}, EXPR_BEG},
125
- #line 34 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
116
+ #line 31 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
126
117
  {"not", {keyword_not, keyword_not}, EXPR_ARG},
127
- #line 27 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
118
+ #line 24 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
128
119
  {"false", {keyword_false, keyword_false}, EXPR_END},
129
- #line 40 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
120
+ #line 37 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
130
121
  {"self", {keyword_self, keyword_self}, EXPR_END},
131
- #line 24 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
122
+ #line 21 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
132
123
  {"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE},
133
- #line 37 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
124
+ #line 34 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
134
125
  {"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID},
135
- #line 43 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
126
+ #line 40 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
136
127
  {"true", {keyword_true, keyword_true}, EXPR_END},
137
- #line 46 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
128
+ #line 43 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
138
129
  {"until", {keyword_until, modifier_until}, EXPR_VALUE},
139
- #line 45 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
130
+ #line 42 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
140
131
  {"unless", {keyword_unless, modifier_unless}, EXPR_VALUE},
141
- #line 39 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
132
+ #line 36 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
142
133
  {"return", {keyword_return, keyword_return}, EXPR_MID},
143
- #line 21 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
134
+ #line 18 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
144
135
  {"def", {keyword_def, keyword_def}, EXPR_FNAME},
145
- #line 16 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
136
+ #line 13 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
146
137
  {"and", {keyword_and, keyword_and}, EXPR_VALUE},
147
- #line 22 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
138
+ #line 19 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
148
139
  {"do", {keyword_do, keyword_do}, EXPR_BEG},
149
- #line 49 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
140
+ #line 46 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
150
141
  {"yield", {keyword_yield, keyword_yield}, EXPR_ARG},
151
- #line 28 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
142
+ #line 25 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
152
143
  {"for", {keyword_for, keyword_for}, EXPR_VALUE},
153
- #line 44 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
144
+ #line 41 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
154
145
  {"undef", {keyword_undef, keyword_undef}, EXPR_FNAME},
155
- #line 35 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
146
+ #line 32 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
156
147
  {"or", {keyword_or, keyword_or}, EXPR_VALUE},
157
- #line 30 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
148
+ #line 27 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
158
149
  {"in", {keyword_in, keyword_in}, EXPR_VALUE},
159
- #line 47 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
150
+ #line 44 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
160
151
  {"when", {keyword_when, keyword_when}, EXPR_VALUE},
161
- #line 38 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
152
+ #line 35 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
162
153
  {"retry", {keyword_retry, keyword_retry}, EXPR_END},
163
- #line 29 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
154
+ #line 26 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
164
155
  {"if", {keyword_if, modifier_if}, EXPR_VALUE},
165
- #line 19 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
156
+ #line 16 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
166
157
  {"case", {keyword_case, keyword_case}, EXPR_VALUE},
167
- #line 36 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
158
+ #line 33 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
168
159
  {"redo", {keyword_redo, keyword_redo}, EXPR_END},
169
- #line 32 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
160
+ #line 29 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
170
161
  {"next", {keyword_next, keyword_next}, EXPR_MID},
171
- #line 41 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
162
+ #line 38 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
172
163
  {"super", {keyword_super, keyword_super}, EXPR_ARG},
173
- #line 31 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
164
+ #line 28 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
174
165
  {"module", {keyword_module, keyword_module}, EXPR_VALUE},
175
- #line 17 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
166
+ #line 14 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
176
167
  {"begin", {keyword_begin, keyword_begin}, EXPR_BEG},
177
- #line 12 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
168
+ #line 9 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
178
169
  {"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END},
179
- #line 11 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
170
+ #line 8 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
180
171
  {"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END},
181
- #line 10 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
172
+ #line 7 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
182
173
  {"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
183
- #line 14 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
174
+ #line 11 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
184
175
  {"END", {keyword_END, keyword_END}, EXPR_END},
185
- #line 15 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
176
+ #line 12 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
186
177
  {"alias", {keyword_alias, keyword_alias}, EXPR_FNAME},
187
- #line 13 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
178
+ #line 10 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
188
179
  {"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END},
189
180
  {""},
190
- #line 20 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
181
+ #line 17 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
191
182
  {"class", {keyword_class, keyword_class}, EXPR_CLASS},
192
183
  {""}, {""},
193
- #line 48 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
184
+ #line 45 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
194
185
  {"while", {keyword_while, modifier_while}, EXPR_VALUE}
195
186
  };
196
187
 
197
188
  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
198
189
  {
199
- int key = hash (str, len);
190
+ register unsigned int key = hash (str, len);
200
191
 
201
- if (key <= MAX_HASH_VALUE && key >= 0)
192
+ if (key <= MAX_HASH_VALUE)
202
193
  {
203
- const char *s = wordlist[key].name;
194
+ register const char *s = wordlist[key].name;
204
195
 
205
196
  if (*str == *s && !strcmp (str + 1, s + 1))
206
197
  return &wordlist[key];
@@ -208,4 +199,5 @@ mrb_reserved_word (const char *str, unsigned int len)
208
199
  }
209
200
  return 0;
210
201
  }
211
- #line 50 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
202
+ #line 47 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords"
203
+