summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml109
-rw-r--r--.github/workflows/main.yml24
-rw-r--r--.gitlab-ci.yml2002
-rw-r--r--.travis.yml20
-rw-r--r--AUTHORS1
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--Doxyfile2
-rw-r--r--Makefile4
-rw-r--r--README.md14
-rw-r--r--Rakefile17
-rw-r--r--appveyor.yml21
-rw-r--r--appveyor_config.rb20
-rw-r--r--build_config.rb12
-rw-r--r--doc/guides/compile.md16
-rw-r--r--doc/guides/debugger.md2
-rw-r--r--doc/guides/mrbconf.md12
-rw-r--r--doc/guides/mrbgems.md6
-rw-r--r--doc/limitations.md20
-rw-r--r--doc/opcode.md203
-rw-r--r--examples/targets/build_config_ArduinoDue.rb4
-rw-r--r--examples/targets/build_config_IntelEdison.rb4
-rw-r--r--examples/targets/build_config_IntelGalileo.rb4
-rw-r--r--examples/targets/build_config_RX630.rb4
-rw-r--r--examples/targets/build_config_chipKITMax32.rb4
-rw-r--r--examples/targets/build_config_dreamcast_shelf.rb108
-rw-r--r--include/mrbconf.h20
-rw-r--r--include/mruby.h19
-rw-r--r--include/mruby/array.h10
-rw-r--r--include/mruby/boxing_nan.h14
-rw-r--r--include/mruby/boxing_no.h1
-rw-r--r--include/mruby/boxing_word.h56
-rw-r--r--include/mruby/class.h7
-rw-r--r--include/mruby/common.h10
-rw-r--r--include/mruby/compile.h15
-rw-r--r--include/mruby/dump.h18
-rw-r--r--include/mruby/irep.h10
-rw-r--r--include/mruby/numeric.h1
-rw-r--r--include/mruby/ops.h1
-rw-r--r--include/mruby/string.h15
-rw-r--r--include/mruby/value.h31
-rw-r--r--include/mruby/version.h8
-rw-r--r--lib/mruby-core-ext.rb21
-rw-r--r--lib/mruby/build.rb17
-rw-r--r--lib/mruby/build/command.rb105
-rw-r--r--lib/mruby/build/load_gems.rb20
-rw-r--r--lib/mruby/gem.rb11
-rw-r--r--lib/mruby/source.rb4
-rwxr-xr-xminirake623
-rw-r--r--mrbgems/default.gembox3
-rw-r--r--mrbgems/mruby-array-ext/mrblib/array.rb31
-rw-r--r--mrbgems/mruby-array-ext/test/array.rb19
-rw-r--r--mrbgems/mruby-bin-config/mrbgem.rake9
-rw-r--r--mrbgems/mruby-bin-debugger/bintest/print.rb36
-rw-r--r--mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c1
-rw-r--r--mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h6
-rw-r--r--mrbgems/mruby-bin-mirb/tools/mirb/mirb.c6
-rw-r--r--mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c22
-rw-r--r--mrbgems/mruby-bin-mruby/bintest/mruby.rb25
-rw-r--r--mrbgems/mruby-bin-mruby/mrbgem.rake1
-rw-r--r--mrbgems/mruby-bin-mruby/tools/mruby/mruby.c201
-rw-r--r--mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c8
-rw-r--r--mrbgems/mruby-class-ext/src/class.c13
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c139
-rw-r--r--mrbgems/mruby-compiler/core/node.h1
-rw-r--r--mrbgems/mruby-compiler/core/parse.y497
-rw-r--r--mrbgems/mruby-compiler/core/y.tab.c13153
-rw-r--r--mrbgems/mruby-compiler/mrbgem.rake28
-rw-r--r--mrbgems/mruby-complex/mrbgem.rake3
-rw-r--r--mrbgems/mruby-complex/mrblib/complex.rb10
-rw-r--r--mrbgems/mruby-error/src/exception.c6
-rw-r--r--mrbgems/mruby-eval/src/eval.c217
-rw-r--r--mrbgems/mruby-eval/test/eval.rb21
-rw-r--r--mrbgems/mruby-exit/src/mruby-exit.c13
-rw-r--r--mrbgems/mruby-hash-ext/mrbgem.rake2
-rw-r--r--mrbgems/mruby-hash-ext/src/hash-ext.c4
-rw-r--r--mrbgems/mruby-hash-ext/test/hash.rb10
-rw-r--r--mrbgems/mruby-io/README.md1
-rw-r--r--mrbgems/mruby-io/include/mruby/ext/io.h48
-rw-r--r--mrbgems/mruby-io/mrbgem.rake12
-rw-r--r--mrbgems/mruby-io/mrblib/file.rb66
-rw-r--r--mrbgems/mruby-io/mrblib/file_constants.rb16
-rw-r--r--mrbgems/mruby-io/mrblib/io.rb19
-rw-r--r--mrbgems/mruby-io/src/file.c162
-rw-r--r--mrbgems/mruby-io/src/file_test.c6
-rw-r--r--mrbgems/mruby-io/src/io.c445
-rw-r--r--mrbgems/mruby-io/test/file.rb46
-rw-r--r--mrbgems/mruby-io/test/io.rb32
-rw-r--r--mrbgems/mruby-io/test/mruby_io_test.c127
-rw-r--r--mrbgems/mruby-kernel-ext/src/kernel.c2
-rw-r--r--mrbgems/mruby-kernel-ext/test/kernel.rb46
-rw-r--r--mrbgems/mruby-math/test/math.rb119
-rw-r--r--mrbgems/mruby-metaprog/src/metaprog.c66
-rw-r--r--mrbgems/mruby-metaprog/test/metaprog.rb9
-rw-r--r--mrbgems/mruby-object-ext/src/object.c15
-rw-r--r--mrbgems/mruby-pack/README.md1
-rw-r--r--mrbgems/mruby-pack/mrbgem.rake2
-rw-r--r--mrbgems/mruby-pack/src/pack.c123
-rw-r--r--mrbgems/mruby-print/src/print.c6
-rw-r--r--mrbgems/mruby-proc-ext/src/proc.c8
-rw-r--r--mrbgems/mruby-sleep/mrbgem.rake2
-rw-r--r--mrbgems/mruby-sleep/src/mrb_sleep.c1
-rw-r--r--mrbgems/mruby-socket/README.md1
-rw-r--r--mrbgems/mruby-socket/mrbgem.rake4
-rw-r--r--mrbgems/mruby-socket/src/socket.c2
-rw-r--r--mrbgems/mruby-socket/test/sockettest.c5
-rw-r--r--mrbgems/mruby-sprintf/src/kernel.c4
-rw-r--r--mrbgems/mruby-sprintf/src/sprintf.c85
-rw-r--r--mrbgems/mruby-sprintf/test/sprintf.rb28
-rw-r--r--mrbgems/mruby-struct/src/struct.c2
-rw-r--r--mrbgems/mruby-symbol-ext/mrblib/symbol.rb8
-rw-r--r--mrbgems/mruby-symbol-ext/src/symbol.c2
-rw-r--r--mrbgems/mruby-test/mrbgem.rake13
-rw-r--r--mrbgems/mruby-test/vformat.c319
-rw-r--r--mrbgems/mruby-time/src/time.c44
-rw-r--r--mrblib/hash.rb6
-rw-r--r--mrblib/mrblib.rake2
-rw-r--r--mruby-source.gemspec2
-rw-r--r--src/array.c14
-rw-r--r--src/backtrace.c87
-rw-r--r--src/class.c155
-rw-r--r--src/codedump.c4
-rw-r--r--src/dump.c68
-rw-r--r--src/error.c88
-rw-r--r--src/etc.c17
-rw-r--r--src/fmt_fp.c120
-rw-r--r--src/gc.c10
-rw-r--r--src/hash.c13
-rw-r--r--src/kernel.c12
-rw-r--r--src/load.c48
-rw-r--r--src/numeric.c13
-rw-r--r--src/print.c1
-rw-r--r--src/string.c325
-rw-r--r--src/symbol.c32
-rw-r--r--src/variable.c2
-rw-r--r--src/vm.c51
-rw-r--r--tasks/doc.rake4
-rw-r--r--tasks/gitlab.rake43
-rw-r--r--tasks/libmruby.rake2
-rw-r--r--tasks/mrbgems.rake6
-rw-r--r--tasks/toolchains/android.rake51
-rw-r--r--tasks/toolchains/gcc.rake8
-rw-r--r--tasks/toolchains/openwrt.rake12
-rw-r--r--tasks/toolchains/visualcpp.rake16
-rw-r--r--test/t/ensure.rb34
-rw-r--r--test/t/exception.rb8
-rw-r--r--test/t/kernel.rb15
-rw-r--r--test/t/string.rb58
-rw-r--r--test/t/syntax.rb10
-rw-r--r--test/t/vformat.rb130
-rw-r--r--travis_config.rb17
150 files changed, 18096 insertions, 3442 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 000000000..3907baeff
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,109 @@
+name: Build & Test
+
+on: [push, pull_request]
+
+jobs:
+ Ubuntu-1604:
+ runs-on: ubuntu-16.04
+ steps:
+ - uses: actions/checkout@v1
+ - name: apt
+ run: sudo apt install ruby gperf bison
+ - name: build and test
+ run: rake -m -j4 all test
+ env:
+ MRUBY_CONFIG: travis_config.rb
+
+ Ubuntu-1804-gcc:
+ runs-on: ubuntu-18.04
+ steps:
+ - uses: actions/checkout@v1
+ - name: apt
+ run: sudo apt install ruby gperf bison gcc g++
+ - name: build and test
+ run: rake -m -j4 all test
+ env:
+ MRUBY_CONFIG: travis_config.rb
+ CC: gcc
+ CXX: g++
+
+ Ubuntu-1804-clang:
+ runs-on: ubuntu-18.04
+ steps:
+ - uses: actions/checkout@v1
+ - name: apt
+ run: sudo apt install ruby gperf bison
+ - name: build and test
+ run: rake -m -j4 all test
+ env:
+ MRUBY_CONFIG: travis_config.rb
+ CC: clang
+ CXX: clang++
+
+ macOS:
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@v1
+ - name: brew
+ run: brew install ruby gperf bison
+ - name: build and test
+ run: rake -m -j4 all test
+ env:
+ MRUBY_CONFIG: travis_config.rb
+ YACC: /usr/local/opt/bison/bin/bison
+
+ Windows-MinGW:
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v1
+ - name: chocolatey
+ run: choco install -y ruby winflexbison gperf
+ - name: build and test
+ run: rake -E '$stdout.sync=true' -j4 test
+ env:
+ MRUBY_CONFIG: travis_config.rb
+ YACC: win_bison
+ CFLAGS: -g -O1 -Wall -Wundef
+
+ Windows-Cygwin:
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v1
+ - uses: actions/cache@v1
+ with:
+ path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
+ key: ${{ runner.os }}-cygwin-chocolatey-${{ matrix.os }}-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-cygwin-chocolatey-${{ matrix.os }}-
+ ${{ runner.os }}-cygwin-chocolatey-
+ - name: chocolatey
+ run: choco install -y cygwin
+ - name: Install cygwin packages
+ shell: cmd
+ run: C:\tools\cygwin\cygwinsetup.exe -qgnNdO -R C:/tools/cygwin -l C:/tools/cygwin/package -s http://mirrors.kernel.org/sourceware/cygwin/ -P gcc-core,gcc-g++,bison,make,gperf,ruby
+ - name: Set ENV
+ run: |
+ echo '::set-env name=PATH::C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin'
+ - name: build and test
+ shell: cmd
+ run: C:\tools\cygwin\bin\ruby.exe /usr/bin/rake -m -j4 -v -E 'STDOUT.sync=true' test
+ env:
+ MRUBY_CONFIG: travis_config.rb
+
+ Windows-VC:
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@v1
+ - name: chocolatey
+ run: choco install -y ruby winflexbison gperf
+ - name: build and test
+ shell: cmd
+ run: |
+ call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
+ rake -E "STDOUT.sync=true" -m -j4 -v test
+ env:
+ MRUBY_CONFIG: appveyor_config.rb
+ YACC: win_bison
+ # TODO(take-cheeze): Re-enable /O2
+ CFLAGS: "/c /nologo /W3 /we4013 /Zi /MD /D_CRT_SECURE_NO_WARNINGS"
+ CXXFLAGS: "/c /nologo /W3 /Zi /MD /EHs /D_CRT_SECURE_NO_WARNINGS"
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 000000000..3c1a7e07e
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,24 @@
+name: CIFuzz
+on: [pull_request]
+jobs:
+ Fuzzing:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Build Fuzzers
+ uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
+ with:
+ oss-fuzz-project-name: 'mruby'
+ dry-run: false
+ - name: Run Fuzzers
+ uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
+ with:
+ oss-fuzz-project-name: 'mruby'
+ fuzz-seconds: 600
+ dry-run: false
+ - name: Upload Crash
+ uses: actions/upload-artifact@v1
+ if: failure()
+ with:
+ name: artifacts
+ path: ./out/artifacts
+
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8f4179232..8f0d74f87 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,7 +11,7 @@ pretest:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
- script: "./minirake all test"
+ script: rake --verbose all test
Test gcc-4.7 32bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -19,9 +19,9 @@ Test gcc-4.7 32bit:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 "
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -29,9 +29,9 @@ Test gcc-4.7 32bit_utf8:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-m32 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -41,7 +41,7 @@ Test gcc-4.7 32bit_nan:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -51,7 +51,27 @@ Test gcc-4.7 32bit_nan_utf8:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test gcc-4.7 32bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-4.7 32bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -61,7 +81,7 @@ Test gcc-4.7 32bit_int16:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -71,7 +91,7 @@ Test gcc-4.7 32bit_int16_utf8:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -81,7 +101,7 @@ Test gcc-4.7 32bit_int16_nan:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -91,7 +111,7 @@ Test gcc-4.7 32bit_int16_nan_utf8:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -101,7 +121,7 @@ Test gcc-4.7 32bit_int64:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -111,7 +131,7 @@ Test gcc-4.7 32bit_int64_utf8:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -119,9 +139,9 @@ Test gcc-4.7 32bit_float:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
- CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -129,9 +149,29 @@ Test gcc-4.7 32bit_float_utf8:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-4.7 32bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-4.7 32bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -141,7 +181,7 @@ Test gcc-4.7 32bit_float_int16:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -151,7 +191,7 @@ Test gcc-4.7 32bit_float_int16_utf8:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -161,7 +201,7 @@ Test gcc-4.7 32bit_float_int64:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 32bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -171,7 +211,7 @@ Test gcc-4.7 32bit_float_int64_utf8:
LD: gcc-4.7
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -179,9 +219,9 @@ Test gcc-4.7 64bit:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
- CFLAGS: "-DMRB_WORD_BOXING=1"
+ CFLAGS: ''
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -189,9 +229,9 @@ Test gcc-4.7 64bit_utf8:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
- CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -201,7 +241,7 @@ Test gcc-4.7 64bit_nan:
LD: gcc-4.7
CFLAGS: "-DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -211,7 +251,27 @@ Test gcc-4.7 64bit_nan_utf8:
LD: gcc-4.7
CFLAGS: "-DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test gcc-4.7 64bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
+ CFLAGS: "-DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.7 64bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
+ CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -221,7 +281,7 @@ Test gcc-4.7 64bit_int16:
LD: gcc-4.7
CFLAGS: "-DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -231,7 +291,7 @@ Test gcc-4.7 64bit_int16_utf8:
LD: gcc-4.7
CFLAGS: "-DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -241,7 +301,7 @@ Test gcc-4.7 64bit_int16_nan:
LD: gcc-4.7
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -251,7 +311,7 @@ Test gcc-4.7 64bit_int16_nan_utf8:
LD: gcc-4.7
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -259,9 +319,9 @@ Test gcc-4.7 64bit_int64:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
- CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -269,9 +329,29 @@ Test gcc-4.7 64bit_int64_utf8:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
+ CFLAGS: "-DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.7 64bit_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
+ CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.7 64bit_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -279,9 +359,9 @@ Test gcc-4.7 64bit_float:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -289,9 +369,29 @@ Test gcc-4.7 64bit_float_utf8:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.7 64bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.7 64bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -301,7 +401,7 @@ Test gcc-4.7 64bit_float_int16:
LD: gcc-4.7
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -311,7 +411,7 @@ Test gcc-4.7 64bit_float_int16_utf8:
LD: gcc-4.7
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -319,9 +419,9 @@ Test gcc-4.7 64bit_float_int64:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.7 64bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
@@ -329,9 +429,29 @@ Test gcc-4.7 64bit_float_int64_utf8:
CC: gcc-4.7
CXX: g++-4.7
LD: gcc-4.7
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.7 64bit_float_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.7 64bit_float_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc47_0.7
+ variables:
+ CC: gcc-4.7
+ CXX: g++-4.7
+ LD: gcc-4.7
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -339,9 +459,9 @@ Test gcc-4.8 32bit:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 "
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -349,9 +469,9 @@ Test gcc-4.8 32bit_utf8:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-m32 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -361,7 +481,7 @@ Test gcc-4.8 32bit_nan:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -371,7 +491,27 @@ Test gcc-4.8 32bit_nan_utf8:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test gcc-4.8 32bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-4.8 32bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -381,7 +521,7 @@ Test gcc-4.8 32bit_int16:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -391,7 +531,7 @@ Test gcc-4.8 32bit_int16_utf8:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -401,7 +541,7 @@ Test gcc-4.8 32bit_int16_nan:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -411,7 +551,7 @@ Test gcc-4.8 32bit_int16_nan_utf8:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -421,7 +561,7 @@ Test gcc-4.8 32bit_int64:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -431,7 +571,7 @@ Test gcc-4.8 32bit_int64_utf8:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -439,9 +579,9 @@ Test gcc-4.8 32bit_float:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
- CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -449,9 +589,29 @@ Test gcc-4.8 32bit_float_utf8:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-4.8 32bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-4.8 32bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -461,7 +621,7 @@ Test gcc-4.8 32bit_float_int16:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -471,7 +631,7 @@ Test gcc-4.8 32bit_float_int16_utf8:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -481,7 +641,7 @@ Test gcc-4.8 32bit_float_int64:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 32bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -491,7 +651,7 @@ Test gcc-4.8 32bit_float_int64_utf8:
LD: gcc-4.8
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -499,9 +659,9 @@ Test gcc-4.8 64bit:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
- CFLAGS: "-DMRB_WORD_BOXING=1"
+ CFLAGS: ''
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -509,9 +669,9 @@ Test gcc-4.8 64bit_utf8:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
- CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -521,7 +681,7 @@ Test gcc-4.8 64bit_nan:
LD: gcc-4.8
CFLAGS: "-DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -531,7 +691,27 @@ Test gcc-4.8 64bit_nan_utf8:
LD: gcc-4.8
CFLAGS: "-DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test gcc-4.8 64bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
+ CFLAGS: "-DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.8 64bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
+ CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -541,7 +721,7 @@ Test gcc-4.8 64bit_int16:
LD: gcc-4.8
CFLAGS: "-DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -551,7 +731,7 @@ Test gcc-4.8 64bit_int16_utf8:
LD: gcc-4.8
CFLAGS: "-DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -561,7 +741,7 @@ Test gcc-4.8 64bit_int16_nan:
LD: gcc-4.8
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -571,7 +751,7 @@ Test gcc-4.8 64bit_int16_nan_utf8:
LD: gcc-4.8
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -579,9 +759,9 @@ Test gcc-4.8 64bit_int64:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
- CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -589,9 +769,29 @@ Test gcc-4.8 64bit_int64_utf8:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
+ CFLAGS: "-DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.8 64bit_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
+ CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.8 64bit_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -599,9 +799,9 @@ Test gcc-4.8 64bit_float:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -609,9 +809,29 @@ Test gcc-4.8 64bit_float_utf8:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.8 64bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.8 64bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -621,7 +841,7 @@ Test gcc-4.8 64bit_float_int16:
LD: gcc-4.8
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -631,7 +851,7 @@ Test gcc-4.8 64bit_float_int16_utf8:
LD: gcc-4.8
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -639,9 +859,9 @@ Test gcc-4.8 64bit_float_int64:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.8 64bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
@@ -649,9 +869,29 @@ Test gcc-4.8 64bit_float_int64_utf8:
CC: gcc-4.8
CXX: g++-4.8
LD: gcc-4.8
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.8 64bit_float_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.8 64bit_float_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc48_0.7
+ variables:
+ CC: gcc-4.8
+ CXX: g++-4.8
+ LD: gcc-4.8
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -659,9 +899,9 @@ Test gcc-4.9 32bit:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 "
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -669,9 +909,9 @@ Test gcc-4.9 32bit_utf8:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-m32 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -681,7 +921,7 @@ Test gcc-4.9 32bit_nan:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -691,7 +931,27 @@ Test gcc-4.9 32bit_nan_utf8:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test gcc-4.9 32bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-4.9 32bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -701,7 +961,7 @@ Test gcc-4.9 32bit_int16:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -711,7 +971,7 @@ Test gcc-4.9 32bit_int16_utf8:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -721,7 +981,7 @@ Test gcc-4.9 32bit_int16_nan:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -731,7 +991,7 @@ Test gcc-4.9 32bit_int16_nan_utf8:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -741,7 +1001,7 @@ Test gcc-4.9 32bit_int64:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -751,7 +1011,7 @@ Test gcc-4.9 32bit_int64_utf8:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -759,9 +1019,9 @@ Test gcc-4.9 32bit_float:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
- CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -769,9 +1029,29 @@ Test gcc-4.9 32bit_float_utf8:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-4.9 32bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-4.9 32bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -781,7 +1061,7 @@ Test gcc-4.9 32bit_float_int16:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -791,7 +1071,7 @@ Test gcc-4.9 32bit_float_int16_utf8:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -801,7 +1081,7 @@ Test gcc-4.9 32bit_float_int64:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 32bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -811,7 +1091,7 @@ Test gcc-4.9 32bit_float_int64_utf8:
LD: gcc-4.9
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -819,9 +1099,9 @@ Test gcc-4.9 64bit:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
- CFLAGS: "-DMRB_WORD_BOXING=1"
+ CFLAGS: ''
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -829,9 +1109,9 @@ Test gcc-4.9 64bit_utf8:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
- CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -841,7 +1121,7 @@ Test gcc-4.9 64bit_nan:
LD: gcc-4.9
CFLAGS: "-DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -851,7 +1131,27 @@ Test gcc-4.9 64bit_nan_utf8:
LD: gcc-4.9
CFLAGS: "-DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test gcc-4.9 64bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
+ CFLAGS: "-DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.9 64bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
+ CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -861,7 +1161,7 @@ Test gcc-4.9 64bit_int16:
LD: gcc-4.9
CFLAGS: "-DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -871,7 +1171,7 @@ Test gcc-4.9 64bit_int16_utf8:
LD: gcc-4.9
CFLAGS: "-DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -881,7 +1181,7 @@ Test gcc-4.9 64bit_int16_nan:
LD: gcc-4.9
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -891,7 +1191,7 @@ Test gcc-4.9 64bit_int16_nan_utf8:
LD: gcc-4.9
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -899,9 +1199,9 @@ Test gcc-4.9 64bit_int64:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
- CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -909,9 +1209,29 @@ Test gcc-4.9 64bit_int64_utf8:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
+ CFLAGS: "-DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.9 64bit_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
+ CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.9 64bit_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -919,9 +1239,9 @@ Test gcc-4.9 64bit_float:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -929,9 +1249,29 @@ Test gcc-4.9 64bit_float_utf8:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.9 64bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.9 64bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -941,7 +1281,7 @@ Test gcc-4.9 64bit_float_int16:
LD: gcc-4.9
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -951,7 +1291,7 @@ Test gcc-4.9 64bit_float_int16_utf8:
LD: gcc-4.9
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -959,9 +1299,9 @@ Test gcc-4.9 64bit_float_int64:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-4.9 64bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
@@ -969,9 +1309,29 @@ Test gcc-4.9 64bit_float_int64_utf8:
CC: gcc-4.9
CXX: g++-4.9
LD: gcc-4.9
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.9 64bit_float_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-4.9 64bit_float_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc49_0.7
+ variables:
+ CC: gcc-4.9
+ CXX: g++-4.9
+ LD: gcc-4.9
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -979,9 +1339,9 @@ Test gcc-5 32bit:
CC: gcc-5
CXX: g++-5
LD: gcc-5
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 "
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -989,9 +1349,9 @@ Test gcc-5 32bit_utf8:
CC: gcc-5
CXX: g++-5
LD: gcc-5
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-m32 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1001,7 +1361,7 @@ Test gcc-5 32bit_nan:
LD: gcc-5
CFLAGS: "-m32 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1011,7 +1371,27 @@ Test gcc-5 32bit_nan_utf8:
LD: gcc-5
CFLAGS: "-m32 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test gcc-5 32bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-5 32bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
Test gcc-5 32bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1021,7 +1401,7 @@ Test gcc-5 32bit_int16:
LD: gcc-5
CFLAGS: "-m32 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1031,7 +1411,7 @@ Test gcc-5 32bit_int16_utf8:
LD: gcc-5
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1041,7 +1421,7 @@ Test gcc-5 32bit_int16_nan:
LD: gcc-5
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1051,7 +1431,7 @@ Test gcc-5 32bit_int16_nan_utf8:
LD: gcc-5
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1061,7 +1441,7 @@ Test gcc-5 32bit_int64:
LD: gcc-5
CFLAGS: "-m32 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1071,7 +1451,7 @@ Test gcc-5 32bit_int64_utf8:
LD: gcc-5
CFLAGS: "-m32 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1079,9 +1459,9 @@ Test gcc-5 32bit_float:
CC: gcc-5
CXX: g++-5
LD: gcc-5
- CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1089,9 +1469,29 @@ Test gcc-5 32bit_float_utf8:
CC: gcc-5
CXX: g++-5
LD: gcc-5
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-5 32bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-5 32bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1101,7 +1501,7 @@ Test gcc-5 32bit_float_int16:
LD: gcc-5
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1111,7 +1511,7 @@ Test gcc-5 32bit_float_int16_utf8:
LD: gcc-5
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1121,7 +1521,7 @@ Test gcc-5 32bit_float_int64:
LD: gcc-5
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 32bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1131,7 +1531,7 @@ Test gcc-5 32bit_float_int64_utf8:
LD: gcc-5
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1139,9 +1539,9 @@ Test gcc-5 64bit:
CC: gcc-5
CXX: g++-5
LD: gcc-5
- CFLAGS: "-DMRB_WORD_BOXING=1"
+ CFLAGS: ''
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1149,9 +1549,9 @@ Test gcc-5 64bit_utf8:
CC: gcc-5
CXX: g++-5
LD: gcc-5
- CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1161,7 +1561,7 @@ Test gcc-5 64bit_nan:
LD: gcc-5
CFLAGS: "-DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1171,7 +1571,27 @@ Test gcc-5 64bit_nan_utf8:
LD: gcc-5
CFLAGS: "-DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test gcc-5 64bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
+ CFLAGS: "-DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-5 64bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
+ CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
Test gcc-5 64bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1181,7 +1601,7 @@ Test gcc-5 64bit_int16:
LD: gcc-5
CFLAGS: "-DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1191,7 +1611,7 @@ Test gcc-5 64bit_int16_utf8:
LD: gcc-5
CFLAGS: "-DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1201,7 +1621,7 @@ Test gcc-5 64bit_int16_nan:
LD: gcc-5
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1211,7 +1631,7 @@ Test gcc-5 64bit_int16_nan_utf8:
LD: gcc-5
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1219,9 +1639,9 @@ Test gcc-5 64bit_int64:
CC: gcc-5
CXX: g++-5
LD: gcc-5
- CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1229,9 +1649,29 @@ Test gcc-5 64bit_int64_utf8:
CC: gcc-5
CXX: g++-5
LD: gcc-5
+ CFLAGS: "-DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-5 64bit_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
+ CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-5 64bit_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1239,9 +1679,9 @@ Test gcc-5 64bit_float:
CC: gcc-5
CXX: g++-5
LD: gcc-5
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1249,9 +1689,29 @@ Test gcc-5 64bit_float_utf8:
CC: gcc-5
CXX: g++-5
LD: gcc-5
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-5 64bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-5 64bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1261,7 +1721,7 @@ Test gcc-5 64bit_float_int16:
LD: gcc-5
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1271,7 +1731,7 @@ Test gcc-5 64bit_float_int16_utf8:
LD: gcc-5
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1279,9 +1739,9 @@ Test gcc-5 64bit_float_int64:
CC: gcc-5
CXX: g++-5
LD: gcc-5
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-5 64bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
@@ -1289,9 +1749,29 @@ Test gcc-5 64bit_float_int64_utf8:
CC: gcc-5
CXX: g++-5
LD: gcc-5
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-5 64bit_float_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-5 64bit_float_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc5_0.7
+ variables:
+ CC: gcc-5
+ CXX: g++-5
+ LD: gcc-5
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1299,9 +1779,9 @@ Test gcc-6 32bit:
CC: gcc-6
CXX: g++-6
LD: gcc-6
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 "
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1309,9 +1789,9 @@ Test gcc-6 32bit_utf8:
CC: gcc-6
CXX: g++-6
LD: gcc-6
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-m32 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1321,7 +1801,7 @@ Test gcc-6 32bit_nan:
LD: gcc-6
CFLAGS: "-m32 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1331,7 +1811,27 @@ Test gcc-6 32bit_nan_utf8:
LD: gcc-6
CFLAGS: "-m32 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test gcc-6 32bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-6 32bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
Test gcc-6 32bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1341,7 +1841,7 @@ Test gcc-6 32bit_int16:
LD: gcc-6
CFLAGS: "-m32 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1351,7 +1851,7 @@ Test gcc-6 32bit_int16_utf8:
LD: gcc-6
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1361,7 +1861,7 @@ Test gcc-6 32bit_int16_nan:
LD: gcc-6
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1371,7 +1871,7 @@ Test gcc-6 32bit_int16_nan_utf8:
LD: gcc-6
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1381,7 +1881,7 @@ Test gcc-6 32bit_int64:
LD: gcc-6
CFLAGS: "-m32 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1391,7 +1891,7 @@ Test gcc-6 32bit_int64_utf8:
LD: gcc-6
CFLAGS: "-m32 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1399,9 +1899,9 @@ Test gcc-6 32bit_float:
CC: gcc-6
CXX: g++-6
LD: gcc-6
- CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1409,9 +1909,29 @@ Test gcc-6 32bit_float_utf8:
CC: gcc-6
CXX: g++-6
LD: gcc-6
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-6 32bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test gcc-6 32bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1421,7 +1941,7 @@ Test gcc-6 32bit_float_int16:
LD: gcc-6
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1431,7 +1951,7 @@ Test gcc-6 32bit_float_int16_utf8:
LD: gcc-6
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1441,7 +1961,7 @@ Test gcc-6 32bit_float_int64:
LD: gcc-6
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 32bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1451,7 +1971,7 @@ Test gcc-6 32bit_float_int64_utf8:
LD: gcc-6
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1459,9 +1979,9 @@ Test gcc-6 64bit:
CC: gcc-6
CXX: g++-6
LD: gcc-6
- CFLAGS: "-DMRB_WORD_BOXING=1"
+ CFLAGS: ''
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1469,9 +1989,9 @@ Test gcc-6 64bit_utf8:
CC: gcc-6
CXX: g++-6
LD: gcc-6
- CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1481,7 +2001,7 @@ Test gcc-6 64bit_nan:
LD: gcc-6
CFLAGS: "-DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1491,7 +2011,27 @@ Test gcc-6 64bit_nan_utf8:
LD: gcc-6
CFLAGS: "-DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test gcc-6 64bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
+ CFLAGS: "-DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-6 64bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
+ CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
Test gcc-6 64bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1501,7 +2041,7 @@ Test gcc-6 64bit_int16:
LD: gcc-6
CFLAGS: "-DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1511,7 +2051,7 @@ Test gcc-6 64bit_int16_utf8:
LD: gcc-6
CFLAGS: "-DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1521,7 +2061,7 @@ Test gcc-6 64bit_int16_nan:
LD: gcc-6
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1531,7 +2071,7 @@ Test gcc-6 64bit_int16_nan_utf8:
LD: gcc-6
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1539,9 +2079,9 @@ Test gcc-6 64bit_int64:
CC: gcc-6
CXX: g++-6
LD: gcc-6
- CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1549,9 +2089,29 @@ Test gcc-6 64bit_int64_utf8:
CC: gcc-6
CXX: g++-6
LD: gcc-6
+ CFLAGS: "-DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-6 64bit_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
+ CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-6 64bit_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1559,9 +2119,9 @@ Test gcc-6 64bit_float:
CC: gcc-6
CXX: g++-6
LD: gcc-6
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1569,9 +2129,29 @@ Test gcc-6 64bit_float_utf8:
CC: gcc-6
CXX: g++-6
LD: gcc-6
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-6 64bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-6 64bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1581,7 +2161,7 @@ Test gcc-6 64bit_float_int16:
LD: gcc-6
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1591,7 +2171,7 @@ Test gcc-6 64bit_float_int16_utf8:
LD: gcc-6
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1599,9 +2179,9 @@ Test gcc-6 64bit_float_int64:
CC: gcc-6
CXX: g++-6
LD: gcc-6
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test gcc-6 64bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
@@ -1609,9 +2189,29 @@ Test gcc-6 64bit_float_int64_utf8:
CC: gcc-6
CXX: g++-6
LD: gcc-6
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-6 64bit_float_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test gcc-6 64bit_float_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:gcc6_0.7
+ variables:
+ CC: gcc-6
+ CXX: g++-6
+ LD: gcc-6
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1619,9 +2219,9 @@ Test clang-3.5 32bit:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 "
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1629,9 +2229,9 @@ Test clang-3.5 32bit_utf8:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-m32 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1641,7 +2241,7 @@ Test clang-3.5 32bit_nan:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1651,7 +2251,27 @@ Test clang-3.5 32bit_nan_utf8:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test clang-3.5 32bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.5 32bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
Test clang-3.5 32bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1661,7 +2281,7 @@ Test clang-3.5 32bit_int16:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1671,7 +2291,7 @@ Test clang-3.5 32bit_int16_utf8:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1681,7 +2301,7 @@ Test clang-3.5 32bit_int16_nan:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1691,7 +2311,7 @@ Test clang-3.5 32bit_int16_nan_utf8:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1701,7 +2321,7 @@ Test clang-3.5 32bit_int64:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1711,7 +2331,7 @@ Test clang-3.5 32bit_int64_utf8:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1719,9 +2339,9 @@ Test clang-3.5 32bit_float:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
- CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1729,9 +2349,29 @@ Test clang-3.5 32bit_float_utf8:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.5 32bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.5 32bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1741,7 +2381,7 @@ Test clang-3.5 32bit_float_int16:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1751,7 +2391,7 @@ Test clang-3.5 32bit_float_int16_utf8:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1761,7 +2401,7 @@ Test clang-3.5 32bit_float_int64:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 32bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1771,7 +2411,7 @@ Test clang-3.5 32bit_float_int64_utf8:
LD: clang-3.5
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1779,9 +2419,9 @@ Test clang-3.5 64bit:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
- CFLAGS: "-DMRB_WORD_BOXING=1"
+ CFLAGS: ''
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1789,9 +2429,9 @@ Test clang-3.5 64bit_utf8:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
- CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1801,7 +2441,7 @@ Test clang-3.5 64bit_nan:
LD: clang-3.5
CFLAGS: "-DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1811,7 +2451,27 @@ Test clang-3.5 64bit_nan_utf8:
LD: clang-3.5
CFLAGS: "-DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test clang-3.5 64bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
+ CFLAGS: "-DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.5 64bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
+ CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
Test clang-3.5 64bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1821,7 +2481,7 @@ Test clang-3.5 64bit_int16:
LD: clang-3.5
CFLAGS: "-DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1831,7 +2491,7 @@ Test clang-3.5 64bit_int16_utf8:
LD: clang-3.5
CFLAGS: "-DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1841,7 +2501,7 @@ Test clang-3.5 64bit_int16_nan:
LD: clang-3.5
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1851,7 +2511,7 @@ Test clang-3.5 64bit_int16_nan_utf8:
LD: clang-3.5
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1859,9 +2519,9 @@ Test clang-3.5 64bit_int64:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
- CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1869,9 +2529,29 @@ Test clang-3.5 64bit_int64_utf8:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
+ CFLAGS: "-DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.5 64bit_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
+ CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.5 64bit_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1879,9 +2559,9 @@ Test clang-3.5 64bit_float:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1889,9 +2569,29 @@ Test clang-3.5 64bit_float_utf8:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.5 64bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.5 64bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1901,7 +2601,7 @@ Test clang-3.5 64bit_float_int16:
LD: clang-3.5
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1911,7 +2611,7 @@ Test clang-3.5 64bit_float_int16_utf8:
LD: clang-3.5
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1919,9 +2619,9 @@ Test clang-3.5 64bit_float_int64:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.5 64bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang35_0.7
@@ -1929,9 +2629,29 @@ Test clang-3.5 64bit_float_int64_utf8:
CC: clang-3.5
CXX: clang++-3.5
LD: clang-3.5
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.5 64bit_float_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.5 64bit_float_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang35_0.7
+ variables:
+ CC: clang-3.5
+ CXX: clang++-3.5
+ LD: clang-3.5
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -1939,9 +2659,9 @@ Test clang-3.6 32bit:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 "
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -1949,9 +2669,9 @@ Test clang-3.6 32bit_utf8:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-m32 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -1961,7 +2681,7 @@ Test clang-3.6 32bit_nan:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -1971,7 +2691,27 @@ Test clang-3.6 32bit_nan_utf8:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test clang-3.6 32bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.6 32bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
Test clang-3.6 32bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -1981,7 +2721,7 @@ Test clang-3.6 32bit_int16:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -1991,7 +2731,7 @@ Test clang-3.6 32bit_int16_utf8:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2001,7 +2741,7 @@ Test clang-3.6 32bit_int16_nan:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2011,7 +2751,7 @@ Test clang-3.6 32bit_int16_nan_utf8:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2021,7 +2761,7 @@ Test clang-3.6 32bit_int64:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2031,7 +2771,7 @@ Test clang-3.6 32bit_int64_utf8:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2039,9 +2779,9 @@ Test clang-3.6 32bit_float:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
- CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2049,9 +2789,29 @@ Test clang-3.6 32bit_float_utf8:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.6 32bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.6 32bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2061,7 +2821,7 @@ Test clang-3.6 32bit_float_int16:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2071,7 +2831,7 @@ Test clang-3.6 32bit_float_int16_utf8:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2081,7 +2841,7 @@ Test clang-3.6 32bit_float_int64:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 32bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2091,7 +2851,7 @@ Test clang-3.6 32bit_float_int64_utf8:
LD: clang-3.6
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2099,9 +2859,9 @@ Test clang-3.6 64bit:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
- CFLAGS: "-DMRB_WORD_BOXING=1"
+ CFLAGS: ''
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2109,9 +2869,9 @@ Test clang-3.6 64bit_utf8:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
- CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2121,7 +2881,7 @@ Test clang-3.6 64bit_nan:
LD: clang-3.6
CFLAGS: "-DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2131,7 +2891,27 @@ Test clang-3.6 64bit_nan_utf8:
LD: clang-3.6
CFLAGS: "-DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test clang-3.6 64bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
+ CFLAGS: "-DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.6 64bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
+ CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
Test clang-3.6 64bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2141,7 +2921,7 @@ Test clang-3.6 64bit_int16:
LD: clang-3.6
CFLAGS: "-DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2151,7 +2931,7 @@ Test clang-3.6 64bit_int16_utf8:
LD: clang-3.6
CFLAGS: "-DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2161,7 +2941,7 @@ Test clang-3.6 64bit_int16_nan:
LD: clang-3.6
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2171,7 +2951,7 @@ Test clang-3.6 64bit_int16_nan_utf8:
LD: clang-3.6
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2179,9 +2959,9 @@ Test clang-3.6 64bit_int64:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
- CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2189,9 +2969,29 @@ Test clang-3.6 64bit_int64_utf8:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
+ CFLAGS: "-DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.6 64bit_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
+ CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.6 64bit_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2199,9 +2999,9 @@ Test clang-3.6 64bit_float:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2209,9 +3009,29 @@ Test clang-3.6 64bit_float_utf8:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.6 64bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.6 64bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2221,7 +3041,7 @@ Test clang-3.6 64bit_float_int16:
LD: clang-3.6
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2231,7 +3051,7 @@ Test clang-3.6 64bit_float_int16_utf8:
LD: clang-3.6
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2239,9 +3059,9 @@ Test clang-3.6 64bit_float_int64:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.6 64bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang36_0.7
@@ -2249,9 +3069,29 @@ Test clang-3.6 64bit_float_int64_utf8:
CC: clang-3.6
CXX: clang++-3.6
LD: clang-3.6
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.6 64bit_float_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.6 64bit_float_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang36_0.7
+ variables:
+ CC: clang-3.6
+ CXX: clang++-3.6
+ LD: clang-3.6
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2259,9 +3099,9 @@ Test clang-3.7 32bit:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 "
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2269,9 +3109,9 @@ Test clang-3.7 32bit_utf8:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-m32 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2281,7 +3121,7 @@ Test clang-3.7 32bit_nan:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2291,7 +3131,27 @@ Test clang-3.7 32bit_nan_utf8:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test clang-3.7 32bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.7 32bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
Test clang-3.7 32bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2301,7 +3161,7 @@ Test clang-3.7 32bit_int16:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2311,7 +3171,7 @@ Test clang-3.7 32bit_int16_utf8:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2321,7 +3181,7 @@ Test clang-3.7 32bit_int16_nan:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2331,7 +3191,7 @@ Test clang-3.7 32bit_int16_nan_utf8:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2341,7 +3201,7 @@ Test clang-3.7 32bit_int64:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2351,7 +3211,7 @@ Test clang-3.7 32bit_int64_utf8:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2359,9 +3219,9 @@ Test clang-3.7 32bit_float:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
- CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2369,9 +3229,29 @@ Test clang-3.7 32bit_float_utf8:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.7 32bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.7 32bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2381,7 +3261,7 @@ Test clang-3.7 32bit_float_int16:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2391,7 +3271,7 @@ Test clang-3.7 32bit_float_int16_utf8:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2401,7 +3281,7 @@ Test clang-3.7 32bit_float_int64:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 32bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2411,7 +3291,7 @@ Test clang-3.7 32bit_float_int64_utf8:
LD: clang-3.7
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2419,9 +3299,9 @@ Test clang-3.7 64bit:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
- CFLAGS: "-DMRB_WORD_BOXING=1"
+ CFLAGS: ''
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2429,9 +3309,9 @@ Test clang-3.7 64bit_utf8:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
- CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2441,7 +3321,7 @@ Test clang-3.7 64bit_nan:
LD: clang-3.7
CFLAGS: "-DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2451,7 +3331,27 @@ Test clang-3.7 64bit_nan_utf8:
LD: clang-3.7
CFLAGS: "-DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test clang-3.7 64bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
+ CFLAGS: "-DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.7 64bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
+ CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
Test clang-3.7 64bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2461,7 +3361,7 @@ Test clang-3.7 64bit_int16:
LD: clang-3.7
CFLAGS: "-DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2471,7 +3371,7 @@ Test clang-3.7 64bit_int16_utf8:
LD: clang-3.7
CFLAGS: "-DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2481,7 +3381,7 @@ Test clang-3.7 64bit_int16_nan:
LD: clang-3.7
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2491,7 +3391,7 @@ Test clang-3.7 64bit_int16_nan_utf8:
LD: clang-3.7
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2499,9 +3399,9 @@ Test clang-3.7 64bit_int64:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
- CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2509,9 +3409,29 @@ Test clang-3.7 64bit_int64_utf8:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
+ CFLAGS: "-DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.7 64bit_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
+ CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.7 64bit_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2519,9 +3439,9 @@ Test clang-3.7 64bit_float:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2529,9 +3449,29 @@ Test clang-3.7 64bit_float_utf8:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.7 64bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.7 64bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2541,7 +3481,7 @@ Test clang-3.7 64bit_float_int16:
LD: clang-3.7
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2551,7 +3491,7 @@ Test clang-3.7 64bit_float_int16_utf8:
LD: clang-3.7
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2559,9 +3499,9 @@ Test clang-3.7 64bit_float_int64:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.7 64bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang37_0.7
@@ -2569,9 +3509,29 @@ Test clang-3.7 64bit_float_int64_utf8:
CC: clang-3.7
CXX: clang++-3.7
LD: clang-3.7
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.7 64bit_float_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.7 64bit_float_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang37_0.7
+ variables:
+ CC: clang-3.7
+ CXX: clang++-3.7
+ LD: clang-3.7
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2579,9 +3539,9 @@ Test clang-3.8 32bit:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 "
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2589,9 +3549,9 @@ Test clang-3.8 32bit_utf8:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-m32 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2601,7 +3561,7 @@ Test clang-3.8 32bit_nan:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2611,7 +3571,27 @@ Test clang-3.8 32bit_nan_utf8:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test clang-3.8 32bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.8 32bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
Test clang-3.8 32bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2621,7 +3601,7 @@ Test clang-3.8 32bit_int16:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2631,7 +3611,7 @@ Test clang-3.8 32bit_int16_utf8:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2641,7 +3621,7 @@ Test clang-3.8 32bit_int16_nan:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2651,7 +3631,7 @@ Test clang-3.8 32bit_int16_nan_utf8:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2661,7 +3641,7 @@ Test clang-3.8 32bit_int64:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2671,7 +3651,7 @@ Test clang-3.8 32bit_int64_utf8:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2679,9 +3659,9 @@ Test clang-3.8 32bit_float:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
- CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2689,9 +3669,29 @@ Test clang-3.8 32bit_float_utf8:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.8 32bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.8 32bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2701,7 +3701,7 @@ Test clang-3.8 32bit_float_int16:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2711,7 +3711,7 @@ Test clang-3.8 32bit_float_int16_utf8:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2721,7 +3721,7 @@ Test clang-3.8 32bit_float_int64:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 32bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2731,7 +3731,7 @@ Test clang-3.8 32bit_float_int64_utf8:
LD: clang-3.8
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2739,9 +3739,9 @@ Test clang-3.8 64bit:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
- CFLAGS: "-DMRB_WORD_BOXING=1"
+ CFLAGS: ''
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2749,9 +3749,9 @@ Test clang-3.8 64bit_utf8:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
- CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2761,7 +3761,7 @@ Test clang-3.8 64bit_nan:
LD: clang-3.8
CFLAGS: "-DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2771,7 +3771,27 @@ Test clang-3.8 64bit_nan_utf8:
LD: clang-3.8
CFLAGS: "-DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test clang-3.8 64bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
+ CFLAGS: "-DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.8 64bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
+ CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
Test clang-3.8 64bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2781,7 +3801,7 @@ Test clang-3.8 64bit_int16:
LD: clang-3.8
CFLAGS: "-DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2791,7 +3811,7 @@ Test clang-3.8 64bit_int16_utf8:
LD: clang-3.8
CFLAGS: "-DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2801,7 +3821,7 @@ Test clang-3.8 64bit_int16_nan:
LD: clang-3.8
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2811,7 +3831,7 @@ Test clang-3.8 64bit_int16_nan_utf8:
LD: clang-3.8
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2819,9 +3839,9 @@ Test clang-3.8 64bit_int64:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
- CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2829,9 +3849,29 @@ Test clang-3.8 64bit_int64_utf8:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
+ CFLAGS: "-DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.8 64bit_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
+ CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.8 64bit_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2839,9 +3879,9 @@ Test clang-3.8 64bit_float:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2849,9 +3889,29 @@ Test clang-3.8 64bit_float_utf8:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.8 64bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.8 64bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2861,7 +3921,7 @@ Test clang-3.8 64bit_float_int16:
LD: clang-3.8
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2871,7 +3931,7 @@ Test clang-3.8 64bit_float_int16_utf8:
LD: clang-3.8
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2879,9 +3939,9 @@ Test clang-3.8 64bit_float_int64:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.8 64bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang38_0.7
@@ -2889,9 +3949,29 @@ Test clang-3.8 64bit_float_int64_utf8:
CC: clang-3.8
CXX: clang++-3.8
LD: clang-3.8
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.8 64bit_float_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.8 64bit_float_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang38_0.7
+ variables:
+ CC: clang-3.8
+ CXX: clang++-3.8
+ LD: clang-3.8
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2899,9 +3979,9 @@ Test clang-3.9 32bit:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 "
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2909,9 +3989,9 @@ Test clang-3.9 32bit_utf8:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
- CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-m32 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2921,7 +4001,7 @@ Test clang-3.9 32bit_nan:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2931,7 +4011,27 @@ Test clang-3.9 32bit_nan_utf8:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test clang-3.9 32bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.9 32bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
+ CFLAGS: "-m32 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
Test clang-3.9 32bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2941,7 +4041,7 @@ Test clang-3.9 32bit_int16:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2951,7 +4051,7 @@ Test clang-3.9 32bit_int16_utf8:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2961,7 +4061,7 @@ Test clang-3.9 32bit_int16_nan:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2971,7 +4071,7 @@ Test clang-3.9 32bit_int16_nan_utf8:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2981,7 +4081,7 @@ Test clang-3.9 32bit_int64:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2991,7 +4091,7 @@ Test clang-3.9 32bit_int64_utf8:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -2999,9 +4099,9 @@ Test clang-3.9 32bit_float:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
- CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3009,9 +4109,29 @@ Test clang-3.9 32bit_float_utf8:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.9 32bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
+ CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: "-m32"
+ script: env; rake --verbose all test
+Test clang-3.9 32bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3021,7 +4141,7 @@ Test clang-3.9 32bit_float_int16:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3031,7 +4151,7 @@ Test clang-3.9 32bit_float_int16_utf8:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3041,7 +4161,7 @@ Test clang-3.9 32bit_float_int64:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 32bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3051,7 +4171,7 @@ Test clang-3.9 32bit_float_int64_utf8:
LD: clang-3.9
CFLAGS: "-m32 -DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
LDFLAGS: "-m32"
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3059,9 +4179,9 @@ Test clang-3.9 64bit:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
- CFLAGS: "-DMRB_WORD_BOXING=1"
+ CFLAGS: ''
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3069,9 +4189,9 @@ Test clang-3.9 64bit_utf8:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
- CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ CFLAGS: "-DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3081,7 +4201,7 @@ Test clang-3.9 64bit_nan:
LD: clang-3.9
CFLAGS: "-DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3091,7 +4211,27 @@ Test clang-3.9 64bit_nan_utf8:
LD: clang-3.9
CFLAGS: "-DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
+Test clang-3.9 64bit_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
+ CFLAGS: "-DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.9 64bit_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
+ CFLAGS: "-DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
Test clang-3.9 64bit_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3101,7 +4241,7 @@ Test clang-3.9 64bit_int16:
LD: clang-3.9
CFLAGS: "-DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3111,7 +4251,7 @@ Test clang-3.9 64bit_int16_utf8:
LD: clang-3.9
CFLAGS: "-DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_int16_nan:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3121,7 +4261,7 @@ Test clang-3.9 64bit_int16_nan:
LD: clang-3.9
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_int16_nan_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3131,7 +4271,7 @@ Test clang-3.9 64bit_int16_nan_utf8:
LD: clang-3.9
CFLAGS: "-DMRB_INT16=1 -DMRB_NAN_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3139,9 +4279,9 @@ Test clang-3.9 64bit_int64:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
- CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3149,9 +4289,29 @@ Test clang-3.9 64bit_int64_utf8:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
+ CFLAGS: "-DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.9 64bit_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
+ CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.9 64bit_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
CFLAGS: "-DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_float:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3159,9 +4319,9 @@ Test clang-3.9 64bit_float:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_float_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3169,9 +4329,29 @@ Test clang-3.9 64bit_float_utf8:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.9 64bit_float_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.9 64bit_float_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_float_int16:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3181,7 +4361,7 @@ Test clang-3.9 64bit_float_int16:
LD: clang-3.9
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_float_int16_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3191,7 +4371,7 @@ Test clang-3.9 64bit_float_int16_utf8:
LD: clang-3.9
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT16=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_float_int64:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3199,9 +4379,9 @@ Test clang-3.9 64bit_float_int64:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
- CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
Test clang-3.9 64bit_float_int64_utf8:
stage: test
image: registry.gitlab.com/dabroz/mruby:clang39_0.7
@@ -3209,6 +4389,26 @@ Test clang-3.9 64bit_float_int64_utf8:
CC: clang-3.9
CXX: clang++-3.9
LD: clang-3.9
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_UTF8_STRING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.9 64bit_float_int64_word:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
+ CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1"
+ LDFLAGS: ''
+ script: env; rake --verbose all test
+Test clang-3.9 64bit_float_int64_word_utf8:
+ stage: test
+ image: registry.gitlab.com/dabroz/mruby:clang39_0.7
+ variables:
+ CC: clang-3.9
+ CXX: clang++-3.9
+ LD: clang-3.9
CFLAGS: "-DMRB_USE_FLOAT=1 -DMRB_INT64=1 -DMRB_WORD_BOXING=1 -DMRB_UTF8_STRING=1"
LDFLAGS: ''
- script: env; ./minirake --verbose all test
+ script: env; rake --verbose all test
diff --git a/.travis.yml b/.travis.yml
index 9ef7009a6..f04132d07 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,19 +1,11 @@
language: c
-sudo: false
-
-matrix:
- include:
- - os: linux
- sudo: false
- - os: osx
- osx_image: xcode7.1
-
-addons:
- apt:
- packages:
- - gperf
+jobs:
+ - os: linux
+ - os: osx
env:
- MRUBY_CONFIG=travis_config.rb
-script: "./minirake -j4 all test"
+
+script:
+ - rake -m && rake test
diff --git a/AUTHORS b/AUTHORS
index 2353ff683..366149fb0 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -42,3 +42,4 @@ of this list.
Masahiro Wakame
YAMAMOTO Masaya
KOBAYASHI Shuji
+ RIZAL Reckordp
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3a7428a88..0b632f51c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -9,7 +9,7 @@ things in mind before submitting your pull request:
* Work on the latest possible state of **mruby/master**
* Create a branch which is dedicated to your change
-* Test your changes before creating a pull request (```./minirake test```)
+* Test your changes before creating a pull request (```rake test```)
* If possible write a test case which confirms your change
* Don't mix several features or bug-fixes in one pull request
* Create a meaningful commit message
diff --git a/Doxyfile b/Doxyfile
index 8724fe1ac..8e465afad 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -6,7 +6,7 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "mruby"
-PROJECT_NUMBER = 2.0.1
+PROJECT_NUMBER = 2.1.0
PROJECT_BRIEF = "mruby is the lightweight implementation of the Ruby language"
diff --git a/Makefile b/Makefile
index 4912f17e1..7f1a744e5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,6 @@
# mruby is using Rake (http://rake.rubyforge.org) as a build tool.
-# We provide a minimalistic version called minirake inside of our
-# codebase.
-RAKE = ruby ./minirake
+RAKE = rake
all :
$(RAKE)
diff --git a/README.md b/README.md
index ec3492530..a7139fc21 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ of the Ministry of Economy, Trade and Industry of Japan.
## How to get mruby
-The stable version 2.0.1 of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/archive/2.0.1.zip](https://github.com/mruby/mruby/archive/2.0.1.zip)
+The stable version 2.1.0 of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/archive/2.1.0.zip](https://github.com/mruby/mruby/archive/2.1.0.zip)
The latest development version of mruby can be downloaded via the following URL: [https://github.com/mruby/mruby/zipball/master](https://github.com/mruby/mruby/zipball/master)
@@ -30,11 +30,11 @@ You can also install and compile mruby using [ruby-install](https://github.com/p
## mruby home-page
-The URL of the mruby home-page is: [http://www.mruby.org](http://www.mruby.org).
+The URL of the mruby home-page is: https://mruby.org.
## Mailing list
-We don't have a mailing list, but you can use [GitHub issues](https://github.com/mruby/mruby).
+We don't have a mailing list, but you can use [GitHub issues](https://github.com/mruby/mruby/issues).
## How to compile and install (mruby and gems)
@@ -44,11 +44,11 @@ See the [compile.md](https://github.com/mruby/mruby/blob/master/doc/guides/compi
To run the tests, execute the following from the project's root directory.
- $ make test
+ $ rake test
-Or
-
- $ ruby ./minirake test
+Note: `bison` bundled with MacOS is too old to compile `mruby`.
+Try `brew install bison` and follow the instuction shown to update
+the `$PATH` to compile `mruby`.
## Building documentation
diff --git a/Rakefile b/Rakefile
index 28e2d75c8..4115d9e8e 100644
--- a/Rakefile
+++ b/Rakefile
@@ -5,6 +5,8 @@ MRUBY_ROOT = File.dirname(File.expand_path(__FILE__))
MRUBY_BUILD_HOST_IS_CYGWIN = RUBY_PLATFORM.include?('cygwin')
MRUBY_BUILD_HOST_IS_OPENBSD = RUBY_PLATFORM.include?('openbsd')
+Rake.verbose(false) if Rake.verbose == Rake::DSL::DEFAULT
+
$LOAD_PATH << File.join(MRUBY_ROOT, "lib")
# load build systems
@@ -33,10 +35,9 @@ load "#{MRUBY_ROOT}/tasks/gitlab.rake"
load "#{MRUBY_ROOT}/tasks/doc.rake"
def install_D(src, dst)
- opts = { :verbose => $verbose }
- FileUtils.rm_f dst, opts
- FileUtils.mkdir_p File.dirname(dst), opts
- FileUtils.cp src, dst, opts
+ rm_f dst
+ mkdir_p File.dirname(dst)
+ cp src, dst
end
##############################
@@ -62,7 +63,7 @@ MRuby.each_target do |target|
relative_from_root = gem.dir.relative_path_from(MRUBY_ROOT)
current_build_dir = File.expand_path "#{build_dir}/#{relative_from_root}"
- if current_build_dir !~ /^#{build_dir}/
+ if current_build_dir !~ /^#{Regexp.escape(build_dir)}/
current_build_dir = "#{build_dir}/mrbgems/#{gem.name}"
end
@@ -144,16 +145,16 @@ end
desc "clean all built and in-repo installed artifacts"
task :clean do
MRuby.each_target do |t|
- FileUtils.rm_rf t.build_dir, { :verbose => $verbose }
+ rm_rf t.build_dir
end
- FileUtils.rm_f depfiles, { :verbose => $verbose }
+ rm_f depfiles
puts "Cleaned up target build folder"
end
desc "clean everything!"
task :deep_clean => ["clean", "clean_doc"] do
MRuby.each_target do |t|
- FileUtils.rm_rf t.gem_clone_dir, { :verbose => $verbose }
+ rm_rf t.gem_clone_dir
end
puts "Cleaned up mrbgems build folder"
end
diff --git a/appveyor.yml b/appveyor.yml
index a91834cef..e135383e1 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -4,20 +4,23 @@ os: Visual Studio 2017
shallow_clone: true
-
-cache:
- - win_flex_bison
-
-
environment:
matrix:
# Visual Studio 2017 64bit
- visualcpp: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
+ # Visual Studio 2017 32bit
+ - visualcpp: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat
+ machine: x86
+
# Visual Studio 2015 64bit
- visualcpp: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
machine: amd64
+ # Visual Studio 2015 32bit
+ - visualcpp: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
+ machine: x86
+
# Visual Studio 2013 64bit
- visualcpp: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
machine: amd64
@@ -30,13 +33,7 @@ init:
- ruby --version
-install:
- - if not exist win_flex_bison (
- appveyor DownloadFile "https://github.com/lexxmark/winflexbison/releases/download/v.2.5.10/win_flex_bison-2.5.10.zip" &
- 7z x -y -owin_flex_bison win_flex_bison-2.5.10.zip
- )
-
build_script:
- - set YACC=.\win_flex_bison\win_bison.exe
- set MRUBY_CONFIG=appveyor_config.rb
+ - rake -m
- rake -E $stdout.sync=true test
diff --git a/appveyor_config.rb b/appveyor_config.rb
index b50a9e4ef..25745daa8 100644
--- a/appveyor_config.rb
+++ b/appveyor_config.rb
@@ -1,14 +1,7 @@
-MRuby::Build.new('debug') do |conf|
- toolchain :visualcpp
- enable_debug
-
- # include all core GEMs
- conf.gembox 'full-core'
- conf.compilers.each do |c|
- c.defines += %w(MRB_GC_STRESS MRB_GC_FIXED_ARENA MRB_METHOD_CACHE)
- end
-
- build_mrbc_exec
+def setup_option(conf)
+ conf.cc.flags[0].delete("/Zi") unless ENV['CFLAGS']
+ conf.cxx.flags[0].delete("/Zi") unless ENV['CFLAGS'] || ENV['CXXFLAGS']
+ conf.linker.flags << "/DEBUG:NONE" unless ENV['LDFLAGS']
end
MRuby::Build.new('full-debug') do |conf|
@@ -17,7 +10,8 @@ MRuby::Build.new('full-debug') do |conf|
# include all core GEMs
conf.gembox 'full-core'
- conf.cc.defines += %w(MRB_ENABLE_DEBUG_HOOK)
+ conf.cc.defines += %w(MRB_GC_STRESS MRB_METHOD_CACHE MRB_ENABLE_DEBUG_HOOK)
+ setup_option(conf)
conf.enable_test
end
@@ -30,6 +24,7 @@ MRuby::Build.new do |conf|
conf.compilers.each do |c|
c.defines += %w(MRB_GC_FIXED_ARENA)
end
+ setup_option(conf)
conf.enable_bintest
conf.enable_test
end
@@ -41,6 +36,7 @@ MRuby::Build.new('cxx_abi') do |conf|
conf.compilers.each do |c|
c.defines += %w(MRB_GC_FIXED_ARENA)
end
+ setup_option(conf)
conf.enable_bintest
conf.enable_test
diff --git a/build_config.rb b/build_config.rb
index c0c079c89..254a28ce0 100644
--- a/build_config.rb
+++ b/build_config.rb
@@ -30,9 +30,9 @@ MRuby::Build.new do |conf|
# cc.flags = [ENV['CFLAGS'] || %w()]
# cc.include_paths = ["#{root}/include"]
# cc.defines = %w()
- # cc.option_include_path = '-I%s'
+ # cc.option_include_path = %q[-I"%s"]
# cc.option_define = '-D%s'
- # cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
+ # cc.compile_options = %Q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
# end
# mrbc settings
@@ -50,25 +50,25 @@ MRuby::Build.new do |conf|
# linker.library_paths = []
# linker.option_library = '-l%s'
# linker.option_library_path = '-L%s'
- # linker.link_options = "%{flags} -o %{outfile} %{objs} %{libs}"
+ # linker.link_options = "%{flags} -o "%{outfile}" %{objs} %{libs}"
# end
# Archiver settings
# conf.archiver do |archiver|
# archiver.command = ENV['AR'] || 'ar'
- # archiver.archive_options = 'rs %{outfile} %{objs}'
+ # archiver.archive_options = 'rs "%{outfile}" %{objs}'
# end
# Parser generator settings
# conf.yacc do |yacc|
# yacc.command = ENV['YACC'] || 'bison'
- # yacc.compile_options = '-o %{outfile} %{infile}'
+ # yacc.compile_options = %q[-o "%{outfile}" "%{infile}"]
# end
# gperf settings
# conf.gperf do |gperf|
# gperf.command = 'gperf'
- # gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
+ # gperf.compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"]
# end
# file extensions
diff --git a/doc/guides/compile.md b/doc/guides/compile.md
index 6a093310a..d7937bb2e 100644
--- a/doc/guides/compile.md
+++ b/doc/guides/compile.md
@@ -6,12 +6,16 @@ binaries.
## Prerequisites
To compile mruby out of the source code you need the following tools:
-* C Compiler (e.g. `gcc`)
-* Linker (e.g. `gcc`)
+* C Compiler (e.g. `gcc` or `clang`)
+* Linker (e.g. `gcc` or `clang`)
* Archive utility (e.g. `ar`)
* Parser generator (e.g. `bison`)
* Ruby 2.0 or later (e.g. `ruby` or `jruby`)
+Note that `bison` bundled with MacOS is too old to compile `mruby`.
+Try `brew install bison` and follow the instuction shown to update
+the `$PATH` to compile `mruby`.
+
Optional:
* GIT (to update mruby source and integrate mrbgems easier)
* C++ compiler (to use GEMs which include \*.cpp, \*.cxx, \*.cc)
@@ -32,10 +36,10 @@ All tools necessary to compile mruby can be set or modified here. In case
you want to maintain an additional *build_config.rb* you can define a
customized path using the *$MRUBY_CONFIG* environment variable.
-To compile just call `./minirake` inside of the mruby source root. To
-generate and execute the test tools call `./minirake test`. To clean
-all build files call `./minirake clean`. To see full command line on
-build, call `./minirake -v`.
+To compile just call `rake` inside of the mruby source root. To
+generate and execute the test tools call `rake test`. To clean
+all build files call `rake clean`. To see full command line on
+build, call `rake -v`.
## Build Configuration
diff --git a/doc/guides/debugger.md b/doc/guides/debugger.md
index 81c0e9d63..a94ef1802 100644
--- a/doc/guides/debugger.md
+++ b/doc/guides/debugger.md
@@ -38,7 +38,7 @@ To confirm mrdb was installed properly, run mrdb with the `--version` option:
```bash
$ mrdb --version
-mruby 2.0.1 (2019-4-4)
+mruby 2.1.0 (2019-11-19)
```
## 2.2 Basic Operation
diff --git a/doc/guides/mrbconf.md b/doc/guides/mrbconf.md
index 2f81776df..1e1a5afcf 100644
--- a/doc/guides/mrbconf.md
+++ b/doc/guides/mrbconf.md
@@ -54,17 +54,13 @@ You can use mrbconfs with following ways:
* When defined removes floating point numbers from mruby.
* It makes mruby easier to handle in "Microcontroller without FPU" and "Kernel Space".
-`MRB_INT16`
-* When defined `int16_t` will be defined as `mrb_int`.
-* Conflicts with `MRB_INT32` and `MRB_INT64`.
-
`MRB_INT32`
-* When defined, or both `MRB_INT16` and `MRB_INT64` are not defined on 32-bit CPU mode, `int32_t` will be defined as `mrb_int`.
-* Conflicts with `MRB_INT16` and `MRB_INT64`.
+* When defined, or `MRB_INT64` are not defined on 32-bit CPU mode, `mrb_int` will be defined as `int32_t`.
+* Conflicts with `MRB_INT64`.
`MRB_INT64`
-* When defined, or both `MRB_INT16` and `MRB_INT32` are not defined on 64-bit CPU mode, `int64_t` will be defined as `mrb_int`.
-* Conflicts with `MRB_INT16` and `MRB_INT32`.
+* When defined, or `MRB_INT32` are not defined on 64-bit CPU mode, `mrb_int` will be defined as `int64_t`.
+* Conflicts with `MRB_INT32`.
## Garbage collector configuration.
diff --git a/doc/guides/mrbgems.md b/doc/guides/mrbgems.md
index 184f62954..ffbf17f26 100644
--- a/doc/guides/mrbgems.md
+++ b/doc/guides/mrbgems.md
@@ -45,8 +45,8 @@ conf.gem mgem: 'mruby-redis', checksum_hash: '3446d19fc4a3f9697b5ddbf2a904f301c4
If there is missing dependencies, mrbgem dependencies solver will reference
mrbgem from core or mgem-list.
-To pull all gems from remote GIT repository on build, call ```./minirake -p```,
-or ```./minirake --pull-gems```.
+To pull all gems from remote GIT repository on build, call ```rake -p```,
+or ```rake --pull-gems```.
NOTE: `:bitbucket` option supports only git. Hg is unsupported in this version.
@@ -235,7 +235,7 @@ So it is recommended not to put GEM's local header files on include/.
These exports are retroactive.
For example: when B depends to C and A depends to B, A will get include paths exported by C.
-Exported include_paths are automatically appended to GEM local include_paths by Minirake.
+Exported include_paths are automatically appended to GEM local include_paths by rake.
You can use `spec.export_include_paths` accessor if you want more complex build.
diff --git a/doc/limitations.md b/doc/limitations.md
index 6958d396f..9ad2019f7 100644
--- a/doc/limitations.md
+++ b/doc/limitations.md
@@ -38,7 +38,7 @@ puts [1,2,3]
3
```
-#### mruby [2.0.1 (2019-4-4)]
+#### mruby [2.1.0 (2019-11-19)]
```
[1, 2, 3]
@@ -61,7 +61,7 @@ end
`ZeroDivisionError` is raised.
-#### mruby [2.0.1 (2019-4-4)]
+#### mruby [2.1.0 (2019-11-19)]
No exception is raised.
@@ -89,7 +89,7 @@ p Liste.new "foobar"
` [] `
-#### mruby [2.0.1 (2019-4-4)]
+#### mruby [2.1.0 (2019-11-19)]
`ArgumentError` is raised.
@@ -119,7 +119,7 @@ false
true
```
-#### mruby [2.0.1 (2019-4-4)]
+#### mruby [2.1.0 (2019-11-19)]
```
true
@@ -156,7 +156,7 @@ p 'ok'
ok
```
-#### mruby [2.0.1 (2019-4-4)]
+#### mruby [2.1.0 (2019-11-19)]
```
test.rb:8: undefined method 'test_func' (NoMethodError)
@@ -178,7 +178,7 @@ defined?(Foo)
nil
```
-#### mruby [2.0.1 (2019-4-4)]
+#### mruby [2.1.0 (2019-11-19)]
`NameError` is raised.
@@ -195,7 +195,7 @@ alias $a $__a__
` nil `
-#### mruby [2.0.1 (2019-4-4)]
+#### mruby [2.1.0 (2019-11-19)]
Syntax error
@@ -217,7 +217,7 @@ end
`ArgumentError` is raised.
The re-defined `+` operator does not accept any arguments.
-#### mruby [2.0.1 (2019-4-4)]
+#### mruby [2.1.0 (2019-11-19)]
` 'ab' `
Behavior of the operator wasn't changed.
@@ -233,7 +233,7 @@ $ ruby -e 'puts Proc.new {}.binding'
#<Binding:0x00000e9deabb9950>
```
-#### mruby [2.0.1 (2019-4-4)]
+#### mruby [2.1.0 (2019-11-19)]
```
$ ./bin/mruby -e 'puts Proc.new {}.binding'
@@ -255,7 +255,7 @@ $ ruby -e 'def m(*r,**k) p [r,k] end; m("a"=>1,:b=>2)'
[[{"a"=>1}], {:b=>2}]
```
-#### mruby [mruby 2.0.1]
+#### mruby [mruby 2.1.0]
```
$ ./bin/mruby -e 'def m(*r,**k) p [r,k] end; m("a"=>1,:b=>2)'
diff --git a/doc/opcode.md b/doc/opcode.md
index 574a3c83f..a79453e8a 100644
--- a/doc/opcode.md
+++ b/doc/opcode.md
@@ -16,7 +16,6 @@ In the table.1 below, the second field describes the size (and
sign) of operands.
* B: 8bit
-* sB: signed 8bit
* S: 16bit
* sS: signed 16bit
* W: 24bit
@@ -31,97 +30,111 @@ with `"`, either `OP_EXT1` or `OP_EXT2` or `OP_EXT2` can be prefixed.
## table.1 Instruction Table
-| Instruction Name | Operand type | Semantics |
-|:-----------------|--------------|---------------------|
-| OP_NOP | - | |
-| OP_MOVE" | BB | R(a) = R(b)
-| OP_LOADL" | BB | R(a) = Pool(b)
-| OP_LOADI" | BsB | R(a) = mrb_int(b)
-| OP_LOADI_0' | B | R(a) = 0
-| OP_LOADI_1' | B | R(a) = 1
-| OP_LOADI_2' | B | R(a) = 2
-| OP_LOADI_3' | B | R(a) = 3
-| OP_LOADSYM" | BB | R(a) = Syms(b)
-| OP_LOADNIL' | B | R(a) = nil
-| OP_LOADSELF' | B | R(a) = self
-| OP_LOADT' | B | R(a) = true
-| OP_LOADF' | B | R(a) = false
-| OP_GETGV" | BB | R(a) = getglobal(Syms(b))
-| OP_SETGV" | BB | setglobal(Syms(b), R(a))
-| OP_GETSV" | BB | R(a) = Special[b]
-| OP_SETSV" | BB | Special[b] = R(a)
-| OP_GETIV" | BB | R(a) = ivget(Syms(b))
-| OP_SETIV" | BB | ivset(Syms(b),R(a))
-| OP_GETCV" | BB | R(a) = cvget(Syms(b))
-| OP_SETCV" | BB | cvset(Syms(b),R(a))
-| OP_GETCONST" | BB | R(a) = constget(Syms(b))
-| OP_SETCONST" | BB | constset(Syms(b),R(a))
-| OP_GETMCNST" | BB | R(a) = R(a)::Syms(b)
-| OP_SETMCNST" | BB | R(a+1)::Syms(b) = R(a)
-| OP_GETUPVAR' | BBB | R(a) = uvget(b,c)
-| OP_SETUPVAR' | BBB | uvset(b,c,R(a))
-| OP_JMP | S | pc+=a
-| OP_JMPIF' | SB | if R(b) pc+=a
-| OP_JMPNOT' | SB | if !R(b) pc+=a
-| OP_ONERR | sS | rescue_push(pc+a)
-| OP_EXCEPT' | B | R(a) = exc
-| OP_RESCUE" | BB | R(b) = R(a).isa?(R(b))
-| OP_POPERR | B | a.times{rescue_pop()}
-| OP_RAISE' | B | raise(R(a))
-| OP_EPUSH' | B | ensure_push(SEQ[a])
-| OP_EPOP | B | A.times{ensure_pop().call}
-| OP_SENDV" | BB | R(a) = call(R(a),Syms(b),*R(a+1))
-| OP_SENDVB" | BB | R(a) = call(R(a),Syms(b),*R(a+1),&R(a+2))
-| OP_SEND" | BBB | R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c))
-| OP_SENDB" | BBB | R(a) = call(R(a),Syms(Bx),R(a+1),...,R(a+c),&R(a+c+1))
-| OP_CALL' | B | R(a) = self.call(frame.argc, frame.argv)
-| OP_SUPER' | BB | R(a) = super(R(a+1),... ,R(a+b+1))
-| OP_ARGARY' | BS | R(a) = argument array (16=5:1:5:1:4)
-| OP_ENTER | W | arg setup according to flags (23=5:5:1:5:5:1:1)
-| OP_KARG" | BB | R(a) = kdict[Syms(Bx)] # todo
-| OP_KARG2" | BB | R(a) = kdict[Syms(Bx)]; kdict.rm(Syms(b)) # todo
-| OP_RETURN' | B | return R(a) (normal)
-| OP_RETURN_BLK' | B | return R(a) (in-block return)
-| OP_BREAK' | B | break R(a)
-| OP_BLKPUSH' | BS | R(a) = block (16=5:1:5:1:4)
-| OP_ADD" | BB | R(a) = R(a)+R(a+1)
-| OP_ADDI" | BBB | R(a) = R(a)+mrb_int(c)
-| OP_SUB" | BB | R(a) = R(a)-R(a+1)
-| OP_SUBI" | BB | R(a) = R(a)-C
-| OP_MUL" | BB | R(a) = R(a)*R(a+1)
-| OP_DIV" | BB | R(a) = R(a)/R(a+1)
-| OP_EQ" | BB | R(a) = R(a)==R(a+1)
-| OP_LT" | BB | R(a) = R(a)<R(a+1)
-| OP_LE" | BB | R(a) = R(a)<=R(a+1)
-| OP_GT" | BB | R(a) = R(a)>R(a+1)
-| OP_GE" | BB | R(a) = R(a)>=R(a+1)
-| OP_ARRAY' | BB | R(a) = ary_new(R(a),R(a+1)..R(a+b))
-| OP_ARRAY2" | BB | R(a) = ary_new(R(b),R(b+1)..R(b+c))
-| OP_ARYCAT' | B | ary_cat(R(a),R(a+1))
-| OP_ARYPUSH' | B | ary_push(R(a),R(a+1))
-| OP_AREF' | BB | R(a) = R(a)[b]
-| OP_ASET' | BB | R(a)[b] = R(a+1)
-| OP_APOST' | BB | *R(a),R(A+1)..R(A+C) = R(a)[B..]
-| OP_STRING" | BB | R(a) = str_dup(Lit(b))
-| OP_STRCAT' | B | str_cat(R(a),R(a+1))
-| OP_HASH' | BB | R(a) = hash_new(R(a),R(a+1)..R(a+b))
-| OP_HASHADD' | BB | R(a) = hash_push(R(a),R(a+1)..R(a+b))
-| OP_LAMBDA" | BB | R(a) = lambda(SEQ[b],OP_L_LAMBDA)
-| OP_BLOCK" | BB | R(a) = lambda(SEQ[b],OP_L_BLOCK)
-| OP_METHOD" | BB | R(a) = lambda(SEQ[b],OP_L_METHOD)
-| OP_RANGE_INC' | B | R(a) = range_new(R(a),R(a+1),FALSE)
-| OP_RANGE_EXC' | B | R(a) = range_new(R(a),R(a+1),TRUE)
-| OP_OCLASS' | B | R(a) = ::Object
-| OP_CLASS" | BB | R(a) = newclass(R(a),Syms(b),R(a+1))
-| OP_MODULE" | BB | R(a) = newmodule(R(a),Syms(b))
-| OP_EXEC" | BB | R(a) = blockexec(R(a),SEQ[b])
-| OP_DEF" | BB | R(a).newmethod(Syms(b),R(a+1))
-| OP_ALIAS' | B | alias_method(R(a),R(a+1),R(a+2))
-| OP_UNDEF" | BB | undef_method(R(a),Syms(b))
-| OP_SCLASS' | B | R(a) = R(a).singleton_class
-| OP_TCLASS' | B | R(a) = target_class
-| OP_ERR' | B | raise(RuntimeError, Lit(Bx))
-| OP_EXT1 | - | make 1st operand 16bit
-| OP_EXT2 | - | make 2nd operand 16bit
-| OP_EXT3 | - | make 1st and 2nd operands 16bit
-| OP_STOP | - | stop VM
+| Instruction Name | Operand type | Semantics |
+|------------------|--------------|--------------------------------------------------------|
+| OP_NOP | - | no operation |
+| OP_MOVE" | BB | R(a) = R(b) |
+| OP_LOADL" | BB | R(a) = Pool(b) |
+| OP_LOADI" | BB | R(a) = mrb_int(b) |
+| OP_LOADINEG" | BB | R(a) = mrb_int(-b) |
+| OP_LOADI__1' | B | R(a) = mrb_int(-1) |
+| OP_LOADI_0' | B | R(a) = mrb_int(0) |
+| OP_LOADI_1' | B | R(a) = mrb_int(1) |
+| OP_LOADI_2' | B | R(a) = mrb_int(2) |
+| OP_LOADI_3' | B | R(a) = mrb_int(3) |
+| OP_LOADI_4' | B | R(a) = mrb_int(4) |
+| OP_LOADI_5' | B | R(a) = mrb_int(5) |
+| OP_LOADI_6' | B | R(a) = mrb_int(6) |
+| OP_LOADI_7' | B | R(a) = mrb_int(7) |
+| OP_LOADI16' | BsS | R(a) = mrb_int(b) |
+| OP_LOADSYM" | BB | R(a) = Syms(b) |
+| OP_LOADNIL' | B | R(a) = nil |
+| OP_LOADSELF' | B | R(a) = self |
+| OP_LOADT' | B | R(a) = true |
+| OP_LOADF' | B | R(a) = false |
+| OP_GETGV" | BB | R(a) = getglobal(Syms(b)) |
+| OP_SETGV" | BB | setglobal(Syms(b), R(a)) |
+| OP_GETSV" | BB | R(a) = Special[Syms(b)] |
+| OP_SETSV" | BB | Special[Syms(b)] = R(a) |
+| OP_GETIV" | BB | R(a) = ivget(Syms(b)) |
+| OP_SETIV" | BB | ivset(Syms(b),R(a)) |
+| OP_GETCV" | BB | R(a) = cvget(Syms(b)) |
+| OP_SETCV" | BB | cvset(Syms(b),R(a)) |
+| OP_GETCONST" | BB | R(a) = constget(Syms(b)) |
+| OP_SETCONST" | BB | constset(Syms(b),R(a)) |
+| OP_GETMCNST" | BB | R(a) = R(a)::Syms(b) |
+| OP_SETMCNST" | BB | R(a+1)::Syms(b) = R(a) |
+| OP_GETUPVAR" | BBB | R(a) = uvget(b,c) |
+| OP_SETUPVAR" | BBB | uvset(b,c,R(a)) |
+| OP_JMP | S | pc=a |
+| OP_JMPIF' | BS | if R(a) pc=b |
+| OP_JMPNOT' | BS | if !R(a) pc=b |
+| OP_JMPNIL' | BS | if R(a)==nil pc=b |
+| OP_ONERR | S | rescue_push(a) |
+| OP_EXCEPT' | B | R(a) = exc |
+| OP_RESCUE" | BB | R(b) = R(a).isa?(R(b)) |
+| OP_POPERR' | B | a.times{rescue_pop()} |
+| OP_RAISE' | B | raise(R(a)) |
+| OP_EPUSH' | B | ensure_push(SEQ[a]) |
+| OP_EPOP' | B | A.times{ensure_pop().call} |
+| OP_SENDV" | BB | R(a) = call(R(a),Syms(b),*R(a+1)) |
+| OP_SENDVB" | BB | R(a) = call(R(a),Syms(b),*R(a+1),&R(a+2)) |
+| OP_SEND" | BBB | R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c)) |
+| OP_SENDB" | BBB | R(a) = call(R(a),Syms(b),R(a+1),...,R(a+c),&R(a+c+1)) |
+| OP_CALL | - | R(0) = self.call(frame.argc, frame.argv) |
+| OP_SUPER" | BB | R(a) = super(R(a+1),... ,R(a+b+1)) |
+| OP_ARGARY' | BS | R(a) = argument array (16=5:1:5:1:4) |
+| OP_ENTER | W | arg setup according to flags (23=5:5:1:5:5:1:1) |
+| OP_KEY_P" | BB | R(a) = kdict.key?(Syms(b)) |
+| OP_KEYEND | - | raise unless kdict.empty? |
+| OP_KARG" | BB | R(a) = kdict[Syms(b)]; kdict.delete(Syms(b)) |
+| OP_RETURN' | B | return R(a) (normal) |
+| OP_RETURN_BLK' | B | return R(a) (in-block return) |
+| OP_BREAK' | B | break R(a) |
+| OP_BLKPUSH' | BS | R(a) = block (16=5:1:5:1:4) |
+| OP_ADD' | B | R(a) = R(a)+R(a+1) |
+| OP_ADDI" | BB | R(a) = R(a)+mrb_int(b) |
+| OP_SUB' | B | R(a) = R(a)-R(a+1) |
+| OP_SUBI" | BB | R(a) = R(a)-mrb_int(b) |
+| OP_MUL' | B | R(a) = R(a)*R(a+1) |
+| OP_DIV' | B | R(a) = R(a)/R(a+1) |
+| OP_EQ' | B | R(a) = R(a)==R(a+1) |
+| OP_LT' | B | R(a) = R(a)<R(a+1) |
+| OP_LE' | B | R(a) = R(a)<=R(a+1) |
+| OP_GT' | B | R(a) = R(a)>R(a+1) |
+| OP_GE' | B | R(a) = R(a)>=R(a+1) |
+| OP_ARRAY" | BB | R(a) = ary_new(R(a),R(a+1)..R(a+b)) |
+| OP_ARRAY2" | BBB | R(a) = ary_new(R(b),R(b+1)..R(b+c)) |
+| OP_ARYCAT' | B | ary_cat(R(a),R(a+1)) |
+| OP_ARYPUSH' | B | ary_push(R(a),R(a+1)) |
+| OP_ARYDUP' | B | R(a) = ary_dup(R(a)) |
+| OP_AREF" | BBB | R(a) = R(b)[c] |
+| OP_ASET" | BBB | R(a)[c] = R(b) |
+| OP_APOST" | BBB | *R(a),R(a+1)..R(a+c) = R(a)[b..] |
+| OP_INTERN' | B | R(a) = intern(R(a)) |
+| OP_STRING" | BB | R(a) = str_dup(Lit(b)) |
+| OP_STRCAT' | B | str_cat(R(a),R(a+1)) |
+| OP_HASH" | BB | R(a) = hash_new(R(a),R(a+1)..R(a+b)) |
+| OP_HASHADD" | BB | R(a) = hash_push(R(a),R(a+1)..R(a+b)) |
+| OP_HASHCAT' | B | R(a) = hash_cat(R(a),R(a+1)) |
+| OP_LAMBDA" | BB | R(a) = lambda(SEQ[b],OP_L_LAMBDA) |
+| OP_BLOCK" | BB | R(a) = lambda(SEQ[b],OP_L_BLOCK) |
+| OP_METHOD" | BB | R(a) = lambda(SEQ[b],OP_L_METHOD) |
+| OP_RANGE_INC' | B | R(a) = range_new(R(a),R(a+1),FALSE) |
+| OP_RANGE_EXC' | B | R(a) = range_new(R(a),R(a+1),TRUE) |
+| OP_OCLASS' | B | R(a) = ::Object |
+| OP_CLASS" | BB | R(a) = newclass(R(a),Syms(b),R(a+1)) |
+| OP_MODULE" | BB | R(a) = newmodule(R(a),Syms(b)) |
+| OP_EXEC" | BB | R(a) = blockexec(R(a),SEQ[b]) |
+| OP_DEF" | BB | R(a).newmethod(Syms(b),R(a+1)) |
+| OP_ALIAS" | BB | alias_method(target_class,Syms(a),Syms(b)) |
+| OP_UNDEF' | B | undef_method(target_class,Syms(a)) |
+| OP_SCLASS' | B | R(a) = R(a).singleton_class |
+| OP_TCLASS' | B | R(a) = target_class |
+| OP_DEBUG" | BBB | print a,b,c |
+| OP_ERR' | B | raise(LocalJumpError, Lit(a)) |
+| OP_EXT1 | - | make 1st operand 16bit |
+| OP_EXT2 | - | make 2nd operand 16bit |
+| OP_EXT3 | - | make 1st and 2nd operands 16bit |
+| OP_STOP | - | stop VM |
+|------------------|--------------|--------------------------------------------------------|
diff --git a/examples/targets/build_config_ArduinoDue.rb b/examples/targets/build_config_ArduinoDue.rb
index 527aaa4f6..09646a700 100644
--- a/examples/targets/build_config_ArduinoDue.rb
+++ b/examples/targets/build_config_ArduinoDue.rb
@@ -42,7 +42,7 @@ MRuby::CrossBuild.new("ArduinoDue") do |conf|
cc.flags = %w(-g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500
-Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=156 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM
-D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Due")
- cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
+ cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
#configuration for low memory environment
cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
@@ -64,7 +64,7 @@ MRuby::CrossBuild.new("ArduinoDue") do |conf|
conf.archiver do |archiver|
archiver.command = "#{BIN_PATH}/arm-none-eabi-ar"
- archiver.archive_options = 'rcs %{outfile} %{objs}'
+ archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
#no executables
diff --git a/examples/targets/build_config_IntelEdison.rb b/examples/targets/build_config_IntelEdison.rb
index 8fa3aa0c0..a22f9cfd2 100644
--- a/examples/targets/build_config_IntelEdison.rb
+++ b/examples/targets/build_config_IntelEdison.rb
@@ -32,7 +32,7 @@ MRuby::CrossBuild.new('core2-32-poky-linux') do |conf|
cc.flags = %w(-m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer)
cc.flags << %w(-O2 -pipe -g -feliminate-unused-debug-types)
cc.flags << "--sysroot=#{POKY_EDISON_SYSROOT}"
- cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
+ cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
cc.defines = %w(ENABLE_READLINE)
end
@@ -47,7 +47,7 @@ MRuby::CrossBuild.new('core2-32-poky-linux') do |conf|
conf.archiver do |archiver|
archiver.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-ar"
- archiver.archive_options = 'rcs %{outfile} %{objs}'
+ archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
conf.linker do |linker|
diff --git a/examples/targets/build_config_IntelGalileo.rb b/examples/targets/build_config_IntelGalileo.rb
index 42f800d9f..42f39c456 100644
--- a/examples/targets/build_config_IntelGalileo.rb
+++ b/examples/targets/build_config_IntelGalileo.rb
@@ -39,7 +39,7 @@ MRuby::CrossBuild.new("Galileo") do |conf|
cc.flags = %w(-m32 -march=i586 -c -g -Os -w
-ffunction-sections -fdata-sections -MMD -DARDUINO=153)
cc.flags << "--sysroot=#{GALILEO_SYSROOT}"
- cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
+ cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
end
conf.cxx do |cxx|
@@ -54,7 +54,7 @@ MRuby::CrossBuild.new("Galileo") do |conf|
conf.archiver do |archiver|
archiver.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-ar"
- archiver.archive_options = 'rcs %{outfile} %{objs}'
+ archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
conf.linker do |linker|
diff --git a/examples/targets/build_config_RX630.rb b/examples/targets/build_config_RX630.rb
index fd17eae99..8b1bbb42f 100644
--- a/examples/targets/build_config_RX630.rb
+++ b/examples/targets/build_config_RX630.rb
@@ -27,7 +27,7 @@ MRuby::CrossBuild.new("RX630") do |conf|
conf.cc do |cc|
cc.command = "#{BIN_PATH}/rx-elf-gcc"
cc.flags = "-Wall -g -O2 -flto -mcpu=rx600 -m64bit-doubles"
- cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
+ cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
#configuration for low memory environment
cc.defines << %w(MRB_USE_FLOAT)
@@ -53,7 +53,7 @@ MRuby::CrossBuild.new("RX630") do |conf|
conf.archiver do |archiver|
archiver.command = "#{BIN_PATH}/rx-elf-ar"
- archiver.archive_options = 'rcs %{outfile} %{objs}'
+ archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
#no executables
diff --git a/examples/targets/build_config_chipKITMax32.rb b/examples/targets/build_config_chipKITMax32.rb
index 951f71483..8617d8d10 100644
--- a/examples/targets/build_config_chipKITMax32.rb
+++ b/examples/targets/build_config_chipKITMax32.rb
@@ -39,7 +39,7 @@ MRuby::CrossBuild.new("chipKITMax32") do |conf|
cc.flags = %w(-O2 -mno-smart-io -w -ffunction-sections -fdata-sections -g -mdebugger -Wcast-align
-fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -D_BOARD_MEGA_
-DMPIDEVER=0x01000202 -DMPIDE=23)
- cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
+ cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
#configuration for low memory environment
cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
@@ -60,7 +60,7 @@ MRuby::CrossBuild.new("chipKITMax32") do |conf|
conf.archiver do |archiver|
archiver.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-ar"
- archiver.archive_options = 'rcs %{outfile} %{objs}'
+ archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
#no executables
diff --git a/examples/targets/build_config_dreamcast_shelf.rb b/examples/targets/build_config_dreamcast_shelf.rb
new file mode 100644
index 000000000..85b2ff20d
--- /dev/null
+++ b/examples/targets/build_config_dreamcast_shelf.rb
@@ -0,0 +1,108 @@
+MRuby::Build.new do |conf|
+ # Gets set by the VS command prompts
+ if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
+ toolchain :visualcpp
+ else
+ toolchain :gcc
+ end
+
+ enable_debug
+
+ # Include the default GEMs
+ conf.gembox 'default'
+end
+
+# Cross Compiling configuration for the Sega Dreamcast
+# This configuration requires KallistiOS (KOS)
+# https://dreamcast.wiki
+#
+# Tested on GNU/Linux, MinGW-w64/MSYS2, Cygwin, macOS and MinGW/MSYS (see below)
+#
+MRuby::CrossBuild.new("dreamcast") do |conf|
+ toolchain :gcc
+
+ # Support for DreamSDK (based on MinGW/MSYS)
+ # To compile mruby with DreamSDK, RubyInstaller for Windows should be installed
+ DREAMSDK_HOME = ENV["DREAMSDK_HOME"]
+ MSYS_ROOT = !(DREAMSDK_HOME.nil? || DREAMSDK_HOME.empty?) ? "#{DREAMSDK_HOME}/msys/1.0" : ""
+
+ # Setting paths
+ DREAMCAST_PATH = "#{MSYS_ROOT}/opt/toolchains/dc"
+ KOS_PATH = "#{DREAMCAST_PATH}/kos"
+ BIN_PATH = "#{DREAMCAST_PATH}/sh-elf/bin"
+
+ # C compiler
+ # Flags were extracted from KallistiOS environment files
+ conf.cc do |cc|
+ cc.command = "#{BIN_PATH}/sh-elf-gcc"
+ cc.include_paths << ["#{KOS_PATH}/include", "#{KOS_PATH}/kernel/arch/dreamcast/include", "#{KOS_PATH}/addons/include", "#{KOS_PATH}/../kos-ports/include"]
+ cc.flags << ["-O2", "-fomit-frame-pointer", "-ml", "-m4-single-only", "-ffunction-sections", "-fdata-sections", "-Wall", "-g", "-fno-builtin", "-ml", "-m4-single-only", "-Wl,-Ttext=0x8c010000", "-Wl,--gc-sections", "-T#{KOS_PATH}/utils/ldscripts/shlelf.xc", "-nodefaultlibs"]
+ cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
+ cc.defines << %w(_arch_dreamcast)
+ cc.defines << %w(_arch_sub_pristine)
+ end
+
+ # C++ compiler
+ conf.cxx do |cxx|
+ cxx.command = conf.cc.command.dup
+ cxx.include_paths = conf.cc.include_paths.dup
+ cxx.flags = conf.cc.flags.dup
+ cxx.flags << %w(-fno-rtti -fno-exceptions)
+ cxx.defines = conf.cc.defines.dup
+ cxx.compile_options = conf.cc.compile_options.dup
+ end
+
+ # Linker
+ # There is an issue when making the mruby library with KallistiOS:
+ # 'newlib_kill.o' and 'newlib_getpid.o' aren't found so they are explicitly
+ # specified here at least for now.
+ conf.linker do |linker|
+ linker.command="#{BIN_PATH}/sh-elf-gcc"
+ linker.flags << ["#{MSYS_ROOT}/opt/toolchains/dc/kos/kernel/build/newlib_kill.o", "#{MSYS_ROOT}/opt/toolchains/dc/kos/kernel/build/newlib_getpid.o", "-Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group"]
+ linker.library_paths << ["#{KOS_PATH}/lib/dreamcast", "#{KOS_PATH}/addons/lib/dreamcast", "#{KOS_PATH}/../kos-ports/lib"]
+ end
+
+ # Archiver
+ conf.archiver do |archiver|
+ archiver.command = "#{BIN_PATH}/sh-elf-ar"
+ archiver.archive_options = 'rcs "%{outfile}" %{objs}'
+ end
+
+ # No executables
+ conf.bins = []
+
+ # Do not build executable test
+ conf.build_mrbtest_lib_only
+
+ # Disable C++ exception
+ conf.disable_cxx_exception
+
+ # Gems from core
+ # removing mruby-io
+ conf.gem :core => "mruby-metaprog"
+ conf.gem :core => "mruby-pack"
+ conf.gem :core => "mruby-sprintf"
+ conf.gem :core => "mruby-print"
+ conf.gem :core => "mruby-math"
+ conf.gem :core => "mruby-time"
+ conf.gem :core => "mruby-struct"
+ conf.gem :core => "mruby-compar-ext"
+ conf.gem :core => "mruby-enum-ext"
+ conf.gem :core => "mruby-string-ext"
+ conf.gem :core => "mruby-numeric-ext"
+ conf.gem :core => "mruby-array-ext"
+ conf.gem :core => "mruby-hash-ext"
+ conf.gem :core => "mruby-range-ext"
+ conf.gem :core => "mruby-proc-ext"
+ conf.gem :core => "mruby-symbol-ext"
+ conf.gem :core => "mruby-random"
+ conf.gem :core => "mruby-object-ext"
+ conf.gem :core => "mruby-objectspace"
+ conf.gem :core => "mruby-fiber"
+ conf.gem :core => "mruby-enumerator"
+ conf.gem :core => "mruby-enum-lazy"
+ conf.gem :core => "mruby-toplevel-ext"
+ conf.gem :core => "mruby-kernel-ext"
+ conf.gem :core => "mruby-class-ext"
+ conf.gem :core => "mruby-compiler"
+end
diff --git a/include/mrbconf.h b/include/mrbconf.h
index b86ce82e8..2b1adb24e 100644
--- a/include/mrbconf.h
+++ b/include/mrbconf.h
@@ -38,21 +38,24 @@
/* add -DMRB_METHOD_T_STRUCT on machines that use higher bits of pointers */
/* no MRB_METHOD_T_STRUCT requires highest 2 bits of function pointers to be zero */
-//#define MRB_METHOD_T_STRUCT
-
-/* add -DMRB_INT16 to use 16bit integer for mrb_int; conflict with MRB_INT32 and MRB_INT64 */
-//#define MRB_INT16
+#ifndef MRB_METHOD_T_STRUCT
+ // can't use highest 2 bits of function pointers at least on 32bit
+ // Windows and 32bit Linux.
+# ifdef MRB_32BIT
+# define MRB_METHOD_T_STRUCT
+# endif
+#endif
-/* add -DMRB_INT32 to use 32bit integer for mrb_int; conflict with MRB_INT16 and MRB_INT64;
+/* add -DMRB_INT32 to use 32bit integer for mrb_int; conflict with MRB_INT64;
Default for 32-bit CPU mode. */
//#define MRB_INT32
-/* add -DMRB_INT64 to use 64bit integer for mrb_int; conflict with MRB_INT16 and MRB_INT32;
+/* add -DMRB_INT64 to use 64bit integer for mrb_int; conflict with MRB_INT32;
Default for 64-bit CPU mode. */
//#define MRB_INT64
/* if no specific integer type is chosen */
-#if !defined(MRB_INT16) && !defined(MRB_INT32) && !defined(MRB_INT64)
+#if !defined(MRB_INT32) && !defined(MRB_INT64)
# if defined(MRB_64BIT) && !defined(MRB_NAN_BOXING)
/* Use 64bit integers on 64bit architecture (without MRB_NAN_BOXING) */
# define MRB_INT64
@@ -62,9 +65,6 @@
# endif
#endif
-#define MRB_COMPLEX_NUMBERS
-#define MRB_RATIONAL_NUMBERS
-
/* define on big endian machines; used by MRB_NAN_BOXING, etc. */
#ifndef MRB_ENDIAN_BIG
# if (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN) || \
diff --git a/include/mruby.h b/include/mruby.h
index 04e0c0df7..2fd075112 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -70,7 +70,13 @@
#include "mrbconf.h"
+#include <mruby/common.h>
+#include <mruby/value.h>
+#include <mruby/gc.h>
+#include <mruby/version.h>
+
#ifndef MRB_WITHOUT_FLOAT
+#include <float.h>
#ifndef FLT_EPSILON
#define FLT_EPSILON (1.19209290e-07f)
#endif
@@ -88,11 +94,6 @@
#endif
#endif
-#include <mruby/common.h>
-#include <mruby/value.h>
-#include <mruby/gc.h>
-#include <mruby/version.h>
-
/**
* MRuby C API entry point
*/
@@ -164,8 +165,8 @@ struct mrb_context {
struct RProc **ensure; /* ensure handler stack */
uint16_t esize, eidx;
- enum mrb_fiber_state status;
- mrb_bool vmexec;
+ enum mrb_fiber_state status : 4;
+ mrb_bool vmexec : 1;
struct RFiber *fib;
};
@@ -317,7 +318,9 @@ MRB_API struct RClass *mrb_define_class(mrb_state *mrb, const char *name, struct
* @return [struct RClass *] Reference to the newly defined module.
*/
MRB_API struct RClass *mrb_define_module(mrb_state *mrb, const char *name);
+
MRB_API mrb_value mrb_singleton_class(mrb_state *mrb, mrb_value val);
+MRB_API struct RClass *mrb_singleton_class_ptr(mrb_state *mrb, mrb_value val);
/**
* Include a module in another class or module.
@@ -1148,7 +1151,6 @@ MRB_API void mrb_close(mrb_state *mrb);
MRB_API void* mrb_default_allocf(mrb_state*, void*, size_t, void*);
MRB_API mrb_value mrb_top_self(mrb_state *mrb);
-MRB_API mrb_value mrb_run(mrb_state *mrb, struct RProc* proc, mrb_value self);
MRB_API mrb_value mrb_top_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stack_keep);
MRB_API mrb_value mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stack_keep);
MRB_API mrb_value mrb_vm_exec(mrb_state *mrb, struct RProc *proc, const mrb_code *iseq);
@@ -1232,6 +1234,7 @@ MRB_API mrb_noreturn void mrb_raise(mrb_state *mrb, struct RClass *c, const char
MRB_API mrb_noreturn void mrb_raisef(mrb_state *mrb, struct RClass *c, const char *fmt, ...);
MRB_API mrb_noreturn void mrb_name_error(mrb_state *mrb, mrb_sym id, const char *fmt, ...);
MRB_API mrb_noreturn void mrb_frozen_error(mrb_state *mrb, void *frozen_obj);
+MRB_API mrb_noreturn void mrb_argnum_error(mrb_state *mrb, mrb_int argc, int min, int max);
MRB_API void mrb_warn(mrb_state *mrb, const char *fmt, ...);
MRB_API mrb_noreturn void mrb_bug(mrb_state *mrb, const char *fmt, ...);
MRB_API void mrb_print_backtrace(mrb_state *mrb);
diff --git a/include/mruby/array.h b/include/mruby/array.h
index 9664214d6..92c86a8c5 100644
--- a/include/mruby/array.h
+++ b/include/mruby/array.h
@@ -17,7 +17,7 @@ MRB_BEGIN_DECL
typedef struct mrb_shared_array {
int refcnt;
- mrb_int len;
+ mrb_ssize len;
mrb_value *ptr;
} mrb_shared_array;
@@ -26,9 +26,9 @@ struct RArray {
MRB_OBJECT_HEADER;
union {
struct {
- mrb_int len;
+ mrb_ssize len;
union {
- mrb_int capa;
+ mrb_ssize capa;
mrb_shared_array *shared;
} aux;
mrb_value *ptr;
@@ -239,6 +239,7 @@ MRB_API mrb_value mrb_ary_entry(mrb_value ary, mrb_int offset);
* @param head Beginning position of a replacement subsequence.
* @param len Length of a replacement subsequence.
* @param rpl The array of replacement elements.
+ * It is possible to pass `mrb_undef_value()` instead of an empty array.
* @return The receiver array.
*/
MRB_API mrb_value mrb_ary_splice(mrb_state *mrb, mrb_value self, mrb_int head, mrb_int len, mrb_value rpl);
@@ -291,6 +292,9 @@ MRB_API mrb_value mrb_ary_join(mrb_state *mrb, mrb_value ary, mrb_value sep);
*/
MRB_API mrb_value mrb_ary_resize(mrb_state *mrb, mrb_value ary, mrb_int new_len);
+/* helper functions */
+mrb_value mrb_ary_subseq(mrb_state *mrb, mrb_value ary, mrb_int beg, mrb_int len);
+
MRB_END_DECL
#endif /* MRUBY_ARRAY_H */
diff --git a/include/mruby/boxing_nan.h b/include/mruby/boxing_nan.h
index af598e34e..fae3b7630 100644
--- a/include/mruby/boxing_nan.h
+++ b/include/mruby/boxing_nan.h
@@ -20,6 +20,7 @@
#endif
#define MRB_FIXNUM_SHIFT 0
+#define MRB_SYMBOL_SHIFT 0
/* value representation by nan-boxing:
* float : FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
@@ -43,6 +44,9 @@ typedef struct mrb_value {
};
)
};
+#ifdef MRB_64BIT
+ struct RCptr *vp;
+#endif
} value;
};
} mrb_value;
@@ -53,13 +57,15 @@ typedef struct mrb_value {
#define mrb_type(o) (enum mrb_vtype)((uint32_t)0xfff00000 < (o).value.ttt ? mrb_tt(o) : MRB_TT_FLOAT)
#define mrb_ptr(o) ((void*)((((uintptr_t)0x3fffffffffff)&((uintptr_t)((o).value.p)))<<2))
#define mrb_float(o) (o).f
-#define mrb_cptr(o) mrb_ptr(o)
#define mrb_fixnum(o) (o).value.i
#define mrb_symbol(o) (o).value.sym
#ifdef MRB_64BIT
+MRB_API mrb_value mrb_nan_boxing_cptr_value(struct mrb_state*, void*);
+#define mrb_cptr(o) (((struct RCptr*)mrb_ptr(o))->p)
#define BOXNAN_SHIFT_LONG_POINTER(v) (((uintptr_t)(v)>>34)&0x3fff)
#else
+#define mrb_cptr(o) ((o).value.p)
#define BOXNAN_SHIFT_LONG_POINTER(v) 0
#endif
@@ -89,7 +95,11 @@ typedef struct mrb_value {
#define SET_INT_VALUE(r,n) BOXNAN_SET_VALUE(r, MRB_TT_FIXNUM, value.i, (n))
#define SET_SYM_VALUE(r,v) BOXNAN_SET_VALUE(r, MRB_TT_SYMBOL, value.sym, (v))
#define SET_OBJ_VALUE(r,v) BOXNAN_SET_OBJ_VALUE(r, (((struct RObject*)(v))->tt), (v))
-#define SET_CPTR_VALUE(mrb,r,v) BOXNAN_SET_OBJ_VALUE(r, MRB_TT_CPTR, v)
+#ifdef MRB_64BIT
+#define SET_CPTR_VALUE(mrb,r,v) ((r) = mrb_nan_boxing_cptr_value(mrb, v))
+#else
+#define SET_CPTR_VALUE(mrb,r,v) BOXNAN_SET_VALUE(r, MRB_TT_CPTR, value.p, v)
+#endif
#define SET_UNDEF_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_UNDEF, value.i, 0)
#endif /* MRUBY_BOXING_NAN_H */
diff --git a/include/mruby/boxing_no.h b/include/mruby/boxing_no.h
index 19372b587..7573428e6 100644
--- a/include/mruby/boxing_no.h
+++ b/include/mruby/boxing_no.h
@@ -8,6 +8,7 @@
#define MRUBY_BOXING_NO_H
#define MRB_FIXNUM_SHIFT 0
+#define MRB_SYMBOL_SHIFT 0
union mrb_value_union {
#ifndef MRB_WITHOUT_FLOAT
diff --git a/include/mruby/boxing_word.h b/include/mruby/boxing_word.h
index d763ffaf8..c0d7087e0 100644
--- a/include/mruby/boxing_word.h
+++ b/include/mruby/boxing_word.h
@@ -7,10 +7,6 @@
#ifndef MRUBY_BOXING_WORD_H
#define MRUBY_BOXING_WORD_H
-#if defined(MRB_INT16)
-# error MRB_INT16 is too small for MRB_WORD_BOXING.
-#endif
-
#if defined(MRB_INT64) && !defined(MRB_64BIT)
#error MRB_INT64 cannot be used with MRB_WORD_BOXING in 32-bit mode.
#endif
@@ -22,11 +18,6 @@ struct RFloat {
};
#endif
-struct RCptr {
- MRB_OBJECT_HEADER;
- void *p;
-};
-
enum mrb_special_consts {
MRB_Qnil = 0,
MRB_Qfalse = 4,
@@ -34,41 +25,46 @@ enum mrb_special_consts {
MRB_Qundef = 20,
};
-#define MRB_FIXNUM_SHIFT 1
-#define MRB_SYMBOL_SHIFT 2
-#define MRB_FIXNUM_FLAG (1 << (MRB_FIXNUM_SHIFT - 1))
-#define MRB_SYMBOL_FLAG (1 << (MRB_SYMBOL_SHIFT - 1))
-#define MRB_FIXNUM_MASK ((1 << MRB_FIXNUM_SHIFT) - 1)
-#define MRB_SYMBOL_MASK ((1 << MRB_SYMBOL_SHIFT) - 1)
-#define MRB_IMMEDIATE_MASK 0x07
+#if defined(MRB_64BIT) && defined(MRB_INT32)
+#define MRB_FIXNUM_SHIFT 0
+#else
+#define MRB_FIXNUM_SHIFT BOXWORD_FIXNUM_SHIFT
+#endif
+#define MRB_SYMBOL_SHIFT BOXWORD_SYMBOL_SHIFT
+#define BOXWORD_FIXNUM_BIT_POS 1
+#define BOXWORD_SYMBOL_BIT_POS 2
+#define BOXWORD_FIXNUM_SHIFT BOXWORD_FIXNUM_BIT_POS
#ifdef MRB_64BIT
-#define MRB_SYMBOL_BITSIZE (sizeof(mrb_sym) * CHAR_BIT)
-#define MRB_SYMBOL_MAX UINT32_MAX
+#define BOXWORD_SYMBOL_SHIFT 0
#else
-#define MRB_SYMBOL_BITSIZE (sizeof(mrb_sym) * CHAR_BIT - MRB_SYMBOL_SHIFT)
-#define MRB_SYMBOL_MAX (UINT32_MAX >> MRB_SYMBOL_SHIFT)
+#define BOXWORD_SYMBOL_SHIFT BOXWORD_SYMBOL_BIT_POS
#endif
+#define BOXWORD_FIXNUM_FLAG (1 << (BOXWORD_FIXNUM_BIT_POS - 1))
+#define BOXWORD_SYMBOL_FLAG (1 << (BOXWORD_SYMBOL_BIT_POS - 1))
+#define BOXWORD_FIXNUM_MASK ((1 << BOXWORD_FIXNUM_BIT_POS) - 1)
+#define BOXWORD_SYMBOL_MASK ((1 << BOXWORD_SYMBOL_BIT_POS) - 1)
+#define BOXWORD_IMMEDIATE_MASK 0x07
#define BOXWORD_SHIFT_VALUE(o,n,t) \
- ((((t)(o).w)) >> MRB_##n##_SHIFT)
+ (t)(((long)(o).w) >> BOXWORD_##n##_SHIFT)
#define BOXWORD_SET_SHIFT_VALUE(o,n,v) \
- ((o).w = (((unsigned long)(v)) << MRB_##n##_SHIFT) | MRB_##n##_FLAG)
+ ((o).w = (((unsigned long)(v)) << BOXWORD_##n##_SHIFT) | BOXWORD_##n##_FLAG)
#define BOXWORD_SHIFT_VALUE_P(o,n) \
- (((o).w & MRB_##n##_MASK) == MRB_##n##_FLAG)
+ (((o).w & BOXWORD_##n##_MASK) == BOXWORD_##n##_FLAG)
#define BOXWORD_OBJ_TYPE_P(o,n) \
(!mrb_immediate_p(o) && (o).value.bp->tt == MRB_TT_##n)
/*
* mrb_value representation:
*
- * nil : ...0000 0000 (all bits are zero)
- * false : ...0000 0100
+ * nil : ...0000 0000 (all bits are 0)
+ * false : ...0000 0100 (mrb_fixnum(v) != 0)
* true : ...0000 1100
* undef : ...0001 0100
* fixnum: ...IIII III1
- * symbol: ...SSSS SS10 (high-order 32-bit are symbol value in 64-bit mode)
- * object: ...PPPP P000
+ * symbol: ...SSSS SS10 (use only upper 32-bit as symbol value on 64-bit CPU)
+ * object: ...PPPP P000 (any bits are 1)
*/
typedef union mrb_value {
union {
@@ -114,10 +110,10 @@ MRB_API mrb_value mrb_word_boxing_float_pool(struct mrb_state*, mrb_float);
#endif
#define mrb_bool(o) (((o).w & ~(unsigned long)MRB_Qfalse) != 0)
-#define mrb_immediate_p(o) ((o).w & MRB_IMMEDIATE_MASK || (o).w == MRB_Qnil)
+#define mrb_immediate_p(o) ((o).w & BOXWORD_IMMEDIATE_MASK || (o).w == MRB_Qnil)
#define mrb_fixnum_p(o) BOXWORD_SHIFT_VALUE_P(o, FIXNUM)
#ifdef MRB_64BIT
-#define mrb_symbol_p(o) ((o).value.sym_flag == MRB_SYMBOL_FLAG)
+#define mrb_symbol_p(o) ((o).value.sym_flag == BOXWORD_SYMBOL_FLAG)
#else
#define mrb_symbol_p(o) BOXWORD_SHIFT_VALUE_P(o, SYMBOL)
#endif
@@ -159,7 +155,7 @@ MRB_API mrb_value mrb_word_boxing_float_pool(struct mrb_state*, mrb_float);
#define SET_BOOL_VALUE(r,b) ((b) ? SET_TRUE_VALUE(r) : SET_FALSE_VALUE(r))
#define SET_INT_VALUE(r,n) BOXWORD_SET_SHIFT_VALUE(r, FIXNUM, n)
#ifdef MRB_64BIT
-#define SET_SYM_VALUE(r,v) ((r).value.sym = v, (r).value.sym_flag = MRB_SYMBOL_FLAG)
+#define SET_SYM_VALUE(r,v) ((r).value.sym = v, (r).value.sym_flag = BOXWORD_SYMBOL_FLAG)
#else
#define SET_SYM_VALUE(r,n) BOXWORD_SET_SHIFT_VALUE(r, SYMBOL, n)
#endif
diff --git a/include/mruby/class.h b/include/mruby/class.h
index 7c925f3b3..cbf96fef2 100644
--- a/include/mruby/class.h
+++ b/include/mruby/class.h
@@ -90,10 +90,17 @@ mrb_value mrb_instance_new(mrb_state *mrb, mrb_value cv);
void mrb_class_name_class(mrb_state*, struct RClass*, struct RClass*, mrb_sym);
mrb_bool mrb_const_name_p(mrb_state*, const char*, mrb_int);
mrb_value mrb_class_find_path(mrb_state*, struct RClass*);
+mrb_value mrb_mod_to_s(mrb_state*, mrb_value);
void mrb_gc_mark_mt(mrb_state*, struct RClass*);
size_t mrb_gc_mark_mt_size(mrb_state*, struct RClass*);
void mrb_gc_free_mt(mrb_state*, struct RClass*);
+#ifdef MRB_METHOD_CACHE
+void mrb_mc_clear_by_class(mrb_state *mrb, struct RClass* c);
+#else
+#define mrb_mc_clear_by_class(mrb,c)
+#endif
+
MRB_END_DECL
#endif /* MRUBY_CLASS_H */
diff --git a/include/mruby/common.h b/include/mruby/common.h
index 5be9a40c6..f704ef8df 100644
--- a/include/mruby/common.h
+++ b/include/mruby/common.h
@@ -74,6 +74,16 @@ MRB_BEGIN_DECL
#endif
#endif
+/** Declare mingw versions */
+#if defined(__MINGW32__) || defined(__MINGW64__)
+# include <_mingw.h>
+# if defined(__MINGW64_VERSION_MAJOR)
+# define MRB_MINGW64_VERSION (__MINGW64_VERSION_MAJOR * 1000 + __MINGW64_VERSION_MINOR)
+# elif defined(__MINGW32_MAJOR_VERSION)
+# define MRB_MINGW32_VERSION (__MINGW32_MAJOR_VERSION * 1000 + __MINGW32_MINOR_VERSION)
+# endif
+#endif
+
MRB_END_DECL
#endif /* MRUBY_COMMON_H */
diff --git a/include/mruby/compile.h b/include/mruby/compile.h
index ac9a9892a..7b878d460 100644
--- a/include/mruby/compile.h
+++ b/include/mruby/compile.h
@@ -33,7 +33,7 @@ typedef struct mrbc_context {
mrb_bool no_exec:1;
mrb_bool keep_lv:1;
mrb_bool no_optimize:1;
- mrb_bool on_eval:1;
+ struct RProc *upper;
size_t parser_nerr;
} mrbc_context;
@@ -151,8 +151,8 @@ struct mrb_parser_state {
mrb_ast_node *tree;
mrb_bool no_optimize:1;
- mrb_bool on_eval:1;
mrb_bool capture_errors:1;
+ struct RProc *upper;
struct mrb_parser_message error_buffer[10];
struct mrb_parser_message warn_buffer[10];
@@ -161,6 +161,7 @@ struct mrb_parser_state {
uint16_t current_filename_index;
struct mrb_jmpbuf* jmp;
+ mrb_ast_node *nvars;
};
MRB_API struct mrb_parser_state* mrb_parser_new(mrb_state*);
@@ -179,7 +180,15 @@ MRB_API struct mrb_parser_state* mrb_parse_nstring(mrb_state*,const char*,size_t
MRB_API struct RProc* mrb_generate_code(mrb_state*, struct mrb_parser_state*);
MRB_API mrb_value mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c);
-/* program load functions */
+/** program load functions
+* Please note! Currently due to interactions with the GC calling these functions will
+* leak one RProc object per function call.
+* To prevent this save the current memory arena before calling and restore the arena
+* right after, like so
+* int ai = mrb_gc_arena_save(mrb);
+* mrb_value status = mrb_load_string(mrb, buffer);
+* mrb_gc_arena_restore(mrb, ai);
+*/
#ifndef MRB_DISABLE_STDIO
MRB_API mrb_value mrb_load_file(mrb_state*,FILE*);
MRB_API mrb_value mrb_load_file_cxt(mrb_state*,FILE*, mrbc_context *cxt);
diff --git a/include/mruby/dump.h b/include/mruby/dump.h
index 46c3b63ce..db3e287d3 100644
--- a/include/mruby/dump.h
+++ b/include/mruby/dump.h
@@ -17,10 +17,6 @@
MRB_BEGIN_DECL
#define DUMP_DEBUG_INFO 1
-#define DUMP_ENDIAN_BIG 2
-#define DUMP_ENDIAN_LIL 4
-#define DUMP_ENDIAN_NAT 6
-#define DUMP_ENDIAN_MASK 6
int mrb_dump_irep(mrb_state *mrb, mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size);
#ifndef MRB_DISABLE_STDIO
@@ -52,8 +48,7 @@ MRB_API mrb_irep *mrb_read_irep_buf(mrb_state*, const void*, size_t);
/* Rite Binary File header */
#define RITE_BINARY_IDENT "RITE"
-#define RITE_BINARY_IDENT_LIL "ETIR"
-#define RITE_BINARY_FORMAT_VER "0006"
+#define RITE_BINARY_FORMAT_VER "0007"
#define RITE_COMPILER_NAME "MATZ"
#define RITE_COMPILER_VERSION "0000"
@@ -106,17 +101,6 @@ struct rite_binary_footer {
RITE_SECTION_HEADER;
};
-static inline int
-bigendian_p()
-{
- int i;
- char *p;
-
- i = 1;
- p = (char*)&i;
- return p[0]?0:1;
-}
-
static inline size_t
uint8_to_bin(uint8_t s, uint8_t *bin)
{
diff --git a/include/mruby/irep.h b/include/mruby/irep.h
index 4393129c7..661ef2b48 100644
--- a/include/mruby/irep.h
+++ b/include/mruby/irep.h
@@ -49,6 +49,16 @@ typedef struct mrb_irep {
MRB_API mrb_irep *mrb_add_irep(mrb_state *mrb);
+/** load mruby bytecode functions
+* Please note! Currently due to interactions with the GC calling these functions will
+* leak one RProc object per function call.
+* To prevent this save the current memory arena before calling and restore the arena
+* right after, like so
+* int ai = mrb_gc_arena_save(mrb);
+* mrb_value status = mrb_load_irep(mrb, buffer);
+* mrb_gc_arena_restore(mrb, ai);
+*/
+
/* @param [const uint8_t*] irep code, expected as a literal */
MRB_API mrb_value mrb_load_irep(mrb_state*, const uint8_t*);
diff --git a/include/mruby/numeric.h b/include/mruby/numeric.h
index a176d96cd..06a33cc6f 100644
--- a/include/mruby/numeric.h
+++ b/include/mruby/numeric.h
@@ -37,6 +37,7 @@ MRB_API mrb_value mrb_fixnum_to_str(mrb_state *mrb, mrb_value x, mrb_int base);
/* ArgumentError if format string doesn't match /%(\.[0-9]+)?[aAeEfFgG]/ */
#ifndef MRB_WITHOUT_FLOAT
MRB_API mrb_value mrb_float_to_str(mrb_state *mrb, mrb_value x, const char *fmt);
+MRB_API int mrb_float_to_cstr(mrb_state *mrb, char *buf, size_t len, const char *fmt, mrb_float f);
MRB_API mrb_float mrb_to_flo(mrb_state *mrb, mrb_value x);
MRB_API mrb_value mrb_int_value(mrb_state *mrb, mrb_float f);
#endif
diff --git a/include/mruby/ops.h b/include/mruby/ops.h
index 2327c33fd..c8990ae43 100644
--- a/include/mruby/ops.h
+++ b/include/mruby/ops.h
@@ -115,3 +115,4 @@ OPCODE(EXT1, Z) /* make 1st operand 16bit */
OPCODE(EXT2, Z) /* make 2nd operand 16bit */
OPCODE(EXT3, Z) /* make 1st and 2nd operands 16bit */
OPCODE(STOP, Z) /* stop VM */
+OPCODE(LOADI16, BS) /* R(a) = mrb_int(b) */
diff --git a/include/mruby/string.h b/include/mruby/string.h
index 9039aaab3..93c94ef5d 100644
--- a/include/mruby/string.h
+++ b/include/mruby/string.h
@@ -23,9 +23,9 @@ struct RString {
MRB_OBJECT_HEADER;
union {
struct {
- mrb_int len;
+ mrb_ssize len;
union {
- mrb_int capa;
+ mrb_ssize capa;
struct mrb_shared_string *shared;
struct RString *fshared;
} aux;
@@ -54,7 +54,7 @@ struct RStringEmbed {
RSTR_SET_EMBED_LEN((s),(n));\
}\
else {\
- (s)->as.heap.len = (mrb_int)(n);\
+ (s)->as.heap.len = (mrb_ssize)(n);\
}\
} while (0)
#define RSTR_EMBED_PTR(s) (((struct RStringEmbed*)(s))->ary)
@@ -115,8 +115,8 @@ MRB_API mrb_int mrb_str_strlen(mrb_state*, struct RString*);
#define MRB_STR_POOL 16 /* status flags from here */
#define MRB_STR_ASCII 32
#define MRB_STR_EMBED_LEN_SHIFT 6
-#define MRB_STR_EMBED_LEN_BITSIZE 5
-#define MRB_STR_EMBED_LEN_MASK (((1 << MRB_STR_EMBED_LEN_BITSIZE) - 1) << MRB_STR_EMBED_LEN_SHIFT)
+#define MRB_STR_EMBED_LEN_BIT 5
+#define MRB_STR_EMBED_LEN_MASK (((1 << MRB_STR_EMBED_LEN_BIT) - 1) << MRB_STR_EMBED_LEN_SHIFT)
#define MRB_STR_TYPE_MASK (MRB_STR_POOL - 1)
@@ -447,7 +447,7 @@ MRB_API int mrb_str_cmp(mrb_state *mrb, mrb_value str1, mrb_value str2);
*/
MRB_API char *mrb_str_to_cstr(mrb_state *mrb, mrb_value str);
-mrb_value mrb_str_pool(mrb_state *mrb, mrb_value str);
+mrb_value mrb_str_pool(mrb_state *mrb, const char *s, mrb_int len, mrb_bool nofree);
uint32_t mrb_str_hash(mrb_state *mrb, mrb_value str);
mrb_value mrb_str_dump(mrb_state *mrb, mrb_value str);
@@ -465,7 +465,8 @@ mrb_bool mrb_str_beg_len(mrb_int str_len, mrb_int *begp, mrb_int *lenp);
mrb_value mrb_str_byte_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len);
#ifdef MRB_UTF8_STRING
-mrb_int mrb_utf8_len(const char *str, mrb_int byte_len);
+mrb_int mrb_utf8len(const char *str, const char *end);
+mrb_int mrb_utf8_strlen(const char *str, mrb_int byte_len);
#endif
MRB_END_DECL
diff --git a/include/mruby/value.h b/include/mruby/value.h
index 84ea7fb0a..33c70f15a 100644
--- a/include/mruby/value.h
+++ b/include/mruby/value.h
@@ -34,10 +34,6 @@ typedef uint32_t mrb_sym;
typedef uint8_t mrb_bool;
struct mrb_state;
-#if defined(MRB_INT16) && defined(MRB_INT64)
-# error "You can't define MRB_INT16 and MRB_INT64 at the same time."
-#endif
-
#if defined _MSC_VER && _MSC_VER < 1800
# define PRIo64 "llo"
# define PRId64 "lld"
@@ -63,14 +59,6 @@ struct mrb_state;
# define MRB_PRIo PRIo64
# define MRB_PRId PRId64
# define MRB_PRIx PRIx64
-#elif defined(MRB_INT16)
- typedef int16_t mrb_int;
-# define MRB_INT_BIT 16
-# define MRB_INT_MIN (INT16_MIN>>MRB_FIXNUM_SHIFT)
-# define MRB_INT_MAX (INT16_MAX>>MRB_FIXNUM_SHIFT)
-# define MRB_PRIo PRIo16
-# define MRB_PRId PRId16
-# define MRB_PRIx PRIx16
#else
typedef int32_t mrb_int;
# define MRB_INT_BIT 32
@@ -161,6 +149,13 @@ typedef void mrb_value;
#endif
+#if defined(MRB_WORD_BOXING) || (defined(MRB_NAN_BOXING) && defined(MRB_64BIT))
+struct RCptr {
+ MRB_OBJECT_HEADER;
+ void *p;
+};
+#endif
+
#if defined(MRB_NAN_BOXING)
#include "boxing_nan.h"
#elif defined(MRB_WORD_BOXING)
@@ -169,9 +164,15 @@ typedef void mrb_value;
#include "boxing_no.h"
#endif
-#if !defined(MRB_SYMBOL_BITSIZE)
-#define MRB_SYMBOL_BITSIZE (sizeof(mrb_sym) * CHAR_BIT)
-#define MRB_SYMBOL_MAX UINT32_MAX
+#define MRB_SYMBOL_BIT (sizeof(mrb_sym) * CHAR_BIT - MRB_SYMBOL_SHIFT)
+#define MRB_SYMBOL_MAX (UINT32_MAX >> MRB_SYMBOL_SHIFT)
+
+#if INTPTR_MAX < MRB_INT_MAX
+ typedef intptr_t mrb_ssize;
+# define MRB_SSIZE_MAX (INTPTR_MAX>>MRB_FIXNUM_SHIFT)
+#else
+ typedef mrb_int mrb_ssize;
+# define MRB_SSIZE_MAX MRB_INT_MAX
#endif
#ifndef mrb_immediate_p
diff --git a/include/mruby/version.h b/include/mruby/version.h
index 1c7655a47..f4ef21021 100644
--- a/include/mruby/version.h
+++ b/include/mruby/version.h
@@ -42,12 +42,12 @@ MRB_BEGIN_DECL
/*
* Minor release version number.
*/
-#define MRUBY_RELEASE_MINOR 0
+#define MRUBY_RELEASE_MINOR 1
/*
* Tiny release version number.
*/
-#define MRUBY_RELEASE_TEENY 1
+#define MRUBY_RELEASE_TEENY 0
/*
* The mruby version.
@@ -67,12 +67,12 @@ MRB_BEGIN_DECL
/*
* Release month.
*/
-#define MRUBY_RELEASE_MONTH 4
+#define MRUBY_RELEASE_MONTH 11
/*
* Release day.
*/
-#define MRUBY_RELEASE_DAY 4
+#define MRUBY_RELEASE_DAY 19
/*
* Release date as a string.
diff --git a/lib/mruby-core-ext.rb b/lib/mruby-core-ext.rb
index 7b78bfa91..433f1bb1a 100644
--- a/lib/mruby-core-ext.rb
+++ b/lib/mruby-core-ext.rb
@@ -20,27 +20,8 @@ class String
end
end
-$pp_show = true
-
-if $verbose.nil?
- if Rake.respond_to?(:verbose) && !Rake.verbose.nil?
- if Rake.verbose.class == TrueClass
- # verbose message logging
- $pp_show = false
- else
- $pp_show = true
- Rake.verbose(false)
- end
- else
- # could not identify rake version
- $pp_show = false
- end
-else
- $pp_show = false if $verbose
-end
-
def _pp(cmd, src, tgt=nil, options={})
- return unless $pp_show
+ return if Rake.verbose
width = 5
template = options[:indent] ? "%#{width*options[:indent]}s %s %s" : "%-#{width}s %s %s"
diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb
index 55b82cd2b..8154b2b19 100644
--- a/lib/mruby/build.rb
+++ b/lib/mruby/build.rb
@@ -173,7 +173,7 @@ module MRuby
obj = objfile(cxx_src) if obj.nil?
file cxx_src => [src, __FILE__] do |t|
- FileUtils.mkdir_p File.dirname t.name
+ mkdir_p File.dirname t.name
IO.write t.name, <<EOS
#define __STDC_CONSTANT_MACROS
#define __STDC_LIMIT_MACROS
@@ -276,14 +276,6 @@ EOS
end
end
- def cygwin_filename(name)
- if name.is_a?(Array)
- name.flatten.map { |n| cygwin_filename(n) }
- else
- `cygpath -w "#{filename(name)}"`.strip
- end
- end
-
def exefile(name)
if name.is_a?(Array)
name.flatten.map { |n| exefile(n) }
@@ -320,7 +312,7 @@ EOS
end
def verbose_flag
- $verbose ? ' -v' : ''
+ Rake.verbose ? ' -v' : ''
end
def run_test
@@ -344,7 +336,8 @@ EOS
puts " Binaries: #{@bins.join(', ')}" unless @bins.empty?
unless @gems.empty?
puts " Included Gems:"
- @gems.map do |gem|
+ gems = @gems.sort_by { |gem| gem.name }
+ gems.each do |gem|
gem_version = " - #{gem.version}" if gem.version != '0.0.0'
gem_summary = " - #{gem.summary}" if gem.summary
puts " #{gem.name}#{gem_version}#{gem_summary}"
@@ -386,7 +379,7 @@ EOS
end
def run_test
- @test_runner.runner_options << ' -v' if $verbose
+ @test_runner.runner_options << verbose_flag
mrbtest = exefile("#{build_dir}/bin/mrbtest")
if (@test_runner.command == nil)
puts "You should run #{mrbtest} on target device."
diff --git a/lib/mruby/build/command.rb b/lib/mruby/build/command.rb
index 0a6d6b818..bed0c3a6a 100644
--- a/lib/mruby/build/command.rb
+++ b/lib/mruby/build/command.rb
@@ -4,7 +4,7 @@ module MRuby
class Command
include Rake::DSL
extend Forwardable
- def_delegators :@build, :filename, :objfile, :libfile, :exefile, :cygwin_filename
+ def_delegators :@build, :filename, :objfile, :libfile, :exefile
attr_accessor :build, :command
def initialize(build)
@@ -58,9 +58,9 @@ module MRuby
@source_exts = source_exts
@include_paths = ["#{MRUBY_ROOT}/include"]
@defines = %w()
- @option_include_path = '-I%s'
- @option_define = '-D%s'
- @compile_options = '%{flags} -o %{outfile} -c %{infile}'
+ @option_include_path = %q[-I"%s"]
+ @option_define = %q[-D"%s"]
+ @compile_options = %q[%{flags} -o "%{outfile}" -c "%{infile}"]
@cxx_invalid_flags = []
end
@@ -79,25 +79,16 @@ module MRuby
def all_flags(_defines=[], _include_paths=[], _flags=[])
define_flags = [defines, _defines].flatten.map{ |d| option_define % d }
include_path_flags = [include_paths, _include_paths].flatten.map do |f|
- if MRUBY_BUILD_HOST_IS_CYGWIN
- option_include_path % cygwin_filename(f)
- else
- option_include_path % filename(f)
- end
+ option_include_path % filename(f)
end
[flags, define_flags, include_path_flags, _flags].flatten.join(' ')
end
def run(outfile, infile, _defines=[], _include_paths=[], _flags=[])
- FileUtils.mkdir_p File.dirname(outfile)
+ mkdir_p File.dirname(outfile)
_pp "CC", infile.relative_path, outfile.relative_path
- if MRUBY_BUILD_HOST_IS_CYGWIN
- _run compile_options, { :flags => all_flags(_defines, _include_paths, _flags),
- :infile => cygwin_filename(infile), :outfile => cygwin_filename(outfile) }
- else
- _run compile_options, { :flags => all_flags(_defines, _include_paths, _flags),
- :infile => filename(infile), :outfile => filename(outfile) }
- end
+ _run compile_options, { :flags => all_flags(_defines, _include_paths, _flags),
+ :infile => filename(infile), :outfile => filename(outfile) }
end
def define_rules(build_dir, source_dir='')
@@ -184,18 +175,14 @@ module MRuby
@flags_before_libraries, @flags_after_libraries = [], []
@libraries = []
@library_paths = []
- @option_library = '-l%s'
- @option_library_path = '-L%s'
- @link_options = "%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}"
+ @option_library = %q[-l"%s"]
+ @option_library_path = %q[-L"%s"]
+ @link_options = %Q[%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}]
end
def all_flags(_library_paths=[], _flags=[])
library_path_flags = [library_paths, _library_paths].flatten.map do |f|
- if MRUBY_BUILD_HOST_IS_CYGWIN
- option_library_path % cygwin_filename(f)
- else
- option_library_path % filename(f)
- end
+ option_library_path % filename(f)
end
[flags, library_path_flags, _flags].flatten.join(' ')
end
@@ -205,23 +192,15 @@ module MRuby
end
def run(outfile, objfiles, _libraries=[], _library_paths=[], _flags=[], _flags_before_libraries=[], _flags_after_libraries=[])
- FileUtils.mkdir_p File.dirname(outfile)
+ mkdir_p File.dirname(outfile)
library_flags = [libraries, _libraries].flatten.map { |d| option_library % d }
_pp "LD", outfile.relative_path
- if MRUBY_BUILD_HOST_IS_CYGWIN
- _run link_options, { :flags => all_flags(_library_paths, _flags),
- :outfile => cygwin_filename(outfile) , :objs => cygwin_filename(objfiles).join(' '),
- :flags_before_libraries => [flags_before_libraries, _flags_before_libraries].flatten.join(' '),
- :flags_after_libraries => [flags_after_libraries, _flags_after_libraries].flatten.join(' '),
- :libs => library_flags.join(' ') }
- else
- _run link_options, { :flags => all_flags(_library_paths, _flags),
- :outfile => filename(outfile) , :objs => filename(objfiles).join(' '),
- :flags_before_libraries => [flags_before_libraries, _flags_before_libraries].flatten.join(' '),
- :flags_after_libraries => [flags_after_libraries, _flags_after_libraries].flatten.join(' '),
- :libs => library_flags.join(' ') }
- end
+ _run link_options, { :flags => all_flags(_library_paths, _flags),
+ :outfile => filename(outfile) , :objs => filename(objfiles).map{|f| %Q["#{f}"]}.join(' '),
+ :flags_before_libraries => [flags_before_libraries, _flags_before_libraries].flatten.join(' '),
+ :flags_after_libraries => [flags_after_libraries, _flags_after_libraries].flatten.join(' '),
+ :libs => library_flags.join(' ') }
end
end
@@ -231,17 +210,13 @@ module MRuby
def initialize(build)
super
@command = ENV['AR'] || 'ar'
- @archive_options = 'rs %{outfile} %{objs}'
+ @archive_options = 'rs "%{outfile}" %{objs}'
end
def run(outfile, objfiles)
- FileUtils.mkdir_p File.dirname(outfile)
+ mkdir_p File.dirname(outfile)
_pp "AR", outfile.relative_path
- if MRUBY_BUILD_HOST_IS_CYGWIN
- _run archive_options, { :outfile => cygwin_filename(outfile), :objs => cygwin_filename(objfiles).join(' ') }
- else
- _run archive_options, { :outfile => filename(outfile), :objs => filename(objfiles).join(' ') }
- end
+ _run archive_options, { :outfile => filename(outfile), :objs => filename(objfiles).map{|f| %Q["#{f}"]}.join(' ') }
end
end
@@ -251,11 +226,11 @@ module MRuby
def initialize(build)
super
@command = 'bison'
- @compile_options = '-o %{outfile} %{infile}'
+ @compile_options = %q[-o "%{outfile}" "%{infile}"]
end
def run(outfile, infile)
- FileUtils.mkdir_p File.dirname(outfile)
+ mkdir_p File.dirname(outfile)
_pp "YACC", infile.relative_path, outfile.relative_path
_run compile_options, { :outfile => filename(outfile) , :infile => filename(infile) }
end
@@ -267,11 +242,11 @@ module MRuby
def initialize(build)
super
@command = 'gperf'
- @compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
+ @compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"]
end
def run(outfile, infile)
- FileUtils.mkdir_p File.dirname(outfile)
+ mkdir_p File.dirname(outfile)
_pp "GPERF", infile.relative_path, outfile.relative_path
_run compile_options, { :outfile => filename(outfile) , :infile => filename(infile) }
end
@@ -279,36 +254,42 @@ module MRuby
class Command::Git < Command
attr_accessor :flags
- attr_accessor :clone_options, :pull_options, :checkout_options, :reset_options
+ attr_accessor :clone_options, :pull_options, :checkout_options, :checkout_detach_options, :reset_options
def initialize(build)
super
@command = 'git'
@flags = %w[]
@clone_options = "clone %{flags} %{url} %{dir}"
- @pull_options = "--git-dir #{shellquote("%{repo_dir}/.git")} --work-tree #{shellquote("%{repo_dir}")} pull"
- @checkout_options = "--git-dir #{shellquote("%{repo_dir}/.git")} --work-tree #{shellquote("%{repo_dir}")} checkout %{checksum_hash}"
- @reset_options = "--git-dir #{shellquote("%{repo_dir}/.git")} --work-tree #{shellquote("%{repo_dir}")} reset %{checksum_hash}"
+ @pull_options = "--git-dir %{repo_dir}/.git --work-tree %{repo_dir} pull"
+ @checkout_options = "--git-dir %{repo_dir}/.git --work-tree %{repo_dir} checkout %{checksum_hash}"
+ @checkout_detach_options = "--git-dir %{repo_dir}/.git --work-tree %{repo_dir} checkout --detach %{checksum_hash}"
+ @reset_options = "--git-dir %{repo_dir}/.git --work-tree %{repo_dir} reset %{checksum_hash}"
end
def run_clone(dir, url, _flags = [])
_pp "GIT", url, dir.relative_path
- _run clone_options, { :flags => [flags, _flags].flatten.join(' '), :url => url, :dir => filename(dir) }
+ _run clone_options, { :flags => [flags, _flags].flatten.join(' '), :url => shellquote(url), :dir => shellquote(filename(dir)) }
end
def run_pull(dir, url)
_pp "GIT PULL", url, dir.relative_path
- _run pull_options, { :repo_dir => dir }
+ _run pull_options, { :repo_dir => shellquote(dir) }
end
def run_checkout(dir, checksum_hash)
- _pp "GIT CHECKOUT", checksum_hash
- _run checkout_options, { :checksum_hash => checksum_hash, :repo_dir => dir }
+ _pp "GIT CHECKOUT", dir, checksum_hash
+ _run checkout_options, { :checksum_hash => checksum_hash, :repo_dir => shellquote(dir) }
+ end
+
+ def run_checkout_detach(dir, checksum_hash)
+ _pp "GIT CHECKOUT DETACH", dir, checksum_hash
+ _run checkout_detach_options, { :checksum_hash => checksum_hash, :repo_dir => shellquote(dir) }
end
def run_reset_hard(dir, checksum_hash)
- _pp "GIT RESET", checksum_hash
- _run reset_options, { :checksum_hash => checksum_hash, :repo_dir => dir }
+ _pp "GIT RESET", dir, checksum_hash
+ _run reset_options, { :checksum_hash => checksum_hash, :repo_dir => shellquote(dir) }
end
def commit_hash(dir)
@@ -335,8 +316,8 @@ module MRuby
infiles.each do |f|
_pp "MRBC", f.relative_path, nil, :indent => 2
end
- cmd = "#{filename @command} #{@compile_options % {:funcname => funcname}} #{filename(infiles).join(' ')}"
- print("#{cmd}\n") if $verbose
+ cmd = %Q["#{filename @command}" #{@compile_options % {:funcname => funcname}} #{filename(infiles).map{|f| %Q["#{f}"]}.join(' ')}]
+ puts cmd if Rake.verbose
IO.popen(cmd, 'r+') do |io|
out.puts io.read
end
diff --git a/lib/mruby/build/load_gems.rb b/lib/mruby/build/load_gems.rb
index 9f09167ba..522b8a17e 100644
--- a/lib/mruby/build/load_gems.rb
+++ b/lib/mruby/build/load_gems.rb
@@ -13,13 +13,12 @@ module MRuby
end
def gem(gemdir, &block)
- caller_dir = File.expand_path(File.dirname(/^(.*?):\d/.match(caller.first).to_a[1]))
-
if gemdir.is_a?(Hash)
gemdir = load_special_path_gem(gemdir)
elsif GemBox.path && gemdir.is_a?(String)
gemdir = File.expand_path(gemdir, File.dirname(GemBox.path))
else
+ caller_dir = File.expand_path(File.dirname(caller(1,1)[0][/^(.*?):\d/,1]))
gemdir = File.expand_path(gemdir, caller_dir)
end
@@ -58,7 +57,7 @@ module MRuby
if File.exist? mgem_list_dir
git.run_pull mgem_list_dir, mgem_list_url if $pull_gems
else
- FileUtils.mkdir_p mgem_list_dir
+ mkdir_p mgem_list_dir
git.run_clone mgem_list_dir, mgem_list_url, "--depth 1"
end
@@ -87,28 +86,27 @@ module MRuby
if File.exist?(gemdir)
if $pull_gems
- git.run_pull gemdir, url
# Jump to the top of the branch
- git.run_checkout(gemdir, branch)
- git.run_reset_hard gemdir, "origin/#{branch}"
+ git.run_checkout gemdir, branch
+ git.run_pull gemdir, url
elsif params[:checksum_hash]
- git.run_reset_hard(gemdir, params[:checksum_hash])
+ git.run_checkout_detach gemdir, params[:checksum_hash]
elsif lock
- git.run_reset_hard(gemdir, lock['commit'])
+ git.run_checkout_detach gemdir, lock['commit']
end
else
options = [params[:options]] || []
options << "--recursive"
options << "--branch \"#{branch}\""
options << "--depth 1" unless params[:checksum_hash]
- FileUtils.mkdir_p "#{gem_clone_dir}"
+ mkdir_p "#{gem_clone_dir}"
git.run_clone gemdir, url, options
# Jump to the specified commit
if params[:checksum_hash]
- git.run_reset_hard gemdir, params[:checksum_hash]
+ git.run_checkout_detach gemdir, params[:checksum_hash]
elsif lock
- git.run_reset_hard gemdir, lock['commit']
+ git.run_checkout_detach gemdir, lock['commit']
end
end
diff --git a/lib/mruby/gem.rb b/lib/mruby/gem.rb
index a1cdb28af..4c3cd7f02 100644
--- a/lib/mruby/gem.rb
+++ b/lib/mruby/gem.rb
@@ -106,6 +106,15 @@ module MRuby
define_gem_init_builder if @generate_functions
end
+ def for_windows?
+ if build.kind_of?(MRuby::CrossBuild)
+ return %w(x86_64-w64-mingw32 i686-w64-mingw32).include?(build.host_target)
+ elsif build.kind_of?(MRuby::Build)
+ return ('A'..'Z').to_a.any? { |vol| Dir.exist?("#{vol}:") }
+ end
+ return false
+ end
+
def add_dependency(name, *requirements)
default_gem = requirements.last.kind_of?(Hash) ? requirements.pop : nil
requirements = ['>= 0.0.0'] if requirements.empty?
@@ -157,7 +166,7 @@ module MRuby
def define_gem_init_builder
file objfile("#{build_dir}/gem_init") => [ "#{build_dir}/gem_init.c", File.join(dir, "mrbgem.rake") ]
file "#{build_dir}/gem_init.c" => [build.mrbcfile, __FILE__] + [rbfiles].flatten do |t|
- FileUtils.mkdir_p build_dir
+ mkdir_p build_dir
generate_gem_init("#{build_dir}/gem_init.c")
end
end
diff --git a/lib/mruby/source.rb b/lib/mruby/source.rb
index 5819a322b..a305c7b04 100644
--- a/lib/mruby/source.rb
+++ b/lib/mruby/source.rb
@@ -6,7 +6,9 @@ module MRuby
ROOT = Pathname.new(File.expand_path('../../../',__FILE__))
# Reads a constant defined at version.h
- MRUBY_READ_VERSION_CONSTANT = Proc.new { |name| ROOT.join('include','mruby','version.h').read.match(/^#define #{name} +"?([\w\. ]+)"?$/)[1] }
+ MRUBY_READ_VERSION_CONSTANT = Proc.new do |name|
+ ROOT.join('include','mruby','version.h').read.match(/^#define #{name} +"?([\w\. ]+)"?\r?$/)[1]
+ end
MRUBY_RUBY_VERSION = MRUBY_READ_VERSION_CONSTANT['MRUBY_RUBY_VERSION']
MRUBY_RUBY_ENGINE = MRUBY_READ_VERSION_CONSTANT['MRUBY_RUBY_ENGINE']
diff --git a/minirake b/minirake
index 8df395e97..3a9d2f8cb 100755
--- a/minirake
+++ b/minirake
@@ -1,621 +1,2 @@
-#!/usr/bin/env ruby
-
-# Original is https://github.com/jimweirich/rake/
-# Copyright (c) 2003 Jim Weirich
-# License: MIT-LICENSE
-
-require 'getoptlong'
-require 'fileutils'
-
-$rake_fiber_table = {}
-$rake_jobs = 1
-$rake_failed = []
-
-class String
- def ext(newext='')
- return self.dup if ['.', '..'].include? self
- if newext != ''
- newext = (newext =~ /^\./) ? newext : ("." + newext)
- end
- self.chomp(File.extname(self)) << newext
- end
-
- def pathmap(spec=nil, &block)
- return self if spec.nil?
- result = ''
- spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
- case frag
- when '%f'
- result << File.basename(self)
- when '%n'
- result << File.basename(self).ext
- when '%d'
- result << File.dirname(self)
- when '%x'
- result << File.extname(self)
- when '%X'
- result << self.ext
- when '%p'
- result << self
- when '%s'
- result << (File::ALT_SEPARATOR || File::SEPARATOR)
- when '%-'
- # do nothing
- when '%%'
- result << "%"
- when /%(-?\d+)d/
- result << pathmap_partial($1.to_i)
- when /^%\{([^}]*)\}(\d*[dpfnxX])/
- patterns, operator = $1, $2
- result << pathmap('%' + operator).pathmap_replace(patterns, &block)
- when /^%/
- fail ArgumentError, "Unknown pathmap specifier #{frag} in '#{spec}'"
- else
- result << frag
- end
- end
- result
- end
-end
-
-module MiniRake
- class Task
- TASKS = Hash.new
- RULES = Array.new
-
- # List of prerequisites for a task.
- attr_reader :prerequisites
-
- # Source dependency for rule synthesized tasks. Nil if task was not
- # sythesized from a rule.
- attr_accessor :source
-
- # Create a task named +task_name+ with no actions or prerequisites..
- # use +enhance+ to add actions and prerequisites.
- def initialize(task_name)
- @name = task_name
- @prerequisites = []
- @actions = []
- end
-
- # Enhance a task with prerequisites or actions. Returns self.
- def enhance(deps=nil, &block)
- @prerequisites |= deps if deps
- @actions << block if block_given?
- self
- end
-
- # Name of the task.
- def name
- @name.to_s
- end
-
- def done?; @done end
- def running?; @running end
-
- # Invoke the task if it is needed. Prerequisites are invoked first.
- def invoke
- puts "Invoke #{name} (already=[#{@already_invoked}], needed=[#{needed?}])" if $trace
- return if @already_invoked
- prerequisites = @prerequisites.collect{ |n| n.is_a?(Proc) ? n.call(name) : n }.flatten
- prerequisites.each do |n|
- t = Task[n]
- unless t.done?
- return prerequisites.select{|v| v = Task[v]; v && (!v.done? || !v.running?) }
- end
- end
-
- @already_invoked = true
-
- if needed?
- @running = true
- if $rake_root_fiber
- return Fiber.new do
- self.execute
- $rake_root_fiber.transfer
- end
- else
- self.execute
- end
- end
-
- @done = true
- end
-
- # Execute the actions associated with this task.
- def execute
- puts "Execute #{name}" if $trace
- self.class.enhance_with_matching_rule(name) if @actions.empty?
- unless $dryrun
- @actions.each { |act| act.call(self) }
- end
- @done = true
- @running = false
- end
-
- # Is this task needed?
- def needed?
- true
- end
-
- # Timestamp for this task. Basic tasks return the current time for
- # their time stamp. Other tasks can be more sophisticated.
- def timestamp
- Time.now
- end
-
- # Class Methods ----------------------------------------------------
-
- class << self
-
- # Clear the task list. This cause rake to immediately forget all
- # the tasks that have been assigned. (Normally used in the unit
- # tests.)
- def clear
- TASKS.clear
- RULES.clear
- end
-
- # List of all defined tasks.
- def tasks
- TASKS.keys.sort.collect { |tn| Task[tn] }
- end
-
- # Return a task with the given name. If the task is not currently
- # known, try to synthesize one from the defined rules. If no
- # rules are found, but an existing file matches the task name,
- # assume it is a file task with no dependencies or actions.
- def [](task_name)
- task_name = task_name.to_s
- if task = TASKS[task_name]
- return task
- end
- if task = enhance_with_matching_rule(task_name)
- return task
- end
- if File.exist?(task_name)
- return FileTask.define_task(task_name)
- end
- fail "Don't know how to rake #{task_name}"
- end
-
- # Define a task given +args+ and an option block. If a rule with
- # the given name already exists, the prerequisites and actions are
- # added to the existing task.
- def define_task(args, &block)
- task_name, deps = resolve_args(args)
- lookup(task_name).enhance([deps].flatten, &block)
- end
-
- # Define a rule for synthesizing tasks.
- def create_rule(args, &block)
- pattern, deps = resolve_args(args)
- pattern = Regexp.new(Regexp.quote(pattern) + '$') if String === pattern
- RULES << [pattern, deps, block]
- end
-
-
- # Lookup a task. Return an existing task if found, otherwise
- # create a task of the current type.
- def lookup(task_name)
- name = task_name.to_s
- TASKS[name] ||= self.new(name)
- end
-
- # If a rule can be found that matches the task name, enhance the
- # task with the prerequisites and actions from the rule. Set the
- # source attribute of the task appropriately for the rule. Return
- # the enhanced task or nil of no rule was found.
- def enhance_with_matching_rule(task_name, level=0)
- fail "Rule Recursion Too Deep: #{task_name}" if level >= 16
- RULES.each do |pattern, extensions, block|
- next unless pattern && pattern.match(task_name)
- sources = extensions.flat_map do |ext|
- case ext
- when /%/
- task_name.pathmap(ext)
- when %r{/}
- ext
- when /^\./
- source = task_name.sub(pattern, ext)
- source == ext ? task_name.ext(ext) : source
- when String
- ext
- when Proc, Method
- ext.arity == 1 ? ext.call(task_name) : ext.call
- else
- fail "Don't know how to handle rule dependent: #{ext.inspect}"
- end
- end
- prereqs = sources.map do |source|
- if File.exist?(source) || TASKS[source]
- source
- elsif parent = enhance_with_matching_rule(source, level + 1)
- parent.name
- else
- break nil
- end
- end
- if prereqs
- task = FileTask.define_task(task_name => prereqs, &block)
- task.source = prereqs.first
- return task
- end
- end
- nil
- end
-
- private
-
- # Resolve the arguments for a task/rule.
- def resolve_args(args)
- case args
- when Hash
- fail "Too Many Task Names: #{args.keys.join(' ')}" if args.size > 1
- fail "No Task Name Given" if args.size < 1
- task_name = args.keys[0]
- deps = args[task_name]
- deps = [deps] if (String===deps) || (Regexp===deps) || (Proc===deps)
- else
- task_name = args
- deps = []
- end
- [task_name, deps]
- end
- end
- end
-
-
- ######################################################################
- class FileTask < Task
- # Is this file task needed? Yes if it doesn't exist, or if its time
- # stamp is out of date.
- def needed?
- return true unless File.exist?(name)
- prerequisites = @prerequisites.collect{ |n| n.is_a?(Proc) ? n.call(name) : n }.flatten
- latest_prereq = prerequisites.collect{|n| Task[n].timestamp}.max
- return false if latest_prereq.nil?
- timestamp < latest_prereq
- end
-
- # Time stamp for file task.
- def timestamp
- return Time.at(0) unless File.exist?(name)
- stat = File::stat(name.to_s)
- stat.directory? ? Time.at(0) : stat.mtime
- end
- end
-
- module DSL
- # Declare a basic task.
- def task(args, &block)
- MiniRake::Task.define_task(args, &block)
- end
-
- # Declare a file task.
- def file(args, &block)
- MiniRake::FileTask.define_task(args, &block)
- end
-
- # Declare a set of files tasks to create the given directories on
- # demand.
- def directory(args, &block)
- MiniRake::FileTask.define_task(args) do |t|
- block.call(t) unless block.nil?
- dir = args.is_a?(Hash) ? args.keys.first : args
- (dir.split(File::SEPARATOR) + ['']).inject do |acc, part|
- (acc + File::SEPARATOR).tap do |d|
- Dir.mkdir(d) unless File.exists? d
- end + part
- end
- end
- end
-
- # Declare a rule for auto-tasks.
- def rule(args, &block)
- MiniRake::Task.create_rule(args, &block)
- end
-
- # Write a message to standard out if $verbose is enabled.
- def log(msg)
- print " " if $trace && $verbose
- puts msg if $verbose
- end
-
- # Run the system command +cmd+.
- def sh(cmd)
- puts cmd if $verbose
-
- if !$rake_root_fiber || Fiber.current == $rake_root_fiber
- system(cmd) or fail "Command Failed: [#{cmd}]"
- return
- end
-
- pid = Process.spawn(cmd)
- $rake_fiber_table[pid] = {
- fiber: Fiber.current,
- command: cmd,
- process_waiter: Process.detach(pid)
- }
- $rake_root_fiber.transfer
- end
-
- def desc(text)
- end
- end
-end
-
-Rake = MiniRake
-extend MiniRake::DSL
-
-
-######################################################################
-# Task Definition Functions ...
-
-######################################################################
-# Rake main application object. When invoking +rake+ from the command
-# line, a RakeApp object is created and run.
-#
-class RakeApp
- RAKEFILES = ['rakefile', 'Rakefile']
-
- OPTIONS = [
- ['--dry-run', '-n', GetoptLong::NO_ARGUMENT,
- "Do a dry run without executing actions."],
- ['--help', '-H', GetoptLong::NO_ARGUMENT,
- "Display this help message."],
- ['--libdir', '-I', GetoptLong::REQUIRED_ARGUMENT,
- "Include LIBDIR in the search path for required modules."],
- ['--nosearch', '-N', GetoptLong::NO_ARGUMENT,
- "Do not search parent directories for the Rakefile."],
- ['--quiet', '-q', GetoptLong::NO_ARGUMENT,
- "Do not log messages to standard output (default)."],
- ['--rakefile', '-f', GetoptLong::REQUIRED_ARGUMENT,
- "Use FILE as the rakefile."],
- ['--require', '-r', GetoptLong::REQUIRED_ARGUMENT,
- "Require MODULE before executing rakefile."],
- ['--tasks', '-T', GetoptLong::NO_ARGUMENT,
- "Display the tasks and dependencies, then exit."],
- ['--pull-gems','-p', GetoptLong::NO_ARGUMENT,
- "Pull all git mrbgems."],
- ['--trace', '-t', GetoptLong::NO_ARGUMENT,
- "Turn on invoke/execute tracing."],
- ['--usage', '-h', GetoptLong::NO_ARGUMENT,
- "Display usage."],
- ['--verbose', '-v', GetoptLong::NO_ARGUMENT,
- "Log message to standard output."],
- ['--directory', '-C', GetoptLong::REQUIRED_ARGUMENT,
- "Change executing directory of rakefiles."],
- ['--jobs', '-j', GetoptLong::REQUIRED_ARGUMENT,
- 'Execute rake with parallel jobs.']
- ]
-
- # Create a RakeApp object.
- def initialize
- @rakefile = nil
- @nosearch = false
- end
-
- # True if one of the files in RAKEFILES is in the current directory.
- # If a match is found, it is copied into @rakefile.
- def have_rakefile
- RAKEFILES.each do |fn|
- if File.exist?(fn)
- @rakefile = fn
- return true
- end
- end
- return false
- end
-
- # Display the program usage line.
- def usage
- puts "rake [-f rakefile] {options} targets..."
- end
-
- # Display the rake command line help.
- def help
- usage
- puts
- puts "Options are ..."
- puts
- OPTIONS.sort.each do |long, short, mode, desc|
- if mode == GetoptLong::REQUIRED_ARGUMENT
- if desc =~ /\b([A-Z]{2,})\b/
- long = long + "=#{$1}"
- end
- end
- printf " %-20s (%s)\n", long, short
- printf " %s\n", desc
- end
- end
-
- # Display the tasks and dependencies.
- def display_tasks
- MiniRake::Task.tasks.each do |t|
- puts "#{t.class} #{t.name}"
- t.prerequisites.each { |pre| puts " #{pre}" }
- end
- end
-
- # Return a list of the command line options supported by the
- # program.
- def command_line_options
- OPTIONS.collect { |lst| lst[0..-2] }
- end
-
- # Do the option defined by +opt+ and +value+.
- def do_option(opt, value)
- case opt
- when '--dry-run'
- $dryrun = true
- $trace = true
- when '--help'
- help
- exit
- when '--libdir'
- $:.push(value)
- when '--nosearch'
- @nosearch = true
- when '--quiet'
- $verbose = false
- when '--rakefile'
- RAKEFILES.clear
- RAKEFILES << value
- when '--require'
- require value
- when '--tasks'
- $show_tasks = true
- when '--pull-gems'
- $pull_gems = true
- when '--trace'
- $trace = true
- when '--usage'
- usage
- exit
- when '--verbose'
- $verbose = true
- when '--version'
- puts "rake, version #{RAKEVERSION}"
- exit
- when '--directory'
- Dir.chdir value
- when '--jobs'
- $rake_jobs = [value.to_i, 1].max
- else
- fail "Unknown option: #{opt}"
- end
- end
-
- # Read and handle the command line options.
- def handle_options
- $verbose = false
- $pull_gems = false
- opts = GetoptLong.new(*command_line_options)
- opts.each { |opt, value| do_option(opt, value) }
- end
-
- # Run the +rake+ application.
- def run
- handle_options
-
- unless $rake_root_fiber
- require 'fiber'
- $rake_root_fiber = Fiber.current
- end
-
- begin
- here = Dir.pwd
- while ! have_rakefile
- Dir.chdir("..")
- if Dir.pwd == here || @nosearch
- fail "No Rakefile found (looking for: #{RAKEFILES.join(', ')})"
- end
- here = Dir.pwd
- end
- root_tasks = []
- ARGV.each do |task_name|
- if /^(\w+)=(.*)/.match(task_name)
- ENV[$1] = $2
- else
- root_tasks << task_name
- end
- end
- puts "(in #{Dir.pwd})"
- $rakefile = @rakefile
- load @rakefile
- if $show_tasks
- display_tasks
- else
- root_tasks.push("default") if root_tasks.empty?
- # revese tasks for popping
- root_tasks.reverse!
-
- tasks = []
- until root_tasks.empty?
- root_name = root_tasks.pop
- tasks << root_name
- until tasks.empty?
- task_name = tasks.pop
- t = MiniRake::Task[task_name]
- f = t.invoke
-
- # append additional tasks to task queue
- if f.kind_of?(Array)
- tasks.push(*f)
- tasks.uniq!
- end
-
- unless f.kind_of? Fiber
- tasks.insert 0, task_name unless t.done?
- if root_name == task_name
- wait_process
- end
- next
- end
-
- wait_process while $rake_fiber_table.size >= $rake_jobs
-
- f.transfer
- end
- end
-
- wait_process until $rake_fiber_table.empty?
- end
- rescue Exception => e
- begin
- $rake_failed << e
- wait_process until $rake_fiber_table.empty?
- rescue Exception => next_e
- e = next_e
- retry
- end
- end
-
- return if $rake_failed.empty?
-
- puts "rake aborted!"
- $rake_failed.each do |ex|
- puts ex.message
- if $trace || $verbose
- puts ex.backtrace.join("\n")
- else
- puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || ""
- end
- end
- exit 1
- end
-
- def wait_process(count = 0)
- dur = [0.0001 * (10 ** count), 1].min
- sleep dur
-
- exited = []
- $rake_fiber_table.each do |pid, v|
- exited << pid unless v[:process_waiter].alive?
- end
-
- exited.each do |pid|
- ent = $rake_fiber_table.delete pid
- st = ent[:process_waiter].value
-
- # ignore process that isn't created by `sh` method
- return if ent.nil?
-
- if st.exitstatus != 0
- raise "Command Failed: [#{ent[:command]}]"
- end
-
- fail 'task scheduling bug!' if $rake_fiber_table.size >= $rake_jobs
-
- ent[:fiber].transfer
- end
-
- wait_process(count + 1) if !$rake_fiber_table.empty? && exited.empty?
- end
-
-end
-
-if __FILE__ == $0 then
- RakeApp.new.run
-end
+#! /usr/bin/env ruby
+exec "rake", *ARGV
diff --git a/mrbgems/default.gembox b/mrbgems/default.gembox
index 9859c7d52..d7b627c9e 100644
--- a/mrbgems/default.gembox
+++ b/mrbgems/default.gembox
@@ -89,6 +89,9 @@ MRuby::GemBox.new do |conf|
# Use Method/UnboundMethod class
conf.gem :core => "mruby-method"
+ # Use eval()
+ conf.gem :core => "mruby-eval"
+
# Use mruby-compiler to build other mrbgems
conf.gem :core => "mruby-compiler"
end
diff --git a/mrbgems/mruby-array-ext/mrblib/array.rb b/mrbgems/mruby-array-ext/mrblib/array.rb
index 5492ba2eb..f3246af4f 100644
--- a/mrbgems/mruby-array-ext/mrblib/array.rb
+++ b/mrbgems/mruby-array-ext/mrblib/array.rb
@@ -688,37 +688,6 @@ class Array
##
# call-seq:
- # ary.delete_if { |item| block } -> ary
- # ary.delete_if -> Enumerator
- #
- # Deletes every element of +self+ for which block evaluates to +true+.
- #
- # The array is changed instantly every time the block is called, not after
- # the iteration is over.
- #
- # See also Array#reject!
- #
- # If no block is given, an Enumerator is returned instead.
- #
- # scores = [ 97, 42, 75 ]
- # scores.delete_if {|score| score < 80 } #=> [97]
-
- def delete_if(&block)
- return to_enum :delete_if unless block
-
- idx = 0
- while idx < self.size do
- if block.call(self[idx])
- self.delete_at(idx)
- else
- idx += 1
- end
- end
- self
- end
-
- ##
- # call-seq:
# ary.keep_if { |item| block } -> ary
# ary.keep_if -> Enumerator
#
diff --git a/mrbgems/mruby-array-ext/test/array.rb b/mrbgems/mruby-array-ext/test/array.rb
index cb76559c7..2955ef391 100644
--- a/mrbgems/mruby-array-ext/test/array.rb
+++ b/mrbgems/mruby-array-ext/test/array.rb
@@ -195,12 +195,6 @@ assert("Array#reverse_each") do
b << i
end
assert_equal [ "d", "c", "b", "a" ], b
-
- if Object.const_defined?(:Enumerator)
- assert_equal [ "d", "c", "b", "a" ], a.reverse_each.to_a
- else
- true
- end
end
assert("Array#rotate") do
@@ -305,19 +299,6 @@ end
#assert("Array#bsearch_index") do
#end
-assert("Array#delete_if") do
- a = [1, 2, 3, 4, 5]
- assert_equal [1, 2, 3, 4, 5], a.delete_if { false }
- assert_equal [1, 2, 3, 4, 5], a
-
- a = [1, 2, 3, 4, 5]
- assert_equal [], a.delete_if { true }
- assert_equal [], a
-
- a = [ 1, 2, 3, 4, 5 ]
- assert_equal [1, 2, 3], a.delete_if { |val| val > 3 }
-end
-
assert("Array#keep_if") do
a = [1, 2, 3, 4, 5]
assert_equal [1, 2, 3, 4, 5], a.keep_if { true }
diff --git a/mrbgems/mruby-bin-config/mrbgem.rake b/mrbgems/mruby-bin-config/mrbgem.rake
index 3a0a1b897..c56af435f 100644
--- a/mrbgems/mruby-bin-config/mrbgem.rake
+++ b/mrbgems/mruby-bin-config/mrbgem.rake
@@ -5,19 +5,22 @@ unless MRuby::Build.current.kind_of?(MRuby::CrossBuild)
spec.author = 'mruby developers'
spec.summary = "#{name} command"
+ mruby_config_dir = "#{build.build_dir}/bin"
mruby_config = name + (ENV['OS'] == 'Windows_NT' ? '.bat' : '')
- mruby_config_path = "#{build.build_dir}/bin/#{mruby_config}"
+ mruby_config_path = "#{mruby_config_dir}/#{mruby_config}"
make_cfg = "#{build.build_dir}/lib/libmruby.flags.mak"
tmplt_path = "#{__dir__}/#{mruby_config}"
build.bins << mruby_config
- file mruby_config_path => [make_cfg, tmplt_path] do |t|
+ directory mruby_config_dir
+
+ file mruby_config_path => [mruby_config_dir, make_cfg, tmplt_path] do |t|
config = Hash[File.readlines(make_cfg).map!(&:chomp).map! {|l|
l.gsub('\\"', '"').split(' = ', 2).map! {|s| s.sub(/^(?=.)/, 'echo ')}
}]
tmplt = File.read(tmplt_path)
File.write(t.name, tmplt.gsub(/(#{Regexp.union(*config.keys)})\b/, config))
- FileUtils.chmod(0755, t.name)
+ chmod(0755, t.name)
end
end
end
diff --git a/mrbgems/mruby-bin-debugger/bintest/print.rb b/mrbgems/mruby-bin-debugger/bintest/print.rb
index 6675392b8..a8401963f 100644
--- a/mrbgems/mruby-bin-debugger/bintest/print.rb
+++ b/mrbgems/mruby-bin-debugger/bintest/print.rb
@@ -1,9 +1,10 @@
require 'open3'
require 'tempfile'
+require 'strscan'
class BinTest_MrubyBinDebugger
- @debug1=false
- @debug2=true
+# @debug1=false
+# @debug2=true
def self.test(rubysource, testcase)
script, bin = Tempfile.new(['test', '.rb']), Tempfile.new(['test', '.mrb'])
@@ -19,10 +20,20 @@ class BinTest_MrubyBinDebugger
stdin_data = testcase.map{|t| t[:cmd]}.join("\n") << "\n"
+ prompt = /^\(#{Regexp.escape(script.path)}:\d+\) /
["bin/mrdb #{script.path}","bin/mrdb -b #{bin.path}"].each do |cmd|
o, s = Open3.capture2(cmd, :stdin_data => stdin_data)
+ scanner = StringScanner.new(o)
+ scanner.skip_until(prompt)
+ testcase.each do |tc|
+ exp = tc[:exp]
+ if exp
+ act = scanner.scan_until(/\n/)
+ break unless assert_operator act, :start_with?, exp
+ end
+ scanner.skip_until(prompt)
+ end
- exp_vals = testcase.map{|t| t.fetch(:exp, nil)}
=begin
if @debug1
o.split("\n").each_with_index do |i,actual|
@@ -41,14 +52,6 @@ end
assert_true actual.include?(exp) unless exp.nil?
end
=end
- idx = 0
- exp_vals.each do |exp|
- next if exp.nil?
- idx = o.index(exp, idx)
- assert_false idx.nil?
- break unless idx
- idx += 1
- end
end
end
end
@@ -90,8 +93,8 @@ assert('mruby-bin-debugger(print) error') do
# test case
tc = []
- tc << {:cmd=>"p (1+2", :exp=>'$1 = SyntaxError'}
- tc << {:cmd=>"p bar", :exp=>'$2 = (eval):2: undefined method'}
+ tc << {:cmd=>"p (1+2", :exp=>'$1 = line 1: syntax error'}
+ tc << {:cmd=>"p bar", :exp=>'$2 = undefined method'}
BinTest_MrubyBinDebugger.test(src, tc)
end
@@ -588,7 +591,7 @@ SRC
tc << {:cmd=>'p foo=[foo,bar,baz]', :exp=>'$2 = ["foo", "bar", "baz"]'}
tc << {:cmd=>'p undefined=-1', :exp=>'$3 = -1'}
- tc << {:cmd=>'p "#{undefined}"', :exp=>'$4 = (eval):2: undefined method'}
+ tc << {:cmd=>'p "#{undefined}"', :exp=>'$4 = undefined method'}
BinTest_MrubyBinDebugger.test(src, tc)
end
@@ -626,7 +629,7 @@ SRC
tc << {:cmd=>'p [a,b]', :exp=>'$13 = [20, 10]'}
tc << {:cmd=>'p undefined=-1', :exp=>'$14 = -1'}
- tc << {:cmd=>'p "#{undefined}"', :exp=>'$15 = (eval):2: undefined method'}
+ tc << {:cmd=>'p "#{undefined}"', :exp=>'$15 = undefined method'}
BinTest_MrubyBinDebugger.test(src, tc)
end
@@ -694,8 +697,7 @@ SRC
tc << {:cmd=>'p [a,b]', :exp=>'$13 = [20, 10]'}
tc << {:cmd=>'p undefined=-1', :exp=>'$14 = -1'}
- tc << {:cmd=>'p "#{undefined}"', :exp=>'$15 = (eval):2: undefined method'}
+ tc << {:cmd=>'p "#{undefined}"', :exp=>'$15 = undefined method'}
BinTest_MrubyBinDebugger.test(src, tc)
end
-
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
index d2fa4c856..8fab3c2e8 100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
@@ -5,7 +5,6 @@
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
#include <ctype.h>
#include <mruby.h>
diff --git a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h
index de2f90144..080b0616b 100644
--- a/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h
+++ b/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h
@@ -7,7 +7,11 @@
#define MRDBCONF_H
#ifndef MRB_ENABLE_DEBUG_HOOK
-# error Need 'MRB_ENABLE_DEBUG_HOOK' configuration in your 'build_config.rb'
+# error mruby-bin-debugger need 'MRB_ENABLE_DEBUG_HOOK' configuration in your 'build_config.rb'
+#endif
+
+#ifdef MRB_DISABLE_STDIO
+# error mruby-bin-debugger conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
#endif
/* configuration options: */
diff --git a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
index ac6276dc2..fb973207f 100644
--- a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
+++ b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
@@ -7,6 +7,11 @@
*/
#include <mruby.h>
+
+#ifdef MRB_DISABLE_STDIO
+# error mruby-bin-mirb conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
+#endif
+
#include <mruby/array.h>
#include <mruby/proc.h>
#include <mruby/compile.h>
@@ -17,7 +22,6 @@
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
#include <ctype.h>
#include <signal.h>
diff --git a/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c b/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c
index 4c8c680cb..ee96d77a5 100644
--- a/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c
+++ b/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c
@@ -1,7 +1,11 @@
-#include <stdio.h>
+#include <mruby.h>
+
+#ifdef MRB_DISABLE_STDIO
+# error mruby-bin-mrbc conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
+#endif
+
#include <stdlib.h>
#include <string.h>
-#include <mruby.h>
#include <mruby/compile.h>
#include <mruby/dump.h>
#include <mruby/proc.h>
@@ -32,8 +36,6 @@ usage(const char *name)
"-v print version number, then turn on verbose mode",
"-g produce debugging information",
"-B<symbol> binary <symbol> output in C language format",
- "-e generate little endian iseq data",
- "-E generate big endian iseq data",
"--remove-lv remove local variables",
"--verbose run at verbose mode",
"--version print the version",
@@ -120,10 +122,8 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
args->flags |= DUMP_DEBUG_INFO;
break;
case 'E':
- args->flags = DUMP_ENDIAN_BIG | (args->flags & ~DUMP_ENDIAN_MASK);
- break;
case 'e':
- args->flags = DUMP_ENDIAN_LIL | (args->flags & ~DUMP_ENDIAN_MASK);
+ fprintf(stderr, "%s: -e/-E option no longer needed.\n", args->prog);
break;
case 'h':
return -1;
@@ -156,10 +156,6 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
break;
}
}
- if (args->verbose && args->initname && (args->flags & DUMP_ENDIAN_MASK) == 0) {
- fprintf(stderr, "%s: generating %s endian C file. specify -e/-E for cross compiling.\n",
- args->prog, bigendian_p() ? "big" : "little");
- }
return i;
}
@@ -183,7 +179,7 @@ partial_hook(struct mrb_parser_state *p)
return -1;
}
fn = args->argv[args->idx++];
- p->f = fopen(fn, "r");
+ p->f = fopen(fn, "rb");
if (p->f == NULL) {
fprintf(stderr, "%s: cannot open program file. (%s)\n", args->prog, fn);
return -1;
@@ -210,7 +206,7 @@ load_file(mrb_state *mrb, struct mrbc_args *args)
}
else {
need_close = TRUE;
- if ((infile = fopen(input, "r")) == NULL) {
+ if ((infile = fopen(input, "rb")) == NULL) {
fprintf(stderr, "%s: cannot open program file. (%s)\n", args->prog, input);
return mrb_nil_value();
}
diff --git a/mrbgems/mruby-bin-mruby/bintest/mruby.rb b/mrbgems/mruby-bin-mruby/bintest/mruby.rb
index e032ff79a..9887a2830 100644
--- a/mrbgems/mruby-bin-mruby/bintest/mruby.rb
+++ b/mrbgems/mruby-bin-mruby/bintest/mruby.rb
@@ -39,6 +39,11 @@ assert '$0 value' do
assert_equal '"-e"', `#{cmd('mruby')} -e #{shellquote('p $0')}`.chomp
end
+assert 'ARGV value' do
+ assert_mruby(%{["ab", "cde"]\n}, "", true, %w[-e p(ARGV) ab cde])
+ assert_mruby("[]\n", "", true, %w[-e p(ARGV)])
+end
+
assert('float literal') do
script, bin = Tempfile.new('test.rb'), Tempfile.new('test.mrb')
File.write script.path, 'p [3.21, 2e308.infinite?, -2e308.infinite?]'
@@ -80,10 +85,8 @@ assert('mruby -c option') do
end
assert('mruby -d option') do
- o = `#{cmd('mruby')} -e #{shellquote('p $DEBUG')}`
- assert_equal "false\n", o
- o = `#{cmd('mruby')} -d -e #{shellquote('p $DEBUG')}`
- assert_equal "true\n", o
+ assert_mruby("false\n", "", true, ["-e", "p $DEBUG"])
+ assert_mruby("true\n", "", true, ["-dep $DEBUG"])
end
assert('mruby -e option (no code specified)') do
@@ -125,6 +128,20 @@ assert('mruby -r option (file not found)') do
assert_mruby("", /\A.*: Cannot open library file: .*\n\z/, false, %w[-r _no_exists_])
end
+assert('mruby -v option') do
+ ver_re = '\Amruby \d+\.\d+\.\d+ \(\d+-\d+-\d+\)\n'
+ assert_mruby(/#{ver_re}\z/, "", true, %w[-v])
+ assert_mruby(/#{ver_re}^[^\n]*NODE.*\n:end\n\z/m, "", true, %w[-v -e p(:end)])
+end
+
+assert('mruby --verbose option') do
+ assert_mruby(/\A[^\n]*NODE.*\n:end\n\z/m, "", true, %w[--verbose -e p(:end)])
+end
+
+assert('mruby --') do
+ assert_mruby(%{["-x", "1"]\n}, "", true, %w[-e p(ARGV) -- -x 1])
+end
+
assert('mruby invalid short option') do
assert_mruby("", /\A.*: invalid option -1 .*\n\z/, false, %w[-1])
end
diff --git a/mrbgems/mruby-bin-mruby/mrbgem.rake b/mrbgems/mruby-bin-mruby/mrbgem.rake
index 280621e31..1415013e3 100644
--- a/mrbgems/mruby-bin-mruby/mrbgem.rake
+++ b/mrbgems/mruby-bin-mruby/mrbgem.rake
@@ -4,7 +4,6 @@ MRuby::Gem::Specification.new('mruby-bin-mruby') do |spec|
spec.summary = 'mruby command'
spec.bins = %w(mruby)
spec.add_dependency('mruby-compiler', :core => 'mruby-compiler')
- spec.add_dependency('mruby-error', :core => 'mruby-error')
spec.add_test_dependency('mruby-print', :core => 'mruby-print')
if build.cxx_exception_enabled?
diff --git a/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c b/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
index 461e91918..e5c8f3466 100644
--- a/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
+++ b/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c
@@ -1,7 +1,11 @@
-#include <stdio.h>
+#include <mruby.h>
+
+#ifdef MRB_DISABLE_STDIO
+# error mruby-bin-mruby conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
+#endif
+
#include <stdlib.h>
#include <string.h>
-#include <mruby.h>
#include <mruby/array.h>
#include <mruby/compile.h>
#include <mruby/dump.h>
@@ -9,18 +13,27 @@
struct _args {
FILE *rfp;
- char* cmdline;
+ char *cmdline;
mrb_bool fname : 1;
mrb_bool mrbfile : 1;
mrb_bool check_syntax : 1;
mrb_bool verbose : 1;
+ mrb_bool version : 1;
mrb_bool debug : 1;
int argc;
- char** argv;
+ char **argv;
int libc;
char **libv;
};
+struct options {
+ int argc;
+ char **argv;
+ char *program;
+ char *opt;
+ char short_opt[2];
+};
+
static void
usage(const char *name)
{
@@ -44,6 +57,64 @@ usage(const char *name)
printf(" %s\n", *p++);
}
+static void
+options_init(struct options *opts, int argc, char **argv)
+{
+ opts->argc = argc;
+ opts->argv = argv;
+ opts->program = *argv;
+ *opts->short_opt = 0;
+}
+
+static const char *
+options_opt(struct options *opts)
+{
+ /* concatenated short options (e.g. `-cv`) */
+ if (*opts->short_opt && *++opts->opt) {
+ short_opt:
+ opts->short_opt[0] = *opts->opt;
+ opts->short_opt[1] = 0;
+ return opts->short_opt;
+ }
+
+ while (++opts->argv, --opts->argc) {
+ opts->opt = *opts->argv;
+
+ /* empty || not start with `-` || `-` */
+ if (!opts->opt[0] || opts->opt[0] != '-' || !opts->opt[1]) return NULL;
+
+ if (opts->opt[1] == '-') {
+ /* `--` */
+ if (!opts->opt[2]) {
+ ++opts->argv, --opts->argc;
+ return NULL;
+ }
+ /* long option */
+ opts->opt += 2;
+ *opts->short_opt = 0;
+ return opts->opt;
+ }
+ else {
+ /* short option */
+ ++opts->opt;
+ goto short_opt;
+ }
+ }
+ return NULL;
+}
+
+static const char *
+options_arg(struct options *opts)
+{
+ if (*opts->short_opt && opts->opt[1]) {
+ /* concatenated short option and option argument (e.g. `-rLIBRARY`) */
+ *opts->short_opt = 0;
+ return opts->opt + 1;
+ }
+ --opts->argc, ++opts->argv;
+ return opts->argc ? *opts->argv : NULL;
+}
+
static char *
dup_arg_item(mrb_state *mrb, const char *item)
{
@@ -56,40 +127,24 @@ dup_arg_item(mrb_state *mrb, const char *item)
static int
parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
{
- char **origargv = argv;
static const struct _args args_zero = { 0 };
+ struct options opts[1];
+ const char *opt, *item;
*args = args_zero;
-
- for (argc--,argv++; argc > 0; argc--,argv++) {
- char *item;
- if (argv[0][0] != '-') break;
-
- if (strlen(*argv) <= 1) {
- argc--; argv++;
- args->rfp = stdin;
- break;
- }
-
- item = argv[0] + 1;
- switch (*item++) {
- case 'b':
+ options_init(opts, argc, argv);
+ while ((opt = options_opt(opts))) {
+ if (strcmp(opt, "b") == 0) {
args->mrbfile = TRUE;
- break;
- case 'c':
+ }
+ else if (strcmp(opt, "c") == 0) {
args->check_syntax = TRUE;
- break;
- case 'd':
+ }
+ else if (strcmp(opt, "d") == 0) {
args->debug = TRUE;
- break;
- case 'e':
- if (item[0]) {
- goto append_cmdline;
- }
- else if (argc > 1) {
- argc--; argv++;
- item = argv[0];
-append_cmdline:
+ }
+ else if (strcmp(opt, "e") == 0) {
+ if ((item = options_arg(opts))) {
if (!args->cmdline) {
args->cmdline = dup_arg_item(mrb, item);
}
@@ -106,59 +161,65 @@ append_cmdline:
}
}
else {
- fprintf(stderr, "%s: No code specified for -e\n", *origargv);
+ fprintf(stderr, "%s: No code specified for -e\n", opts->program);
return EXIT_FAILURE;
}
- break;
- case 'h':
- usage(*origargv);
+ }
+ else if (strcmp(opt, "h") == 0) {
+ usage(opts->program);
exit(EXIT_SUCCESS);
- case 'r':
- if (!item[0]) {
- if (argc <= 1) {
- fprintf(stderr, "%s: No library specified for -r\n", *origargv);
- return EXIT_FAILURE;
+ }
+ else if (strcmp(opt, "r") == 0) {
+ if ((item = options_arg(opts))) {
+ if (args->libc == 0) {
+ args->libv = (char**)mrb_malloc(mrb, sizeof(char*));
}
- argc--; argv++;
- item = argv[0];
- }
- if (args->libc == 0) {
- args->libv = (char**)mrb_malloc(mrb, sizeof(char*));
+ else {
+ args->libv = (char**)mrb_realloc(mrb, args->libv, sizeof(char*) * (args->libc + 1));
+ }
+ args->libv[args->libc++] = dup_arg_item(mrb, item);
}
else {
- args->libv = (char**)mrb_realloc(mrb, args->libv, sizeof(char*) * (args->libc + 1));
+ fprintf(stderr, "%s: No library specified for -r\n", opts->program);
+ return EXIT_FAILURE;
}
- args->libv[args->libc++] = dup_arg_item(mrb, item);
- break;
- case 'v':
- if (!args->verbose) mrb_show_version(mrb);
- args->verbose = TRUE;
- break;
- case '-':
- if (strcmp((*argv) + 2, "version") == 0) {
+ }
+ else if (strcmp(opt, "v") == 0) {
+ if (!args->verbose) {
mrb_show_version(mrb);
- exit(EXIT_SUCCESS);
- }
- else if (strcmp((*argv) + 2, "verbose") == 0) {
- args->verbose = TRUE;
- break;
+ args->version = TRUE;
}
- else if (strcmp((*argv) + 2, "copyright") == 0) {
- mrb_show_copyright(mrb);
- exit(EXIT_SUCCESS);
- }
- default:
- fprintf(stderr, "%s: invalid option %s (-h will show valid options)\n", *origargv, *argv);
+ args->verbose = TRUE;
+ }
+ else if (strcmp(opt, "version") == 0) {
+ mrb_show_version(mrb);
+ exit(EXIT_SUCCESS);
+ }
+ else if (strcmp(opt, "verbose") == 0) {
+ args->verbose = TRUE;
+ }
+ else if (strcmp(opt, "copyright") == 0) {
+ mrb_show_copyright(mrb);
+ exit(EXIT_SUCCESS);
+ }
+ else {
+ fprintf(stderr, "%s: invalid option %s%s (-h will show valid options)\n",
+ opts->program, opt[1] ? "--" : "-", opt);
return EXIT_FAILURE;
}
}
- if (args->rfp == NULL && args->cmdline == NULL) {
- if (*argv == NULL) args->rfp = stdin;
+ argc = opts->argc; argv = opts->argv;
+ if (args->cmdline == NULL) {
+ if (*argv == NULL) {
+ if (args->version) exit(EXIT_SUCCESS);
+ args->rfp = stdin;
+ }
else {
- args->rfp = fopen(argv[0], args->mrbfile ? "rb" : "r");
+ args->rfp = strcmp(argv[0], "-") == 0 ?
+ stdin : fopen(argv[0], args->mrbfile ? "rb" : "r");
if (args->rfp == NULL) {
- fprintf(stderr, "%s: Cannot open program file: %s\n", *origargv, *argv);
+ fprintf(stderr, "%s: Cannot open program file: %s\n", opts->program, argv[0]);
return EXIT_FAILURE;
}
args->fname = TRUE;
diff --git a/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c b/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c
index fb78b0c3b..3d05238d2 100644
--- a/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c
+++ b/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c
@@ -1,7 +1,11 @@
-#include <stdio.h>
+#include <mruby.h>
+
+#ifdef MRB_DISABLE_STDIO
+# error mruby-bin-strip conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
+#endif
+
#include <stdlib.h>
#include <string.h>
-#include <mruby.h>
#include <mruby/irep.h>
#include <mruby/dump.h>
diff --git a/mrbgems/mruby-class-ext/src/class.c b/mrbgems/mruby-class-ext/src/class.c
index 0d27c30ed..b7b5e18f8 100644
--- a/mrbgems/mruby-class-ext/src/class.c
+++ b/mrbgems/mruby-class-ext/src/class.c
@@ -5,7 +5,11 @@
static mrb_value
mrb_mod_name(mrb_state *mrb, mrb_value self)
{
- return mrb_class_path(mrb, mrb_class_ptr(self));
+ mrb_value name = mrb_class_path(mrb, mrb_class_ptr(self));
+ if (mrb_string_p(name)) {
+ MRB_SET_FROZEN_FLAG(mrb_basic_ptr(name));
+ }
+ return name;
}
static mrb_value
@@ -39,10 +43,15 @@ mrb_mod_module_exec(mrb_state *mrb, mrb_value self)
const mrb_value *argv;
mrb_int argc;
mrb_value blk;
+ struct RClass *c;
mrb_get_args(mrb, "*&!", &argv, &argc, &blk);
- mrb->c->ci->target_class = mrb_class_ptr(self);
+ c = mrb_class_ptr(self);
+ if (mrb->c->ci->acc < 0) {
+ return mrb_yield_with_class(mrb, blk, argc, argv, self, c);
+ }
+ mrb->c->ci->target_class = c;
return mrb_yield_cont(mrb, blk, self, argc, argv);
}
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 8379dfd97..da598adaf 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -281,15 +281,6 @@ no_optimize(codegen_scope *s)
return FALSE;
}
-static
-mrb_bool
-on_eval(codegen_scope *s)
-{
- if (s && s->parser && s->parser->on_eval)
- return TRUE;
- return FALSE;
-}
-
struct mrb_insn_data
mrb_decode_insn(const mrb_code *pc)
{
@@ -407,9 +398,6 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep)
if (no_peephole(s)) {
normal:
genop_2(s, OP_MOVE, dst, src);
- if (on_eval(s)) {
- genop_0(s, OP_NOP);
- }
return;
}
else {
@@ -599,7 +587,7 @@ new_lit(codegen_scope *s, mrb_value val)
switch (mrb_type(val)) {
case MRB_TT_STRING:
- *pv = mrb_str_pool(s->mrb, val);
+ *pv = mrb_str_pool(s->mrb, RSTRING_PTR(val), RSTRING_LEN(val), RSTR_NOFREE_P(RSTRING(val)));
break;
#ifndef MRB_WITHOUT_FLOAT
@@ -674,6 +662,43 @@ lv_idx(codegen_scope *s, mrb_sym id)
return 0;
}
+static int
+search_upvar(codegen_scope *s, mrb_sym id, int *idx)
+{
+ struct RProc *u;
+ int lv = 0;
+ codegen_scope *up = s->prev;
+
+ while (up) {
+ *idx = lv_idx(up, id);
+ if (*idx > 0) {
+ return lv;
+ }
+ lv ++;
+ up = up->prev;
+ }
+
+ if (lv < 1) lv = 1;
+ u = s->parser->upper;
+ while (u && !MRB_PROC_CFUNC_P(u)) {
+ struct mrb_irep *ir = u->body.irep;
+ uint_fast16_t n = ir->nlocals;
+ const struct mrb_locals *v = ir->lv;
+ for (; n > 1; n --, v ++) {
+ if (v->name == id) {
+ *idx = v->r;
+ return lv - 1;
+ }
+ }
+ if (MRB_PROC_SCOPE_P(u)) break;
+ u = u->upper;
+ lv ++;
+ }
+
+ codegen_error(s, "Can't found local variables");
+ return -1; /* not reached */
+}
+
static void
for_body(codegen_scope *s, node *tree)
{
@@ -771,7 +796,7 @@ lambda_body(codegen_scope *s, node *tree, int blk)
s->ainfo = (((ma+oa) & 0x3f) << 7) /* (12bits = 5:1:5:1) */
| ((ra & 0x1) << 6)
| ((pa & 0x1f) << 1)
- | (kd & 0x1);
+ | ((ka | kd) != 0 ? 0x01 : 0x00);
genop_W(s, OP_ENTER, a);
/* generate jump table for optional arguments initializer */
pos = new_label(s);
@@ -786,12 +811,19 @@ lambda_body(codegen_scope *s, node *tree, int blk)
i = 0;
while (opt) {
int idx;
+ mrb_sym id = nsym(opt->car->car);
dispatch(s, pos+i*3+1);
codegen(s, opt->car->cdr, VAL);
pop();
- idx = lv_idx(s, nsym(opt->car->car));
- gen_move(s, idx, cursp(), 0);
+ idx = lv_idx(s, id);
+ if (idx > 0) {
+ gen_move(s, idx, cursp(), 0);
+ }
+ else {
+ int lv = search_upvar(s, id, &idx);
+ genop_3(s, OP_GETUPVAR, cursp(), idx, lv);
+ }
i++;
opt = opt->cdr;
}
@@ -818,11 +850,19 @@ lambda_body(codegen_scope *s, node *tree, int blk)
mrb_assert(nint(kwd->car) == NODE_KW_ARG);
if (def_arg) {
+ int idx;
genop_2(s, OP_KEY_P, lv_idx(s, kwd_sym), new_sym(s, kwd_sym));
jmpif_key_p = genjmp2(s, OP_JMPIF, lv_idx(s, kwd_sym), 0, 0);
codegen(s, def_arg, VAL);
pop();
- gen_move(s, lv_idx(s, kwd_sym), cursp(), 0);
+ idx = lv_idx(s, kwd_sym);
+ if (idx > 0) {
+ gen_move(s, idx, cursp(), 0);
+ }
+ else {
+ int lv = search_upvar(s, kwd_sym, &idx);
+ genop_3(s, OP_GETUPVAR, cursp(), idx, lv);
+ }
jmp_def_set = genjmp(s, OP_JMP, 0);
dispatch(s, jmpif_key_p);
}
@@ -1103,25 +1143,18 @@ gen_assignment(codegen_scope *s, node *tree, int sp, int val)
if (idx > 0) {
if (idx != sp) {
gen_move(s, idx, sp, val);
- if (val && on_eval(s)) genop_0(s, OP_NOP);
}
break;
}
else { /* upvar */
- int lv = 0;
- codegen_scope *up = s->prev;
-
- while (up) {
- idx = lv_idx(up, nsym(tree));
- if (idx > 0) {
- genop_3(s, OP_SETUPVAR, sp, idx, lv);
- break;
- }
- lv++;
- up = up->prev;
- }
+ int lv = search_upvar(s, nsym(tree), &idx);
+ genop_3(s, OP_SETUPVAR, sp, idx, lv);
}
break;
+ case NODE_NVAR:
+ idx = nint(tree);
+ codegen_error(s, "Can't assign to numbered parameter");
+ break;
case NODE_IVAR:
idx = new_sym(s, nsym(tree));
genop_2(s, OP_SETIV, sp, idx);
@@ -2320,26 +2353,25 @@ codegen(codegen_scope *s, node *tree, int val)
if (idx > 0) {
gen_move(s, cursp(), idx, val);
- if (val && on_eval(s)) genop_0(s, OP_NOP);
}
else {
- int lv = 0;
- codegen_scope *up = s->prev;
-
- while (up) {
- idx = lv_idx(up, nsym(tree));
- if (idx > 0) {
- genop_3(s, OP_GETUPVAR, cursp(), idx, lv);
- break;
- }
- lv++;
- up = up->prev;
- }
+ int lv = search_upvar(s, nsym(tree), &idx);
+ genop_3(s, OP_GETUPVAR, cursp(), idx, lv);
}
push();
}
break;
+ case NODE_NVAR:
+ if (val) {
+ int idx = nint(tree);
+
+ gen_move(s, cursp(), idx, val);
+
+ push();
+ }
+ break;
+
case NODE_GVAR:
{
int sym = new_sym(s, nsym(tree));
@@ -2425,12 +2457,20 @@ codegen(codegen_scope *s, node *tree, int val)
else
#endif
{
- if (i == -1) genop_1(s, OP_LOADI__1, cursp());
- else if (i < 0) genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i);
+ if (i < 0) {
+ if (i == -1) genop_1(s, OP_LOADI__1, cursp());
+ else if (i >= -0xff) genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i);
+ else if (i >= -0x8000) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
+ else goto lit_int;
+ }
else if (i < 8) genop_1(s, OP_LOADI_0 + (uint8_t)i, cursp());
- else if (i <= 0xffff) genop_2(s, OP_LOADI, cursp(), (uint16_t)i);
+ else if (i <= 0xff) genop_2(s, OP_LOADI, cursp(), (uint16_t)i);
+ else if (i <= 0x7fff) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
else {
- int off = new_lit(s, mrb_fixnum_value(i));
+ int off;
+
+ lit_int:
+ off = new_lit(s, mrb_fixnum_value(i));
genop_2(s, OP_LOADL, cursp(), off);
}
}
@@ -2486,9 +2526,12 @@ codegen(codegen_scope *s, node *tree, int val)
else {
#endif
if (i == -1) genop_1(s, OP_LOADI__1, cursp());
- else if (i >= -0xffff) {
+ else if (i >= -0xff) {
genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i);
}
+ else if (i >= -0x8000) {
+ genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
+ }
else {
int off = new_lit(s, mrb_fixnum_value(i));
genop_2(s, OP_LOADL, cursp(), off);
diff --git a/mrbgems/mruby-compiler/core/node.h b/mrbgems/mruby-compiler/core/node.h
index 219bddab0..a57b7bdf7 100644
--- a/mrbgems/mruby-compiler/core/node.h
+++ b/mrbgems/mruby-compiler/core/node.h
@@ -51,6 +51,7 @@ enum node_type {
NODE_IVAR,
NODE_CONST,
NODE_CVAR,
+ NODE_NVAR,
NODE_NTH_REF,
NODE_BACK_REF,
NODE_MATCH,
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y
index 05262c60a..123c6c0c2 100644
--- a/mrbgems/mruby-compiler/core/parse.y
+++ b/mrbgems/mruby-compiler/core/parse.y
@@ -9,7 +9,6 @@
#ifdef PARSER_DEBUG
# define YYDEBUG 1
#endif
-#define YYERROR_VERBOSE 1
#define YYSTACK_USE_ALLOCA 1
#include <ctype.h>
@@ -71,23 +70,8 @@ typedef unsigned int stack_type;
#define nint(x) ((node*)(intptr_t)(x))
#define intn(x) ((int)(intptr_t)(x))
-#if defined(MRB_COMPLEX_NUMBERS) || defined(MRB_RATIONAL_NUMBERS)
- #define MRB_SUFFIX_SUPPORT
-
- #ifdef MRB_RATIONAL_NUMBERS
- #define NUM_SUFFIX_R (1<<0)
- #else
- #define NUM_SUFFIX_R 0
- #endif
-
- #ifdef MRB_COMPLEX_NUMBERS
- #define NUM_SUFFIX_I (1<<1)
- #else
- #define NUM_SUFFIX_I 0
- #endif
-
- #define NUM_SUFFIX_ALL (NUM_SUFFIX_R | NUM_SUFFIX_I)
-#endif
+#define NUM_SUFFIX_R (1<<0)
+#define NUM_SUFFIX_I (1<<1)
static inline mrb_sym
intern_cstr_gen(parser_state *p, const char *s)
@@ -103,12 +87,7 @@ intern_gen(parser_state *p, const char *s, size_t len)
}
#define intern(s,len) intern_gen(p,(s),(len))
-static inline mrb_sym
-intern_gen_c(parser_state *p, const char c)
-{
- return mrb_intern(p->mrb, &c, 1);
-}
-#define intern_c(c) intern_gen_c(p,(c))
+#define intern_lit(s) mrb_intern_lit(p->mrb, s)
static void
cons_free_gen(parser_state *p, node *cons)
@@ -286,6 +265,7 @@ local_unnest(parser_state *p)
static mrb_bool
local_var_p(parser_state *p, mrb_sym sym)
{
+ struct RProc *u;
node *l = p->locals;
while (l) {
@@ -296,6 +276,18 @@ local_var_p(parser_state *p, mrb_sym sym)
}
l = l->cdr;
}
+
+ u = p->upper;
+ while (u && !MRB_PROC_CFUNC_P(u)) {
+ struct mrb_irep *ir = u->body.irep;
+ uint_fast16_t n = ir->nlocals;
+ const struct mrb_locals *v = ir->lv;
+ for (; n > 1; n --, v ++) {
+ if (v->name == sym) return TRUE;
+ }
+ if (MRB_PROC_SCOPE_P(u)) break;
+ u = u->upper;
+ }
return FALSE;
}
@@ -335,6 +327,24 @@ locals_node(parser_state *p)
return p->locals ? p->locals->car : NULL;
}
+static void
+nvars_nest(parser_state *p)
+{
+ p->nvars = cons(nint(0), p->nvars);
+}
+
+static void
+nvars_block(parser_state *p)
+{
+ p->nvars = cons(nint(-2), p->nvars);
+}
+
+static void
+nvars_unnest(parser_state *p)
+{
+ p->nvars = p->nvars->cdr;
+}
+
/* (:scope (vars..) (prog...)) */
static node*
new_scope(parser_state *p, node *body)
@@ -669,6 +679,16 @@ new_cvar(parser_state *p, mrb_sym sym)
return cons((node*)NODE_CVAR, nsym(sym));
}
+/* (:nvar . a) */
+static node*
+new_nvar(parser_state *p, int num)
+{
+ int nvars = intn(p->nvars->car);
+
+ p->nvars->car = nint(nvars > num ? nvars : num);
+ return cons((node*)NODE_NVAR, nint(num));
+}
+
/* (:const . a) */
static node*
new_const(parser_state *p, mrb_sym sym)
@@ -793,15 +813,15 @@ new_args_tail(parser_state *p, node *kws, node *kwrest, mrb_sym blk)
local_add_blk(p, blk);
- // allocate register for keywords arguments
- // order is for Proc#parameters
+ /* allocate register for keywords arguments */
+ /* order is for Proc#parameters */
for (k = kws; k; k = k->cdr) {
- if (!k->car->cdr->cdr->car) { // allocate required keywords
+ if (!k->car->cdr->cdr->car) { /* allocate required keywords */
local_add_f(p, sym(k->car->cdr->car));
}
}
for (k = kws; k; k = k->cdr) {
- if (k->car->cdr->cdr->car) { // allocate keywords with default
+ if (k->car->cdr->cdr->car) { /* allocate keywords with default */
local_add_lv(p, k->car->cdr->cdr->car->cdr);
k->car->cdr->cdr->car = k->car->cdr->cdr->car->car;
local_add_f(p, sym(k->car->cdr->car));
@@ -819,6 +839,13 @@ new_kw_arg(parser_state *p, mrb_sym kw, node *def_arg)
return list3((node*)NODE_KW_ARG, nsym(kw), def_arg);
}
+/* (:kw_rest_args . a) */
+static node*
+new_kw_rest_args(parser_state *p, node *a)
+{
+ return cons((node*)NODE_KW_REST_ARGS, a);
+}
+
/* (:block_arg . a) */
static node*
new_block_arg(parser_state *p, node *a)
@@ -826,10 +853,41 @@ new_block_arg(parser_state *p, node *a)
return cons((node*)NODE_BLOCK_ARG, a);
}
+static node*
+setup_numparams(parser_state *p, node *a)
+{
+ int nvars = intn(p->nvars->car);
+ if (nvars > 0) {
+ int i;
+ mrb_sym sym;
+ // m || opt || rest || tail
+ if (a && (a->car || (a->cdr && a->cdr->car) || (a->cdr->cdr && a->cdr->cdr->car) || (a->cdr->cdr->cdr->cdr && a->cdr->cdr->cdr->cdr->car))) {
+ yyerror(p, "ordinary parameter is defined");
+ }
+ else if (p->locals) {
+ /* p->locals should not be NULL unless error happens before the point */
+ node* args = 0;
+ for (i = nvars; i > 0; i--) {
+ char buf[3];
+
+ buf[0] = '_';
+ buf[1] = i+'0';
+ buf[2] = '\0';
+ sym = intern_cstr(buf);
+ args = cons(new_arg(p, sym), args);
+ p->locals->car = cons(nsym(sym), p->locals->car);
+ }
+ a = new_args(p, args, 0, 0, 0, 0);
+ }
+ }
+ return a;
+}
+
/* (:block arg body) */
static node*
new_block(parser_state *p, node *a, node *b)
{
+ a = setup_numparams(p, a);
return list4((node*)NODE_BLOCK, locals_node(p), a, b);
}
@@ -871,37 +929,29 @@ new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b)
return list4((node*)NODE_OP_ASGN, a, nsym(op), b);
}
-#ifdef MRB_COMPLEX_NUMBERS
static node*
new_imaginary(parser_state *p, node *imaginary)
{
- return new_call(p, new_const(p, intern_cstr("Kernel")), intern_cstr("Complex"), list1(list2(list3((node*)NODE_INT, (node*)strdup("0"), nint(10)), imaginary)), 1);
+ 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);
}
-#endif
-#ifdef MRB_RATIONAL_NUMBERS
static node*
new_rational(parser_state *p, node *rational)
{
- return new_call(p, new_const(p, intern_cstr("Kernel")), intern_cstr("Rational"), list1(list1(rational)), 1);
+ return new_call(p, new_const(p, intern_lit("Kernel")), intern_lit("Rational"), list1(list1(rational)), 1);
}
-#endif
/* (:int . i) */
static node*
new_int(parser_state *p, const char *s, int base, int suffix)
{
node* result = list3((node*)NODE_INT, (node*)strdup(s), nint(base));
-#ifdef MRB_RATIONAL_NUMBERS
if (suffix & NUM_SUFFIX_R) {
result = new_rational(p, result);
}
-#endif
-#ifdef MRB_COMPLEX_NUMBERS
if (suffix & NUM_SUFFIX_I) {
result = new_imaginary(p, result);
}
-#endif
return result;
}
@@ -911,16 +961,12 @@ static node*
new_float(parser_state *p, const char *s, int suffix)
{
node* result = cons((node*)NODE_FLOAT, (node*)strdup(s));
-#ifdef MRB_RATIONAL_NUMBERS
if (suffix & NUM_SUFFIX_R) {
result = new_rational(p, result);
}
-#endif
-#ifdef MRB_COMPLEX_NUMBERS
if (suffix & NUM_SUFFIX_I) {
result = new_imaginary(p, result);
}
-#endif
return result;
}
#endif
@@ -1281,7 +1327,6 @@ heredoc_end(parser_state *p)
p->parsing_heredoc = p->parsing_heredoc->cdr;
if (p->parsing_heredoc == NULL) {
p->lstate = EXPR_BEG;
- p->cmd_start = TRUE;
end_strterm(p);
p->lex_strterm = p->lex_strterm_before_heredoc;
p->lex_strterm_before_heredoc = NULL;
@@ -1297,7 +1342,8 @@ heredoc_end(parser_state *p)
%}
-%pure-parser
+%define parse.error verbose
+%define api.pure
%parse-param {parser_state *p}
%lex-param {parser_state *p}
@@ -1366,6 +1412,7 @@ heredoc_end(parser_state *p)
%token <nd> tSTRING tSTRING_PART tSTRING_MID
%token <nd> tNTH_REF tBACK_REF
%token <num> tREGEXP_END
+%token <num> tNUMPARAM
%type <nd> singleton string string_fragment string_rep string_interp xstring regexp
%type <nd> literal numeric cpath symbol
@@ -1498,11 +1545,13 @@ top_stmt : stmt
| keyword_BEGIN
{
$<nd>$ = local_switch(p);
+ nvars_block(p);
}
'{' top_compstmt '}'
{
yyerror(p, "BEGIN not supported");
local_resume(p, $<nd>2);
+ nvars_unnest(p);
$$ = 0;
}
;
@@ -1622,7 +1671,7 @@ command_asgn : lhs '=' command_rhs
}
| primary_value '[' opt_call_args ']' tOP_ASGN command_rhs
{
- $$ = new_op_asgn(p, new_call(p, $1, intern("[]",2), $3, '.'), $5, $6);
+ $$ = new_op_asgn(p, new_call(p, $1, intern_lit("[]"), $3, '.'), $5, $6);
}
| primary_value call_op tIDENTIFIER tOP_ASGN command_rhs
{
@@ -1700,6 +1749,7 @@ block_command : block_call
cmd_brace_block : tLBRACE_ARG
{
local_nest(p);
+ nvars_nest(p);
}
opt_block_param
compstmt
@@ -1707,6 +1757,7 @@ cmd_brace_block : tLBRACE_ARG
{
$$ = new_block(p, $3, $4);
local_unnest(p);
+ nvars_unnest(p);
}
;
@@ -1851,7 +1902,7 @@ mlhs_node : variable
}
| primary_value '[' opt_call_args ']'
{
- $$ = new_call(p, $1, intern("[]",2), $3, '.');
+ $$ = new_call(p, $1, intern_lit("[]"), $3, '.');
}
| primary_value call_op tIDENTIFIER
{
@@ -1890,7 +1941,7 @@ lhs : variable
}
| primary_value '[' opt_call_args ']'
{
- $$ = new_call(p, $1, intern("[]",2), $3, '.');
+ $$ = new_call(p, $1, intern_lit("[]"), $3, '.');
}
| primary_value call_op tIDENTIFIER
{
@@ -1921,6 +1972,10 @@ lhs : variable
backref_error(p, $1);
$$ = 0;
}
+ | tNUMPARAM
+ {
+ yyerror(p, "can't assign to numbered parameter");
+ }
;
cname : tIDENTIFIER
@@ -1974,36 +2029,36 @@ undef_list : fsym
}
;
-op : '|' { $$ = intern_c('|'); }
- | '^' { $$ = intern_c('^'); }
- | '&' { $$ = intern_c('&'); }
- | tCMP { $$ = intern("<=>",3); }
- | tEQ { $$ = intern("==",2); }
- | tEQQ { $$ = intern("===",3); }
- | tMATCH { $$ = intern("=~",2); }
- | tNMATCH { $$ = intern("!~",2); }
- | '>' { $$ = intern_c('>'); }
- | tGEQ { $$ = intern(">=",2); }
- | '<' { $$ = intern_c('<'); }
- | tLEQ { $$ = intern("<=",2); }
- | tNEQ { $$ = intern("!=",2); }
- | tLSHFT { $$ = intern("<<",2); }
- | tRSHFT { $$ = intern(">>",2); }
- | '+' { $$ = intern_c('+'); }
- | '-' { $$ = intern_c('-'); }
- | '*' { $$ = intern_c('*'); }
- | tSTAR { $$ = intern_c('*'); }
- | '/' { $$ = intern_c('/'); }
- | '%' { $$ = intern_c('%'); }
- | tPOW { $$ = intern("**",2); }
- | tDSTAR { $$ = intern("**",2); }
- | '!' { $$ = intern_c('!'); }
- | '~' { $$ = intern_c('~'); }
- | tUPLUS { $$ = intern("+@",2); }
- | tUMINUS { $$ = intern("-@",2); }
- | tAREF { $$ = intern("[]",2); }
- | tASET { $$ = intern("[]=",3); }
- | '`' { $$ = intern_c('`'); }
+op : '|' { $$ = intern_lit("|"); }
+ | '^' { $$ = intern_lit("^"); }
+ | '&' { $$ = intern_lit("&"); }
+ | tCMP { $$ = intern_lit("<=>"); }
+ | tEQ { $$ = intern_lit("=="); }
+ | tEQQ { $$ = intern_lit("==="); }
+ | tMATCH { $$ = intern_lit("=~"); }
+ | tNMATCH { $$ = intern_lit("!~"); }
+ | '>' { $$ = intern_lit(">"); }
+ | tGEQ { $$ = intern_lit(">="); }
+ | '<' { $$ = intern_lit("<"); }
+ | tLEQ { $$ = intern_lit("<="); }
+ | tNEQ { $$ = intern_lit("!="); }
+ | tLSHFT { $$ = intern_lit("<<"); }
+ | tRSHFT { $$ = intern_lit(">>"); }
+ | '+' { $$ = intern_lit("+"); }
+ | '-' { $$ = intern_lit("-"); }
+ | '*' { $$ = intern_lit("*"); }
+ | tSTAR { $$ = intern_lit("*"); }
+ | '/' { $$ = intern_lit("/"); }
+ | '%' { $$ = intern_lit("%"); }
+ | tPOW { $$ = intern_lit("**"); }
+ | tDSTAR { $$ = intern_lit("**"); }
+ | '!' { $$ = intern_lit("!"); }
+ | '~' { $$ = intern_lit("~"); }
+ | tUPLUS { $$ = intern_lit("+@"); }
+ | tUMINUS { $$ = intern_lit("-@"); }
+ | tAREF { $$ = intern_lit("[]"); }
+ | tASET { $$ = intern_lit("[]="); }
+ | '`' { $$ = intern_lit("`"); }
;
reswords : keyword__LINE__ | keyword__FILE__ | keyword__ENCODING__
@@ -2030,7 +2085,7 @@ arg : lhs '=' arg_rhs
}
| primary_value '[' opt_call_args ']' tOP_ASGN arg_rhs
{
- $$ = new_op_asgn(p, new_call(p, $1, intern("[]",2), $3, '.'), $5, $6);
+ $$ = new_op_asgn(p, new_call(p, $1, intern_lit("[]"), $3, '.'), $5, $6);
}
| primary_value call_op tIDENTIFIER tOP_ASGN arg_rhs
{
@@ -2230,6 +2285,30 @@ paren_args : '(' opt_call_args ')'
{
$$ = $2;
}
+ | '(' tDOT3 rparen
+ {
+#if 1
+ mrb_sym r = mrb_intern_lit(p->mrb, "*");
+ mrb_sym b = mrb_intern_lit(p->mrb, "&");
+ if (local_var_p(p, r) && local_var_p(p, b)) {
+ $$ = cons(list1(new_splat(p, new_lvar(p, r))),
+ new_block_arg(p, new_lvar(p, b)));
+ }
+#else
+ mrb_sym r = mrb_intern_lit(p->mrb, "*");
+ mrb_sym k = mrb_intern_lit(p->mrb, "**");
+ mrb_sym b = mrb_intern_lit(p->mrb, "&");
+ if (local_var_p(p, r) && local_var_p(p, k) && local_var_p(p, b)) {
+ $$ = cons(list2(new_splat(p, new_lvar(p, r)),
+ new_kw_hash(p, list1(cons(new_kw_rest_args(p, 0), new_lvar(p, k))))),
+ new_block_arg(p, new_lvar(p, b)));
+ }
+#endif
+ else {
+ yyerror(p, "unexpected argument forwarding ...");
+ $$ = 0;
+ }
+ }
;
opt_paren_args : none
@@ -2311,7 +2390,7 @@ opt_block_arg : comma block_arg
;
comma : ','
- | ',' heredoc_bodies
+ | ',' opt_nl heredoc_bodies
;
args : arg
@@ -2362,6 +2441,10 @@ primary : literal
| heredoc
| var_ref
| backref
+ | tNUMPARAM
+ {
+ $$ = new_nvar(p, $1);
+ }
| tFID
{
$$ = new_fcall(p, $1, 0);
@@ -2514,6 +2597,7 @@ primary : literal
if (p->in_def || p->in_single)
yyerror(p, "class definition in method body");
$<nd>$ = local_switch(p);
+ nvars_block(p);
}
bodystmt
keyword_end
@@ -2521,6 +2605,7 @@ primary : literal
$$ = new_class(p, $2, $3, $5);
SET_LINENO($$, $1);
local_resume(p, $<nd>4);
+ nvars_unnest(p);
}
| keyword_class
tLSHFT expr
@@ -2531,6 +2616,7 @@ primary : literal
term
{
$<nd>$ = cons(local_switch(p), nint(p->in_single));
+ nvars_block(p);
p->in_single = 0;
}
bodystmt
@@ -2539,6 +2625,7 @@ primary : literal
$$ = new_sclass(p, $3, $7);
SET_LINENO($$, $1);
local_resume(p, $<nd>6->car);
+ nvars_unnest(p);
p->in_def = $<num>4;
p->in_single = intn($<nd>6->cdr);
}
@@ -2548,6 +2635,7 @@ primary : literal
if (p->in_def || p->in_single)
yyerror(p, "module definition in method body");
$<nd>$ = local_switch(p);
+ nvars_block(p);
}
bodystmt
keyword_end
@@ -2555,6 +2643,7 @@ primary : literal
$$ = new_module(p, $2, $4);
SET_LINENO($$, $1);
local_resume(p, $<nd>3);
+ nvars_unnest(p);
}
| keyword_def fname
{
@@ -2564,6 +2653,7 @@ primary : literal
{
p->in_def++;
$<nd>$ = local_switch(p);
+ nvars_block(p);
}
f_arglist
bodystmt
@@ -2572,6 +2662,7 @@ primary : literal
$$ = new_def(p, $2, $5, $6);
SET_LINENO($$, $1);
local_resume(p, $<nd>4);
+ nvars_unnest(p);
p->in_def--;
p->cmdarg_stack = $<stack>3;
}
@@ -2586,6 +2677,7 @@ primary : literal
p->in_single++;
p->lstate = EXPR_ENDFN; /* force for args */
$<nd>$ = local_switch(p);
+ nvars_block(p);
}
f_arglist
bodystmt
@@ -2594,6 +2686,7 @@ primary : literal
$$ = new_sdef(p, $2, $5, $7, $8);
SET_LINENO($$, $1);
local_resume(p, $<nd>6);
+ nvars_unnest(p);
p->in_single--;
p->cmdarg_stack = $<stack>4;
}
@@ -2861,6 +2954,7 @@ lambda_body : tLAMBEG compstmt '}'
do_block : keyword_do_block
{
local_nest(p);
+ nvars_nest(p);
}
opt_block_param
bodystmt
@@ -2868,6 +2962,7 @@ do_block : keyword_do_block
{
$$ = new_block(p,$3,$4);
local_unnest(p);
+ nvars_unnest(p);
}
;
@@ -2915,11 +3010,11 @@ method_call : operation paren_args
}
| primary_value call_op paren_args
{
- $$ = new_call(p, $1, intern("call",4), $3, $2);
+ $$ = new_call(p, $1, intern_lit("call"), $3, $2);
}
| primary_value tCOLON2 paren_args
{
- $$ = new_call(p, $1, intern("call",4), $3, tCOLON2);
+ $$ = new_call(p, $1, intern_lit("call"), $3, tCOLON2);
}
| keyword_super paren_args
{
@@ -2931,13 +3026,14 @@ method_call : operation paren_args
}
| primary_value '[' opt_call_args ']'
{
- $$ = new_call(p, $1, intern("[]",2), $3, '.');
+ $$ = new_call(p, $1, intern_lit("[]"), $3, '.');
}
;
brace_block : '{'
{
local_nest(p);
+ nvars_nest(p);
$<num>$ = p->lineno;
}
opt_block_param
@@ -2946,10 +3042,12 @@ brace_block : '{'
$$ = new_block(p,$3,$4);
SET_LINENO($$, $<num>2);
local_unnest(p);
+ nvars_unnest(p);
}
| keyword_do
{
local_nest(p);
+ nvars_nest(p);
$<num>$ = p->lineno;
}
opt_block_param
@@ -2958,6 +3056,7 @@ brace_block : '{'
$$ = new_block(p,$3,$4);
SET_LINENO($$, $<num>2);
local_unnest(p);
+ nvars_unnest(p);
}
;
@@ -3224,6 +3323,10 @@ var_lhs : variable
{
assignable(p, $1);
}
+ | tNUMPARAM
+ {
+ yyerror(p, "can't assign to numbered parameter");
+ }
;
var_ref : variable
@@ -3302,6 +3405,24 @@ f_arglist : '(' f_args rparen
p->lstate = EXPR_BEG;
p->cmd_start = TRUE;
}
+ | '(' tDOT3 rparen
+ {
+#if 1
+ /* til real keyword args implemented */
+ mrb_sym r = mrb_intern_lit(p->mrb, "*");
+ mrb_sym b = mrb_intern_lit(p->mrb, "&");
+ local_add_f(p, r);
+ $$ = new_args(p, 0, 0, r, 0,
+ new_args_tail(p, 0, 0, b));
+#else
+ mrb_sym r = mrb_intern_lit(p->mrb, "*");
+ mrb_sym k = mrb_intern_lit(p->mrb, "**");
+ mrb_sym b = mrb_intern_lit(p->mrb, "&");
+ local_add_f(p, r); local_add_f(p, k);
+ $$ = new_args(p, 0, 0, r, 0,
+ new_args_tail(p, 0, new_kw_rest_args(p, nsym(k)), b));
+#endif
+ }
| f_args term
{
$$ = $1;
@@ -3329,11 +3450,13 @@ f_kw : f_label arg
f_block_kw : f_label primary_value
{
- $$ = new_kw_arg(p, $1, $2);
+ $$ = new_kw_arg(p, $1, cons($2, locals_node(p)));
+ local_unnest(p);
}
| f_label
{
$$ = new_kw_arg(p, $1, 0);
+ local_unnest(p);
}
;
@@ -3363,11 +3486,11 @@ kwrest_mark : tPOW
f_kwrest : kwrest_mark tIDENTIFIER
{
- $$ = cons((node*)NODE_KW_REST_ARGS, nsym($2));
+ $$ = new_kw_rest_args(p, nsym($2));
}
| kwrest_mark
{
- $$ = cons((node*)NODE_KW_REST_ARGS, 0);
+ $$ = new_kw_rest_args(p, 0);
}
;
@@ -3482,6 +3605,11 @@ f_bad_arg : tCONSTANT
yyerror(p, "formal argument cannot be a class variable");
$$ = 0;
}
+ | tNUMPARAM
+ {
+ yyerror(p, "formal argument cannot be a numbered parameter");
+ $$ = 0;
+ }
;
f_norm_arg : f_bad_arg
@@ -3643,24 +3771,28 @@ assocs : assoc
$$ = list1($1);
NODE_LINENO($$, $1);
}
- | assocs ',' assoc
+ | assocs comma assoc
{
$$ = push($1, $3);
}
;
+label_tag : tLABEL_TAG
+ | tLABEL_TAG heredoc_bodies
+ ;
+
assoc : arg tASSOC arg
{
void_expr_error(p, $1);
void_expr_error(p, $3);
$$ = cons($1, $3);
}
- | tIDENTIFIER tLABEL_TAG arg
+ | tIDENTIFIER label_tag arg
{
void_expr_error(p, $3);
$$ = cons(new_sym(p, $1), $3);
}
- | string_fragment tLABEL_TAG arg
+ | string_fragment label_tag arg
{
void_expr_error(p, $3);
if ($1->car == (node*)NODE_DSTR) {
@@ -3673,7 +3805,7 @@ assoc : arg tASSOC arg
| tDSTAR arg
{
void_expr_error(p, $2);
- $$ = cons(cons((node*)NODE_KW_REST_ARGS, 0), $2);
+ $$ = cons(new_kw_rest_args(p, 0), $2);
}
;
@@ -3722,7 +3854,7 @@ opt_nl : /* none */
| nl
;
-rparen : opt_nl ')'
+rparen : opt_terms ')'
;
trailer : /* none */
@@ -3737,7 +3869,7 @@ term : ';' {yyerrok;}
nl : '\n'
{
- p->lineno++;
+ p->lineno += $<num>1;
p->column = 0;
}
;
@@ -3897,6 +4029,27 @@ static mrb_bool peeks(parser_state *p, const char *s);
static mrb_bool skips(parser_state *p, const char *s);
static inline int
+nextc0(parser_state *p)
+{
+ int c;
+#ifndef MRB_DISABLE_STDIO
+ if (p->f) {
+ if (feof(p->f)) return -1;
+ c = fgetc(p->f);
+ if (c == EOF) return -1;
+ }
+ else
+#endif
+ if (!p->s || p->s >= p->send) {
+ return -1;
+ }
+ else {
+ c = (unsigned char)*p->s++;
+ }
+ return c;
+}
+
+static inline int
nextc(parser_state *p)
{
int c;
@@ -3910,24 +4063,19 @@ nextc(parser_state *p)
cons_free(tmp);
}
else {
-#ifndef MRB_DISABLE_STDIO
- if (p->f) {
- if (feof(p->f)) goto eof;
- c = fgetc(p->f);
- if (c == EOF) goto eof;
- }
- else
-#endif
- if (!p->s || p->s >= p->send) {
- goto eof;
- }
- else {
- c = (unsigned char)*p->s++;
- }
+ c = nextc0(p);
+ if (c < 0) goto eof;
}
if (c >= 0) {
p->column++;
}
+ if (c == '\r') {
+ const int lf = nextc0(p);
+ if (lf == '\n') {
+ return '\n';
+ }
+ if (lf > 0) pushback(p, lf);
+ }
return c;
eof:
@@ -4384,12 +4532,7 @@ parse_string(parser_state *p)
}
}
if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) {
- if (c < 0) {
- p->parsing_heredoc = NULL;
- }
- else {
- return tHEREDOC_END;
- }
+ return tHEREDOC_END;
}
}
if (c < 0) {
@@ -4593,13 +4736,13 @@ parse_string(parser_state *p)
return tSTRING;
}
-#ifdef MRB_SUFFIX_SUPPORT
static int
-number_literal_suffix(parser_state *p, int mask)
+number_literal_suffix(parser_state *p)
{
int c, result = 0;
node *list = 0;
int column = p->column;
+ int mask = NUM_SUFFIX_R|NUM_SUFFIX_I;
while ((c = nextc(p)) != -1) {
list = push(list, (node*)(intptr_t)c);
@@ -4631,7 +4774,6 @@ number_literal_suffix(parser_state *p, int mask)
}
return result;
}
-#endif
static int
heredoc_identifier(parser_state *p)
@@ -4715,6 +4857,7 @@ static int
parser_yylex(parser_state *p)
{
int32_t c;
+ int nlines = 1;
int space_seen = 0;
int cmd_state;
enum mrb_lex_state_enum last_state;
@@ -4772,6 +4915,7 @@ parser_yylex(parser_state *p)
break;
}
if (p->parsing_heredoc != NULL) {
+ pylval.num = nlines;
return '\n';
}
while ((c = nextc(p))) {
@@ -4781,13 +4925,13 @@ parser_yylex(parser_state *p)
space_seen = 1;
break;
case '#': /* comment as a whitespace */
- pushback(p, '#');
- p->lineno++;
- goto retry;
+ skip(p, '\n');
+ nlines++;
+ break;
case '.':
if (!peek(p, '.')) {
pushback(p, '.');
- p->lineno++;
+ p->lineno+=nlines; nlines=1;
goto retry;
}
pushback(p, c);
@@ -4795,7 +4939,7 @@ parser_yylex(parser_state *p)
case '&':
if (peek(p, '.')) {
pushback(p, '&');
- p->lineno++;
+ p->lineno+=nlines; nlines=1;
goto retry;
}
pushback(p, c);
@@ -4811,12 +4955,13 @@ parser_yylex(parser_state *p)
normal_newline:
p->cmd_start = TRUE;
p->lstate = EXPR_BEG;
+ pylval.num = nlines;
return '\n';
case '*':
if ((c = nextc(p)) == '*') {
if ((c = nextc(p)) == '=') {
- pylval.id = intern("**",2);
+ pylval.id = intern_lit("**");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -4834,7 +4979,7 @@ parser_yylex(parser_state *p)
}
else {
if (c == '=') {
- pylval.id = intern_c('*');
+ pylval.id = intern_lit("*");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -4893,7 +5038,7 @@ parser_yylex(parser_state *p)
c = nextc(p);
} while (!(c < 0 || ISSPACE(c)));
if (c != '\n') skip(p, '\n');
- p->lineno++;
+ p->lineno+=nlines; nlines=1;
p->column = 0;
goto retry;
}
@@ -4950,7 +5095,7 @@ parser_yylex(parser_state *p)
}
if (c == '<') {
if ((c = nextc(p)) == '=') {
- pylval.id = intern("<<",2);
+ pylval.id = intern_lit("<<");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -4972,7 +5117,7 @@ parser_yylex(parser_state *p)
}
if (c == '>') {
if ((c = nextc(p)) == '=') {
- pylval.id = intern(">>",2);
+ pylval.id = intern_lit(">>");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -5080,7 +5225,7 @@ parser_yylex(parser_state *p)
if ((c = nextc(p)) == '&') {
p->lstate = EXPR_BEG;
if ((c = nextc(p)) == '=') {
- pylval.id = intern("&&",2);
+ pylval.id = intern_lit("&&");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -5092,7 +5237,7 @@ parser_yylex(parser_state *p)
return tANDDOT;
}
else if (c == '=') {
- pylval.id = intern_c('&');
+ pylval.id = intern_lit("&");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -5119,7 +5264,7 @@ parser_yylex(parser_state *p)
if ((c = nextc(p)) == '|') {
p->lstate = EXPR_BEG;
if ((c = nextc(p)) == '=') {
- pylval.id = intern("||",2);
+ pylval.id = intern_lit("||");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -5127,7 +5272,7 @@ parser_yylex(parser_state *p)
return tOROP;
}
if (c == '=') {
- pylval.id = intern_c('|');
+ pylval.id = intern_lit("|");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -5151,7 +5296,7 @@ parser_yylex(parser_state *p)
return '+';
}
if (c == '=') {
- pylval.id = intern_c('+');
+ pylval.id = intern_lit("+");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -5179,7 +5324,7 @@ parser_yylex(parser_state *p)
return '-';
}
if (c == '=') {
- pylval.id = intern_c('-');
+ pylval.id = intern_lit("-");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -5254,9 +5399,7 @@ parser_yylex(parser_state *p)
no_digits();
}
else if (nondigit) goto trailing_uc;
- #ifdef MRB_SUFFIX_SUPPORT
- suffix = number_literal_suffix(p, NUM_SUFFIX_ALL);
- #endif
+ suffix = number_literal_suffix(p);
pylval.nd = new_int(p, tok(p), 16, suffix);
return tINTEGER;
}
@@ -5281,9 +5424,7 @@ parser_yylex(parser_state *p)
no_digits();
}
else if (nondigit) goto trailing_uc;
- #ifdef MRB_SUFFIX_SUPPORT
- suffix = number_literal_suffix(p, NUM_SUFFIX_ALL);
- #endif
+ suffix = number_literal_suffix(p);
pylval.nd = new_int(p, tok(p), 2, suffix);
return tINTEGER;
}
@@ -5308,9 +5449,7 @@ parser_yylex(parser_state *p)
no_digits();
}
else if (nondigit) goto trailing_uc;
- #ifdef MRB_SUFFIX_SUPPORT
- suffix = number_literal_suffix(p, NUM_SUFFIX_ALL);
- #endif
+ suffix = number_literal_suffix(p);
pylval.nd = new_int(p, tok(p), 10, suffix);
return tINTEGER;
}
@@ -5344,9 +5483,7 @@ parser_yylex(parser_state *p)
pushback(p, c);
tokfix(p);
if (nondigit) goto trailing_uc;
- #ifdef MRB_SUFFIX_SUPPORT
- suffix = number_literal_suffix(p, NUM_SUFFIX_ALL);
- #endif
+ suffix = number_literal_suffix(p);
pylval.nd = new_int(p, tok(p), 8, suffix);
return tINTEGER;
}
@@ -5364,9 +5501,7 @@ parser_yylex(parser_state *p)
}
else {
pushback(p, c);
- #ifdef MRB_SUFFIX_SUPPORT
- suffix = number_literal_suffix(p, NUM_SUFFIX_ALL);
- #endif
+ suffix = number_literal_suffix(p);
pylval.nd = new_int(p, "0", 10, suffix);
return tINTEGER;
}
@@ -5456,16 +5591,12 @@ parser_yylex(parser_state *p)
yywarning_s(p, "float out of range", tok(p));
errno = 0;
}
- #ifdef MRB_SUFFIX_SUPPORT
- suffix = number_literal_suffix(p, NUM_SUFFIX_ALL);
- #endif
+ suffix = number_literal_suffix(p);
pylval.nd = new_float(p, tok(p), suffix);
return tFLOAT;
#endif
}
- #ifdef MRB_SUFFIX_SUPPORT
- suffix = number_literal_suffix(p, NUM_SUFFIX_ALL);
- #endif
+ suffix = number_literal_suffix(p);
pylval.nd = new_int(p, tok(p), 10, suffix);
return tINTEGER;
}
@@ -5513,7 +5644,7 @@ parser_yylex(parser_state *p)
return tREGEXP_BEG;
}
if ((c = nextc(p)) == '=') {
- pylval.id = intern_c('/');
+ pylval.id = intern_lit("/");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -5532,7 +5663,7 @@ parser_yylex(parser_state *p)
case '^':
if ((c = nextc(p)) == '=') {
- pylval.id = intern_c('^');
+ pylval.id = intern_lit("^");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -5629,7 +5760,7 @@ parser_yylex(parser_state *p)
case '\\':
c = nextc(p);
if (c == '\n') {
- p->lineno++;
+ p->lineno+=nlines; nlines=1;
p->column = 0;
space_seen = 1;
goto retry; /* skip \\n */
@@ -5709,7 +5840,7 @@ parser_yylex(parser_state *p)
}
}
if ((c = nextc(p)) == '=') {
- pylval.id = intern_c('%');
+ pylval.id = intern_lit("%");
p->lstate = EXPR_BEG;
return tOP_ASGN;
}
@@ -5763,7 +5894,7 @@ parser_yylex(parser_state *p)
tokadd(p, '$');
tokadd(p, c);
tokfix(p);
- pylval.id = intern_cstr(tok(p));
+ pylval.id = intern(tok(p), toklen(p));
return tGVAR;
case '-':
@@ -5773,7 +5904,7 @@ parser_yylex(parser_state *p)
pushback(p, c);
gvar:
tokfix(p);
- pylval.id = intern_cstr(tok(p));
+ pylval.id = intern(tok(p), toklen(p));
return tGVAR;
case '&': /* $&: last match */
@@ -5911,6 +6042,39 @@ parser_yylex(parser_state *p)
result = tIVAR;
break;
+ case '_':
+ if (toklen(p) == 2 && ISDIGIT(tok(p)[1]) && p->nvars) {
+ int n = tok(p)[1] - '0';
+ int nvar;
+
+ if (n > 0) {
+ node *nvars = p->nvars->cdr;
+
+ while (nvars) {
+ nvar = intn(nvars->car);
+ if (nvar == -2) break; /* top of the scope */
+ if (nvar > 0) {
+ yywarning(p, "numbered parameter used in outer block");
+ break;
+ }
+ nvars->car = nint(-1);
+ nvars = nvars->cdr;
+ }
+ nvar = intn(p->nvars->car);
+ if (nvar == -1) {
+ yywarning(p, "numbered parameter used in inner block");
+ }
+ if (nvar >= -1) {
+ pylval.num = n;
+ p->lstate = EXPR_END;
+ return tNUMPARAM;
+ }
+ else {
+ yywarning(p, "identifier for numbered parameter; consider another name");
+ }
+ }
+ }
+ /* fall through */
default:
if (toklast(p) == '!' || toklast(p) == '?') {
result = tFID;
@@ -5926,6 +6090,15 @@ parser_yylex(parser_state *p)
else {
pushback(p, c);
}
+ if ((c = nextc(p)) == '=' && !peek(p, '~') && !peek(p, '>') &&
+ (!peek(p, '=') || (peek_n(p, '>', 1)))) {
+ result = tIDENTIFIER;
+ tokadd(p, c);
+ tokfix(p);
+ }
+ else {
+ pushback(p, c);
+ }
}
if (result == 0 && ISUPPER(tok(p)[0])) {
result = tCONSTANT;
@@ -5939,7 +6112,7 @@ parser_yylex(parser_state *p)
if (IS_LABEL_SUFFIX(0)) {
p->lstate = EXPR_END;
tokfix(p);
- pylval.id = intern_cstr(tok(p));
+ pylval.id = intern(tok(p), toklen(p));
return tIDENTIFIER;
}
}
@@ -5998,7 +6171,7 @@ parser_yylex(parser_state *p)
}
}
{
- mrb_sym ident = intern_cstr(tok(p));
+ mrb_sym ident = intern(tok(p), toklen(p));
pylval.id = ident;
if (last_state != EXPR_DOT && ISLOWER(tok(p)[0]) && local_var_p(p, ident)) {
@@ -6032,7 +6205,7 @@ parser_init_cxt(parser_state *p, mrbc_context *cxt)
}
p->capture_errors = cxt->capture_errors;
p->no_optimize = cxt->no_optimize;
- p->on_eval = cxt->on_eval;
+ p->upper = cxt->upper;
if (cxt->partial_hook) {
p->cxt = cxt;
}
@@ -6893,6 +7066,10 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
printf("NODE_CVAR %s\n", mrb_sym_name(mrb, sym(tree)));
break;
+ case NODE_NVAR:
+ printf("NODE_NVAR %d\n", intn(tree));
+ break;
+
case NODE_CONST:
printf("NODE_CONST %s\n", mrb_sym_name(mrb, sym(tree)));
break;
diff --git a/mrbgems/mruby-compiler/core/y.tab.c b/mrbgems/mruby-compiler/core/y.tab.c
new file mode 100644
index 000000000..827f1123f
--- /dev/null
+++ b/mrbgems/mruby-compiler/core/y.tab.c
@@ -0,0 +1,13153 @@
+/* A Bison parser, made by GNU Bison 3.5.1. */
+
+/* Bison implementation for Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
+ Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Undocumented macros, especially those whose name start with YY_,
+ are private implementation details. Do not rely on them. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Bison version. */
+#define YYBISON_VERSION "3.5.1"
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 1
+
+/* Push parsers. */
+#define YYPUSH 0
+
+/* Pull parsers. */
+#define YYPULL 1
+
+
+
+
+/* First part of user prologue. */
+#line 7 "mrbgems/mruby-compiler/core/parse.y"
+
+#undef PARSER_DEBUG
+#ifdef PARSER_DEBUG
+# define YYDEBUG 1
+#endif
+#define YYSTACK_USE_ALLOCA 1
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mruby.h>
+#include <mruby/compile.h>
+#include <mruby/proc.h>
+#include <mruby/error.h>
+#include <mruby/throw.h>
+#include <mruby/string.h>
+#include "node.h"
+
+#define YYLEX_PARAM p
+
+typedef mrb_ast_node node;
+typedef struct mrb_parser_state parser_state;
+typedef struct mrb_parser_heredoc_info parser_heredoc_info;
+
+static int yyparse(parser_state *p);
+static int yylex(void *lval, parser_state *p);
+static void yyerror(parser_state *p, const char *s);
+static void yywarn(parser_state *p, const char *s);
+static void yywarning(parser_state *p, const char *s);
+static void backref_error(parser_state *p, node *n);
+static void void_expr_error(parser_state *p, node *n);
+static void tokadd(parser_state *p, int32_t c);
+
+#define identchar(c) (ISALNUM(c) || (c) == '_' || !ISASCII(c))
+
+typedef unsigned int stack_type;
+
+#define BITSTACK_PUSH(stack, n) ((stack) = ((stack)<<1)|((n)&1))
+#define BITSTACK_POP(stack) ((stack) = (stack) >> 1)
+#define BITSTACK_LEXPOP(stack) ((stack) = ((stack) >> 1) | ((stack) & 1))
+#define BITSTACK_SET_P(stack) ((stack)&1)
+
+#define COND_PUSH(n) BITSTACK_PUSH(p->cond_stack, (n))
+#define COND_POP() BITSTACK_POP(p->cond_stack)
+#define COND_LEXPOP() BITSTACK_LEXPOP(p->cond_stack)
+#define COND_P() BITSTACK_SET_P(p->cond_stack)
+
+#define CMDARG_PUSH(n) BITSTACK_PUSH(p->cmdarg_stack, (n))
+#define CMDARG_POP() BITSTACK_POP(p->cmdarg_stack)
+#define CMDARG_LEXPOP() BITSTACK_LEXPOP(p->cmdarg_stack)
+#define CMDARG_P() BITSTACK_SET_P(p->cmdarg_stack)
+
+#define SET_LINENO(c,n) ((c)->lineno = (n))
+#define NODE_LINENO(c,n) do {\
+ if (n) {\
+ (c)->filename_index = (n)->filename_index;\
+ (c)->lineno = (n)->lineno;\
+ }\
+} while (0)
+
+#define sym(x) ((mrb_sym)(intptr_t)(x))
+#define nsym(x) ((node*)(intptr_t)(x))
+#define nint(x) ((node*)(intptr_t)(x))
+#define intn(x) ((int)(intptr_t)(x))
+
+#define NUM_SUFFIX_R (1<<0)
+#define NUM_SUFFIX_I (1<<1)
+
+static inline mrb_sym
+intern_cstr_gen(parser_state *p, const char *s)
+{
+ return mrb_intern_cstr(p->mrb, s);
+}
+#define intern_cstr(s) intern_cstr_gen(p,(s))
+
+static inline mrb_sym
+intern_gen(parser_state *p, const char *s, size_t len)
+{
+ return mrb_intern(p->mrb, s, len);
+}
+#define intern(s,len) intern_gen(p,(s),(len))
+
+#define intern_lit(s) mrb_intern_lit(p->mrb, s)
+
+static void
+cons_free_gen(parser_state *p, node *cons)
+{
+ cons->cdr = p->cells;
+ p->cells = cons;
+}
+#define cons_free(c) cons_free_gen(p, (c))
+
+static void*
+parser_palloc(parser_state *p, size_t size)
+{
+ void *m = mrb_pool_alloc(p->pool, size);
+
+ if (!m) {
+ MRB_THROW(p->jmp);
+ }
+ return m;
+}
+
+static node*
+cons_gen(parser_state *p, node *car, node *cdr)
+{
+ node *c;
+
+ if (p->cells) {
+ c = p->cells;
+ p->cells = p->cells->cdr;
+ }
+ else {
+ c = (node *)parser_palloc(p, sizeof(mrb_ast_node));
+ }
+
+ c->car = car;
+ c->cdr = cdr;
+ c->lineno = p->lineno;
+ c->filename_index = p->current_filename_index;
+ /* beginning of next partial file; need to point the previous file */
+ if (p->lineno == 0 && p->current_filename_index > 0) {
+ c->filename_index-- ;
+ }
+ return c;
+}
+#define cons(a,b) cons_gen(p,(a),(b))
+
+static node*
+list1_gen(parser_state *p, node *a)
+{
+ return cons(a, 0);
+}
+#define list1(a) list1_gen(p, (a))
+
+static node*
+list2_gen(parser_state *p, node *a, node *b)
+{
+ return cons(a, cons(b,0));
+}
+#define list2(a,b) list2_gen(p, (a),(b))
+
+static node*
+list3_gen(parser_state *p, node *a, node *b, node *c)
+{
+ return cons(a, cons(b, cons(c,0)));
+}
+#define list3(a,b,c) list3_gen(p, (a),(b),(c))
+
+static node*
+list4_gen(parser_state *p, node *a, node *b, node *c, node *d)
+{
+ return cons(a, cons(b, cons(c, cons(d, 0))));
+}
+#define list4(a,b,c,d) list4_gen(p, (a),(b),(c),(d))
+
+static node*
+list5_gen(parser_state *p, node *a, node *b, node *c, node *d, node *e)
+{
+ return cons(a, cons(b, cons(c, cons(d, cons(e, 0)))));
+}
+#define list5(a,b,c,d,e) list5_gen(p, (a),(b),(c),(d),(e))
+
+static node*
+list6_gen(parser_state *p, node *a, node *b, node *c, node *d, node *e, node *f)
+{
+ return cons(a, cons(b, cons(c, cons(d, cons(e, cons(f, 0))))));
+}
+#define list6(a,b,c,d,e,f) list6_gen(p, (a),(b),(c),(d),(e),(f))
+
+static node*
+append_gen(parser_state *p, node *a, node *b)
+{
+ node *c = a;
+
+ if (!a) return b;
+ if (!b) return a;
+ while (c->cdr) {
+ c = c->cdr;
+ }
+ c->cdr = b;
+ return a;
+}
+#define append(a,b) append_gen(p,(a),(b))
+#define push(a,b) append_gen(p,(a),list1(b))
+
+static char*
+parser_strndup(parser_state *p, const char *s, size_t len)
+{
+ char *b = (char *)parser_palloc(p, len+1);
+
+ memcpy(b, s, len);
+ b[len] = '\0';
+ return b;
+}
+#undef strndup
+#define strndup(s,len) parser_strndup(p, s, len)
+
+static char*
+parser_strdup(parser_state *p, const char *s)
+{
+ return parser_strndup(p, s, strlen(s));
+}
+#undef strdup
+#define strdup(s) parser_strdup(p, s)
+
+static void
+dump_int(uint16_t i, char *s)
+{
+ char *p = s;
+ char *t = s;
+
+ while (i > 0) {
+ *p++ = (i % 10)+'0';
+ i /= 10;
+ }
+ if (p == s) *p++ = '0';
+ *p = 0;
+ p--; /* point the last char */
+ while (t < p) {
+ char c = *t;
+ *t++ = *p;
+ *p-- = c;
+ }
+}
+
+/* xxx ----------------------------- */
+
+static node*
+local_switch(parser_state *p)
+{
+ node *prev = p->locals;
+
+ p->locals = cons(0, 0);
+ return prev;
+}
+
+static void
+local_resume(parser_state *p, node *prev)
+{
+ p->locals = prev;
+}
+
+static void
+local_nest(parser_state *p)
+{
+ p->locals = cons(0, p->locals);
+}
+
+static void
+local_unnest(parser_state *p)
+{
+ if (p->locals) {
+ p->locals = p->locals->cdr;
+ }
+}
+
+static mrb_bool
+local_var_p(parser_state *p, mrb_sym sym)
+{
+ struct RProc *u;
+ node *l = p->locals;
+
+ while (l) {
+ node *n = l->car;
+ while (n) {
+ if (sym(n->car) == sym) return TRUE;
+ n = n->cdr;
+ }
+ l = l->cdr;
+ }
+
+ u = p->upper;
+ while (u && !MRB_PROC_CFUNC_P(u)) {
+ struct mrb_irep *ir = u->body.irep;
+ uint_fast16_t n = ir->nlocals;
+ const struct mrb_locals *v = ir->lv;
+ for (; n > 1; n --, v ++) {
+ if (v->name == sym) return TRUE;
+ }
+ if (MRB_PROC_SCOPE_P(u)) break;
+ u = u->upper;
+ }
+ return FALSE;
+}
+
+static void
+local_add_f(parser_state *p, mrb_sym sym)
+{
+ if (p->locals) {
+ p->locals->car = push(p->locals->car, nsym(sym));
+ }
+}
+
+static void
+local_add(parser_state *p, mrb_sym sym)
+{
+ if (!local_var_p(p, sym)) {
+ local_add_f(p, sym);
+ }
+}
+
+static void
+local_add_blk(parser_state *p, mrb_sym blk)
+{
+ /* allocate register for block */
+ local_add_f(p, blk ? blk : mrb_intern_lit(p->mrb, "&"));
+}
+
+static void
+local_add_kw(parser_state *p, mrb_sym kwd)
+{
+ /* allocate register for keywords hash */
+ local_add_f(p, kwd ? kwd : mrb_intern_lit(p->mrb, "**"));
+}
+
+static node*
+locals_node(parser_state *p)
+{
+ return p->locals ? p->locals->car : NULL;
+}
+
+static void
+nvars_nest(parser_state *p)
+{
+ p->nvars = cons(nint(0), p->nvars);
+}
+
+static void
+nvars_block(parser_state *p)
+{
+ p->nvars = cons(nint(-2), p->nvars);
+}
+
+static void
+nvars_unnest(parser_state *p)
+{
+ p->nvars = p->nvars->cdr;
+}
+
+/* (:scope (vars..) (prog...)) */
+static node*
+new_scope(parser_state *p, node *body)
+{
+ return cons((node*)NODE_SCOPE, cons(locals_node(p), body));
+}
+
+/* (:begin prog...) */
+static node*
+new_begin(parser_state *p, node *body)
+{
+ if (body) {
+ return list2((node*)NODE_BEGIN, body);
+ }
+ return cons((node*)NODE_BEGIN, 0);
+}
+
+#define newline_node(n) (n)
+
+/* (:rescue body rescue else) */
+static node*
+new_rescue(parser_state *p, node *body, node *resq, node *els)
+{
+ return list4((node*)NODE_RESCUE, body, resq, els);
+}
+
+static node*
+new_mod_rescue(parser_state *p, node *body, node *resq)
+{
+ return new_rescue(p, body, list1(list3(0, 0, resq)), 0);
+}
+
+/* (:ensure body ensure) */
+static node*
+new_ensure(parser_state *p, node *a, node *b)
+{
+ return cons((node*)NODE_ENSURE, cons(a, cons(0, b)));
+}
+
+/* (:nil) */
+static node*
+new_nil(parser_state *p)
+{
+ return list1((node*)NODE_NIL);
+}
+
+/* (:true) */
+static node*
+new_true(parser_state *p)
+{
+ return list1((node*)NODE_TRUE);
+}
+
+/* (:false) */
+static node*
+new_false(parser_state *p)
+{
+ return list1((node*)NODE_FALSE);
+}
+
+/* (:alias new old) */
+static node*
+new_alias(parser_state *p, mrb_sym a, mrb_sym b)
+{
+ return cons((node*)NODE_ALIAS, cons(nsym(a), nsym(b)));
+}
+
+/* (:if cond then else) */
+static node*
+new_if(parser_state *p, node *a, node *b, node *c)
+{
+ void_expr_error(p, a);
+ return list4((node*)NODE_IF, a, b, c);
+}
+
+/* (:unless cond then else) */
+static node*
+new_unless(parser_state *p, node *a, node *b, node *c)
+{
+ void_expr_error(p, a);
+ return list4((node*)NODE_IF, a, c, b);
+}
+
+/* (:while cond body) */
+static node*
+new_while(parser_state *p, node *a, node *b)
+{
+ void_expr_error(p, a);
+ return cons((node*)NODE_WHILE, cons(a, b));
+}
+
+/* (:until cond body) */
+static node*
+new_until(parser_state *p, node *a, node *b)
+{
+ void_expr_error(p, a);
+ return cons((node*)NODE_UNTIL, cons(a, b));
+}
+
+/* (:for var obj body) */
+static node*
+new_for(parser_state *p, node *v, node *o, node *b)
+{
+ void_expr_error(p, o);
+ return list4((node*)NODE_FOR, v, o, b);
+}
+
+/* (:case a ((when ...) body) ((when...) body)) */
+static node*
+new_case(parser_state *p, node *a, node *b)
+{
+ node *n = list2((node*)NODE_CASE, a);
+ node *n2 = n;
+
+ void_expr_error(p, a);
+ while (n2->cdr) {
+ n2 = n2->cdr;
+ }
+ n2->cdr = b;
+ return n;
+}
+
+/* (:postexe a) */
+static node*
+new_postexe(parser_state *p, node *a)
+{
+ return cons((node*)NODE_POSTEXE, a);
+}
+
+/* (:self) */
+static node*
+new_self(parser_state *p)
+{
+ return list1((node*)NODE_SELF);
+}
+
+/* (:call a b c) */
+static node*
+new_call(parser_state *p, node *a, mrb_sym b, node *c, int pass)
+{
+ node *n = list4(nint(pass?NODE_CALL:NODE_SCALL), a, nsym(b), c);
+ void_expr_error(p, a);
+ NODE_LINENO(n, a);
+ return n;
+}
+
+/* (:fcall self mid args) */
+static node*
+new_fcall(parser_state *p, mrb_sym b, node *c)
+{
+ node *n = new_self(p);
+ NODE_LINENO(n, c);
+ n = list4((node*)NODE_FCALL, n, nsym(b), c);
+ NODE_LINENO(n, c);
+ return n;
+}
+
+/* (:super . c) */
+static node*
+new_super(parser_state *p, node *c)
+{
+ return cons((node*)NODE_SUPER, c);
+}
+
+/* (:zsuper) */
+static node*
+new_zsuper(parser_state *p)
+{
+ return list1((node*)NODE_ZSUPER);
+}
+
+/* (:yield . c) */
+static node*
+new_yield(parser_state *p, node *c)
+{
+ if (c) {
+ if (c->cdr) {
+ yyerror(p, "both block arg and actual block given");
+ }
+ return cons((node*)NODE_YIELD, c->car);
+ }
+ return cons((node*)NODE_YIELD, 0);
+}
+
+/* (:return . c) */
+static node*
+new_return(parser_state *p, node *c)
+{
+ return cons((node*)NODE_RETURN, c);
+}
+
+/* (:break . c) */
+static node*
+new_break(parser_state *p, node *c)
+{
+ return cons((node*)NODE_BREAK, c);
+}
+
+/* (:next . c) */
+static node*
+new_next(parser_state *p, node *c)
+{
+ return cons((node*)NODE_NEXT, c);
+}
+
+/* (:redo) */
+static node*
+new_redo(parser_state *p)
+{
+ return list1((node*)NODE_REDO);
+}
+
+/* (:retry) */
+static node*
+new_retry(parser_state *p)
+{
+ return list1((node*)NODE_RETRY);
+}
+
+/* (:dot2 a b) */
+static node*
+new_dot2(parser_state *p, node *a, node *b)
+{
+ return cons((node*)NODE_DOT2, cons(a, b));
+}
+
+/* (:dot3 a b) */
+static node*
+new_dot3(parser_state *p, node *a, node *b)
+{
+ return cons((node*)NODE_DOT3, cons(a, b));
+}
+
+/* (:colon2 b c) */
+static node*
+new_colon2(parser_state *p, node *b, mrb_sym c)
+{
+ void_expr_error(p, b);
+ return cons((node*)NODE_COLON2, cons(b, nsym(c)));
+}
+
+/* (:colon3 . c) */
+static node*
+new_colon3(parser_state *p, mrb_sym c)
+{
+ return cons((node*)NODE_COLON3, nsym(c));
+}
+
+/* (:and a b) */
+static node*
+new_and(parser_state *p, node *a, node *b)
+{
+ return cons((node*)NODE_AND, cons(a, b));
+}
+
+/* (:or a b) */
+static node*
+new_or(parser_state *p, node *a, node *b)
+{
+ return cons((node*)NODE_OR, cons(a, b));
+}
+
+/* (:array a...) */
+static node*
+new_array(parser_state *p, node *a)
+{
+ return cons((node*)NODE_ARRAY, a);
+}
+
+/* (:splat . a) */
+static node*
+new_splat(parser_state *p, node *a)
+{
+ return cons((node*)NODE_SPLAT, a);
+}
+
+/* (:hash (k . v) (k . v)...) */
+static node*
+new_hash(parser_state *p, node *a)
+{
+ return cons((node*)NODE_HASH, a);
+}
+
+/* (:kw_hash (k . v) (k . v)...) */
+static node*
+new_kw_hash(parser_state *p, node *a)
+{
+ return cons((node*)NODE_KW_HASH, a);
+}
+
+/* (:sym . a) */
+static node*
+new_sym(parser_state *p, mrb_sym sym)
+{
+ return cons((node*)NODE_SYM, nsym(sym));
+}
+
+static mrb_sym
+new_strsym(parser_state *p, node* str)
+{
+ const char *s = (const char*)str->cdr->car;
+ size_t len = (size_t)str->cdr->cdr;
+
+ return mrb_intern(p->mrb, s, len);
+}
+
+/* (:lvar . a) */
+static node*
+new_lvar(parser_state *p, mrb_sym sym)
+{
+ return cons((node*)NODE_LVAR, nsym(sym));
+}
+
+/* (:gvar . a) */
+static node*
+new_gvar(parser_state *p, mrb_sym sym)
+{
+ return cons((node*)NODE_GVAR, nsym(sym));
+}
+
+/* (:ivar . a) */
+static node*
+new_ivar(parser_state *p, mrb_sym sym)
+{
+ return cons((node*)NODE_IVAR, nsym(sym));
+}
+
+/* (:cvar . a) */
+static node*
+new_cvar(parser_state *p, mrb_sym sym)
+{
+ return cons((node*)NODE_CVAR, nsym(sym));
+}
+
+/* (:nvar . a) */
+static node*
+new_nvar(parser_state *p, int num)
+{
+ int nvars = intn(p->nvars->car);
+
+ p->nvars->car = nint(nvars > num ? nvars : num);
+ return cons((node*)NODE_NVAR, nint(num));
+}
+
+/* (:const . a) */
+static node*
+new_const(parser_state *p, mrb_sym sym)
+{
+ return cons((node*)NODE_CONST, nsym(sym));
+}
+
+/* (:undef a...) */
+static node*
+new_undef(parser_state *p, mrb_sym sym)
+{
+ return list2((node*)NODE_UNDEF, nsym(sym));
+}
+
+/* (:class class super body) */
+static node*
+new_class(parser_state *p, node *c, node *s, node *b)
+{
+ void_expr_error(p, s);
+ return list4((node*)NODE_CLASS, c, s, cons(locals_node(p), b));
+}
+
+/* (:sclass obj body) */
+static node*
+new_sclass(parser_state *p, node *o, node *b)
+{
+ void_expr_error(p, o);
+ return list3((node*)NODE_SCLASS, o, cons(locals_node(p), b));
+}
+
+/* (:module module body) */
+static node*
+new_module(parser_state *p, node *m, node *b)
+{
+ return list3((node*)NODE_MODULE, m, cons(locals_node(p), b));
+}
+
+/* (:def m lv (arg . body)) */
+static node*
+new_def(parser_state *p, mrb_sym m, node *a, node *b)
+{
+ return list5((node*)NODE_DEF, nsym(m), locals_node(p), a, b);
+}
+
+/* (:sdef obj m lv (arg . body)) */
+static node*
+new_sdef(parser_state *p, node *o, mrb_sym m, node *a, node *b)
+{
+ void_expr_error(p, o);
+ return list6((node*)NODE_SDEF, o, nsym(m), locals_node(p), a, b);
+}
+
+/* (:arg . sym) */
+static node*
+new_arg(parser_state *p, mrb_sym sym)
+{
+ return cons((node*)NODE_ARG, nsym(sym));
+}
+
+static void
+local_add_margs(parser_state *p, node *n)
+{
+ while (n) {
+ if (n->car->car == (node*)NODE_MASGN) {
+ node *t = n->car->cdr->cdr;
+
+ n->car->cdr->cdr = NULL;
+ while (t) {
+ local_add_f(p, sym(t->car));
+ t = t->cdr;
+ }
+ local_add_margs(p, n->car->cdr->car->car);
+ local_add_margs(p, n->car->cdr->car->cdr->cdr->car);
+ }
+ n = n->cdr;
+ }
+}
+
+static void
+local_add_lv(parser_state *p, node *lv)
+{
+ while (lv) {
+ local_add_f(p, sym(lv->car));
+ lv = lv->cdr;
+ }
+}
+
+/* (m o r m2 tail) */
+/* m: (a b c) */
+/* o: ((a . e1) (b . e2)) */
+/* r: a */
+/* m2: (a b c) */
+/* b: a */
+static node*
+new_args(parser_state *p, node *m, node *opt, mrb_sym rest, node *m2, node *tail)
+{
+ node *n;
+
+ local_add_margs(p, m);
+ local_add_margs(p, m2);
+ n = cons(m2, tail);
+ n = cons(nsym(rest), n);
+ n = cons(opt, n);
+ while (opt) {
+ /* opt: (sym . (opt . lv)) -> (sym . opt) */
+ local_add_lv(p, opt->car->cdr->cdr);
+ opt->car->cdr = opt->car->cdr->car;
+ opt = opt->cdr;
+ }
+ return cons(m, n);
+}
+
+/* (:args_tail keywords rest_keywords_sym block_sym) */
+static node*
+new_args_tail(parser_state *p, node *kws, node *kwrest, mrb_sym blk)
+{
+ node *k;
+
+ if (kws || kwrest) {
+ local_add_kw(p, (kwrest && kwrest->cdr)? sym(kwrest->cdr) : 0);
+ }
+
+ local_add_blk(p, blk);
+
+ /* allocate register for keywords arguments */
+ /* order is for Proc#parameters */
+ for (k = kws; k; k = k->cdr) {
+ if (!k->car->cdr->cdr->car) { /* allocate required keywords */
+ local_add_f(p, sym(k->car->cdr->car));
+ }
+ }
+ for (k = kws; k; k = k->cdr) {
+ if (k->car->cdr->cdr->car) { /* allocate keywords with default */
+ local_add_lv(p, k->car->cdr->cdr->car->cdr);
+ k->car->cdr->cdr->car = k->car->cdr->cdr->car->car;
+ local_add_f(p, sym(k->car->cdr->car));
+ }
+ }
+
+ return list4((node*)NODE_ARGS_TAIL, kws, kwrest, nsym(blk));
+}
+
+/* (:kw_arg kw_sym def_arg) */
+static node*
+new_kw_arg(parser_state *p, mrb_sym kw, node *def_arg)
+{
+ mrb_assert(kw);
+ return list3((node*)NODE_KW_ARG, nsym(kw), def_arg);
+}
+
+/* (:kw_rest_args . a) */
+static node*
+new_kw_rest_args(parser_state *p, node *a)
+{
+ return cons((node*)NODE_KW_REST_ARGS, a);
+}
+
+/* (:block_arg . a) */
+static node*
+new_block_arg(parser_state *p, node *a)
+{
+ return cons((node*)NODE_BLOCK_ARG, a);
+}
+
+static node*
+setup_numparams(parser_state *p, node *a)
+{
+ int nvars = intn(p->nvars->car);
+ if (nvars > 0) {
+ int i;
+ mrb_sym sym;
+ // m || opt || rest || tail
+ if (a && (a->car || (a->cdr && a->cdr->car) || (a->cdr->cdr && a->cdr->cdr->car) || (a->cdr->cdr->cdr->cdr && a->cdr->cdr->cdr->cdr->car))) {
+ yyerror(p, "ordinary parameter is defined");
+ }
+ else if (p->locals) {
+ /* p->locals should not be NULL unless error happens before the point */
+ node* args = 0;
+ for (i = nvars; i > 0; i--) {
+ char buf[3];
+
+ buf[0] = '_';
+ buf[1] = i+'0';
+ buf[2] = '\0';
+ sym = intern_cstr(buf);
+ args = cons(new_arg(p, sym), args);
+ p->locals->car = cons(nsym(sym), p->locals->car);
+ }
+ a = new_args(p, args, 0, 0, 0, 0);
+ }
+ }
+ return a;
+}
+
+/* (:block arg body) */
+static node*
+new_block(parser_state *p, node *a, node *b)
+{
+ a = setup_numparams(p, a);
+ return list4((node*)NODE_BLOCK, locals_node(p), a, b);
+}
+
+/* (:lambda arg body) */
+static node*
+new_lambda(parser_state *p, node *a, node *b)
+{
+ return list4((node*)NODE_LAMBDA, locals_node(p), a, b);
+}
+
+/* (:asgn lhs rhs) */
+static node*
+new_asgn(parser_state *p, node *a, node *b)
+{
+ void_expr_error(p, b);
+ return cons((node*)NODE_ASGN, cons(a, b));
+}
+
+/* (:masgn mlhs=(pre rest post) mrhs) */
+static node*
+new_masgn(parser_state *p, node *a, node *b)
+{
+ void_expr_error(p, b);
+ return cons((node*)NODE_MASGN, cons(a, b));
+}
+
+/* (:masgn mlhs mrhs) no check */
+static node*
+new_masgn_param(parser_state *p, node *a, node *b)
+{
+ return cons((node*)NODE_MASGN, cons(a, b));
+}
+
+/* (:asgn lhs rhs) */
+static node*
+new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b)
+{
+ void_expr_error(p, b);
+ return list4((node*)NODE_OP_ASGN, a, nsym(op), b);
+}
+
+static node*
+new_imaginary(parser_state *p, node *imaginary)
+{
+ 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);
+}
+
+static node*
+new_rational(parser_state *p, node *rational)
+{
+ return new_call(p, new_const(p, intern_lit("Kernel")), intern_lit("Rational"), list1(list1(rational)), 1);
+}
+
+/* (:int . i) */
+static node*
+new_int(parser_state *p, const char *s, int base, int suffix)
+{
+ node* result = list3((node*)NODE_INT, (node*)strdup(s), nint(base));
+ if (suffix & NUM_SUFFIX_R) {
+ result = new_rational(p, result);
+ }
+ if (suffix & NUM_SUFFIX_I) {
+ result = new_imaginary(p, result);
+ }
+ return result;
+}
+
+#ifndef MRB_WITHOUT_FLOAT
+/* (:float . i) */
+static node*
+new_float(parser_state *p, const char *s, int suffix)
+{
+ node* result = cons((node*)NODE_FLOAT, (node*)strdup(s));
+ if (suffix & NUM_SUFFIX_R) {
+ result = new_rational(p, result);
+ }
+ if (suffix & NUM_SUFFIX_I) {
+ result = new_imaginary(p, result);
+ }
+ return result;
+}
+#endif
+
+/* (:str . (s . len)) */
+static node*
+new_str(parser_state *p, const char *s, size_t len)
+{
+ return cons((node*)NODE_STR, cons((node*)strndup(s, len), nint(len)));
+}
+
+/* (:dstr . a) */
+static node*
+new_dstr(parser_state *p, node *a)
+{
+ return cons((node*)NODE_DSTR, a);
+}
+
+static int
+string_node_p(node *n)
+{
+ return (int)((enum node_type)(intptr_t)n->car == NODE_STR);
+}
+
+static node*
+composite_string_node(parser_state *p, node *a, node *b)
+{
+ size_t newlen = (size_t)a->cdr + (size_t)b->cdr;
+ char *str = (char*)mrb_pool_realloc(p->pool, a->car, (size_t)a->cdr + 1, newlen + 1);
+ memcpy(str + (size_t)a->cdr, b->car, (size_t)b->cdr);
+ str[newlen] = '\0';
+ a->car = (node*)str;
+ a->cdr = (node*)newlen;
+ cons_free(b);
+ return a;
+}
+
+static node*
+concat_string(parser_state *p, node *a, node *b)
+{
+ if (string_node_p(a)) {
+ if (string_node_p(b)) {
+ /* a == NODE_STR && b == NODE_STR */
+ composite_string_node(p, a->cdr, b->cdr);
+ cons_free(b);
+ return a;
+ }
+ else {
+ /* a == NODE_STR && b == NODE_DSTR */
+
+ if (string_node_p(b->cdr->car)) {
+ /* a == NODE_STR && b->[NODE_STR, ...] */
+ composite_string_node(p, a->cdr, b->cdr->car->cdr);
+ cons_free(b->cdr->car);
+ b->cdr->car = a;
+ return b;
+ }
+ }
+ }
+ else {
+ node *c; /* last node of a */
+ for (c = a; c->cdr != NULL; c = c->cdr) ;
+
+ if (string_node_p(b)) {
+ /* a == NODE_DSTR && b == NODE_STR */
+ if (string_node_p(c->car)) {
+ /* a->[..., NODE_STR] && b == NODE_STR */
+ composite_string_node(p, c->car->cdr, b->cdr);
+ cons_free(b);
+ return a;
+ }
+
+ push(a, b);
+ return a;
+ }
+ else {
+ /* a == NODE_DSTR && b == NODE_DSTR */
+ if (string_node_p(c->car) && string_node_p(b->cdr->car)) {
+ /* a->[..., NODE_STR] && b->[NODE_STR, ...] */
+ node *d = b->cdr;
+ cons_free(b);
+ composite_string_node(p, c->car->cdr, d->car->cdr);
+ cons_free(d->car);
+ c->cdr = d->cdr;
+ cons_free(d);
+ return a;
+ }
+ else {
+ c->cdr = b->cdr;
+ cons_free(b);
+ return a;
+ }
+ }
+ }
+
+ return new_dstr(p, list2(a, b));
+}
+
+/* (:str . (s . len)) */
+static node*
+new_xstr(parser_state *p, const char *s, int len)
+{
+ return cons((node*)NODE_XSTR, cons((node*)strndup(s, len), nint(len)));
+}
+
+/* (:xstr . a) */
+static node*
+new_dxstr(parser_state *p, node *a)
+{
+ return cons((node*)NODE_DXSTR, a);
+}
+
+/* (:dsym . a) */
+static node*
+new_dsym(parser_state *p, node *a)
+{
+ return cons((node*)NODE_DSYM, a);
+}
+
+/* (:regx . (s . (opt . enc))) */
+static node*
+new_regx(parser_state *p, const char *p1, const char* p2, const char* p3)
+{
+ return cons((node*)NODE_REGX, cons((node*)p1, cons((node*)p2, (node*)p3)));
+}
+
+/* (:dregx . (a . b)) */
+static node*
+new_dregx(parser_state *p, node *a, node *b)
+{
+ return cons((node*)NODE_DREGX, cons(a, b));
+}
+
+/* (:backref . n) */
+static node*
+new_back_ref(parser_state *p, int n)
+{
+ return cons((node*)NODE_BACK_REF, nint(n));
+}
+
+/* (:nthref . n) */
+static node*
+new_nth_ref(parser_state *p, int n)
+{
+ return cons((node*)NODE_NTH_REF, nint(n));
+}
+
+/* (:heredoc . a) */
+static node*
+new_heredoc(parser_state *p)
+{
+ parser_heredoc_info *inf = (parser_heredoc_info *)parser_palloc(p, sizeof(parser_heredoc_info));
+ return cons((node*)NODE_HEREDOC, (node*)inf);
+}
+
+static void
+new_bv(parser_state *p, mrb_sym id)
+{
+}
+
+static node*
+new_literal_delim(parser_state *p)
+{
+ return cons((node*)NODE_LITERAL_DELIM, 0);
+}
+
+/* (:words . a) */
+static node*
+new_words(parser_state *p, node *a)
+{
+ return cons((node*)NODE_WORDS, a);
+}
+
+/* (:symbols . a) */
+static node*
+new_symbols(parser_state *p, node *a)
+{
+ return cons((node*)NODE_SYMBOLS, a);
+}
+
+/* xxx ----------------------------- */
+
+/* (:call a op) */
+static node*
+call_uni_op(parser_state *p, node *recv, const char *m)
+{
+ void_expr_error(p, recv);
+ return new_call(p, recv, intern_cstr(m), 0, 1);
+}
+
+/* (:call a op b) */
+static node*
+call_bin_op(parser_state *p, node *recv, const char *m, node *arg1)
+{
+ return new_call(p, recv, intern_cstr(m), list1(list1(arg1)), 1);
+}
+
+static void
+args_with_block(parser_state *p, node *a, node *b)
+{
+ if (b) {
+ if (a->cdr) {
+ yyerror(p, "both block arg and actual block given");
+ }
+ a->cdr = b;
+ }
+}
+
+static void
+call_with_block(parser_state *p, node *a, node *b)
+{
+ node *n;
+
+ switch ((enum node_type)intn(a->car)) {
+ case NODE_SUPER:
+ case NODE_ZSUPER:
+ if (!a->cdr) a->cdr = cons(0, b);
+ else {
+ args_with_block(p, a->cdr, b);
+ }
+ break;
+ case NODE_CALL:
+ case NODE_FCALL:
+ case NODE_SCALL:
+ n = a->cdr->cdr->cdr;
+ if (!n->car) n->car = cons(0, b);
+ else {
+ args_with_block(p, n->car, b);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+static node*
+negate_lit(parser_state *p, node *n)
+{
+ return cons((node*)NODE_NEGATE, n);
+}
+
+static node*
+cond(node *n)
+{
+ return n;
+}
+
+static node*
+ret_args(parser_state *p, node *n)
+{
+ if (n->cdr) {
+ yyerror(p, "block argument should not be given");
+ return NULL;
+ }
+ if (!n->car->cdr) return n->car->car;
+ return new_array(p, n->car);
+}
+
+static void
+assignable(parser_state *p, node *lhs)
+{
+ if (intn(lhs->car) == NODE_LVAR) {
+ local_add(p, sym(lhs->cdr));
+ }
+}
+
+static node*
+var_reference(parser_state *p, node *lhs)
+{
+ node *n;
+
+ if (intn(lhs->car) == NODE_LVAR) {
+ if (!local_var_p(p, sym(lhs->cdr))) {
+ n = new_fcall(p, sym(lhs->cdr), 0);
+ cons_free(lhs);
+ return n;
+ }
+ }
+
+ return lhs;
+}
+
+typedef enum mrb_string_type string_type;
+
+static node*
+new_strterm(parser_state *p, string_type type, int term, int paren)
+{
+ return cons(nint(type), cons((node*)0, cons(nint(paren), nint(term))));
+}
+
+static void
+end_strterm(parser_state *p)
+{
+ cons_free(p->lex_strterm->cdr->cdr);
+ cons_free(p->lex_strterm->cdr);
+ cons_free(p->lex_strterm);
+ p->lex_strterm = NULL;
+}
+
+static parser_heredoc_info *
+parsing_heredoc_inf(parser_state *p)
+{
+ node *nd = p->parsing_heredoc;
+ if (nd == NULL)
+ return NULL;
+ /* mrb_assert(nd->car->car == NODE_HEREDOC); */
+ return (parser_heredoc_info*)nd->car->cdr;
+}
+
+static void
+heredoc_treat_nextline(parser_state *p)
+{
+ if (p->heredocs_from_nextline == NULL)
+ return;
+ if (p->parsing_heredoc == NULL) {
+ node *n;
+ p->parsing_heredoc = p->heredocs_from_nextline;
+ p->lex_strterm_before_heredoc = p->lex_strterm;
+ p->lex_strterm = new_strterm(p, parsing_heredoc_inf(p)->type, 0, 0);
+ n = p->all_heredocs;
+ if (n) {
+ while (n->cdr)
+ n = n->cdr;
+ n->cdr = p->parsing_heredoc;
+ }
+ else {
+ p->all_heredocs = p->parsing_heredoc;
+ }
+ }
+ else {
+ node *n, *m;
+ m = p->heredocs_from_nextline;
+ while (m->cdr)
+ m = m->cdr;
+ n = p->all_heredocs;
+ mrb_assert(n != NULL);
+ if (n == p->parsing_heredoc) {
+ m->cdr = n;
+ p->all_heredocs = p->heredocs_from_nextline;
+ p->parsing_heredoc = p->heredocs_from_nextline;
+ }
+ else {
+ while (n->cdr != p->parsing_heredoc) {
+ n = n->cdr;
+ mrb_assert(n != NULL);
+ }
+ m->cdr = n->cdr;
+ n->cdr = p->heredocs_from_nextline;
+ p->parsing_heredoc = p->heredocs_from_nextline;
+ }
+ }
+ p->heredocs_from_nextline = NULL;
+}
+
+static void
+heredoc_end(parser_state *p)
+{
+ p->parsing_heredoc = p->parsing_heredoc->cdr;
+ if (p->parsing_heredoc == NULL) {
+ p->lstate = EXPR_BEG;
+ end_strterm(p);
+ p->lex_strterm = p->lex_strterm_before_heredoc;
+ p->lex_strterm_before_heredoc = NULL;
+ }
+ else {
+ /* next heredoc */
+ p->lex_strterm->car = nint(parsing_heredoc_inf(p)->type);
+ }
+}
+#define is_strterm_type(p,str_func) (intn((p)->lex_strterm->car) & (str_func))
+
+/* xxx ----------------------------- */
+
+
+#line 1408 "mrbgems/mruby-compiler/core/y.tab.c"
+
+# ifndef YY_CAST
+# ifdef __cplusplus
+# define YY_CAST(Type, Val) static_cast<Type> (Val)
+# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
+# else
+# define YY_CAST(Type, Val) ((Type) (Val))
+# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+# endif
+# endif
+# ifndef YY_NULLPTR
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# else
+# define YY_NULLPTR ((void*)0)
+# endif
+# endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 1
+#endif
+
+
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
+
+/* Token type. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ enum yytokentype
+ {
+ keyword_class = 258,
+ keyword_module = 259,
+ keyword_def = 260,
+ keyword_begin = 261,
+ keyword_if = 262,
+ keyword_unless = 263,
+ keyword_while = 264,
+ keyword_until = 265,
+ keyword_for = 266,
+ keyword_undef = 267,
+ keyword_rescue = 268,
+ keyword_ensure = 269,
+ keyword_end = 270,
+ keyword_then = 271,
+ keyword_elsif = 272,
+ keyword_else = 273,
+ keyword_case = 274,
+ keyword_when = 275,
+ keyword_break = 276,
+ keyword_next = 277,
+ keyword_redo = 278,
+ keyword_retry = 279,
+ keyword_in = 280,
+ keyword_do = 281,
+ keyword_do_cond = 282,
+ keyword_do_block = 283,
+ keyword_do_LAMBDA = 284,
+ keyword_return = 285,
+ keyword_yield = 286,
+ keyword_super = 287,
+ keyword_self = 288,
+ keyword_nil = 289,
+ keyword_true = 290,
+ keyword_false = 291,
+ keyword_and = 292,
+ keyword_or = 293,
+ keyword_not = 294,
+ modifier_if = 295,
+ modifier_unless = 296,
+ modifier_while = 297,
+ modifier_until = 298,
+ modifier_rescue = 299,
+ keyword_alias = 300,
+ keyword_BEGIN = 301,
+ keyword_END = 302,
+ keyword__LINE__ = 303,
+ keyword__FILE__ = 304,
+ keyword__ENCODING__ = 305,
+ tIDENTIFIER = 306,
+ tFID = 307,
+ tGVAR = 308,
+ tIVAR = 309,
+ tCONSTANT = 310,
+ tCVAR = 311,
+ tLABEL_TAG = 312,
+ tINTEGER = 313,
+ tFLOAT = 314,
+ tCHAR = 315,
+ tXSTRING = 316,
+ tREGEXP = 317,
+ tSTRING = 318,
+ tSTRING_PART = 319,
+ tSTRING_MID = 320,
+ tNTH_REF = 321,
+ tBACK_REF = 322,
+ tREGEXP_END = 323,
+ tNUMPARAM = 324,
+ tUPLUS = 325,
+ tUMINUS = 326,
+ tPOW = 327,
+ tCMP = 328,
+ tEQ = 329,
+ tEQQ = 330,
+ tNEQ = 331,
+ tGEQ = 332,
+ tLEQ = 333,
+ tANDOP = 334,
+ tOROP = 335,
+ tMATCH = 336,
+ tNMATCH = 337,
+ tDOT2 = 338,
+ tDOT3 = 339,
+ tAREF = 340,
+ tASET = 341,
+ tLSHFT = 342,
+ tRSHFT = 343,
+ tCOLON2 = 344,
+ tCOLON3 = 345,
+ tOP_ASGN = 346,
+ tASSOC = 347,
+ tLPAREN = 348,
+ tLPAREN_ARG = 349,
+ tRPAREN = 350,
+ tLBRACK = 351,
+ tLBRACE = 352,
+ tLBRACE_ARG = 353,
+ tSTAR = 354,
+ tDSTAR = 355,
+ tAMPER = 356,
+ tLAMBDA = 357,
+ tANDDOT = 358,
+ tSYMBEG = 359,
+ tREGEXP_BEG = 360,
+ tWORDS_BEG = 361,
+ tSYMBOLS_BEG = 362,
+ tSTRING_BEG = 363,
+ tXSTRING_BEG = 364,
+ tSTRING_DVAR = 365,
+ tLAMBEG = 366,
+ tHEREDOC_BEG = 367,
+ tHEREDOC_END = 368,
+ tLITERAL_DELIM = 369,
+ tHD_LITERAL_DELIM = 370,
+ tHD_STRING_PART = 371,
+ tHD_STRING_MID = 372,
+ tLOWEST = 373,
+ tUMINUS_NUM = 374,
+ tLAST_TOKEN = 375
+ };
+#endif
+
+/* Value type. */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+union YYSTYPE
+{
+#line 1350 "mrbgems/mruby-compiler/core/parse.y"
+
+ node *nd;
+ mrb_sym id;
+ int num;
+ stack_type stack;
+ const struct vtable *vars;
+
+#line 1586 "mrbgems/mruby-compiler/core/y.tab.c"
+
+};
+typedef union YYSTYPE YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+
+int yyparse (parser_state *p);
+
+
+
+
+
+#ifdef short
+# undef short
+#endif
+
+/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
+ <limits.h> and (if available) <stdint.h> are included
+ so that the code can choose integer types of a good width. */
+
+#ifndef __PTRDIFF_MAX__
+# include <limits.h> /* INFRINGES ON USER NAME SPACE */
+# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_STDINT_H
+# endif
+#endif
+
+/* Narrow types that promote to a signed type and that can represent a
+ signed or unsigned integer of at least N bits. In tables they can
+ save space and decrease cache pressure. Promoting to a signed type
+ helps avoid bugs in integer arithmetic. */
+
+#ifdef __INT_LEAST8_MAX__
+typedef __INT_LEAST8_TYPE__ yytype_int8;
+#elif defined YY_STDINT_H
+typedef int_least8_t yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+
+#ifdef __INT_LEAST16_MAX__
+typedef __INT_LEAST16_TYPE__ yytype_int16;
+#elif defined YY_STDINT_H
+typedef int_least16_t yytype_int16;
+#else
+typedef short yytype_int16;
+#endif
+
+#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST8_TYPE__ yytype_uint8;
+#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
+ && UINT_LEAST8_MAX <= INT_MAX)
+typedef uint_least8_t yytype_uint8;
+#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
+typedef unsigned char yytype_uint8;
+#else
+typedef short yytype_uint8;
+#endif
+
+#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST16_TYPE__ yytype_uint16;
+#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
+ && UINT_LEAST16_MAX <= INT_MAX)
+typedef uint_least16_t yytype_uint16;
+#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
+typedef unsigned short yytype_uint16;
+#else
+typedef int yytype_uint16;
+#endif
+
+#ifndef YYPTRDIFF_T
+# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
+# define YYPTRDIFF_T __PTRDIFF_TYPE__
+# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
+# elif defined PTRDIFF_MAX
+# ifndef ptrdiff_t
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# endif
+# define YYPTRDIFF_T ptrdiff_t
+# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
+# else
+# define YYPTRDIFF_T long
+# define YYPTRDIFF_MAXIMUM LONG_MAX
+# endif
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM \
+ YY_CAST (YYPTRDIFF_T, \
+ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
+ ? YYPTRDIFF_MAXIMUM \
+ : YY_CAST (YYSIZE_T, -1)))
+
+#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
+/* Stored state numbers (used for stacks). */
+typedef yytype_int16 yy_state_t;
+
+/* State numbers in computations. */
+typedef int yy_state_fast_t;
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define YY_ATTRIBUTE_PURE
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+# define YY_ATTRIBUTE_UNUSED
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(E) ((void) (E))
+#else
+# define YYUSE(E) /* empty */
+#endif
+
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END \
+ _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
+
+
+#define YY_ASSERT(E) ((void) (0 && (E)))
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+# ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+# endif
+# else
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+ && (! defined __cplusplus \
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ yy_state_t yyss_alloc;
+ YYSTYPE yyvs_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) \
+ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
+ + YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYPTRDIFF_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / YYSIZEOF (*yyptr); \
+ } \
+ while (0)
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(Dst, Src, Count) \
+ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
+# else
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYPTRDIFF_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+ while (0)
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 3
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 11586
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 147
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 176
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 594
+/* YYNSTATES -- Number of states. */
+#define YYNSTATES 1034
+
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 375
+
+
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, with out-of-bounds checking. */
+#define YYTRANSLATE(YYX) \
+ (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex. */
+static const yytype_uint8 yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 146, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 133, 2, 2, 2, 131, 126, 2,
+ 142, 143, 129, 127, 140, 128, 145, 130, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 121, 144,
+ 123, 119, 122, 120, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 138, 2, 139, 125, 2, 141, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 136, 124, 137, 134, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
+ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
+ 115, 116, 117, 118, 132, 135
+};
+
+#if YYDEBUG
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+static const yytype_int16 yyrline[] =
+{
+ 0, 1508, 1508, 1508, 1519, 1525, 1529, 1534, 1538, 1544,
+ 1546, 1545, 1559, 1586, 1592, 1596, 1601, 1605, 1611, 1611,
+ 1615, 1619, 1623, 1627, 1631, 1635, 1639, 1644, 1645, 1649,
+ 1653, 1657, 1661, 1664, 1668, 1672, 1676, 1680, 1684, 1689,
+ 1693, 1700, 1701, 1705, 1709, 1710, 1714, 1718, 1722, 1726,
+ 1729, 1738, 1739, 1742, 1743, 1750, 1749, 1764, 1768, 1773,
+ 1777, 1782, 1786, 1791, 1795, 1799, 1803, 1807, 1813, 1817,
+ 1823, 1824, 1830, 1834, 1838, 1842, 1846, 1850, 1854, 1858,
+ 1862, 1866, 1872, 1873, 1879, 1883, 1889, 1893, 1899, 1903,
+ 1907, 1911, 1915, 1919, 1925, 1931, 1938, 1942, 1946, 1950,
+ 1954, 1958, 1964, 1970, 1975, 1981, 1985, 1988, 1992, 1996,
+ 2003, 2004, 2005, 2006, 2011, 2018, 2019, 2022, 2026, 2026,
+ 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041,
+ 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051,
+ 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061,
+ 2064, 2064, 2064, 2065, 2065, 2066, 2066, 2066, 2067, 2067,
+ 2067, 2067, 2068, 2068, 2068, 2069, 2069, 2069, 2070, 2070,
+ 2070, 2070, 2071, 2071, 2071, 2071, 2072, 2072, 2072, 2072,
+ 2073, 2073, 2073, 2073, 2074, 2074, 2074, 2074, 2075, 2075,
+ 2078, 2082, 2086, 2090, 2094, 2098, 2102, 2107, 2112, 2117,
+ 2121, 2125, 2129, 2133, 2137, 2141, 2145, 2149, 2153, 2157,
+ 2161, 2165, 2169, 2173, 2177, 2181, 2185, 2189, 2193, 2197,
+ 2201, 2205, 2209, 2213, 2217, 2221, 2225, 2229, 2233, 2237,
+ 2241, 2245, 2249, 2255, 2256, 2261, 2265, 2272, 2276, 2284,
+ 2288, 2314, 2315, 2318, 2319, 2320, 2325, 2330, 2337, 2343,
+ 2348, 2353, 2358, 2365, 2365, 2376, 2382, 2386, 2392, 2393,
+ 2396, 2402, 2408, 2413, 2420, 2425, 2430, 2437, 2438, 2439,
+ 2440, 2441, 2442, 2443, 2444, 2448, 2453, 2452, 2464, 2468,
+ 2463, 2473, 2473, 2477, 2481, 2485, 2489, 2494, 2499, 2503,
+ 2507, 2511, 2515, 2519, 2520, 2526, 2532, 2525, 2544, 2552,
+ 2560, 2560, 2560, 2567, 2567, 2567, 2574, 2580, 2585, 2587,
+ 2584, 2596, 2594, 2612, 2617, 2610, 2634, 2632, 2649, 2653,
+ 2648, 2670, 2676, 2669, 2693, 2697, 2701, 2705, 2711, 2718,
+ 2719, 2720, 2723, 2724, 2727, 2728, 2736, 2737, 2743, 2747,
+ 2750, 2754, 2758, 2762, 2767, 2771, 2775, 2779, 2785, 2784,
+ 2794, 2798, 2802, 2806, 2812, 2817, 2822, 2826, 2830, 2834,
+ 2838, 2842, 2846, 2850, 2854, 2858, 2862, 2866, 2870, 2874,
+ 2878, 2884, 2889, 2896, 2896, 2900, 2905, 2912, 2916, 2922,
+ 2923, 2926, 2931, 2934, 2938, 2944, 2948, 2955, 2954, 2969,
+ 2979, 2983, 2988, 2995, 2999, 3003, 3007, 3011, 3015, 3019,
+ 3023, 3027, 3034, 3033, 3048, 3047, 3063, 3071, 3080, 3083,
+ 3090, 3093, 3097, 3098, 3101, 3105, 3108, 3112, 3115, 3116,
+ 3117, 3118, 3121, 3122, 3128, 3129, 3130, 3134, 3140, 3141,
+ 3147, 3152, 3151, 3162, 3166, 3172, 3176, 3182, 3186, 3192,
+ 3195, 3196, 3199, 3205, 3211, 3212, 3215, 3222, 3221, 3235,
+ 3239, 3246, 3251, 3258, 3264, 3265, 3266, 3267, 3268, 3272,
+ 3278, 3282, 3288, 3289, 3290, 3294, 3300, 3304, 3308, 3312,
+ 3316, 3322, 3326, 3332, 3336, 3340, 3344, 3348, 3352, 3360,
+ 3367, 3378, 3379, 3383, 3387, 3386, 3402, 3408, 3426, 3432,
+ 3438, 3444, 3451, 3456, 3463, 3467, 3473, 3477, 3483, 3484,
+ 3487, 3491, 3497, 3501, 3505, 3509, 3515, 3520, 3525, 3529,
+ 3533, 3537, 3541, 3545, 3549, 3553, 3557, 3561, 3565, 3569,
+ 3573, 3577, 3582, 3588, 3593, 3598, 3603, 3608, 3615, 3619,
+ 3626, 3631, 3630, 3642, 3646, 3652, 3660, 3668, 3676, 3680,
+ 3686, 3690, 3696, 3697, 3700, 3705, 3712, 3713, 3716, 3722,
+ 3726, 3732, 3737, 3737, 3762, 3763, 3769, 3774, 3780, 3781,
+ 3784, 3790, 3795, 3805, 3812, 3813, 3814, 3817, 3818, 3819,
+ 3820, 3823, 3824, 3825, 3828, 3829, 3832, 3836, 3842, 3843,
+ 3849, 3850, 3853, 3854, 3857, 3860, 3861, 3862, 3865, 3866,
+ 3867, 3870, 3877, 3878, 3882
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || 1
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "keyword_class", "keyword_module",
+ "keyword_def", "keyword_begin", "keyword_if", "keyword_unless",
+ "keyword_while", "keyword_until", "keyword_for", "keyword_undef",
+ "keyword_rescue", "keyword_ensure", "keyword_end", "keyword_then",
+ "keyword_elsif", "keyword_else", "keyword_case", "keyword_when",
+ "keyword_break", "keyword_next", "keyword_redo", "keyword_retry",
+ "keyword_in", "keyword_do", "keyword_do_cond", "keyword_do_block",
+ "keyword_do_LAMBDA", "keyword_return", "keyword_yield", "keyword_super",
+ "keyword_self", "keyword_nil", "keyword_true", "keyword_false",
+ "keyword_and", "keyword_or", "keyword_not", "modifier_if",
+ "modifier_unless", "modifier_while", "modifier_until", "modifier_rescue",
+ "keyword_alias", "keyword_BEGIN", "keyword_END", "keyword__LINE__",
+ "keyword__FILE__", "keyword__ENCODING__", "tIDENTIFIER", "tFID", "tGVAR",
+ "tIVAR", "tCONSTANT", "tCVAR", "tLABEL_TAG", "tINTEGER", "tFLOAT",
+ "tCHAR", "tXSTRING", "tREGEXP", "tSTRING", "tSTRING_PART", "tSTRING_MID",
+ "tNTH_REF", "tBACK_REF", "tREGEXP_END", "tNUMPARAM", "tUPLUS", "tUMINUS",
+ "tPOW", "tCMP", "tEQ", "tEQQ", "tNEQ", "tGEQ", "tLEQ", "tANDOP", "tOROP",
+ "tMATCH", "tNMATCH", "tDOT2", "tDOT3", "tAREF", "tASET", "tLSHFT",
+ "tRSHFT", "tCOLON2", "tCOLON3", "tOP_ASGN", "tASSOC", "tLPAREN",
+ "tLPAREN_ARG", "tRPAREN", "tLBRACK", "tLBRACE", "tLBRACE_ARG", "tSTAR",
+ "tDSTAR", "tAMPER", "tLAMBDA", "tANDDOT", "tSYMBEG", "tREGEXP_BEG",
+ "tWORDS_BEG", "tSYMBOLS_BEG", "tSTRING_BEG", "tXSTRING_BEG",
+ "tSTRING_DVAR", "tLAMBEG", "tHEREDOC_BEG", "tHEREDOC_END",
+ "tLITERAL_DELIM", "tHD_LITERAL_DELIM", "tHD_STRING_PART",
+ "tHD_STRING_MID", "tLOWEST", "'='", "'?'", "':'", "'>'", "'<'", "'|'",
+ "'^'", "'&'", "'+'", "'-'", "'*'", "'/'", "'%'", "tUMINUS_NUM", "'!'",
+ "'~'", "tLAST_TOKEN", "'{'", "'}'", "'['", "']'", "','", "'`'", "'('",
+ "')'", "';'", "'.'", "'\\n'", "$accept", "program", "$@1",
+ "top_compstmt", "top_stmts", "top_stmt", "@2", "bodystmt", "compstmt",
+ "stmts", "stmt", "$@3", "command_asgn", "command_rhs", "expr",
+ "expr_value", "command_call", "block_command", "cmd_brace_block", "$@4",
+ "command", "mlhs", "mlhs_inner", "mlhs_basic", "mlhs_item", "mlhs_list",
+ "mlhs_post", "mlhs_node", "lhs", "cname", "cpath", "fname", "fsym",
+ "undef_list", "$@5", "op", "reswords", "arg", "aref_args", "arg_rhs",
+ "paren_args", "opt_paren_args", "opt_call_args", "call_args",
+ "command_args", "@6", "block_arg", "opt_block_arg", "comma", "args",
+ "mrhs", "primary", "@7", "@8", "$@9", "$@10", "@11", "@12", "$@13",
+ "$@14", "$@15", "$@16", "$@17", "$@18", "@19", "@20", "@21", "@22",
+ "@23", "@24", "@25", "@26", "primary_value", "then", "do", "if_tail",
+ "opt_else", "for_var", "f_margs", "$@27", "block_args_tail",
+ "opt_block_args_tail", "block_param", "opt_block_param",
+ "block_param_def", "$@28", "opt_bv_decl", "bv_decls", "bvar",
+ "f_larglist", "lambda_body", "do_block", "$@29", "block_call",
+ "method_call", "brace_block", "@30", "@31", "case_body", "cases",
+ "opt_rescue", "exc_list", "exc_var", "opt_ensure", "literal", "string",
+ "string_fragment", "string_rep", "string_interp", "@32", "xstring",
+ "regexp", "heredoc", "heredoc_bodies", "heredoc_body",
+ "heredoc_string_rep", "heredoc_string_interp", "@33", "words", "symbol",
+ "basic_symbol", "sym", "symbols", "numeric", "variable", "var_lhs",
+ "var_ref", "backref", "superclass", "$@34", "f_arglist", "f_label",
+ "f_kw", "f_block_kw", "f_block_kwarg", "f_kwarg", "kwrest_mark",
+ "f_kwrest", "args_tail", "opt_args_tail", "f_args", "f_bad_arg",
+ "f_norm_arg", "f_arg_item", "@35", "f_arg", "f_opt_asgn", "f_opt",
+ "f_block_opt", "f_block_optarg", "f_optarg", "restarg_mark",
+ "f_rest_arg", "blkarg_mark", "f_block_arg", "opt_f_block_arg",
+ "singleton", "$@36", "assoc_list", "assocs", "label_tag", "assoc",
+ "operation", "operation2", "operation3", "dot_or_colon", "call_op",
+ "call_op2", "opt_terms", "opt_nl", "rparen", "trailer", "term", "nl",
+ "terms", "none", YY_NULLPTR
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
+static const yytype_int16 yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
+ 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
+ 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
+ 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
+ 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
+ 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
+ 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
+ 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
+ 365, 366, 367, 368, 369, 370, 371, 372, 373, 61,
+ 63, 58, 62, 60, 124, 94, 38, 43, 45, 42,
+ 47, 37, 374, 33, 126, 375, 123, 125, 91, 93,
+ 44, 96, 40, 41, 59, 46, 10
+};
+# endif
+
+#define YYPACT_NINF (-829)
+
+#define yypact_value_is_default(Yyn) \
+ ((Yyn) == YYPACT_NINF)
+
+#define YYTABLE_NINF (-595)
+
+#define yytable_value_is_error(Yyn) \
+ ((Yyn) == YYTABLE_NINF)
+
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+static const yytype_int16 yypact[] =
+{
+ -829, 164, 2491, -829, 7022, 8994, 9330, 5100, -829, 8646,
+ 8646, -829, -829, 9106, 6520, 4956, 7370, 7370, -829, -829,
+ 7370, 2735, 5870, -829, -829, -829, -829, -39, 6520, -829,
+ 36, -829, -829, -829, 5240, 5380, -829, -829, 5520, -829,
+ -829, -829, -829, -829, -829, -829, 20, 8762, 8762, 129,
+ 4227, 1481, 7602, 7950, 6798, -829, 6242, 614, 927, 1024,
+ 1126, 839, -829, 410, 8878, 8762, -829, 852, -829, 1251,
+ -829, 448, -829, -829, 166, 171, -829, 80, 9218, -829,
+ 198, 11318, 299, 402, 21, 59, -829, 354, -829, -829,
+ -829, -829, -829, -829, -829, -829, -829, 203, 165, -829,
+ 340, 137, -829, -829, -829, -829, -829, 159, 159, 177,
+ 72, 552, -829, 8646, 99, 4344, 607, -829, 200, -829,
+ 494, -829, -829, 137, -829, -829, -829, -829, -829, -829,
+ -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,
+ -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,
+ -829, -829, 33, 44, 47, 101, -829, -829, -829, -829,
+ -829, -829, 170, 218, 219, 227, -829, 229, -829, -829,
+ -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,
+ -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,
+ -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,
+ -829, -829, -829, 240, 3417, 270, 448, 83, 225, 526,
+ 61, 247, 86, 83, 8646, 8646, 539, 306, -829, -829,
+ 609, 329, 95, 110, -829, -829, -829, -829, -829, -829,
+ -829, -829, -829, 6381, -829, -829, 253, -829, -829, -829,
+ -829, -829, -829, 852, -829, 264, -829, 386, -829, -829,
+ 852, 2601, 8762, 8762, 8762, 8762, -829, 11297, -829, -829,
+ 271, 361, 271, -829, -829, -829, 7138, -829, -829, -829,
+ 7370, -829, -829, -829, 4956, 8646, -829, -829, 286, 4461,
+ -829, 796, 355, 398, 7254, 4227, 302, 852, 1251, 852,
+ 323, -829, 7254, 852, 325, 1517, 1517, -829, 11297, 316,
+ 1517, -829, 421, 9442, 370, 798, 826, 859, 1597, -829,
+ -829, -829, -829, 1166, -829, -829, -829, -829, -829, -829,
+ 679, 749, -829, -829, 1186, -829, 1195, -829, 1257, -829,
+ 860, 444, 446, -829, -829, -829, -829, 4722, 8646, 8646,
+ 8646, 8646, 7254, 8646, 8646, -829, -829, 8066, -829, 4227,
+ 6910, 392, 8066, 8762, 8762, 8762, 8762, 8762, 8762, 8762,
+ 8762, 8762, 8762, 8762, 8762, 8762, 8762, 8762, 8762, 8762,
+ 8762, 8762, 8762, 8762, 8762, 8762, 8762, 8762, 8762, 9714,
+ -829, 7370, -829, 9798, -829, -829, 10974, -829, -829, -829,
+ -829, 8878, 8878, -829, 428, -829, 448, -829, 961, -829,
+ -829, -829, -829, -829, 9882, 7370, 9966, 3417, 8646, -829,
+ -829, -829, -829, 522, 528, 149, -829, 3561, 533, 8762,
+ 10050, 7370, 10134, 8762, 8762, 3849, 126, 126, 113, 10218,
+ 7370, 10302, -829, 501, -829, 4461, 386, -829, -829, 8182,
+ 542, -829, 679, 8762, 11318, 11318, 11318, 8762, 476, -829,
+ 7486, -829, 8762, -829, 7718, 852, 425, 852, 271, 271,
+ -829, -829, 745, 431, -829, -829, 6520, 3966, 443, 10050,
+ 10134, 8762, 1251, 852, -829, -829, 4839, 445, 1251, -829,
+ -829, 7834, -829, 852, 7950, -829, -829, -829, 961, 80,
+ 9442, -829, 9442, 10386, 7370, 10470, 30, -829, -829, -829,
+ -829, -829, -829, -829, -829, -829, -829, -829, -829, 1719,
+ -829, 8762, -829, 451, 554, 472, -829, -829, -829, -829,
+ -829, 479, 8762, -829, 497, 596, 511, 608, -829, -829,
+ 1283, 4461, 679, -829, -829, -829, -829, -829, -829, -829,
+ 8762, 8762, -829, -829, -829, -829, -829, -829, -829, -829,
+ 153, 8762, -829, 11121, 271, -829, 852, 9442, 532, -829,
+ -829, -829, 570, 572, 2302, -829, -829, 976, 180, 355,
+ 2331, 2331, 2331, 2331, 1479, 1479, 11455, 11395, 2331, 2331,
+ 11378, 11378, 671, 671, 11061, 1479, 1479, 1462, 1462, 1490,
+ 175, 175, 355, 355, 355, 2869, 5986, 3137, 6102, -829,
+ 159, -829, 550, 437, -829, 563, -829, -829, 5870, -829,
+ -829, 2061, 153, 153, -829, 11044, -829, -829, -829, -829,
+ -829, 852, 8646, 3417, 736, 813, -829, 159, 560, 159,
+ 699, 745, 1650, 6659, -829, 8298, 706, -829, 690, -829,
+ 5636, 5753, 605, 268, 276, 706, -829, -829, -829, -829,
+ 79, 88, 613, 121, 140, 8646, 6520, 616, 740, 11318,
+ 450, -829, 679, 11318, 11318, 679, 8762, 11297, -829, 271,
+ 11318, -829, -829, -829, -829, 7486, 7718, -829, -829, -829,
+ 623, -829, -829, 136, 1251, 852, 1517, 392, -829, 736,
+ 813, 626, 959, 1023, -829, -829, 1123, 622, 77, 11318,
+ 768, -829, -829, -829, 201, -829, 1719, -829, 11318, 1719,
+ -829, -829, 1907, -829, -829, -829, 637, -829, 355, 355,
+ -829, 1719, 3417, -829, -829, 11140, 8414, -829, -829, 9442,
+ 7254, 8878, 8762, 10554, 7370, 10638, 70, 8878, 8878, -829,
+ 428, 672, 8878, 8878, -829, 428, 59, 166, 3417, 4461,
+ 153, -829, 852, 762, -829, -829, -829, 1826, 3417, 852,
+ -829, 11121, -829, 689, -829, 4110, 774, -829, 8646, 779,
+ -829, 8762, 8762, 358, 8762, 8762, 800, 4605, 4605, 156,
+ 126, -829, -829, -829, 8530, 3705, 679, 11318, -829, 271,
+ -829, -829, -829, 192, -829, 104, 852, 676, 674, 678,
+ 3417, 4461, -829, 766, -829, 472, -829, -829, -829, 684,
+ 686, 687, -829, 691, 766, 687, -829, -829, 622, 622,
+ 9554, -829, 694, 472, 695, 9554, -829, 698, 701, -829,
+ 835, 8762, 11209, -829, -829, 11318, 3003, 3271, 712, 408,
+ 432, 8762, 8762, -829, -829, -829, -829, -829, 8878, -829,
+ -829, -829, -829, -829, -829, -829, 840, 722, 4461, 3417,
+ -829, -829, 852, 852, 845, -829, 1650, 9666, 83, -829,
+ -829, 4605, -829, -829, 83, -829, 8762, -829, 855, 856,
+ -829, 11318, 193, 7718, -829, 733, -829, 1530, -829, 680,
+ 868, 753, -829, 1719, -829, 1907, -829, 1907, -829, 1907,
+ -829, -829, 769, 771, 837, 995, 768, -829, -829, 1282,
+ -829, 995, 1719, -829, 1907, -829, -829, 11228, 439, 11318,
+ 11318, -829, -829, -829, -829, 761, 896, -829, -829, -829,
+ 3417, 862, -829, 1028, 826, 859, 3417, -829, 3561, -829,
+ -829, 4605, -829, -829, -829, 1585, 1585, 547, -829, 22,
+ -829, -829, -829, -829, 687, 778, 687, 687, -829, -829,
+ -829, 10722, -829, 472, 768, -829, -829, 780, 792, 793,
+ -829, 799, 793, -829, -829, 913, 961, 10806, 7370, 10890,
+ 528, 690, 935, 812, 812, 1585, 823, 680, -829, -829,
+ 1907, -829, -829, -829, 824, 828, -829, 1719, -829, 1907,
+ -829, 1907, -829, 1907, -829, -829, -829, 736, 813, 834,
+ 357, 579, -829, -829, -829, 1585, 812, 1585, -829, 687,
+ 793, 842, 793, 793, 192, 812, -829, -829, 1907, -829,
+ -829, -829, 793, -829
+};
+
+ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_int16 yydefact[] =
+{
+ 2, 0, 0, 1, 0, 0, 0, 0, 276, 0,
+ 0, 300, 303, 0, 0, 580, 324, 325, 326, 327,
+ 288, 253, 400, 475, 474, 476, 477, 582, 0, 10,
+ 0, 479, 478, 480, 466, 275, 468, 467, 470, 469,
+ 462, 463, 424, 425, 481, 482, 274, 0, 0, 0,
+ 0, 278, 594, 594, 80, 295, 0, 0, 0, 0,
+ 0, 0, 439, 0, 0, 0, 3, 580, 6, 9,
+ 27, 32, 44, 52, 51, 0, 68, 0, 72, 82,
+ 0, 49, 232, 0, 53, 293, 267, 268, 422, 269,
+ 270, 271, 420, 419, 451, 421, 418, 473, 0, 272,
+ 273, 253, 5, 8, 324, 325, 288, 594, 400, 0,
+ 105, 106, 274, 0, 0, 0, 0, 108, 483, 328,
+ 0, 473, 273, 0, 316, 160, 170, 161, 157, 186,
+ 187, 188, 189, 168, 183, 176, 166, 165, 181, 164,
+ 163, 159, 184, 158, 171, 175, 177, 169, 162, 178,
+ 185, 180, 179, 172, 182, 167, 156, 174, 173, 155,
+ 153, 154, 150, 151, 152, 110, 112, 111, 145, 146,
+ 141, 123, 124, 125, 132, 129, 131, 126, 127, 147,
+ 148, 133, 134, 138, 142, 128, 130, 120, 121, 122,
+ 135, 136, 137, 139, 140, 143, 144, 149, 552, 318,
+ 113, 114, 551, 0, 0, 0, 50, 0, 0, 0,
+ 473, 0, 273, 0, 0, 0, 104, 0, 339, 338,
+ 0, 0, 473, 273, 179, 172, 182, 167, 150, 151,
+ 152, 110, 111, 0, 115, 117, 20, 116, 442, 447,
+ 446, 588, 591, 580, 590, 0, 444, 0, 592, 589,
+ 581, 564, 0, 0, 0, 0, 248, 260, 66, 252,
+ 594, 422, 594, 556, 67, 65, 594, 242, 289, 64,
+ 0, 241, 399, 63, 580, 0, 583, 18, 0, 0,
+ 209, 0, 210, 285, 0, 0, 0, 580, 15, 580,
+ 70, 14, 0, 580, 0, 585, 585, 233, 0, 0,
+ 585, 554, 0, 0, 78, 0, 88, 95, 522, 456,
+ 455, 457, 458, 0, 454, 453, 437, 431, 430, 433,
+ 0, 0, 428, 449, 0, 460, 0, 426, 0, 435,
+ 0, 464, 465, 48, 224, 225, 4, 581, 0, 0,
+ 0, 0, 0, 0, 0, 387, 389, 0, 84, 0,
+ 76, 73, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 577, 594, 576, 0, 579, 578, 0, 404, 402, 294,
+ 423, 0, 0, 393, 57, 292, 313, 105, 106, 107,
+ 464, 465, 484, 311, 0, 594, 0, 0, 0, 319,
+ 575, 574, 321, 0, 594, 285, 330, 0, 329, 0,
+ 0, 594, 0, 0, 0, 0, 0, 0, 285, 0,
+ 594, 0, 308, 0, 118, 0, 0, 443, 445, 0,
+ 0, 593, 558, 0, 261, 563, 255, 0, 258, 249,
+ 0, 257, 0, 250, 0, 580, 0, 580, 594, 594,
+ 243, 254, 580, 0, 291, 47, 0, 0, 0, 0,
+ 0, 0, 17, 580, 283, 13, 581, 69, 279, 282,
+ 286, 587, 234, 586, 587, 236, 287, 555, 94, 86,
+ 0, 81, 0, 0, 594, 0, 529, 525, 524, 523,
+ 526, 527, 498, 531, 543, 499, 547, 546, 542, 522,
+ 296, 491, 496, 594, 501, 594, 521, 384, 528, 530,
+ 533, 507, 0, 540, 507, 545, 507, 0, 505, 459,
+ 0, 0, 434, 440, 438, 429, 450, 461, 427, 436,
+ 0, 0, 7, 21, 22, 23, 24, 25, 45, 46,
+ 594, 0, 28, 30, 0, 31, 580, 0, 74, 85,
+ 43, 33, 41, 0, 237, 190, 29, 0, 273, 206,
+ 214, 219, 220, 221, 216, 218, 228, 229, 222, 223,
+ 199, 200, 226, 227, 582, 215, 217, 211, 212, 213,
+ 201, 202, 203, 204, 205, 567, 572, 568, 573, 398,
+ 253, 396, 0, 567, 569, 568, 570, 397, 594, 567,
+ 568, 253, 594, 594, 34, 237, 191, 40, 198, 55,
+ 58, 0, 0, 0, 105, 106, 109, 0, 0, 594,
+ 0, 580, 522, 0, 277, 594, 594, 410, 594, 331,
+ 571, 284, 0, 567, 568, 594, 333, 301, 332, 304,
+ 571, 284, 0, 567, 568, 0, 0, 0, 0, 260,
+ 0, 307, 559, 561, 560, 0, 0, 262, 256, 594,
+ 562, 557, 240, 239, 244, 245, 247, 290, 584, 19,
+ 0, 26, 197, 71, 16, 580, 585, 87, 79, 91,
+ 93, 0, 90, 92, 489, 535, 0, 582, 0, 490,
+ 0, 503, 550, 500, 0, 504, 0, 514, 536, 0,
+ 517, 544, 0, 519, 548, 452, 0, 441, 207, 208,
+ 375, 373, 0, 372, 371, 266, 0, 83, 77, 0,
+ 0, 0, 0, 0, 594, 0, 0, 0, 0, 395,
+ 61, 401, 0, 0, 394, 59, 390, 54, 0, 0,
+ 594, 314, 0, 0, 401, 317, 553, 522, 0, 0,
+ 322, 411, 412, 594, 413, 0, 594, 336, 0, 0,
+ 334, 0, 0, 401, 0, 0, 0, 0, 0, 401,
+ 0, 119, 448, 306, 0, 0, 259, 263, 251, 594,
+ 11, 280, 235, 89, 529, 347, 580, 340, 0, 377,
+ 0, 0, 297, 0, 497, 594, 549, 506, 534, 507,
+ 507, 507, 541, 507, 529, 507, 432, 370, 582, 582,
+ 493, 494, 594, 594, 355, 0, 538, 355, 355, 353,
+ 0, 0, 264, 75, 42, 238, 567, 568, 0, 567,
+ 568, 0, 0, 39, 195, 38, 196, 62, 0, 36,
+ 193, 37, 194, 60, 391, 392, 0, 0, 0, 0,
+ 485, 312, 580, 580, 0, 488, 522, 0, 0, 415,
+ 337, 0, 12, 417, 0, 298, 0, 299, 0, 0,
+ 309, 262, 594, 246, 348, 345, 532, 0, 383, 0,
+ 0, 0, 502, 0, 510, 0, 512, 0, 518, 0,
+ 515, 520, 0, 0, 0, 492, 0, 351, 352, 355,
+ 363, 537, 0, 366, 0, 368, 388, 265, 401, 231,
+ 230, 35, 192, 405, 403, 0, 0, 487, 486, 320,
+ 0, 0, 414, 0, 96, 103, 0, 416, 0, 302,
+ 305, 0, 407, 408, 406, 0, 0, 343, 381, 582,
+ 379, 382, 386, 385, 507, 507, 507, 507, 376, 374,
+ 285, 0, 495, 594, 0, 354, 361, 355, 355, 355,
+ 539, 355, 355, 56, 315, 0, 102, 0, 594, 0,
+ 594, 594, 0, 349, 346, 0, 341, 0, 378, 511,
+ 0, 508, 513, 516, 571, 284, 350, 0, 358, 0,
+ 360, 0, 367, 0, 364, 369, 323, 99, 101, 0,
+ 567, 568, 409, 335, 310, 0, 344, 0, 380, 507,
+ 355, 355, 355, 355, 97, 342, 509, 359, 0, 356,
+ 362, 365, 355, 357
+};
+
+ /* YYPGOTO[NTERM-NUM]. */
+static const yytype_int16 yypgoto[] =
+{
+ -829, -829, -829, 510, -829, 32, -829, -214, 182, -829,
+ 28, -829, -155, -302, 867, 1, -16, -829, -536, -829,
+ 131, 971, -170, 4, -69, -266, -431, -15, 1295, -48,
+ 981, 19, 5, -829, -829, 24, -829, 653, -829, 413,
+ 75, -58, -352, 54, 13, -829, -390, -235, -11, 39,
+ -303, 89, -829, -829, -829, -829, -829, -829, -829, -829,
+ -829, -829, -829, -829, -829, -829, -829, -829, -829, -829,
+ -829, -829, 8, -206, -382, 7, -568, -829, -829, -829,
+ 272, 538, -829, -512, -829, -829, -78, -829, 2, -829,
+ -829, 255, -829, -829, -829, -65, -829, -829, -430, -829,
+ 14, -829, -829, -829, -829, -829, 154, 58, -196, -829,
+ -829, -829, -829, -377, -257, -829, 787, -829, -829, -829,
+ -6, -829, -829, -829, 1461, 1552, 1026, 1065, -829, -829,
+ 173, 314, 343, 141, -829, -829, -829, 524, -306, 246,
+ -307, -801, -716, -519, -829, 474, -664, -627, -828, 142,
+ 346, -829, 236, -829, 517, -439, -829, -829, -829, 92,
+ 785, -411, 505, -339, -829, -829, -80, -829, 26, -22,
+ -152, -254, 788, -12, -33, -2
+};
+
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int16 yydefgoto[] =
+{
+ -1, 1, 2, 66, 67, 68, 278, 413, 414, 287,
+ 288, 466, 70, 561, 71, 207, 72, 73, 620, 750,
+ 74, 75, 289, 76, 77, 78, 491, 79, 208, 117,
+ 118, 234, 235, 236, 656, 598, 201, 81, 294, 565,
+ 599, 268, 456, 457, 269, 270, 259, 449, 484, 458,
+ 555, 82, 204, 292, 685, 293, 308, 698, 214, 777,
+ 215, 778, 655, 941, 623, 621, 859, 407, 409, 632,
+ 633, 866, 281, 417, 647, 769, 770, 221, 796, 945,
+ 965, 910, 818, 722, 723, 819, 798, 949, 950, 510,
+ 802, 346, 550, 84, 85, 395, 613, 612, 440, 944,
+ 636, 763, 868, 872, 86, 87, 88, 321, 322, 531,
+ 89, 90, 91, 532, 244, 245, 246, 435, 92, 93,
+ 94, 315, 95, 96, 210, 211, 99, 212, 403, 622,
+ 758, 511, 512, 821, 822, 513, 514, 515, 807, 707,
+ 759, 518, 519, 520, 696, 521, 522, 523, 826, 827,
+ 524, 525, 526, 527, 528, 701, 203, 408, 299, 459,
+ 443, 263, 123, 627, 601, 412, 406, 386, 463, 799,
+ 464, 482, 248, 249, 250, 291
+};
+
+ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
+static const yytype_int16 yytable[] =
+{
+ 102, 517, 516, 383, 385, 275, 658, 425, 237, 351,
+ 83, 213, 83, 120, 120, 276, 243, 209, 209, 271,
+ 389, 220, 237, 209, 209, 209, 199, 453, 209, 602,
+ 69, 200, 69, 277, 337, 273, 103, 490, 200, 304,
+ 600, 247, 485, 671, 608, 649, 487, 611, 333, 566,
+ 297, 301, 200, 628, 290, 260, 260, 825, 83, 260,
+ 668, 688, 305, 533, 668, 662, 399, 629, 766, 642,
+ 258, 264, 209, 671, 265, 314, 705, 776, 652, 885,
+ 200, 600, 812, 608, 970, 387, 305, 694, 951, 614,
+ 617, 295, 629, 336, 119, 119, 267, 272, -564, 416,
+ 748, 749, 119, 274, -99, 271, 800, 242, 262, 262,
+ 384, -472, 262, -101, 394, 473, 324, 326, 328, 330,
+ -96, 209, -475, 83, 380, 535, 728, 841, 535, 422,
+ 535, 629, 535, -474, 535, -103, -476, 477, -102, -104,
+ 431, 479, 691, 119, 296, 300, -98, 256, 256, 695,
+ 397, 256, -471, 646, 398, 794, 629, 497, 498, 499,
+ 500, -466, 987, 387, 3, -100, 382, 119, 242, 970,
+ 261, 261, 279, 501, 261, -466, 393, 424, -475, 556,
+ -96, -97, 267, 272, 283, 533, 951, 808, 801, -474,
+ -477, 842, -476, 630, 345, 388, 238, 560, 393, 239,
+ 240, 470, 697, 516, 847, -103, 261, 261, -564, 853,
+ -466, 765, 83, 439, -564, 426, 427, -466, -401, -91,
+ 348, -567, 209, 209, 453, 495, 490, 241, -93, 242,
+ -568, 986, 286, 720, 489, -88, 560, 560, 858, 238,
+ 471, 390, 239, 240, 884, 825, -477, 353, 825, 450,
+ -95, 454, 314, -94, 476, -69, 391, 200, 451, -479,
+ 451, -90, 483, 483, 460, 671, 812, 483, -102, 436,
+ 241, 392, 242, 388, 209, 717, -83, 721, 209, 266,
+ -92, -401, 209, 209, 481, 668, 668, 83, 786, 290,
+ 347, 490, 83, 83, -471, -401, -89, 286, 833, -103,
+ 83, 266, 506, 672, 376, 377, 378, -478, -480, 260,
+ 677, 305, 472, 475, 942, -479, -466, 352, -470, 274,
+ 478, 683, -96, 402, 461, 415, 516, 507, -401, 410,
+ -401, 552, 762, 825, 535, 558, 562, -401, 423, 543,
+ 544, 545, 546, -88, 419, 83, 209, 209, 209, 209,
+ 83, 209, 209, 290, 432, 209, 626, 83, 305, 774,
+ 567, 428, 262, -478, -480, 69, 892, 775, 808, 542,
+ 547, 530, -466, -98, -470, 562, 562, 437, 808, 460,
+ 239, 240, 838, 907, 908, 411, 554, -98, -328, 209,
+ 808, 554, 119, 434, 600, -100, 608, 256, 880, 567,
+ 567, 256, -328, 460, 727, 717, 439, 606, 533, 753,
+ 606, 448, 637, 209, 42, 83, 209, 43, 442, 460,
+ 261, 687, 467, 489, 261, 83, 665, 353, 460, 209,
+ 606, 392, 792, 83, 788, 843, 276, -328, 209, 119,
+ 849, 851, -68, 83, -328, 474, 606, 675, 676, 876,
+ 863, 516, 943, 486, 785, 606, 451, 451, 607, -103,
+ 237, 468, 60, 490, 480, 102, 416, 286, 331, 332,
+ -98, 679, 671, -98, -98, 83, 488, -97, 660, 756,
+ -95, 607, 808, 674, 83, 343, 344, 735, 489, 471,
+ 200, 379, 460, 668, 606, 69, 808, 607, 305, 742,
+ 305, -98, 209, -98, 684, 380, 607, 101, 830, 101,
+ 492, 702, 256, 702, 101, 101, 540, -102, 541, 606,
+ 101, 101, 101, 743, 996, 101, 619, -98, 742, 717,
+ 848, 286, 559, 791, 856, 261, 256, 634, -94, 83,
+ 381, 635, 669, 726, 864, 607, 921, 382, 724, 639,
+ 744, -100, 256, 746, 788, 101, -98, 661, -97, 261,
+ 516, 256, 736, 238, 529, 305, 239, 240, 673, 101,
+ 607, 744, 276, 686, 678, 261, 560, -90, -565, 119,
+ 681, 119, 560, 404, 261, -83, 890, 560, 560, -582,
+ 448, 700, -582, -582, 241, -100, 242, 380, 794, 638,
+ 497, 498, 499, 500, 261, 703, 271, 645, 261, 271,
+ 724, 724, 704, 740, 730, 420, 501, 657, 101, 706,
+ 101, 745, 242, 752, 747, 256, 1009, 271, -274, 380,
+ 209, 83, 405, 764, 767, 261, 767, 709, 261, 382,
+ 629, -470, -274, 767, 886, 926, 119, 711, 261, 784,
+ 237, 712, 760, 483, 743, -470, 780, 200, 454, 714,
+ 489, 781, 936, 209, 421, 400, 401, 451, 938, 257,
+ 257, 382, 729, 257, 554, 739, 316, -274, 317, 318,
+ 200, 854, -100, 267, -274, 276, 267, 985, -565, 741,
+ -470, 731, -100, 560, -565, -100, -100, -470, 429, 754,
+ 280, 282, 739, -92, 267, 257, 298, 768, 765, 101,
+ 927, 928, 380, 716, 755, 562, 975, 334, 335, 101,
+ 101, 562, 845, -100, 765, -100, 562, 562, 319, 320,
+ 83, 948, 460, 497, 498, 499, 500, 305, 83, 567,
+ 902, 903, 209, 353, 773, 567, 209, 430, 724, 501,
+ 567, 567, 779, 782, 382, 783, 83, 83, 834, 606,
+ 790, 869, -571, 848, 873, 793, 83, 789, 242, 874,
+ 710, 101, 713, 83, 816, 101, 209, 861, 883, 101,
+ 101, 867, 343, 344, 101, 83, 83, 451, 871, 101,
+ 101, -97, 238, 83, 875, 239, 240, 101, 374, 375,
+ 376, 377, 378, 702, 616, 618, 276, 276, 83, 83,
+ 607, 534, -89, 317, 318, 877, 887, 888, 119, 803,
+ 702, 702, 889, 694, 893, -571, 895, 897, 905, 261,
+ 261, 899, 562, 911, 906, 909, 616, 618, 912, -571,
+ 502, 914, 101, 101, 101, 101, 101, 101, 101, 101,
+ 916, 918, 101, 979, 101, 923, 567, 101, 238, 924,
+ 929, 239, 240, 319, 320, 256, 83, 83, 505, 506,
+ 939, 940, -571, 946, -571, 933, 206, 206, -567, 83,
+ 767, -571, 206, 952, 682, 469, 101, 493, 261, 241,
+ 953, 242, 960, 958, 507, 959, 101, 101, 973, 380,
+ 329, 380, -284, 317, 318, 444, 445, 446, 334, 119,
+ 101, 974, 101, 101, 119, -473, -284, 976, 990, 257,
+ 997, 539, 101, 257, 317, 318, 101, 988, 1006, -473,
+ 101, 857, 999, 1001, 421, 101, 494, 276, 83, 1003,
+ 101, 382, 810, 382, 83, 813, 83, 870, -273, 83,
+ 1014, -284, 1015, 319, 320, -568, 119, 828, -284, 878,
+ 879, 702, -273, 1017, -473, 238, -567, 882, 239, 240,
+ -568, -473, 101, 1024, 319, 320, 460, 680, 637, 767,
+ 396, 101, 1028, 891, 218, -567, 209, 124, 1013, 1018,
+ 323, 317, 318, 817, 1012, 418, 241, -273, 242, 101,
+ 553, 418, 855, 606, -273, 564, 569, 570, 571, 572,
+ 573, 574, 575, 576, 577, 578, 579, 580, 581, 582,
+ 583, 584, 585, 586, 587, 588, 589, 590, 591, 592,
+ 593, 594, 438, 202, 257, 820, 101, 261, 441, 930,
+ 925, 319, 320, 804, 615, 615, 452, 962, -567, -568,
+ -285, 967, 809, 937, 607, 894, 896, 898, 257, 900,
+ 0, 901, -567, 0, -285, 733, 0, 100, 0, 100,
+ 122, 122, 615, 0, 257, 0, 615, 615, 223, 380,
+ 0, 206, 206, 257, 961, 0, 0, 325, 317, 318,
+ 0, 0, 659, 0, 0, -567, 663, -567, 380, -285,
+ 664, -567, 0, 667, -567, 670, -285, 298, 0, 256,
+ 0, 0, -568, 0, 734, 100, 0, 977, 980, 307,
+ 981, 382, 0, 982, 615, 441, -568, 101, 101, 955,
+ 0, 380, 261, 405, 667, 0, 0, 298, 319, 320,
+ 382, 462, 465, 307, 0, 968, 0, 257, 971, 0,
+ 844, 846, 0, 0, 0, 850, 852, 0, 0, -568,
+ 101, -568, 0, 0, 699, -568, 978, 0, -568, 0,
+ 797, 0, 0, 382, 794, 708, 497, 498, 499, 500,
+ 100, 0, 0, 811, 844, 846, 815, 850, 852, 327,
+ 317, 318, 501, 718, 719, 824, 0, 0, 0, 0,
+ 989, 991, 992, 993, 725, 206, 206, 206, 206, 0,
+ 548, 549, 0, 0, 648, 648, 503, 806, 0, 0,
+ 820, 806, 795, 820, 805, 0, 820, 101, 820, 529,
+ 317, 318, 0, 1021, 0, 101, 101, 0, 829, 101,
+ 319, 320, 101, 101, 0, 823, 0, 101, 101, 536,
+ 317, 318, 0, 101, 101, 0, 0, 0, 537, 317,
+ 318, 922, 0, 101, 441, 1026, 0, 0, 0, 100,
+ 101, 441, 0, 101, 0, 631, 0, 0, 820, 0,
+ 319, 320, 101, 101, 0, 0, 0, 0, 761, 922,
+ 101, 338, 339, 340, 341, 342, 0, 80, 0, 80,
+ 319, 320, 0, 0, 0, 101, 101, 0, 219, 319,
+ 320, 820, 0, 820, 0, 820, 0, 820, 0, 787,
+ 538, 317, 318, 0, 0, 0, 0, 0, 667, 298,
+ 0, 0, 0, 496, 0, 497, 498, 499, 500, 0,
+ 0, 0, 820, 0, 100, 80, 715, 317, 318, 100,
+ 100, 501, 0, 101, 502, 0, 0, 100, 0, 0,
+ 0, 0, 0, 101, 101, 913, 915, 954, 307, 956,
+ 0, 319, 320, 957, 0, 503, 101, 0, 0, 832,
+ 0, 504, 505, 506, 615, 835, 969, 257, 972, 0,
+ 615, 615, 0, 0, 0, 615, 615, 319, 320, 0,
+ 0, 0, 100, 0, 0, 0, 0, 100, 507, 751,
+ 80, 508, 0, 0, 100, 307, 0, 568, 0, 983,
+ 984, 0, 964, 806, 615, 615, 829, 615, 615, 829,
+ 963, 829, 0, 823, 0, 101, 823, 881, 823, 0,
+ 0, 101, 0, 101, 0, 0, 101, 966, 418, 0,
+ 0, 0, 0, 0, 0, 0, 568, 568, 0, 1016,
+ 0, 0, 0, 97, 1019, 97, 121, 121, 121, 0,
+ 0, 1020, 100, 1022, 222, 0, 0, 1023, 0, 0,
+ 0, 829, 100, 101, 917, 0, 0, 0, 823, 206,
+ 100, 1025, 0, 0, 919, 920, 0, 0, 0, 80,
+ 100, 615, 1032, 0, 0, 998, 1000, 1002, 0, 1004,
+ 1005, 97, 0, 0, 829, 306, 829, 0, 829, 0,
+ 829, 823, 206, 823, 0, 823, 0, 823, 0, 615,
+ 0, 0, 100, 0, 353, 0, 298, 0, 0, 306,
+ 860, 100, 0, 0, 0, 829, 0, 865, 0, 366,
+ 367, 353, 823, 0, 98, 307, 98, 307, 1027, 1029,
+ 1030, 1031, 353, 0, 0, 0, 366, 367, 648, 0,
+ 1033, 0, 0, 0, 80, 0, 97, 366, 367, 80,
+ 80, 794, 0, 497, 498, 499, 500, 80, 373, 374,
+ 375, 376, 377, 378, -281, 0, 100, -281, -281, 501,
+ 0, 0, 98, 371, 372, 373, 374, 375, 376, 377,
+ 378, 0, 0, 0, 0, 0, 0, 374, 375, 376,
+ 377, 378, 307, 503, -281, -281, 0, -281, 0, 947,
+ 238, 257, 80, 239, 240, 206, 794, 80, 497, 498,
+ 499, 500, 0, 0, 80, 0, 0, 563, 496, 0,
+ 497, 498, 499, 500, 501, 0, 418, 448, 0, 0,
+ 0, 241, 418, 242, 0, 97, 501, 98, 0, 502,
+ 0, 0, 0, 0, 0, 0, 0, 0, 503, 0,
+ 0, 0, 0, 0, 0, 0, 563, 563, 100, 0,
+ 503, 0, 0, 0, 0, 0, 504, 505, 506, 0,
+ 0, 496, 80, 497, 498, 499, 500, 0, 0, 0,
+ 0, 0, 80, 0, 0, 0, 0, 0, 0, 501,
+ 80, 0, 502, 507, 0, 0, 508, 0, 0, 0,
+ 80, 0, 0, 0, 0, 0, 0, 0, 0, 509,
+ 97, 0, 0, 503, 0, 97, 97, 0, 0, 504,
+ 505, 506, 0, 97, 0, 0, 98, 0, 0, 0,
+ 0, 0, 80, 0, 306, 0, 0, 0, 0, 0,
+ 496, 80, 497, 498, 499, 500, 507, 0, 0, 508,
+ 0, 0, 0, 0, 0, 0, 0, 100, 501, 0,
+ 0, 502, 757, 0, 307, 100, 568, 0, 97, 0,
+ 0, 0, 568, 97, 0, 0, 0, 568, 568, 0,
+ 97, 306, 503, 100, 100, 0, 0, 0, 504, 505,
+ 506, 0, 0, 100, 0, 0, 80, 0, 0, 0,
+ 100, 98, 0, 0, 0, 0, 98, 98, 0, 0,
+ 0, 0, 100, 100, 98, 507, 0, 0, 508, 0,
+ 100, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 100, 100, 0, 97, 0,
+ 0, 0, 0, 0, 0, 0, 0, 496, 97, 497,
+ 498, 499, 500, 0, 0, 122, 97, 0, 0, 98,
+ 122, 0, 0, 0, 98, 501, 97, 0, 502, 0,
+ 0, 98, 0, 0, 98, 0, 0, 0, 0, 0,
+ 862, 0, 0, 568, 0, 0, 0, 0, 80, 503,
+ 0, 0, 0, 100, 100, 504, 505, 506, 97, 0,
+ 0, 0, 935, 0, 0, 0, 100, 97, 0, 0,
+ 0, 0, 0, 98, 98, 0, 0, 0, 0, 0,
+ 0, 306, 507, 306, 0, 508, 0, 0, 814, 98,
+ 497, 498, 499, 500, 0, 0, 0, 0, 0, 98,
+ 0, 0, 0, 0, 0, 0, 501, 98, 0, 502,
+ 0, 0, 0, 0, 0, 0, 0, 98, 0, 0,
+ 0, 0, 97, 0, 0, 100, 0, 0, 0, 0,
+ 503, 100, 0, 100, 0, 0, 100, 505, 506, 0,
+ 0, 0, 0, 0, 0, 0, 0, 80, 306, 98,
+ 0, 0, 0, 0, 0, 80, 563, 0, 98, 0,
+ 0, 0, 563, 507, 0, 0, 0, 563, 563, 0,
+ 0, 0, 0, 80, 80, 0, 0, 0, 0, 0,
+ 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
+ 80, -594, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 80, 80, -594, -594, -594, -594, -594, -594,
+ 80, -594, 0, 98, 97, 0, 0, -594, -594, 0,
+ 0, 0, 0, 0, 0, 80, 80, 0, -594, -594,
+ 0, -594, -594, -594, -594, -594, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 563, 0, 0, 0, 0, 0, 0,
+ -594, 0, 0, 80, 80, 0, 0, 0, 0, 0,
+ 0, 0, 932, 0, -594, 0, 80, 0, 0, 0,
+ 0, 0, 0, 0, -594, 98, 0, -594, -594, 0,
+ 0, 0, 0, 97, 0, 0, 0, 0, 0, 0,
+ 306, 97, 0, 0, 0, 0, 0, -594, -594, 0,
+ 0, 0, 0, 266, -594, -594, -594, -594, 0, 97,
+ 97, 0, 0, 0, 0, 0, 0, 0, 0, 97,
+ 0, 0, 0, 0, 0, 80, 97, 0, 0, 0,
+ 0, 80, 0, 80, 0, 0, 80, 0, 97, 97,
+ 0, 0, 0, 0, 0, 0, 97, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 97, 97, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 98, 0, 0, 0, 0, 0,
+ 0, 121, 98, 98, 0, 0, 121, 0, 0, 98,
+ 0, 0, 0, 0, 98, 98, 0, 0, 0, 0,
+ 98, 98, 0, 0, 0, 0, 0, 0, 0, 0,
+ 98, 0, 0, 0, 0, 0, 0, 98, 0, 97,
+ 97, 0, 0, 0, 0, 0, 0, 0, 934, 98,
+ 98, 0, 97, 0, 0, 0, 0, 98, 0, 0,
+ 0, 0, 0, 0, 0, 0, 732, 0, 0, 0,
+ 0, 0, 98, 98, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 353, 354, 355, 356, 357, 358,
+ 359, 360, 361, 362, 363, 364, 365, 0, 0, 366,
+ 367, 97, 0, 0, 0, 0, 0, 97, 0, 97,
+ 98, 0, 97, 353, -595, -595, -595, -595, 358, 359,
+ 98, 98, -595, -595, 0, 0, 0, 0, 366, 367,
+ 0, 0, 368, 98, 369, 370, 371, 372, 373, 374,
+ 375, 376, 377, 378, 0, 0, 0, 0, 0, 0,
+ 0, 0, -260, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 369, 370, 371, 372, 373, 374, 375,
+ 376, 377, 378, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 98, 0, 0, 0, 0, 0, 98, 0,
+ 98, -594, 4, 98, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 0, 0, 0, 0, 0, 0,
+ 15, 0, 16, 17, 18, 19, 0, 0, 0, 0,
+ 0, 20, 21, 22, 23, 24, 25, 26, 0, 0,
+ 27, 0, 0, 0, 0, 0, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 0, 40,
+ 41, 42, 0, 0, 43, 0, 0, 44, 45, 0,
+ 46, 47, 48, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 49, 0, 0, 50, 51, 0, 52, 53, 0,
+ 54, 0, 0, 55, 0, 56, 57, 58, 59, 60,
+ 61, -466, 0, 62, -594, 0, 0, -594, -594, 0,
+ 0, 0, 0, 0, -466, -466, -466, -466, -466, -466,
+ 0, -466, 0, 63, 64, 65, 0, 0, -466, -466,
+ 0, 0, 0, 0, 0, -594, 0, -594, -466, -466,
+ 0, -466, -466, -466, -466, -466, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 442, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, -466, -466, -466, -466, -466, -466, -466,
+ -466, -466, -466, -466, -466, -466, 0, 0, -466, -466,
+ -466, 0, -466, -466, 0, 0, 0, 0, 0, -466,
+ 0, 0, 0, 0, -466, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, -466, 0, 0, -466, -466, 0,
+ -466, -466, 0, -466, -466, -466, -466, -466, -466, -466,
+ -466, -466, -466, 0, 0, -594, 0, 0, -466, -466,
+ -466, -466, 0, 0, -466, -466, -466, -466, -594, -594,
+ -594, -594, -594, -594, 0, -594, 0, 0, 0, 0,
+ 0, 0, -594, -594, 0, 0, 0, 0, 0, 0,
+ 0, 0, -594, -594, 0, -594, -594, -594, -594, -594,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, -594, -594, -594,
+ -594, -594, -594, -594, -594, -594, -594, -594, -594, -594,
+ 0, 0, -594, -594, -594, 0, 0, -594, 0, 0,
+ 0, 0, 0, -594, 0, 0, 0, 0, -594, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, -594, 0,
+ 0, -594, -594, 0, 0, -594, 0, -594, -594, -594,
+ -594, -594, -594, -594, -594, -594, -594, 0, 0, -571,
+ 0, 0, -594, -594, -594, -594, 0, 266, -594, -594,
+ -594, -594, -571, -571, -571, 0, -571, -571, 0, -571,
+ 0, 0, 0, 0, 0, -571, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -571, -571, 0, -571,
+ -571, -571, -571, -571, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -571, -571, -571, -571, -571, -571, -571, -571, -571,
+ -571, -571, -571, -571, 0, 0, -571, -571, -571, 0,
+ 737, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -571, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -571, 0, 0, -571, -571, 0, -99, -571,
+ 0, -571, -571, -571, -571, -571, -571, -571, -571, -571,
+ -571, 0, 0, -571, 0, -571, -571, -571, 0, -91,
+ 0, 0, -571, -571, -571, -571, -571, -571, -571, 0,
+ -571, -571, 0, -571, 0, 0, 0, 0, 0, -571,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -571, -571, 0, -571, -571, -571, -571, -571, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, -571, -571, -571, -571, -571,
+ -571, -571, -571, -571, -571, -571, -571, -571, 0, 0,
+ -571, -571, -571, 0, 737, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -571, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -571, 0, 0, -571,
+ -571, 0, -99, -571, 0, -571, -571, -571, -571, -571,
+ -571, -571, -571, -571, -571, 0, 0, -284, 0, -571,
+ -571, -571, 0, -571, 0, 0, -571, -571, -571, -571,
+ -284, -284, -284, 0, -284, -284, 0, -284, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, -284, -284, 0, -284, -284, -284,
+ -284, -284, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, -284,
+ -284, -284, -284, -284, -284, -284, -284, -284, -284, -284,
+ -284, -284, 0, 0, -284, -284, -284, 0, 738, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -284, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -284, 0, 0, -284, -284, 0, -101, -284, 0, -284,
+ -284, -284, -284, -284, -284, -284, -284, -284, -284, 0,
+ 0, -284, 0, 0, -284, -284, 0, -93, 0, 0,
+ -284, -284, -284, -284, -284, -284, -284, 0, -284, -284,
+ 0, -284, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, -284, -284,
+ 0, -284, -284, -284, -284, -284, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, -284, -284, -284, -284, -284, -284, -284,
+ -284, -284, -284, -284, -284, -284, 0, 0, -284, -284,
+ -284, 0, 738, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, -284, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, -284, 0, 0, -284, -284, 0,
+ -101, -284, 0, -284, -284, -284, -284, -284, -284, -284,
+ -284, -284, -284, 0, 0, 0, 0, 0, -284, -284,
+ 0, -284, 0, 0, -284, -284, -284, -284, 284, 0,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ -594, -594, -594, 0, 0, -594, 15, 0, 16, 17,
+ 18, 19, 0, 0, 0, 0, 0, 20, 21, 22,
+ 23, 24, 25, 26, 0, 0, 27, 0, 0, 0,
+ 0, 0, 28, 0, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 0, 40, 41, 42, 0, 0,
+ 43, 0, 0, 44, 45, 0, 46, 47, 48, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 49, 0, 0,
+ 50, 51, 0, 52, 53, 0, 54, 0, 0, 55,
+ 0, 56, 57, 58, 59, 60, 61, 0, 0, 62,
+ -594, 0, 0, -594, -594, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 63,
+ 64, 65, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -594, 284, -594, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 0, 0, -594, 0, -594, -594,
+ 15, 0, 16, 17, 18, 19, 0, 0, 0, 0,
+ 0, 20, 21, 22, 23, 24, 25, 26, 0, 0,
+ 27, 0, 0, 0, 0, 0, 28, 0, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 0, 40,
+ 41, 42, 0, 0, 43, 0, 0, 44, 45, 0,
+ 46, 47, 48, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 49, 0, 0, 50, 51, 0, 52, 53, 0,
+ 54, 0, 0, 55, 0, 56, 57, 58, 59, 60,
+ 61, 0, 0, 62, -594, 0, 0, -594, -594, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 63, 64, 65, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, -594, 284, -594, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 0, 0,
+ -594, 0, 0, -594, 15, -594, 16, 17, 18, 19,
+ 0, 0, 0, 0, 0, 20, 21, 22, 23, 24,
+ 25, 26, 0, 0, 27, 0, 0, 0, 0, 0,
+ 28, 0, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 0, 40, 41, 42, 0, 0, 43, 0,
+ 0, 44, 45, 0, 46, 47, 48, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 49, 0, 0, 50, 51,
+ 0, 52, 53, 0, 54, 0, 0, 55, 0, 56,
+ 57, 58, 59, 60, 61, 0, 0, 62, -594, 0,
+ 0, -594, -594, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 63, 64, 65,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, -594,
+ 284, -594, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 0, 0, -594, 0, 0, -594, 15, 0,
+ 16, 17, 18, 19, 0, 0, 0, 0, 0, 20,
+ 21, 22, 23, 24, 25, 26, 0, 0, 27, 0,
+ 0, 0, 0, 0, 28, 0, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 0, 40, 41, 42,
+ 0, 0, 43, 0, 0, 44, 45, 0, 46, 47,
+ 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 49,
+ 0, 0, 50, 51, 0, 52, 53, 0, 54, 0,
+ 0, 55, 0, 56, 57, 58, 59, 60, 61, 0,
+ 0, 62, -594, 0, 0, -594, -594, 4, 0, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 0,
+ 0, 63, 64, 65, 0, 15, 0, 16, 17, 18,
+ 19, 0, 0, -594, 0, -594, 20, 21, 22, 23,
+ 24, 25, 26, 0, 0, 27, 0, 0, 0, 0,
+ 0, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 0, 40, 41, 42, 0, 0, 43,
+ 0, 0, 44, 45, 0, 46, 47, 48, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 49, 0, 0, 50,
+ 51, 0, 52, 53, 0, 54, 0, 0, 55, 0,
+ 56, 57, 58, 59, 60, 61, 0, 0, 62, -594,
+ 0, 0, -594, -594, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 63, 64,
+ 65, 0, 0, -594, 0, 0, 0, 0, 0, 0,
+ -594, 284, -594, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 0, -594, -594, 0, 0, 0, 15,
+ 0, 16, 17, 18, 19, 0, 0, 0, 0, 0,
+ 20, 21, 22, 23, 24, 25, 26, 0, 0, 27,
+ 0, 0, 0, 0, 0, 28, 0, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 0, 40, 41,
+ 42, 0, 0, 43, 0, 0, 44, 45, 0, 46,
+ 47, 48, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 49, 0, 0, 50, 51, 0, 52, 53, 0, 54,
+ 0, 0, 55, 0, 56, 57, 58, 59, 60, 61,
+ 0, 0, 62, -594, 0, 0, -594, -594, 284, 0,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 0, 0, 63, 64, 65, 0, 15, 0, 16, 17,
+ 18, 19, 0, 0, -594, 0, -594, 20, 21, 22,
+ 23, 24, 25, 26, 0, 0, 27, 0, 0, 0,
+ 0, 0, 28, 0, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 0, 40, 41, 42, 0, 0,
+ 43, 0, 0, 44, 45, 0, 46, 47, 48, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 49, 0, 0,
+ 285, 51, 0, 52, 53, 0, 54, 0, 0, 55,
+ 0, 56, 57, 58, 59, 60, 61, 0, 0, 62,
+ -594, 0, 0, -594, -594, 284, 0, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 0, 0, 63,
+ 64, 65, 0, 15, 0, 16, 17, 18, 19, 0,
+ -594, -594, 0, -594, 20, 21, 22, 23, 24, 25,
+ 26, 0, 0, 27, 0, 0, 0, 0, 0, 28,
+ 0, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 0, 40, 41, 42, 0, 0, 43, 0, 0,
+ 44, 45, 0, 46, 47, 48, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 49, 0, 0, 50, 51, 0,
+ 52, 53, 0, 54, 0, 0, 55, 0, 56, 57,
+ 58, 59, 60, 61, 0, 0, 62, -594, 0, 0,
+ -594, -594, 284, 0, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 0, 0, 63, 64, 65, 0,
+ 15, 0, 16, 17, 18, 19, 0, -594, -594, 0,
+ -594, 20, 21, 22, 23, 24, 25, 26, 0, 0,
+ 27, 0, 0, 0, 0, 0, 28, 0, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 0, 40,
+ 41, 42, 0, 0, 43, 0, 0, 44, 45, 0,
+ 46, 47, 48, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 49, 0, 0, 50, 51, 0, 52, 53, 0,
+ 54, 0, 0, 55, 0, 56, 57, 58, 59, 60,
+ 61, 0, 0, 62, -594, 0, 0, -594, -594, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 63, 64, 65, 0, 0, -594, 0,
+ 0, 0, 0, 0, 0, -594, 284, -594, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 0, 0,
+ -594, 0, 0, 0, 15, 0, 16, 17, 18, 19,
+ 0, 0, 0, 0, 0, 20, 21, 22, 23, 24,
+ 25, 26, 0, 0, 27, 0, 0, 0, 0, 0,
+ 28, 0, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 0, 40, 41, 42, 0, 0, 43, 0,
+ 0, 44, 45, 0, 46, 47, 48, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 49, 0, 0, 50, 51,
+ 0, 52, 53, 0, 54, 0, 0, 55, 0, 56,
+ 57, 58, 59, 60, 61, 0, 0, 62, -594, 0,
+ 0, -594, -594, 0, 0, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 0, 0, 63, 64, 65,
+ 0, 15, 0, 16, 17, 18, 19, 0, 0, -594,
+ 0, -594, 20, 21, 22, 23, 24, 25, 26, 0,
+ 0, 27, 0, 0, 0, 0, 0, 28, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 0,
+ 40, 41, 42, 0, 0, 43, 0, 0, 44, 45,
+ 0, 46, 47, 48, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 49, 0, 0, 50, 51, 0, 52, 53,
+ 0, 54, 0, 0, 55, 0, 56, 57, 58, 59,
+ 60, 61, 0, 0, 62, 238, 0, 0, 239, 240,
+ 0, 0, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 0, 0, 63, 64, 65, 0, 15, 0,
+ 16, 17, 18, 19, 0, 0, 241, 0, 242, 20,
+ 21, 22, 23, 24, 25, 26, 0, 0, 27, 0,
+ 0, 0, 0, 0, 28, 0, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 0, 40, 41, 42,
+ 0, 0, 43, 0, 0, 44, 45, 0, 46, 47,
+ 48, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 49,
+ 0, 0, 50, 51, 0, 52, 53, 0, 54, 0,
+ 0, 55, 0, 56, 57, 58, 59, 60, 61, 0,
+ 0, 62, 238, 0, 0, 239, 240, 0, 0, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 0, 0,
+ 0, 63, 64, 65, 0, 15, 0, 16, 17, 18,
+ 19, 0, 0, 241, 0, 242, 20, 21, 22, 23,
+ 24, 25, 26, 0, 0, 27, 0, 0, 0, 0,
+ 0, 0, 0, 0, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 0, 40, 41, 42, 0, 0, 43,
+ 0, 0, 44, 45, 0, 46, 47, 48, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 205, 0, 0, 115,
+ 51, 0, 52, 53, 0, 0, 0, 0, 55, 0,
+ 56, 57, 58, 59, 60, 61, 0, 0, 62, 238,
+ 0, 0, 239, 240, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 63, 64,
+ 65, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 241, 0, 242, 125, 126, 127, 128, 129, 130, 131,
+ 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
+ 142, 143, 144, 145, 146, 147, 148, 0, 0, 0,
+ 149, 150, 151, 152, 153, 154, 155, 156, 157, 158,
+ 0, 0, 0, 0, 0, 159, 160, 161, 162, 163,
+ 164, 165, 166, 36, 37, 167, 39, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 168, 169, 170, 171, 172, 173, 174, 175, 176, 0,
+ 0, 177, 178, 0, 0, 179, 180, 181, 182, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 183,
+ 184, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 185, 186, 187, 188, 189, 190, 191, 192,
+ 193, 194, 0, 195, 196, 0, 0, 0, 0, 0,
+ 0, 197, 198, -564, -564, -564, -564, -564, -564, -564,
+ -564, -564, 0, 0, 0, 0, 0, 0, 0, -564,
+ 0, -564, -564, -564, -564, 0, -564, 0, 0, 0,
+ -564, -564, -564, -564, -564, -564, -564, 0, 0, -564,
+ 0, 0, 0, 0, 0, 0, 0, 0, -564, -564,
+ -564, -564, -564, -564, -564, -564, -564, 0, -564, -564,
+ -564, 0, 0, -564, 0, 0, -564, -564, 0, -564,
+ -564, -564, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -564, 0, 0, -564, -564, 0, -564, -564, 0, -564,
+ -564, -564, -564, 0, -564, -564, -564, -564, -564, -564,
+ 0, 0, -564, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -564, -564, -564, 0, -564, 0, 0, 0,
+ 0, 0, -564, -566, -566, -566, -566, -566, -566, -566,
+ -566, -566, 0, 0, 0, 0, 0, 0, 0, -566,
+ 0, -566, -566, -566, -566, 0, -566, 0, 0, 0,
+ -566, -566, -566, -566, -566, -566, -566, 0, 0, -566,
+ 0, 0, 0, 0, 0, 0, 0, 0, -566, -566,
+ -566, -566, -566, -566, -566, -566, -566, 0, -566, -566,
+ -566, 0, 0, -566, 0, 0, -566, -566, 0, -566,
+ -566, -566, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -566, 0, 0, -566, -566, 0, -566, -566, 0, -566,
+ -566, -566, -566, 0, -566, -566, -566, -566, -566, -566,
+ 0, 0, -566, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -566, -566, -566, 0, -566, 0, 0, 0,
+ 0, 0, -566, -565, -565, -565, -565, -565, -565, -565,
+ -565, -565, 0, 0, 0, 0, 0, 0, 0, -565,
+ 0, -565, -565, -565, -565, 0, -565, 0, 0, 0,
+ -565, -565, -565, -565, -565, -565, -565, 0, 0, -565,
+ 0, 0, 0, 0, 0, 0, 0, 0, -565, -565,
+ -565, -565, -565, -565, -565, -565, -565, 0, -565, -565,
+ -565, 0, 0, -565, 0, 0, -565, -565, 0, -565,
+ -565, -565, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -565, 0, 0, -565, -565, 0, -565, -565, 0, -565,
+ -565, -565, -565, 0, -565, -565, -565, -565, -565, -565,
+ 0, 0, -565, 0, 0, 0, 0, 0, 0, -567,
+ -567, -567, -567, -567, -567, -567, -567, -567, 0, 0,
+ 0, 0, -565, -565, -565, -567, -565, -567, -567, -567,
+ -567, 0, -565, 0, 0, 0, -567, -567, -567, -567,
+ -567, -567, -567, 0, 0, -567, 0, 0, 0, 0,
+ 0, 0, 0, 0, -567, -567, -567, -567, -567, -567,
+ -567, -567, -567, 0, -567, -567, -567, 0, 0, -567,
+ 0, 0, -567, -567, 0, -567, -567, -567, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -567, 771, 0, -567,
+ -567, 0, -567, -567, 0, -567, -567, -567, -567, 0,
+ -567, -567, -567, -567, -567, -567, 0, 0, -567, 0,
+ 0, 0, 0, 0, 0, -99, -568, -568, -568, -568,
+ -568, -568, -568, -568, -568, 0, 0, 0, -567, -567,
+ -567, 0, -568, 0, -568, -568, -568, -568, -567, 0,
+ 0, 0, 0, -568, -568, -568, -568, -568, -568, -568,
+ 0, 0, -568, 0, 0, 0, 0, 0, 0, 0,
+ 0, -568, -568, -568, -568, -568, -568, -568, -568, -568,
+ 0, -568, -568, -568, 0, 0, -568, 0, 0, -568,
+ -568, 0, -568, -568, -568, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, -568, 772, 0, -568, -568, 0, -568,
+ -568, 0, -568, -568, -568, -568, 0, -568, -568, -568,
+ -568, -568, -568, 0, 0, -568, 0, 0, 0, 0,
+ 0, 0, -101, -253, -253, -253, -253, -253, -253, -253,
+ -253, -253, 0, 0, 0, -568, -568, -568, 0, -253,
+ 0, -253, -253, -253, -253, -568, 0, 0, 0, 0,
+ -253, -253, -253, -253, -253, -253, -253, 0, 0, -253,
+ 0, 0, 0, 0, 0, 0, 0, 0, -253, -253,
+ -253, -253, -253, -253, -253, -253, -253, 0, -253, -253,
+ -253, 0, 0, -253, 0, 0, -253, -253, 0, -253,
+ -253, -253, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -253, 0, 0, -253, -253, 0, -253, -253, 0, -253,
+ -253, -253, -253, 0, -253, -253, -253, -253, -253, -253,
+ 0, 0, -253, 0, 0, 0, 0, 0, 0, -569,
+ -569, -569, -569, -569, -569, -569, -569, -569, 0, 0,
+ 0, 0, -253, -253, -253, -569, 0, -569, -569, -569,
+ -569, 0, 266, 0, 0, 0, -569, -569, -569, -569,
+ -569, -569, -569, 0, 0, -569, 0, 0, 0, 0,
+ 0, 0, 0, 0, -569, -569, -569, -569, -569, -569,
+ -569, -569, -569, 0, -569, -569, -569, 0, 0, -569,
+ 0, 0, -569, -569, 0, -569, -569, -569, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -569, 0, 0, -569,
+ -569, 0, -569, -569, 0, -569, -569, -569, -569, 0,
+ -569, -569, -569, -569, -569, -569, 0, 0, -569, 0,
+ 0, 0, 0, 0, 0, -570, -570, -570, -570, -570,
+ -570, -570, -570, -570, 0, 0, 0, 0, -569, -569,
+ -569, -570, 0, -570, -570, -570, -570, 0, -569, 0,
+ 0, 0, -570, -570, -570, -570, -570, -570, -570, 0,
+ 0, -570, 0, 0, 0, 0, 0, 0, 0, 0,
+ -570, -570, -570, -570, -570, -570, -570, -570, -570, 0,
+ -570, -570, -570, 0, 0, -570, 0, 0, -570, -570,
+ 0, -570, -570, -570, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, -570, 0, 0, -570, -570, 0, -570, -570,
+ 0, -570, -570, -570, -570, 0, -570, -570, -570, -570,
+ -570, -570, 0, 0, -570, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, -570, -570, -570, 0, 0, 0,
+ 0, 0, 0, 0, -570, 125, 126, 127, 128, 129,
+ 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
+ 140, 141, 142, 143, 144, 145, 146, 147, 148, 0,
+ 0, 0, 149, 150, 151, 224, 225, 226, 227, 156,
+ 157, 158, 0, 0, 0, 0, 0, 159, 160, 161,
+ 228, 229, 230, 231, 166, 309, 310, 232, 311, 0,
+ 0, 0, 0, 0, 0, 312, 0, 0, 0, 0,
+ 0, 0, 168, 169, 170, 171, 172, 173, 174, 175,
+ 176, 0, 0, 177, 178, 0, 0, 179, 180, 181,
+ 182, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 183, 184, 0, 0, 0, 0, 0, 0, 0,
+ 313, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 185, 186, 187, 188, 189, 190,
+ 191, 192, 193, 194, 0, 195, 196, 0, 0, 0,
+ 0, 0, 0, 197, 125, 126, 127, 128, 129, 130,
+ 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
+ 141, 142, 143, 144, 145, 146, 147, 148, 0, 0,
+ 0, 149, 150, 151, 224, 225, 226, 227, 156, 157,
+ 158, 0, 0, 0, 0, 0, 159, 160, 161, 228,
+ 229, 230, 231, 166, 309, 310, 232, 311, 0, 0,
+ 0, 0, 0, 0, 312, 0, 0, 0, 0, 0,
+ 0, 168, 169, 170, 171, 172, 173, 174, 175, 176,
+ 0, 0, 177, 178, 0, 0, 179, 180, 181, 182,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 183, 184, 0, 0, 0, 0, 0, 0, 0, 433,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 185, 186, 187, 188, 189, 190, 191,
+ 192, 193, 194, 0, 195, 196, 0, 0, 0, 0,
+ 0, 0, 197, 125, 126, 127, 128, 129, 130, 131,
+ 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
+ 142, 143, 144, 145, 146, 147, 148, 0, 0, 0,
+ 149, 150, 151, 224, 225, 226, 227, 156, 157, 158,
+ 0, 0, 0, 0, 0, 159, 160, 161, 228, 229,
+ 230, 231, 166, 0, 0, 232, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 168, 169, 170, 171, 172, 173, 174, 175, 176, 0,
+ 0, 177, 178, 0, 0, 179, 180, 181, 182, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 183,
+ 184, 0, 0, 0, 233, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 185, 186, 187, 188, 189, 190, 191, 192,
+ 193, 194, 0, 195, 196, 0, 0, 0, 0, 0,
+ 0, 197, 125, 126, 127, 128, 129, 130, 131, 132,
+ 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
+ 143, 144, 145, 146, 147, 148, 0, 0, 0, 149,
+ 150, 151, 224, 225, 226, 227, 156, 157, 158, 0,
+ 0, 0, 0, 0, 159, 160, 161, 228, 229, 230,
+ 231, 166, 0, 0, 232, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 168,
+ 169, 170, 171, 172, 173, 174, 175, 176, 0, 0,
+ 177, 178, 0, 0, 179, 180, 181, 182, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 183, 184,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 185, 186, 187, 188, 189, 190, 191, 192, 193,
+ 194, 0, 195, 196, 0, 0, 0, 0, 0, 0,
+ 197, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 0, 0, 0, 0, 0, 0, 0, 15, 0, 104,
+ 105, 18, 19, 0, 0, 0, 0, 0, 106, 107,
+ 108, 23, 24, 25, 26, 0, 0, 109, 0, 0,
+ 0, 0, 0, 0, 0, 0, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 0, 40, 41, 42, 0,
+ 0, 43, 0, 0, 44, 45, 0, 112, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 302, 0,
+ 0, 115, 51, 0, 52, 53, 0, 0, 0, 0,
+ 55, 0, 56, 57, 58, 59, 60, 61, 0, 0,
+ 62, 0, 0, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 0, 0, 0, 0, 0, 0, 0, 15,
+ 116, 104, 105, 18, 19, 0, 0, 0, 303, 0,
+ 106, 107, 108, 23, 24, 25, 26, 0, 0, 109,
+ 0, 0, 0, 0, 0, 0, 0, 0, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 0, 40, 41,
+ 42, 0, 0, 43, 0, 0, 44, 45, 0, 112,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 302, 0, 0, 115, 51, 0, 52, 53, 0, 0,
+ 0, 0, 55, 0, 56, 57, 58, 59, 60, 61,
+ 0, 0, 62, 0, 0, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 0, 0, 0, 0, 0,
+ 0, 15, 116, 16, 17, 18, 19, 0, 0, 0,
+ 557, 0, 20, 21, 22, 23, 24, 25, 26, 0,
+ 0, 27, 0, 0, 0, 0, 0, 28, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 0,
+ 40, 41, 42, 0, 0, 43, 0, 0, 44, 45,
+ 0, 46, 47, 48, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 49, 0, 0, 50, 51, 0, 52, 53,
+ 0, 54, 0, 0, 55, 0, 56, 57, 58, 59,
+ 60, 61, 0, 0, 62, 0, 0, 0, 0, 0,
+ 0, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 0, 0, 0, 0, 63, 64, 65, 15, 0, 16,
+ 17, 18, 19, 0, 0, 0, 0, 0, 20, 21,
+ 22, 23, 24, 25, 26, 0, 0, 109, 0, 0,
+ 0, 0, 0, 0, 0, 0, 31, 32, 33, 251,
+ 35, 36, 37, 38, 39, 0, 40, 41, 42, 0,
+ 0, 43, 0, 0, 44, 45, 0, 46, 47, 48,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 455, 0, 0, 0, 0, 0, 205, 0,
+ 0, 115, 51, 0, 52, 53, 0, 252, 253, 254,
+ 55, 0, 56, 57, 58, 59, 60, 61, 0, 0,
+ 62, 0, 0, 0, 0, 0, 0, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 0, 0, 0,
+ 63, 255, 65, 15, 0, 16, 17, 18, 19, 0,
+ 0, 0, 0, 0, 20, 21, 22, 23, 24, 25,
+ 26, 0, 0, 27, 0, 0, 0, 0, 0, 28,
+ 0, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 0, 40, 41, 42, 0, 0, 43, 0, 0,
+ 44, 45, 0, 46, 47, 48, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 49, 0, 0, 50, 51, 0,
+ 52, 53, 0, 54, 0, 0, 55, 0, 56, 57,
+ 58, 59, 60, 61, 0, 0, 62, 0, 0, 0,
+ 0, 0, 0, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 0, 0, 0, 0, 63, 64, 65, 15,
+ 0, 16, 17, 18, 19, 0, 0, 0, 0, 0,
+ 20, 21, 22, 23, 24, 25, 26, 0, 0, 109,
+ 0, 0, 0, 0, 0, 0, 0, 0, 31, 32,
+ 33, 251, 35, 36, 37, 38, 39, 0, 40, 41,
+ 42, 0, 0, 43, 0, 0, 44, 45, 0, 46,
+ 47, 48, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 205, 0, 0, 115, 51, 0, 52, 53, 0, 252,
+ 253, 254, 55, 0, 56, 57, 58, 59, 60, 61,
+ 0, 0, 62, 0, 0, 0, 0, 0, 0, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 0, 0,
+ 0, 0, 63, 255, 65, 15, 0, 104, 105, 18,
+ 19, 0, 0, 0, 0, 0, 106, 107, 108, 23,
+ 24, 25, 26, 0, 0, 109, 0, 0, 0, 0,
+ 0, 0, 0, 0, 31, 32, 33, 251, 35, 36,
+ 37, 38, 39, 0, 40, 41, 42, 0, 0, 43,
+ 0, 0, 44, 45, 0, 46, 47, 48, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 205, 0, 0, 115,
+ 51, 0, 52, 53, 0, 666, 253, 254, 55, 0,
+ 56, 57, 58, 59, 60, 61, 0, 0, 62, 0,
+ 0, 0, 0, 0, 0, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 0, 0, 0, 0, 63, 255,
+ 65, 15, 0, 104, 105, 18, 19, 0, 0, 0,
+ 0, 0, 106, 107, 108, 23, 24, 25, 26, 0,
+ 0, 109, 0, 0, 0, 0, 0, 0, 0, 0,
+ 31, 32, 33, 251, 35, 36, 37, 38, 39, 0,
+ 40, 41, 42, 0, 0, 43, 0, 0, 44, 45,
+ 0, 46, 47, 48, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 205, 0, 0, 115, 51, 0, 52, 53,
+ 0, 252, 253, 0, 55, 0, 56, 57, 58, 59,
+ 60, 61, 0, 0, 62, 0, 0, 0, 0, 0,
+ 0, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 0, 0, 0, 0, 63, 255, 65, 15, 0, 104,
+ 105, 18, 19, 0, 0, 0, 0, 0, 106, 107,
+ 108, 23, 24, 25, 26, 0, 0, 109, 0, 0,
+ 0, 0, 0, 0, 0, 0, 31, 32, 33, 251,
+ 35, 36, 37, 38, 39, 0, 40, 41, 42, 0,
+ 0, 43, 0, 0, 44, 45, 0, 46, 47, 48,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 205, 0,
+ 0, 115, 51, 0, 52, 53, 0, 0, 253, 254,
+ 55, 0, 56, 57, 58, 59, 60, 61, 0, 0,
+ 62, 0, 0, 0, 0, 0, 0, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 0, 0, 0, 0,
+ 63, 255, 65, 15, 0, 104, 105, 18, 19, 0,
+ 0, 0, 0, 0, 106, 107, 108, 23, 24, 25,
+ 26, 0, 0, 109, 0, 0, 0, 0, 0, 0,
+ 0, 0, 31, 32, 33, 251, 35, 36, 37, 38,
+ 39, 0, 40, 41, 42, 0, 0, 43, 0, 0,
+ 44, 45, 0, 46, 47, 48, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 205, 0, 0, 115, 51, 0,
+ 52, 53, 0, 666, 253, 0, 55, 0, 56, 57,
+ 58, 59, 60, 61, 0, 0, 62, 0, 0, 0,
+ 0, 0, 0, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 0, 0, 0, 0, 63, 255, 65, 15,
+ 0, 104, 105, 18, 19, 0, 0, 0, 0, 0,
+ 106, 107, 108, 23, 24, 25, 26, 0, 0, 109,
+ 0, 0, 0, 0, 0, 0, 0, 0, 31, 32,
+ 33, 251, 35, 36, 37, 38, 39, 0, 40, 41,
+ 42, 0, 0, 43, 0, 0, 44, 45, 0, 46,
+ 47, 48, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 205, 0, 0, 115, 51, 0, 52, 53, 0, 0,
+ 253, 0, 55, 0, 56, 57, 58, 59, 60, 61,
+ 0, 0, 62, 0, 0, 0, 0, 0, 0, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 0, 0,
+ 0, 0, 63, 255, 65, 15, 0, 16, 17, 18,
+ 19, 0, 0, 0, 0, 0, 20, 21, 22, 23,
+ 24, 25, 26, 0, 0, 109, 0, 0, 0, 0,
+ 0, 0, 0, 0, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 0, 40, 41, 42, 0, 0, 43,
+ 0, 0, 44, 45, 0, 46, 47, 48, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 205, 0, 0, 115,
+ 51, 0, 52, 53, 0, 551, 0, 0, 55, 0,
+ 56, 57, 58, 59, 60, 61, 0, 0, 62, 0,
+ 0, 0, 0, 0, 0, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 0, 0, 0, 0, 63, 255,
+ 65, 15, 0, 104, 105, 18, 19, 0, 0, 0,
+ 0, 0, 106, 107, 108, 23, 24, 25, 26, 0,
+ 0, 109, 0, 0, 0, 0, 0, 0, 0, 0,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 0,
+ 40, 41, 42, 0, 0, 43, 0, 0, 44, 45,
+ 0, 46, 47, 48, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 205, 0, 0, 115, 51, 0, 52, 53,
+ 0, 252, 0, 0, 55, 0, 56, 57, 58, 59,
+ 60, 61, 0, 0, 62, 0, 0, 0, 0, 0,
+ 0, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 0, 0, 0, 0, 63, 255, 65, 15, 0, 104,
+ 105, 18, 19, 0, 0, 0, 0, 0, 106, 107,
+ 108, 23, 24, 25, 26, 0, 0, 109, 0, 0,
+ 0, 0, 0, 0, 0, 0, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 0, 40, 41, 42, 0,
+ 0, 43, 0, 0, 44, 45, 0, 46, 47, 48,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 205, 0,
+ 0, 115, 51, 0, 52, 53, 0, 551, 0, 0,
+ 55, 0, 56, 57, 58, 59, 60, 61, 0, 0,
+ 62, 0, 0, 0, 0, 0, 0, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 0, 0, 0, 0,
+ 63, 255, 65, 15, 0, 104, 105, 18, 19, 0,
+ 0, 0, 0, 0, 106, 107, 108, 23, 24, 25,
+ 26, 0, 0, 109, 0, 0, 0, 0, 0, 0,
+ 0, 0, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 0, 40, 41, 42, 0, 0, 43, 0, 0,
+ 44, 45, 0, 46, 47, 48, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 205, 0, 0, 115, 51, 0,
+ 52, 53, 0, 831, 0, 0, 55, 0, 56, 57,
+ 58, 59, 60, 61, 0, 0, 62, 0, 0, 0,
+ 0, 0, 0, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 0, 0, 0, 0, 63, 255, 65, 15,
+ 0, 104, 105, 18, 19, 0, 0, 0, 0, 0,
+ 106, 107, 108, 23, 24, 25, 26, 0, 0, 109,
+ 0, 0, 0, 0, 0, 0, 0, 0, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 0, 40, 41,
+ 42, 0, 0, 43, 0, 0, 44, 45, 0, 46,
+ 47, 48, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 205, 0, 0, 115, 51, 0, 52, 53, 0, 666,
+ 0, 0, 55, 0, 56, 57, 58, 59, 60, 61,
+ 0, 0, 62, 0, 0, 0, 0, 0, 0, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 0, 0,
+ 0, 0, 63, 255, 65, 15, 0, 16, 17, 18,
+ 19, 0, 0, 0, 0, 0, 20, 21, 22, 23,
+ 24, 25, 26, 0, 0, 27, 0, 0, 0, 0,
+ 0, 0, 0, 0, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 0, 40, 41, 42, 0, 0, 43,
+ 0, 0, 44, 45, 0, 46, 47, 48, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 205, 0, 0, 115,
+ 51, 0, 52, 53, 0, 0, 0, 0, 55, 0,
+ 56, 57, 58, 59, 60, 61, 0, 0, 62, 0,
+ 0, 0, 0, 0, 0, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 0, 0, 0, 0, 63, 64,
+ 65, 15, 0, 104, 105, 18, 19, 0, 0, 0,
+ 0, 0, 106, 107, 108, 23, 24, 25, 26, 0,
+ 0, 109, 0, 0, 0, 0, 0, 0, 0, 0,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 0,
+ 40, 41, 42, 0, 0, 43, 0, 0, 44, 45,
+ 0, 46, 47, 48, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 205, 0, 0, 115, 51, 0, 52, 53,
+ 0, 0, 0, 0, 55, 0, 56, 57, 58, 59,
+ 60, 61, 0, 0, 62, 0, 0, 0, 0, 0,
+ 0, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 0, 0, 0, 0, 63, 255, 65, 15, 0, 16,
+ 17, 18, 19, 0, 0, 0, 0, 0, 20, 21,
+ 22, 23, 24, 25, 26, 0, 0, 109, 0, 0,
+ 0, 0, 0, 0, 0, 0, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 0, 40, 41, 42, 0,
+ 0, 43, 0, 0, 44, 45, 0, 46, 47, 48,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 205, 0,
+ 0, 115, 51, 0, 52, 53, 0, 0, 0, 0,
+ 55, 0, 56, 57, 58, 59, 60, 61, 0, 0,
+ 62, 0, 0, 0, 0, 0, 0, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 0, 0, 0, 0,
+ 63, 255, 65, 15, 0, 104, 105, 18, 19, 0,
+ 0, 0, 0, 0, 106, 107, 108, 23, 24, 25,
+ 26, 0, 0, 109, 0, 0, 0, 0, 0, 0,
+ 0, 0, 31, 32, 33, 110, 35, 36, 37, 111,
+ 39, 0, 40, 41, 42, 0, 0, 43, 0, 0,
+ 44, 45, 0, 112, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 113, 0, 0, 114, 0, 0, 115, 51, 0,
+ 52, 53, 0, 0, 0, 0, 55, 0, 56, 57,
+ 58, 59, 60, 61, 0, 0, 62, 0, 0, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 116, 104, 105, 18,
+ 19, 0, 0, 0, 0, 0, 106, 107, 108, 23,
+ 24, 25, 26, 0, 0, 109, 0, 0, 0, 0,
+ 0, 0, 0, 0, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 0, 40, 41, 42, 0, 0, 43,
+ 0, 0, 44, 45, 0, 216, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 217, 0, 0, 50,
+ 51, 0, 52, 53, 0, 54, 0, 0, 55, 0,
+ 56, 57, 58, 59, 60, 61, 0, 0, 62, 0,
+ 0, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 0, 0, 0, 0, 0, 0, 0, 15, 116, 104,
+ 105, 18, 19, 0, 0, 0, 0, 0, 106, 107,
+ 108, 23, 24, 25, 26, 0, 0, 109, 0, 0,
+ 0, 0, 0, 0, 0, 0, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 0, 40, 41, 42, 0,
+ 0, 43, 0, 0, 44, 45, 0, 112, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 302, 0,
+ 0, 349, 51, 0, 52, 53, 0, 350, 0, 0,
+ 55, 0, 56, 57, 58, 59, 60, 61, 0, 0,
+ 62, 0, 0, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 0, 0, 0, 0, 0, 0, 0, 15,
+ 116, 104, 105, 18, 19, 0, 0, 0, 0, 0,
+ 106, 107, 108, 23, 24, 25, 26, 0, 0, 109,
+ 0, 0, 0, 0, 0, 0, 0, 0, 31, 32,
+ 33, 110, 35, 36, 37, 111, 39, 0, 40, 41,
+ 42, 0, 0, 43, 0, 0, 44, 45, 0, 112,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 114, 0, 0, 115, 51, 0, 52, 53, 0, 0,
+ 0, 0, 55, 0, 56, 57, 58, 59, 60, 61,
+ 0, 0, 62, 0, 0, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 0, 0, 0, 0, 0, 0,
+ 0, 15, 116, 104, 105, 18, 19, 0, 0, 0,
+ 0, 0, 106, 107, 108, 23, 24, 25, 26, 0,
+ 0, 109, 0, 0, 0, 0, 0, 0, 0, 0,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 0,
+ 40, 41, 42, 0, 0, 43, 0, 0, 44, 45,
+ 0, 112, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 302, 0, 0, 349, 51, 0, 52, 53,
+ 0, 0, 0, 0, 55, 0, 56, 57, 58, 59,
+ 60, 61, 0, 0, 62, 0, 0, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 0, 0, 0, 0,
+ 0, 0, 0, 15, 116, 104, 105, 18, 19, 0,
+ 0, 0, 0, 0, 106, 107, 108, 23, 24, 25,
+ 26, 0, 0, 109, 0, 0, 0, 0, 0, 0,
+ 0, 0, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 0, 40, 41, 42, 0, 0, 43, 0, 0,
+ 44, 45, 0, 112, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 904, 0, 0, 115, 51, 0,
+ 52, 53, 0, 0, 0, 0, 55, 0, 56, 57,
+ 58, 59, 60, 61, 0, 0, 62, 0, 0, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 116, 104, 105, 18,
+ 19, 0, 0, 0, 0, 0, 106, 107, 108, 23,
+ 24, 25, 26, 0, 0, 109, 0, 0, 0, 0,
+ 0, 0, 0, 0, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 0, 40, 41, 42, 0, 0, 43,
+ 0, 0, 44, 45, 0, 216, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 931, 0, 0, 115,
+ 51, 0, 52, 53, 0, 595, 596, 0, 55, 597,
+ 56, 57, 58, 59, 60, 61, 0, 0, 62, 0,
+ 0, 0, 0, 0, 168, 169, 170, 171, 172, 173,
+ 174, 175, 176, 0, 0, 177, 178, 0, 116, 179,
+ 180, 181, 182, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 183, 184, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 185, 186, 187, 188,
+ 189, 190, 191, 192, 193, 194, 0, 195, 196, 603,
+ 604, 0, 0, 605, 0, 197, 266, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 168, 169,
+ 170, 171, 172, 173, 174, 175, 176, 0, 0, 177,
+ 178, 0, 0, 179, 180, 181, 182, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 183, 184, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
+ 0, 195, 196, 624, 596, 0, 0, 625, 0, 197,
+ 266, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 168, 169, 170, 171, 172, 173, 174, 175,
+ 176, 0, 0, 177, 178, 0, 0, 179, 180, 181,
+ 182, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 183, 184, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 185, 186, 187, 188, 189, 190,
+ 191, 192, 193, 194, 0, 195, 196, 609, 604, 0,
+ 0, 610, 0, 197, 266, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 168, 169, 170, 171,
+ 172, 173, 174, 175, 176, 0, 0, 177, 178, 0,
+ 0, 179, 180, 181, 182, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 183, 184, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 185, 186,
+ 187, 188, 189, 190, 191, 192, 193, 194, 0, 195,
+ 196, 640, 596, 0, 0, 641, 0, 197, 266, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 168, 169, 170, 171, 172, 173, 174, 175, 176, 0,
+ 0, 177, 178, 0, 0, 179, 180, 181, 182, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 183,
+ 184, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 185, 186, 187, 188, 189, 190, 191, 192,
+ 193, 194, 0, 195, 196, 643, 604, 0, 0, 644,
+ 0, 197, 266, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 168, 169, 170, 171, 172, 173,
+ 174, 175, 176, 0, 0, 177, 178, 0, 0, 179,
+ 180, 181, 182, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 183, 184, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 185, 186, 187, 188,
+ 189, 190, 191, 192, 193, 194, 0, 195, 196, 650,
+ 596, 0, 0, 651, 0, 197, 266, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 168, 169,
+ 170, 171, 172, 173, 174, 175, 176, 0, 0, 177,
+ 178, 0, 0, 179, 180, 181, 182, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 183, 184, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
+ 0, 195, 196, 653, 604, 0, 0, 654, 0, 197,
+ 266, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 168, 169, 170, 171, 172, 173, 174, 175,
+ 176, 0, 0, 177, 178, 0, 0, 179, 180, 181,
+ 182, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 183, 184, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 185, 186, 187, 188, 189, 190,
+ 191, 192, 193, 194, 0, 195, 196, 689, 596, 0,
+ 0, 690, 0, 197, 266, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 168, 169, 170, 171,
+ 172, 173, 174, 175, 176, 0, 0, 177, 178, 0,
+ 0, 179, 180, 181, 182, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 183, 184, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 185, 186,
+ 187, 188, 189, 190, 191, 192, 193, 194, 0, 195,
+ 196, 692, 604, 0, 0, 693, 0, 197, 266, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 168, 169, 170, 171, 172, 173, 174, 175, 176, 0,
+ 0, 177, 178, 0, 0, 179, 180, 181, 182, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 183,
+ 184, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 185, 186, 187, 188, 189, 190, 191, 192,
+ 193, 194, 0, 195, 196, 836, 596, 0, 0, 837,
+ 0, 197, 266, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 168, 169, 170, 171, 172, 173,
+ 174, 175, 176, 0, 0, 177, 178, 0, 0, 179,
+ 180, 181, 182, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 183, 184, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 185, 186, 187, 188,
+ 189, 190, 191, 192, 193, 194, 0, 195, 196, 839,
+ 604, 0, 0, 840, 0, 197, 266, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 168, 169,
+ 170, 171, 172, 173, 174, 175, 176, 0, 0, 177,
+ 178, 0, 0, 179, 180, 181, 182, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 183, 184, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
+ 0, 195, 196, 994, 596, 0, 0, 995, 0, 197,
+ 266, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 168, 169, 170, 171, 172, 173, 174, 175,
+ 176, 0, 0, 177, 178, 0, 0, 179, 180, 181,
+ 182, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 183, 184, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 185, 186, 187, 188, 189, 190,
+ 191, 192, 193, 194, 0, 195, 196, 1007, 596, 0,
+ 0, 1008, 0, 197, 266, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 168, 169, 170, 171,
+ 172, 173, 174, 175, 176, 0, 0, 177, 178, 0,
+ 0, 179, 180, 181, 182, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 183, 184, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 185, 186,
+ 187, 188, 189, 190, 191, 192, 193, 194, 0, 195,
+ 196, 1010, 604, 0, 0, 1011, 0, 197, 266, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 168, 169, 170, 171, 172, 173, 174, 175, 176, 0,
+ 0, 177, 178, 0, 0, 179, 180, 181, 182, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 183,
+ 184, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 185, 186, 187, 188, 189, 190, 191, 192,
+ 193, 194, 0, 195, 196, 609, 604, 0, 0, 610,
+ 0, 197, 266, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 168, 169, 170, 171, 172, 173,
+ 174, 175, 176, 0, 0, 177, 178, 0, 0, 179,
+ 180, 181, 182, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 183, 184, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 732, 0,
+ 0, 0, 0, 0, 0, 0, 185, 186, 187, 188,
+ 189, 190, 191, 192, 193, 194, 0, 195, 196, 0,
+ 0, 0, 0, 0, 0, 197, 353, 354, 355, 356,
+ 357, 358, 359, 360, 361, 362, 363, 364, 365, 0,
+ 0, 366, 367, 353, 354, 355, 356, 357, 358, 359,
+ 360, 361, 362, 363, 364, 365, 0, 0, 366, 367,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 368, 0, 369, 370, 371, 372,
+ 373, 374, 375, 376, 377, 378, 0, 0, 0, 0,
+ 0, 368, 0, 369, 370, 371, 372, 373, 374, 375,
+ 376, 377, 378, 353, 354, 355, 356, 357, 358, 359,
+ 360, 361, 362, 363, 364, 365, 0, 242, 366, 367,
+ 0, 0, 353, 354, 355, 356, 357, 358, 359, 360,
+ 361, 362, 363, 364, 365, 0, 0, 366, 367, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 368, 0, 369, 370, 371, 372, 373, 374, 375,
+ 376, 377, 378, 0, 0, 0, 0, 0, 0, 0,
+ 368, -260, 369, 370, 371, 372, 373, 374, 375, 376,
+ 377, 378, 0, 0, 0, 0, 0, 0, 0, 0,
+ -261, 353, 354, 355, 356, 357, 358, 359, 360, 361,
+ 362, 363, 364, 365, 0, 0, 366, 367, 0, 0,
+ 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
+ 363, 364, 365, 0, 0, 366, 367, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 368,
+ 0, 369, 370, 371, 372, 373, 374, 375, 376, 377,
+ 378, 0, 0, 0, 0, 0, 0, 0, 368, -262,
+ 369, 370, 371, 372, 373, 374, 375, 376, 377, 378,
+ 0, 0, 0, 0, 0, 0, 0, 0, -263, 353,
+ 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
+ 364, 365, 0, 0, 366, 367, 0, 0, 0, 447,
+ 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
+ 363, 364, 365, 0, 0, 366, 367, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 368, 0, 369,
+ 370, 371, 372, 373, 374, 375, 376, 377, 378, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 368, 0,
+ 369, 370, 371, 372, 373, 374, 375, 376, 377, 378,
+ 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
+ 363, -595, -595, 0, 0, 366, 367, 353, 354, 355,
+ 356, 357, 358, 359, 360, 0, 362, 363, 0, 0,
+ 0, 0, 366, 367, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 369, 370, 371, 372, 373, 374, 375, 376, 377, 378,
+ 0, 0, 0, 0, 0, 0, 0, 369, 370, 371,
+ 372, 373, 374, 375, 376, 377, 378, 353, 354, 355,
+ 356, 357, 358, 359, 0, 0, 362, 363, 0, 0,
+ 0, 0, 366, 367, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 369, 370, 371,
+ 372, 373, 374, 375, 376, 377, 378
+};
+
+static const yytype_int16 yycheck[] =
+{
+ 2, 308, 308, 83, 84, 27, 436, 213, 14, 78,
+ 2, 10, 4, 5, 6, 27, 15, 9, 10, 21,
+ 85, 13, 28, 15, 16, 17, 7, 262, 20, 381,
+ 2, 7, 4, 28, 67, 22, 4, 303, 14, 54,
+ 379, 15, 296, 454, 383, 427, 300, 386, 64, 352,
+ 52, 53, 28, 405, 50, 16, 17, 721, 50, 20,
+ 450, 492, 54, 320, 454, 442, 114, 406, 636, 421,
+ 16, 17, 64, 484, 20, 56, 515, 645, 430, 795,
+ 56, 420, 709, 422, 912, 26, 78, 57, 889, 391,
+ 392, 52, 431, 67, 5, 6, 21, 22, 26, 16,
+ 612, 613, 13, 142, 25, 107, 29, 146, 16, 17,
+ 89, 91, 20, 25, 101, 285, 58, 59, 60, 61,
+ 25, 113, 89, 115, 103, 321, 557, 57, 324, 209,
+ 326, 470, 328, 89, 330, 25, 89, 289, 25, 119,
+ 220, 293, 494, 54, 52, 53, 25, 16, 17, 119,
+ 51, 20, 91, 27, 55, 51, 495, 53, 54, 55,
+ 56, 89, 140, 26, 0, 25, 145, 78, 146, 997,
+ 16, 17, 136, 69, 20, 103, 101, 91, 145, 349,
+ 119, 25, 107, 108, 55, 442, 987, 706, 111, 145,
+ 89, 121, 145, 407, 28, 136, 113, 352, 123, 116,
+ 117, 281, 509, 509, 740, 119, 52, 53, 136, 745,
+ 138, 18, 204, 20, 142, 214, 215, 145, 26, 140,
+ 140, 142, 214, 215, 459, 305, 492, 144, 140, 146,
+ 142, 947, 50, 80, 303, 140, 391, 392, 750, 113,
+ 91, 87, 116, 117, 140, 909, 145, 72, 912, 260,
+ 140, 262, 233, 140, 287, 119, 91, 233, 260, 89,
+ 262, 140, 295, 296, 266, 676, 893, 300, 119, 243,
+ 144, 91, 146, 136, 266, 532, 140, 124, 270, 142,
+ 140, 89, 274, 275, 295, 675, 676, 279, 665, 285,
+ 119, 557, 284, 285, 91, 103, 140, 115, 729, 119,
+ 292, 142, 101, 455, 129, 130, 131, 89, 89, 270,
+ 462, 303, 284, 287, 882, 145, 89, 119, 89, 142,
+ 292, 473, 119, 123, 270, 55, 632, 126, 136, 89,
+ 138, 347, 635, 997, 530, 350, 352, 145, 91, 338,
+ 339, 340, 341, 140, 119, 337, 338, 339, 340, 341,
+ 342, 343, 344, 349, 25, 347, 404, 349, 350, 91,
+ 352, 55, 270, 145, 145, 337, 805, 91, 887, 337,
+ 342, 313, 145, 16, 145, 391, 392, 113, 897, 381,
+ 116, 117, 734, 822, 823, 145, 347, 119, 89, 381,
+ 909, 352, 303, 140, 733, 119, 735, 266, 780, 391,
+ 392, 270, 103, 405, 556, 662, 20, 383, 665, 623,
+ 386, 140, 414, 405, 60, 407, 408, 63, 57, 421,
+ 266, 490, 136, 492, 270, 417, 448, 72, 430, 421,
+ 406, 91, 686, 425, 669, 737, 448, 138, 430, 350,
+ 742, 743, 119, 435, 145, 143, 422, 458, 459, 91,
+ 757, 757, 882, 137, 660, 431, 458, 459, 383, 119,
+ 466, 279, 108, 729, 139, 467, 16, 285, 58, 59,
+ 113, 466, 883, 116, 117, 467, 55, 119, 439, 631,
+ 140, 406, 1001, 457, 476, 37, 38, 567, 557, 91,
+ 466, 89, 494, 883, 470, 467, 1015, 422, 490, 91,
+ 492, 144, 494, 146, 476, 103, 431, 2, 722, 4,
+ 140, 513, 381, 515, 9, 10, 72, 119, 72, 495,
+ 15, 16, 17, 91, 963, 20, 98, 119, 91, 786,
+ 91, 349, 140, 685, 748, 381, 405, 15, 140, 531,
+ 138, 13, 450, 554, 758, 470, 848, 145, 550, 16,
+ 608, 119, 421, 611, 789, 50, 119, 15, 119, 405,
+ 866, 430, 584, 113, 63, 557, 116, 117, 143, 64,
+ 495, 629, 584, 481, 143, 421, 731, 140, 26, 490,
+ 137, 492, 737, 89, 430, 140, 800, 742, 743, 113,
+ 140, 140, 116, 117, 144, 16, 146, 103, 51, 417,
+ 53, 54, 55, 56, 450, 51, 608, 425, 454, 611,
+ 612, 613, 140, 600, 44, 89, 69, 435, 113, 140,
+ 115, 608, 146, 622, 611, 494, 978, 629, 89, 103,
+ 622, 623, 138, 635, 636, 481, 638, 140, 484, 145,
+ 979, 89, 103, 645, 796, 859, 557, 51, 494, 660,
+ 656, 140, 633, 686, 91, 103, 655, 633, 669, 51,
+ 729, 656, 868, 655, 138, 58, 59, 669, 874, 16,
+ 17, 145, 140, 20, 635, 600, 62, 138, 64, 65,
+ 656, 746, 119, 608, 145, 697, 611, 140, 136, 139,
+ 138, 119, 113, 848, 142, 116, 117, 145, 89, 139,
+ 47, 48, 627, 140, 629, 52, 53, 17, 18, 204,
+ 862, 863, 103, 531, 15, 731, 930, 64, 65, 214,
+ 215, 737, 738, 144, 18, 146, 742, 743, 114, 115,
+ 722, 51, 734, 53, 54, 55, 56, 729, 730, 731,
+ 818, 819, 734, 72, 139, 737, 738, 138, 750, 69,
+ 742, 743, 139, 137, 145, 15, 748, 749, 730, 735,
+ 137, 763, 26, 91, 766, 139, 758, 675, 146, 768,
+ 524, 266, 526, 765, 137, 270, 768, 15, 789, 274,
+ 275, 92, 37, 38, 279, 777, 778, 789, 14, 284,
+ 285, 119, 113, 785, 15, 116, 117, 292, 127, 128,
+ 129, 130, 131, 805, 391, 392, 818, 819, 800, 801,
+ 735, 62, 140, 64, 65, 15, 140, 143, 729, 51,
+ 822, 823, 144, 57, 140, 89, 140, 140, 820, 675,
+ 676, 140, 848, 825, 140, 140, 423, 424, 140, 103,
+ 72, 140, 337, 338, 339, 340, 341, 342, 343, 344,
+ 15, 139, 347, 933, 349, 15, 848, 352, 113, 137,
+ 15, 116, 117, 114, 115, 734, 858, 859, 100, 101,
+ 15, 15, 136, 140, 138, 867, 9, 10, 142, 871,
+ 882, 145, 15, 15, 471, 89, 381, 89, 734, 144,
+ 137, 146, 55, 124, 126, 124, 391, 392, 137, 103,
+ 61, 103, 89, 64, 65, 252, 253, 254, 255, 820,
+ 405, 15, 407, 408, 825, 89, 103, 55, 140, 266,
+ 140, 61, 417, 270, 64, 65, 421, 949, 15, 103,
+ 425, 749, 140, 140, 138, 430, 138, 949, 930, 140,
+ 435, 145, 706, 145, 936, 709, 938, 765, 89, 941,
+ 15, 138, 140, 114, 115, 142, 867, 721, 145, 777,
+ 778, 963, 103, 140, 138, 113, 142, 785, 116, 117,
+ 142, 145, 467, 139, 114, 115, 978, 467, 980, 981,
+ 113, 476, 140, 801, 13, 26, 978, 6, 981, 987,
+ 63, 64, 65, 721, 980, 207, 144, 138, 146, 494,
+ 347, 213, 747, 979, 145, 352, 353, 354, 355, 356,
+ 357, 358, 359, 360, 361, 362, 363, 364, 365, 366,
+ 367, 368, 369, 370, 371, 372, 373, 374, 375, 376,
+ 377, 378, 245, 7, 381, 721, 531, 883, 250, 866,
+ 858, 114, 115, 700, 391, 392, 261, 906, 89, 26,
+ 89, 909, 706, 871, 979, 809, 810, 811, 405, 813,
+ -1, 815, 103, -1, 103, 89, -1, 2, -1, 4,
+ 5, 6, 419, -1, 421, -1, 423, 424, 13, 103,
+ -1, 214, 215, 430, 89, -1, -1, 63, 64, 65,
+ -1, -1, 439, -1, -1, 136, 443, 138, 103, 138,
+ 447, 142, -1, 450, 145, 452, 145, 454, -1, 978,
+ -1, -1, 89, -1, 138, 50, -1, 89, 936, 54,
+ 938, 145, -1, 941, 471, 337, 103, 622, 623, 893,
+ -1, 103, 978, 138, 481, -1, -1, 484, 114, 115,
+ 145, 274, 275, 78, -1, 909, -1, 494, 912, -1,
+ 737, 738, -1, -1, -1, 742, 743, -1, -1, 136,
+ 655, 138, -1, -1, 511, 142, 138, -1, 145, -1,
+ 696, -1, -1, 145, 51, 522, 53, 54, 55, 56,
+ 115, -1, -1, 709, 771, 772, 712, 774, 775, 63,
+ 64, 65, 69, 540, 541, 721, -1, -1, -1, -1,
+ 954, 955, 956, 957, 551, 338, 339, 340, 341, -1,
+ 343, 344, -1, -1, 426, 427, 93, 700, -1, -1,
+ 906, 704, 99, 909, 700, -1, 912, 722, 914, 63,
+ 64, 65, -1, 997, -1, 730, 731, -1, 721, 734,
+ 114, 115, 737, 738, -1, 721, -1, 742, 743, 63,
+ 64, 65, -1, 748, 749, -1, -1, -1, 63, 64,
+ 65, 848, -1, 758, 476, 1019, -1, -1, -1, 204,
+ 765, 483, -1, 768, -1, 408, -1, -1, 964, -1,
+ 114, 115, 777, 778, -1, -1, -1, -1, 635, 876,
+ 785, 40, 41, 42, 43, 44, -1, 2, -1, 4,
+ 114, 115, -1, -1, -1, 800, 801, -1, 13, 114,
+ 115, 997, -1, 999, -1, 1001, -1, 1003, -1, 666,
+ 63, 64, 65, -1, -1, -1, -1, -1, 675, 676,
+ -1, -1, -1, 51, -1, 53, 54, 55, 56, -1,
+ -1, -1, 1028, -1, 279, 50, 63, 64, 65, 284,
+ 285, 69, -1, 848, 72, -1, -1, 292, -1, -1,
+ -1, -1, -1, 858, 859, 827, 828, 893, 303, 895,
+ -1, 114, 115, 899, -1, 93, 871, -1, -1, 726,
+ -1, 99, 100, 101, 731, 732, 912, 734, 914, -1,
+ 737, 738, -1, -1, -1, 742, 743, 114, 115, -1,
+ -1, -1, 337, -1, -1, -1, -1, 342, 126, 621,
+ 115, 129, -1, -1, 349, 350, -1, 352, -1, 945,
+ 946, -1, 140, 906, 771, 772, 909, 774, 775, 912,
+ 906, 914, -1, 909, -1, 930, 912, 784, 914, -1,
+ -1, 936, -1, 938, -1, -1, 941, 909, 660, -1,
+ -1, -1, -1, -1, -1, -1, 391, 392, -1, 985,
+ -1, -1, -1, 2, 990, 4, 5, 6, 7, -1,
+ -1, 997, 407, 999, 13, -1, -1, 1003, -1, -1,
+ -1, 964, 417, 978, 831, -1, -1, -1, 964, 622,
+ 425, 1017, -1, -1, 841, 842, -1, -1, -1, 204,
+ 435, 848, 1028, -1, -1, 967, 968, 969, -1, 971,
+ 972, 50, -1, -1, 997, 54, 999, -1, 1001, -1,
+ 1003, 997, 655, 999, -1, 1001, -1, 1003, -1, 876,
+ -1, -1, 467, -1, 72, -1, 883, -1, -1, 78,
+ 752, 476, -1, -1, -1, 1028, -1, 759, -1, 87,
+ 88, 72, 1028, -1, 2, 490, 4, 492, 1020, 1021,
+ 1022, 1023, 72, -1, -1, -1, 87, 88, 780, -1,
+ 1032, -1, -1, -1, 279, -1, 115, 87, 88, 284,
+ 285, 51, -1, 53, 54, 55, 56, 292, 126, 127,
+ 128, 129, 130, 131, 113, -1, 531, 116, 117, 69,
+ -1, -1, 50, 124, 125, 126, 127, 128, 129, 130,
+ 131, -1, -1, -1, -1, -1, -1, 127, 128, 129,
+ 130, 131, 557, 93, 143, 144, -1, 146, -1, 99,
+ 113, 978, 337, 116, 117, 768, 51, 342, 53, 54,
+ 55, 56, -1, -1, 349, -1, -1, 352, 51, -1,
+ 53, 54, 55, 56, 69, -1, 868, 140, -1, -1,
+ -1, 144, 874, 146, -1, 204, 69, 115, -1, 72,
+ -1, -1, -1, -1, -1, -1, -1, -1, 93, -1,
+ -1, -1, -1, -1, -1, -1, 391, 392, 623, -1,
+ 93, -1, -1, -1, -1, -1, 99, 100, 101, -1,
+ -1, 51, 407, 53, 54, 55, 56, -1, -1, -1,
+ -1, -1, 417, -1, -1, -1, -1, -1, -1, 69,
+ 425, -1, 72, 126, -1, -1, 129, -1, -1, -1,
+ 435, -1, -1, -1, -1, -1, -1, -1, -1, 142,
+ 279, -1, -1, 93, -1, 284, 285, -1, -1, 99,
+ 100, 101, -1, 292, -1, -1, 204, -1, -1, -1,
+ -1, -1, 467, -1, 303, -1, -1, -1, -1, -1,
+ 51, 476, 53, 54, 55, 56, 126, -1, -1, 129,
+ -1, -1, -1, -1, -1, -1, -1, 722, 69, -1,
+ -1, 72, 142, -1, 729, 730, 731, -1, 337, -1,
+ -1, -1, 737, 342, -1, -1, -1, 742, 743, -1,
+ 349, 350, 93, 748, 749, -1, -1, -1, 99, 100,
+ 101, -1, -1, 758, -1, -1, 531, -1, -1, -1,
+ 765, 279, -1, -1, -1, -1, 284, 285, -1, -1,
+ -1, -1, 777, 778, 292, 126, -1, -1, 129, -1,
+ 785, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 800, 801, -1, 407, -1,
+ -1, -1, -1, -1, -1, -1, -1, 51, 417, 53,
+ 54, 55, 56, -1, -1, 820, 425, -1, -1, 337,
+ 825, -1, -1, -1, 342, 69, 435, -1, 72, -1,
+ -1, 349, -1, -1, 352, -1, -1, -1, -1, -1,
+ 84, -1, -1, 848, -1, -1, -1, -1, 623, 93,
+ -1, -1, -1, 858, 859, 99, 100, 101, 467, -1,
+ -1, -1, 867, -1, -1, -1, 871, 476, -1, -1,
+ -1, -1, -1, 391, 392, -1, -1, -1, -1, -1,
+ -1, 490, 126, 492, -1, 129, -1, -1, 51, 407,
+ 53, 54, 55, 56, -1, -1, -1, -1, -1, 417,
+ -1, -1, -1, -1, -1, -1, 69, 425, -1, 72,
+ -1, -1, -1, -1, -1, -1, -1, 435, -1, -1,
+ -1, -1, 531, -1, -1, 930, -1, -1, -1, -1,
+ 93, 936, -1, 938, -1, -1, 941, 100, 101, -1,
+ -1, -1, -1, -1, -1, -1, -1, 722, 557, 467,
+ -1, -1, -1, -1, -1, 730, 731, -1, 476, -1,
+ -1, -1, 737, 126, -1, -1, -1, 742, 743, -1,
+ -1, -1, -1, 748, 749, -1, -1, -1, -1, -1,
+ -1, -1, -1, 758, -1, -1, -1, -1, -1, -1,
+ 765, 0, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 777, 778, 13, 14, 15, 16, 17, 18,
+ 785, 20, -1, 531, 623, -1, -1, 26, 27, -1,
+ -1, -1, -1, -1, -1, 800, 801, -1, 37, 38,
+ -1, 40, 41, 42, 43, 44, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 848, -1, -1, -1, -1, -1, -1,
+ 89, -1, -1, 858, 859, -1, -1, -1, -1, -1,
+ -1, -1, 867, -1, 103, -1, 871, -1, -1, -1,
+ -1, -1, -1, -1, 113, 623, -1, 116, 117, -1,
+ -1, -1, -1, 722, -1, -1, -1, -1, -1, -1,
+ 729, 730, -1, -1, -1, -1, -1, 136, 137, -1,
+ -1, -1, -1, 142, 143, 144, 145, 146, -1, 748,
+ 749, -1, -1, -1, -1, -1, -1, -1, -1, 758,
+ -1, -1, -1, -1, -1, 930, 765, -1, -1, -1,
+ -1, 936, -1, 938, -1, -1, 941, -1, 777, 778,
+ -1, -1, -1, -1, -1, -1, 785, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 800, 801, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 722, -1, -1, -1, -1, -1,
+ -1, 820, 730, 731, -1, -1, 825, -1, -1, 737,
+ -1, -1, -1, -1, 742, 743, -1, -1, -1, -1,
+ 748, 749, -1, -1, -1, -1, -1, -1, -1, -1,
+ 758, -1, -1, -1, -1, -1, -1, 765, -1, 858,
+ 859, -1, -1, -1, -1, -1, -1, -1, 867, 777,
+ 778, -1, 871, -1, -1, -1, -1, 785, -1, -1,
+ -1, -1, -1, -1, -1, -1, 44, -1, -1, -1,
+ -1, -1, 800, 801, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, 84, -1, -1, 87,
+ 88, 930, -1, -1, -1, -1, -1, 936, -1, 938,
+ 848, -1, 941, 72, 73, 74, 75, 76, 77, 78,
+ 858, 859, 81, 82, -1, -1, -1, -1, 87, 88,
+ -1, -1, 120, 871, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, -1, -1, -1, -1, -1, -1,
+ -1, -1, 140, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 122, 123, 124, 125, 126, 127, 128,
+ 129, 130, 131, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 930, -1, -1, -1, -1, -1, 936, -1,
+ 938, 0, 1, 941, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, -1, -1, -1, -1, -1, -1,
+ 19, -1, 21, 22, 23, 24, -1, -1, -1, -1,
+ -1, 30, 31, 32, 33, 34, 35, 36, -1, -1,
+ 39, -1, -1, -1, -1, -1, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, -1, 58,
+ 59, 60, -1, -1, 63, -1, -1, 66, 67, -1,
+ 69, 70, 71, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 90, -1, -1, 93, 94, -1, 96, 97, -1,
+ 99, -1, -1, 102, -1, 104, 105, 106, 107, 108,
+ 109, 0, -1, 112, 113, -1, -1, 116, 117, -1,
+ -1, -1, -1, -1, 13, 14, 15, 16, 17, 18,
+ -1, 20, -1, 132, 133, 134, -1, -1, 27, 28,
+ -1, -1, -1, -1, -1, 144, -1, 146, 37, 38,
+ -1, 40, 41, 42, 43, 44, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 57, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, -1, -1, 87, 88,
+ 89, -1, 91, 92, -1, -1, -1, -1, -1, 98,
+ -1, -1, -1, -1, 103, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 113, -1, -1, 116, 117, -1,
+ 119, 120, -1, 122, 123, 124, 125, 126, 127, 128,
+ 129, 130, 131, -1, -1, 0, -1, -1, 137, 138,
+ 139, 140, -1, -1, 143, 144, 145, 146, 13, 14,
+ 15, 16, 17, 18, -1, 20, -1, -1, -1, -1,
+ -1, -1, 27, 28, -1, -1, -1, -1, -1, -1,
+ -1, -1, 37, 38, -1, 40, 41, 42, 43, 44,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+ -1, -1, 87, 88, 89, -1, -1, 92, -1, -1,
+ -1, -1, -1, 98, -1, -1, -1, -1, 103, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 113, -1,
+ -1, 116, 117, -1, -1, 120, -1, 122, 123, 124,
+ 125, 126, 127, 128, 129, 130, 131, -1, -1, 0,
+ -1, -1, 137, 138, 139, 140, -1, 142, 143, 144,
+ 145, 146, 13, 14, 15, -1, 17, 18, -1, 20,
+ -1, -1, -1, -1, -1, 26, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 37, 38, -1, 40,
+ 41, 42, 43, 44, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+ 81, 82, 83, 84, -1, -1, 87, 88, 89, -1,
+ 91, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 103, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 113, -1, -1, 116, 117, -1, 119, 120,
+ -1, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+ 131, -1, -1, 0, -1, 136, 137, 138, -1, 140,
+ -1, -1, 143, 144, 145, 146, 13, 14, 15, -1,
+ 17, 18, -1, 20, -1, -1, -1, -1, -1, 26,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 37, 38, -1, 40, 41, 42, 43, 44, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 72, 73, 74, 75, 76,
+ 77, 78, 79, 80, 81, 82, 83, 84, -1, -1,
+ 87, 88, 89, -1, 91, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 103, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 113, -1, -1, 116,
+ 117, -1, 119, 120, -1, 122, 123, 124, 125, 126,
+ 127, 128, 129, 130, 131, -1, -1, 0, -1, 136,
+ 137, 138, -1, 140, -1, -1, 143, 144, 145, 146,
+ 13, 14, 15, -1, 17, 18, -1, 20, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 37, 38, -1, 40, 41, 42,
+ 43, 44, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+ 83, 84, -1, -1, 87, 88, 89, -1, 91, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 103, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 113, -1, -1, 116, 117, -1, 119, 120, -1, 122,
+ 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
+ -1, 0, -1, -1, 137, 138, -1, 140, -1, -1,
+ 143, 144, 145, 146, 13, 14, 15, -1, 17, 18,
+ -1, 20, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 37, 38,
+ -1, 40, 41, 42, 43, 44, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, -1, -1, 87, 88,
+ 89, -1, 91, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 103, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 113, -1, -1, 116, 117, -1,
+ 119, 120, -1, 122, 123, 124, 125, 126, 127, 128,
+ 129, 130, 131, -1, -1, -1, -1, -1, 137, 138,
+ -1, 140, -1, -1, 143, 144, 145, 146, 1, -1,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, -1, -1, 18, 19, -1, 21, 22,
+ 23, 24, -1, -1, -1, -1, -1, 30, 31, 32,
+ 33, 34, 35, 36, -1, -1, 39, -1, -1, -1,
+ -1, -1, 45, -1, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, -1, 58, 59, 60, -1, -1,
+ 63, -1, -1, 66, 67, -1, 69, 70, 71, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 90, -1, -1,
+ 93, 94, -1, 96, 97, -1, 99, -1, -1, 102,
+ -1, 104, 105, 106, 107, 108, 109, -1, -1, 112,
+ 113, -1, -1, 116, 117, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 132,
+ 133, 134, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 144, 1, 146, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, -1, -1, 15, -1, 17, 18,
+ 19, -1, 21, 22, 23, 24, -1, -1, -1, -1,
+ -1, 30, 31, 32, 33, 34, 35, 36, -1, -1,
+ 39, -1, -1, -1, -1, -1, 45, -1, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, -1, 58,
+ 59, 60, -1, -1, 63, -1, -1, 66, 67, -1,
+ 69, 70, 71, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 90, -1, -1, 93, 94, -1, 96, 97, -1,
+ 99, -1, -1, 102, -1, 104, 105, 106, 107, 108,
+ 109, -1, -1, 112, 113, -1, -1, 116, 117, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 132, 133, 134, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 144, 1, 146, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, -1, -1,
+ 15, -1, -1, 18, 19, 20, 21, 22, 23, 24,
+ -1, -1, -1, -1, -1, 30, 31, 32, 33, 34,
+ 35, 36, -1, -1, 39, -1, -1, -1, -1, -1,
+ 45, -1, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, -1, 58, 59, 60, -1, -1, 63, -1,
+ -1, 66, 67, -1, 69, 70, 71, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 90, -1, -1, 93, 94,
+ -1, 96, 97, -1, 99, -1, -1, 102, -1, 104,
+ 105, 106, 107, 108, 109, -1, -1, 112, 113, -1,
+ -1, 116, 117, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 132, 133, 134,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 144,
+ 1, 146, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, -1, -1, 15, -1, -1, 18, 19, -1,
+ 21, 22, 23, 24, -1, -1, -1, -1, -1, 30,
+ 31, 32, 33, 34, 35, 36, -1, -1, 39, -1,
+ -1, -1, -1, -1, 45, -1, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, -1, 58, 59, 60,
+ -1, -1, 63, -1, -1, 66, 67, -1, 69, 70,
+ 71, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 90,
+ -1, -1, 93, 94, -1, 96, 97, -1, 99, -1,
+ -1, 102, -1, 104, 105, 106, 107, 108, 109, -1,
+ -1, 112, 113, -1, -1, 116, 117, 1, -1, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
+ -1, 132, 133, 134, -1, 19, -1, 21, 22, 23,
+ 24, -1, -1, 144, -1, 146, 30, 31, 32, 33,
+ 34, 35, 36, -1, -1, 39, -1, -1, -1, -1,
+ -1, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, -1, 58, 59, 60, -1, -1, 63,
+ -1, -1, 66, 67, -1, 69, 70, 71, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 90, -1, -1, 93,
+ 94, -1, 96, 97, -1, 99, -1, -1, 102, -1,
+ 104, 105, 106, 107, 108, 109, -1, -1, 112, 113,
+ -1, -1, 116, 117, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 132, 133,
+ 134, -1, -1, 137, -1, -1, -1, -1, -1, -1,
+ 144, 1, 146, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, -1, 14, 15, -1, -1, -1, 19,
+ -1, 21, 22, 23, 24, -1, -1, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, 45, -1, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
+ 60, -1, -1, 63, -1, -1, 66, 67, -1, 69,
+ 70, 71, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 90, -1, -1, 93, 94, -1, 96, 97, -1, 99,
+ -1, -1, 102, -1, 104, 105, 106, 107, 108, 109,
+ -1, -1, 112, 113, -1, -1, 116, 117, 1, -1,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ -1, -1, 132, 133, 134, -1, 19, -1, 21, 22,
+ 23, 24, -1, -1, 144, -1, 146, 30, 31, 32,
+ 33, 34, 35, 36, -1, -1, 39, -1, -1, -1,
+ -1, -1, 45, -1, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, -1, 58, 59, 60, -1, -1,
+ 63, -1, -1, 66, 67, -1, 69, 70, 71, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 90, -1, -1,
+ 93, 94, -1, 96, 97, -1, 99, -1, -1, 102,
+ -1, 104, 105, 106, 107, 108, 109, -1, -1, 112,
+ 113, -1, -1, 116, 117, 1, -1, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, -1, -1, 132,
+ 133, 134, -1, 19, -1, 21, 22, 23, 24, -1,
+ 143, 144, -1, 146, 30, 31, 32, 33, 34, 35,
+ 36, -1, -1, 39, -1, -1, -1, -1, -1, 45,
+ -1, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, -1, 58, 59, 60, -1, -1, 63, -1, -1,
+ 66, 67, -1, 69, 70, 71, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 90, -1, -1, 93, 94, -1,
+ 96, 97, -1, 99, -1, -1, 102, -1, 104, 105,
+ 106, 107, 108, 109, -1, -1, 112, 113, -1, -1,
+ 116, 117, 1, -1, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, -1, -1, 132, 133, 134, -1,
+ 19, -1, 21, 22, 23, 24, -1, 143, 144, -1,
+ 146, 30, 31, 32, 33, 34, 35, 36, -1, -1,
+ 39, -1, -1, -1, -1, -1, 45, -1, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, -1, 58,
+ 59, 60, -1, -1, 63, -1, -1, 66, 67, -1,
+ 69, 70, 71, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 90, -1, -1, 93, 94, -1, 96, 97, -1,
+ 99, -1, -1, 102, -1, 104, 105, 106, 107, 108,
+ 109, -1, -1, 112, 113, -1, -1, 116, 117, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 132, 133, 134, -1, -1, 137, -1,
+ -1, -1, -1, -1, -1, 144, 1, 146, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, -1, -1,
+ 15, -1, -1, -1, 19, -1, 21, 22, 23, 24,
+ -1, -1, -1, -1, -1, 30, 31, 32, 33, 34,
+ 35, 36, -1, -1, 39, -1, -1, -1, -1, -1,
+ 45, -1, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, -1, 58, 59, 60, -1, -1, 63, -1,
+ -1, 66, 67, -1, 69, 70, 71, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 90, -1, -1, 93, 94,
+ -1, 96, 97, -1, 99, -1, -1, 102, -1, 104,
+ 105, 106, 107, 108, 109, -1, -1, 112, 113, -1,
+ -1, 116, 117, -1, -1, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, -1, -1, 132, 133, 134,
+ -1, 19, -1, 21, 22, 23, 24, -1, -1, 144,
+ -1, 146, 30, 31, 32, 33, 34, 35, 36, -1,
+ -1, 39, -1, -1, -1, -1, -1, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, -1,
+ 58, 59, 60, -1, -1, 63, -1, -1, 66, 67,
+ -1, 69, 70, 71, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 90, -1, -1, 93, 94, -1, 96, 97,
+ -1, 99, -1, -1, 102, -1, 104, 105, 106, 107,
+ 108, 109, -1, -1, 112, 113, -1, -1, 116, 117,
+ -1, -1, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, -1, -1, 132, 133, 134, -1, 19, -1,
+ 21, 22, 23, 24, -1, -1, 144, -1, 146, 30,
+ 31, 32, 33, 34, 35, 36, -1, -1, 39, -1,
+ -1, -1, -1, -1, 45, -1, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, -1, 58, 59, 60,
+ -1, -1, 63, -1, -1, 66, 67, -1, 69, 70,
+ 71, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 90,
+ -1, -1, 93, 94, -1, 96, 97, -1, 99, -1,
+ -1, 102, -1, 104, 105, 106, 107, 108, 109, -1,
+ -1, 112, 113, -1, -1, 116, 117, -1, -1, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, -1, -1,
+ -1, 132, 133, 134, -1, 19, -1, 21, 22, 23,
+ 24, -1, -1, 144, -1, 146, 30, 31, 32, 33,
+ 34, 35, 36, -1, -1, 39, -1, -1, -1, -1,
+ -1, -1, -1, -1, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, -1, 58, 59, 60, -1, -1, 63,
+ -1, -1, 66, 67, -1, 69, 70, 71, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 90, -1, -1, 93,
+ 94, -1, 96, 97, -1, -1, -1, -1, 102, -1,
+ 104, 105, 106, 107, 108, 109, -1, -1, 112, 113,
+ -1, -1, 116, 117, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 132, 133,
+ 134, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 144, -1, 146, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ -1, -1, -1, -1, -1, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, -1,
+ -1, 81, 82, -1, -1, 85, 86, 87, 88, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 99,
+ 100, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 122, 123, 124, 125, 126, 127, 128, 129,
+ 130, 131, -1, 133, 134, -1, -1, -1, -1, -1,
+ -1, 141, 142, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, -1, -1, -1, 19,
+ -1, 21, 22, 23, 24, -1, 26, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
+ 60, -1, -1, 63, -1, -1, 66, 67, -1, 69,
+ 70, 71, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 90, -1, -1, 93, 94, -1, 96, 97, -1, 99,
+ 100, 101, 102, -1, 104, 105, 106, 107, 108, 109,
+ -1, -1, 112, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 132, 133, 134, -1, 136, -1, -1, -1,
+ -1, -1, 142, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, -1, -1, -1, 19,
+ -1, 21, 22, 23, 24, -1, 26, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
+ 60, -1, -1, 63, -1, -1, 66, 67, -1, 69,
+ 70, 71, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 90, -1, -1, 93, 94, -1, 96, 97, -1, 99,
+ 100, 101, 102, -1, 104, 105, 106, 107, 108, 109,
+ -1, -1, 112, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 132, 133, 134, -1, 136, -1, -1, -1,
+ -1, -1, 142, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, -1, -1, -1, 19,
+ -1, 21, 22, 23, 24, -1, 26, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
+ 60, -1, -1, 63, -1, -1, 66, 67, -1, 69,
+ 70, 71, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 90, -1, -1, 93, 94, -1, 96, 97, -1, 99,
+ 100, 101, 102, -1, 104, 105, 106, 107, 108, 109,
+ -1, -1, 112, -1, -1, -1, -1, -1, -1, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, 132, 133, 134, 19, 136, 21, 22, 23,
+ 24, -1, 142, -1, -1, -1, 30, 31, 32, 33,
+ 34, 35, 36, -1, -1, 39, -1, -1, -1, -1,
+ -1, -1, -1, -1, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, -1, 58, 59, 60, -1, -1, 63,
+ -1, -1, 66, 67, -1, 69, 70, 71, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 90, 91, -1, 93,
+ 94, -1, 96, 97, -1, 99, 100, 101, 102, -1,
+ 104, 105, 106, 107, 108, 109, -1, -1, 112, -1,
+ -1, -1, -1, -1, -1, 119, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, -1, -1, -1, 132, 133,
+ 134, -1, 19, -1, 21, 22, 23, 24, 142, -1,
+ -1, -1, -1, 30, 31, 32, 33, 34, 35, 36,
+ -1, -1, 39, -1, -1, -1, -1, -1, -1, -1,
+ -1, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ -1, 58, 59, 60, -1, -1, 63, -1, -1, 66,
+ 67, -1, 69, 70, 71, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 90, 91, -1, 93, 94, -1, 96,
+ 97, -1, 99, 100, 101, 102, -1, 104, 105, 106,
+ 107, 108, 109, -1, -1, 112, -1, -1, -1, -1,
+ -1, -1, 119, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, -1, -1, -1, 132, 133, 134, -1, 19,
+ -1, 21, 22, 23, 24, 142, -1, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
+ 60, -1, -1, 63, -1, -1, 66, 67, -1, 69,
+ 70, 71, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 90, -1, -1, 93, 94, -1, 96, 97, -1, 99,
+ 100, 101, 102, -1, 104, 105, 106, 107, 108, 109,
+ -1, -1, 112, -1, -1, -1, -1, -1, -1, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, 132, 133, 134, 19, -1, 21, 22, 23,
+ 24, -1, 142, -1, -1, -1, 30, 31, 32, 33,
+ 34, 35, 36, -1, -1, 39, -1, -1, -1, -1,
+ -1, -1, -1, -1, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, -1, 58, 59, 60, -1, -1, 63,
+ -1, -1, 66, 67, -1, 69, 70, 71, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 90, -1, -1, 93,
+ 94, -1, 96, 97, -1, 99, 100, 101, 102, -1,
+ 104, 105, 106, 107, 108, 109, -1, -1, 112, -1,
+ -1, -1, -1, -1, -1, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, -1, -1, -1, -1, 132, 133,
+ 134, 19, -1, 21, 22, 23, 24, -1, 142, -1,
+ -1, -1, 30, 31, 32, 33, 34, 35, 36, -1,
+ -1, 39, -1, -1, -1, -1, -1, -1, -1, -1,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, -1,
+ 58, 59, 60, -1, -1, 63, -1, -1, 66, 67,
+ -1, 69, 70, 71, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 90, -1, -1, 93, 94, -1, 96, 97,
+ -1, 99, 100, 101, 102, -1, 104, 105, 106, 107,
+ 108, 109, -1, -1, 112, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 132, 133, 134, -1, -1, -1,
+ -1, -1, -1, -1, 142, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, -1,
+ -1, -1, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, -1, -1, -1, -1, -1, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, -1,
+ -1, -1, -1, -1, -1, 63, -1, -1, -1, -1,
+ -1, -1, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, -1, -1, 81, 82, -1, -1, 85, 86, 87,
+ 88, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 99, 100, -1, -1, -1, -1, -1, -1, -1,
+ 108, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, -1, 133, 134, -1, -1, -1,
+ -1, -1, -1, 141, 3, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, -1, -1,
+ -1, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, -1, -1, -1, -1, -1, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, -1, -1,
+ -1, -1, -1, -1, 63, -1, -1, -1, -1, -1,
+ -1, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ -1, -1, 81, 82, -1, -1, 85, 86, 87, 88,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 99, 100, -1, -1, -1, -1, -1, -1, -1, 108,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 122, 123, 124, 125, 126, 127, 128,
+ 129, 130, 131, -1, 133, 134, -1, -1, -1, -1,
+ -1, -1, 141, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ -1, -1, -1, -1, -1, 45, 46, 47, 48, 49,
+ 50, 51, 52, -1, -1, 55, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, -1,
+ -1, 81, 82, -1, -1, 85, 86, 87, 88, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 99,
+ 100, -1, -1, -1, 104, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 122, 123, 124, 125, 126, 127, 128, 129,
+ 130, 131, -1, 133, 134, -1, -1, -1, -1, -1,
+ -1, 141, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, -1, -1, -1, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, -1,
+ -1, -1, -1, -1, 45, 46, 47, 48, 49, 50,
+ 51, 52, -1, -1, 55, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 70,
+ 71, 72, 73, 74, 75, 76, 77, 78, -1, -1,
+ 81, 82, -1, -1, 85, 86, 87, 88, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 99, 100,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+ 131, -1, 133, 134, -1, -1, -1, -1, -1, -1,
+ 141, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ -1, -1, -1, -1, -1, -1, -1, 19, -1, 21,
+ 22, 23, 24, -1, -1, -1, -1, -1, 30, 31,
+ 32, 33, 34, 35, 36, -1, -1, 39, -1, -1,
+ -1, -1, -1, -1, -1, -1, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, -1, 58, 59, 60, -1,
+ -1, 63, -1, -1, 66, 67, -1, 69, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 90, -1,
+ -1, 93, 94, -1, 96, 97, -1, -1, -1, -1,
+ 102, -1, 104, 105, 106, 107, 108, 109, -1, -1,
+ 112, -1, -1, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, -1, -1, -1, 19,
+ 132, 21, 22, 23, 24, -1, -1, -1, 140, -1,
+ 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
+ 60, -1, -1, 63, -1, -1, 66, 67, -1, 69,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 90, -1, -1, 93, 94, -1, 96, 97, -1, -1,
+ -1, -1, 102, -1, 104, 105, 106, 107, 108, 109,
+ -1, -1, 112, -1, -1, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, -1, -1, -1, -1, -1,
+ -1, 19, 132, 21, 22, 23, 24, -1, -1, -1,
+ 140, -1, 30, 31, 32, 33, 34, 35, 36, -1,
+ -1, 39, -1, -1, -1, -1, -1, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, -1,
+ 58, 59, 60, -1, -1, 63, -1, -1, 66, 67,
+ -1, 69, 70, 71, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 90, -1, -1, 93, 94, -1, 96, 97,
+ -1, 99, -1, -1, 102, -1, 104, 105, 106, 107,
+ 108, 109, -1, -1, 112, -1, -1, -1, -1, -1,
+ -1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ -1, -1, -1, -1, 132, 133, 134, 19, -1, 21,
+ 22, 23, 24, -1, -1, -1, -1, -1, 30, 31,
+ 32, 33, 34, 35, 36, -1, -1, 39, -1, -1,
+ -1, -1, -1, -1, -1, -1, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, -1, 58, 59, 60, -1,
+ -1, 63, -1, -1, 66, 67, -1, 69, 70, 71,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 84, -1, -1, -1, -1, -1, 90, -1,
+ -1, 93, 94, -1, 96, 97, -1, 99, 100, 101,
+ 102, -1, 104, 105, 106, 107, 108, 109, -1, -1,
+ 112, -1, -1, -1, -1, -1, -1, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, -1, -1, -1,
+ 132, 133, 134, 19, -1, 21, 22, 23, 24, -1,
+ -1, -1, -1, -1, 30, 31, 32, 33, 34, 35,
+ 36, -1, -1, 39, -1, -1, -1, -1, -1, 45,
+ -1, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, -1, 58, 59, 60, -1, -1, 63, -1, -1,
+ 66, 67, -1, 69, 70, 71, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 90, -1, -1, 93, 94, -1,
+ 96, 97, -1, 99, -1, -1, 102, -1, 104, 105,
+ 106, 107, 108, 109, -1, -1, 112, -1, -1, -1,
+ -1, -1, -1, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, 132, 133, 134, 19,
+ -1, 21, 22, 23, 24, -1, -1, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
+ 60, -1, -1, 63, -1, -1, 66, 67, -1, 69,
+ 70, 71, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 90, -1, -1, 93, 94, -1, 96, 97, -1, 99,
+ 100, 101, 102, -1, 104, 105, 106, 107, 108, 109,
+ -1, -1, 112, -1, -1, -1, -1, -1, -1, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, 132, 133, 134, 19, -1, 21, 22, 23,
+ 24, -1, -1, -1, -1, -1, 30, 31, 32, 33,
+ 34, 35, 36, -1, -1, 39, -1, -1, -1, -1,
+ -1, -1, -1, -1, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, -1, 58, 59, 60, -1, -1, 63,
+ -1, -1, 66, 67, -1, 69, 70, 71, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 90, -1, -1, 93,
+ 94, -1, 96, 97, -1, 99, 100, 101, 102, -1,
+ 104, 105, 106, 107, 108, 109, -1, -1, 112, -1,
+ -1, -1, -1, -1, -1, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, -1, -1, -1, -1, 132, 133,
+ 134, 19, -1, 21, 22, 23, 24, -1, -1, -1,
+ -1, -1, 30, 31, 32, 33, 34, 35, 36, -1,
+ -1, 39, -1, -1, -1, -1, -1, -1, -1, -1,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, -1,
+ 58, 59, 60, -1, -1, 63, -1, -1, 66, 67,
+ -1, 69, 70, 71, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 90, -1, -1, 93, 94, -1, 96, 97,
+ -1, 99, 100, -1, 102, -1, 104, 105, 106, 107,
+ 108, 109, -1, -1, 112, -1, -1, -1, -1, -1,
+ -1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ -1, -1, -1, -1, 132, 133, 134, 19, -1, 21,
+ 22, 23, 24, -1, -1, -1, -1, -1, 30, 31,
+ 32, 33, 34, 35, 36, -1, -1, 39, -1, -1,
+ -1, -1, -1, -1, -1, -1, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, -1, 58, 59, 60, -1,
+ -1, 63, -1, -1, 66, 67, -1, 69, 70, 71,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 90, -1,
+ -1, 93, 94, -1, 96, 97, -1, -1, 100, 101,
+ 102, -1, 104, 105, 106, 107, 108, 109, -1, -1,
+ 112, -1, -1, -1, -1, -1, -1, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, -1, -1, -1, -1,
+ 132, 133, 134, 19, -1, 21, 22, 23, 24, -1,
+ -1, -1, -1, -1, 30, 31, 32, 33, 34, 35,
+ 36, -1, -1, 39, -1, -1, -1, -1, -1, -1,
+ -1, -1, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, -1, 58, 59, 60, -1, -1, 63, -1, -1,
+ 66, 67, -1, 69, 70, 71, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 90, -1, -1, 93, 94, -1,
+ 96, 97, -1, 99, 100, -1, 102, -1, 104, 105,
+ 106, 107, 108, 109, -1, -1, 112, -1, -1, -1,
+ -1, -1, -1, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, 132, 133, 134, 19,
+ -1, 21, 22, 23, 24, -1, -1, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
+ 60, -1, -1, 63, -1, -1, 66, 67, -1, 69,
+ 70, 71, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 90, -1, -1, 93, 94, -1, 96, 97, -1, -1,
+ 100, -1, 102, -1, 104, 105, 106, 107, 108, 109,
+ -1, -1, 112, -1, -1, -1, -1, -1, -1, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, 132, 133, 134, 19, -1, 21, 22, 23,
+ 24, -1, -1, -1, -1, -1, 30, 31, 32, 33,
+ 34, 35, 36, -1, -1, 39, -1, -1, -1, -1,
+ -1, -1, -1, -1, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, -1, 58, 59, 60, -1, -1, 63,
+ -1, -1, 66, 67, -1, 69, 70, 71, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 90, -1, -1, 93,
+ 94, -1, 96, 97, -1, 99, -1, -1, 102, -1,
+ 104, 105, 106, 107, 108, 109, -1, -1, 112, -1,
+ -1, -1, -1, -1, -1, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, -1, -1, -1, -1, 132, 133,
+ 134, 19, -1, 21, 22, 23, 24, -1, -1, -1,
+ -1, -1, 30, 31, 32, 33, 34, 35, 36, -1,
+ -1, 39, -1, -1, -1, -1, -1, -1, -1, -1,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, -1,
+ 58, 59, 60, -1, -1, 63, -1, -1, 66, 67,
+ -1, 69, 70, 71, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 90, -1, -1, 93, 94, -1, 96, 97,
+ -1, 99, -1, -1, 102, -1, 104, 105, 106, 107,
+ 108, 109, -1, -1, 112, -1, -1, -1, -1, -1,
+ -1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ -1, -1, -1, -1, 132, 133, 134, 19, -1, 21,
+ 22, 23, 24, -1, -1, -1, -1, -1, 30, 31,
+ 32, 33, 34, 35, 36, -1, -1, 39, -1, -1,
+ -1, -1, -1, -1, -1, -1, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, -1, 58, 59, 60, -1,
+ -1, 63, -1, -1, 66, 67, -1, 69, 70, 71,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 90, -1,
+ -1, 93, 94, -1, 96, 97, -1, 99, -1, -1,
+ 102, -1, 104, 105, 106, 107, 108, 109, -1, -1,
+ 112, -1, -1, -1, -1, -1, -1, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, -1, -1, -1, -1,
+ 132, 133, 134, 19, -1, 21, 22, 23, 24, -1,
+ -1, -1, -1, -1, 30, 31, 32, 33, 34, 35,
+ 36, -1, -1, 39, -1, -1, -1, -1, -1, -1,
+ -1, -1, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, -1, 58, 59, 60, -1, -1, 63, -1, -1,
+ 66, 67, -1, 69, 70, 71, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 90, -1, -1, 93, 94, -1,
+ 96, 97, -1, 99, -1, -1, 102, -1, 104, 105,
+ 106, 107, 108, 109, -1, -1, 112, -1, -1, -1,
+ -1, -1, -1, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, 132, 133, 134, 19,
+ -1, 21, 22, 23, 24, -1, -1, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
+ 60, -1, -1, 63, -1, -1, 66, 67, -1, 69,
+ 70, 71, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 90, -1, -1, 93, 94, -1, 96, 97, -1, 99,
+ -1, -1, 102, -1, 104, 105, 106, 107, 108, 109,
+ -1, -1, 112, -1, -1, -1, -1, -1, -1, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, 132, 133, 134, 19, -1, 21, 22, 23,
+ 24, -1, -1, -1, -1, -1, 30, 31, 32, 33,
+ 34, 35, 36, -1, -1, 39, -1, -1, -1, -1,
+ -1, -1, -1, -1, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, -1, 58, 59, 60, -1, -1, 63,
+ -1, -1, 66, 67, -1, 69, 70, 71, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 90, -1, -1, 93,
+ 94, -1, 96, 97, -1, -1, -1, -1, 102, -1,
+ 104, 105, 106, 107, 108, 109, -1, -1, 112, -1,
+ -1, -1, -1, -1, -1, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, -1, -1, -1, -1, 132, 133,
+ 134, 19, -1, 21, 22, 23, 24, -1, -1, -1,
+ -1, -1, 30, 31, 32, 33, 34, 35, 36, -1,
+ -1, 39, -1, -1, -1, -1, -1, -1, -1, -1,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, -1,
+ 58, 59, 60, -1, -1, 63, -1, -1, 66, 67,
+ -1, 69, 70, 71, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 90, -1, -1, 93, 94, -1, 96, 97,
+ -1, -1, -1, -1, 102, -1, 104, 105, 106, 107,
+ 108, 109, -1, -1, 112, -1, -1, -1, -1, -1,
+ -1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ -1, -1, -1, -1, 132, 133, 134, 19, -1, 21,
+ 22, 23, 24, -1, -1, -1, -1, -1, 30, 31,
+ 32, 33, 34, 35, 36, -1, -1, 39, -1, -1,
+ -1, -1, -1, -1, -1, -1, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, -1, 58, 59, 60, -1,
+ -1, 63, -1, -1, 66, 67, -1, 69, 70, 71,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 90, -1,
+ -1, 93, 94, -1, 96, 97, -1, -1, -1, -1,
+ 102, -1, 104, 105, 106, 107, 108, 109, -1, -1,
+ 112, -1, -1, -1, -1, -1, -1, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, -1, -1, -1, -1,
+ 132, 133, 134, 19, -1, 21, 22, 23, 24, -1,
+ -1, -1, -1, -1, 30, 31, 32, 33, 34, 35,
+ 36, -1, -1, 39, -1, -1, -1, -1, -1, -1,
+ -1, -1, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, -1, 58, 59, 60, -1, -1, 63, -1, -1,
+ 66, 67, -1, 69, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 87, -1, -1, 90, -1, -1, 93, 94, -1,
+ 96, 97, -1, -1, -1, -1, 102, -1, 104, 105,
+ 106, 107, 108, 109, -1, -1, 112, -1, -1, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, -1, -1, -1, 19, 132, 21, 22, 23,
+ 24, -1, -1, -1, -1, -1, 30, 31, 32, 33,
+ 34, 35, 36, -1, -1, 39, -1, -1, -1, -1,
+ -1, -1, -1, -1, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, -1, 58, 59, 60, -1, -1, 63,
+ -1, -1, 66, 67, -1, 69, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 90, -1, -1, 93,
+ 94, -1, 96, 97, -1, 99, -1, -1, 102, -1,
+ 104, 105, 106, 107, 108, 109, -1, -1, 112, -1,
+ -1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ -1, -1, -1, -1, -1, -1, -1, 19, 132, 21,
+ 22, 23, 24, -1, -1, -1, -1, -1, 30, 31,
+ 32, 33, 34, 35, 36, -1, -1, 39, -1, -1,
+ -1, -1, -1, -1, -1, -1, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, -1, 58, 59, 60, -1,
+ -1, 63, -1, -1, 66, 67, -1, 69, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 90, -1,
+ -1, 93, 94, -1, 96, 97, -1, 99, -1, -1,
+ 102, -1, 104, 105, 106, 107, 108, 109, -1, -1,
+ 112, -1, -1, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, -1, -1, -1, 19,
+ 132, 21, 22, 23, 24, -1, -1, -1, -1, -1,
+ 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
+ 60, -1, -1, 63, -1, -1, 66, 67, -1, 69,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 90, -1, -1, 93, 94, -1, 96, 97, -1, -1,
+ -1, -1, 102, -1, 104, 105, 106, 107, 108, 109,
+ -1, -1, 112, -1, -1, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, -1, -1, -1, -1, -1, -1,
+ -1, 19, 132, 21, 22, 23, 24, -1, -1, -1,
+ -1, -1, 30, 31, 32, 33, 34, 35, 36, -1,
+ -1, 39, -1, -1, -1, -1, -1, -1, -1, -1,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, -1,
+ 58, 59, 60, -1, -1, 63, -1, -1, 66, 67,
+ -1, 69, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 90, -1, -1, 93, 94, -1, 96, 97,
+ -1, -1, -1, -1, 102, -1, 104, 105, 106, 107,
+ 108, 109, -1, -1, 112, -1, -1, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, -1, -1, -1, -1,
+ -1, -1, -1, 19, 132, 21, 22, 23, 24, -1,
+ -1, -1, -1, -1, 30, 31, 32, 33, 34, 35,
+ 36, -1, -1, 39, -1, -1, -1, -1, -1, -1,
+ -1, -1, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, -1, 58, 59, 60, -1, -1, 63, -1, -1,
+ 66, 67, -1, 69, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 90, -1, -1, 93, 94, -1,
+ 96, 97, -1, -1, -1, -1, 102, -1, 104, 105,
+ 106, 107, 108, 109, -1, -1, 112, -1, -1, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, -1, -1, -1, 19, 132, 21, 22, 23,
+ 24, -1, -1, -1, -1, -1, 30, 31, 32, 33,
+ 34, 35, 36, -1, -1, 39, -1, -1, -1, -1,
+ -1, -1, -1, -1, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, -1, 58, 59, 60, -1, -1, 63,
+ -1, -1, 66, 67, -1, 69, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 90, -1, -1, 93,
+ 94, -1, 96, 97, -1, 51, 52, -1, 102, 55,
+ 104, 105, 106, 107, 108, 109, -1, -1, 112, -1,
+ -1, -1, -1, -1, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, -1, -1, 81, 82, -1, 132, 85,
+ 86, 87, 88, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 99, 100, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 122, 123, 124, 125,
+ 126, 127, 128, 129, 130, 131, -1, 133, 134, 51,
+ 52, -1, -1, 55, -1, 141, 142, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, -1, -1, 81,
+ 82, -1, -1, 85, 86, 87, 88, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 99, 100, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ -1, 133, 134, 51, 52, -1, -1, 55, -1, 141,
+ 142, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, -1, -1, 81, 82, -1, -1, 85, 86, 87,
+ 88, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 99, 100, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, -1, 133, 134, 51, 52, -1,
+ -1, 55, -1, 141, 142, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, -1, -1, 81, 82, -1,
+ -1, 85, 86, 87, 88, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 99, 100, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 122, 123,
+ 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
+ 134, 51, 52, -1, -1, 55, -1, 141, 142, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, -1,
+ -1, 81, 82, -1, -1, 85, 86, 87, 88, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 99,
+ 100, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 122, 123, 124, 125, 126, 127, 128, 129,
+ 130, 131, -1, 133, 134, 51, 52, -1, -1, 55,
+ -1, 141, 142, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, -1, -1, 81, 82, -1, -1, 85,
+ 86, 87, 88, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 99, 100, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 122, 123, 124, 125,
+ 126, 127, 128, 129, 130, 131, -1, 133, 134, 51,
+ 52, -1, -1, 55, -1, 141, 142, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, -1, -1, 81,
+ 82, -1, -1, 85, 86, 87, 88, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 99, 100, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ -1, 133, 134, 51, 52, -1, -1, 55, -1, 141,
+ 142, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, -1, -1, 81, 82, -1, -1, 85, 86, 87,
+ 88, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 99, 100, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, -1, 133, 134, 51, 52, -1,
+ -1, 55, -1, 141, 142, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, -1, -1, 81, 82, -1,
+ -1, 85, 86, 87, 88, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 99, 100, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 122, 123,
+ 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
+ 134, 51, 52, -1, -1, 55, -1, 141, 142, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, -1,
+ -1, 81, 82, -1, -1, 85, 86, 87, 88, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 99,
+ 100, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 122, 123, 124, 125, 126, 127, 128, 129,
+ 130, 131, -1, 133, 134, 51, 52, -1, -1, 55,
+ -1, 141, 142, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, -1, -1, 81, 82, -1, -1, 85,
+ 86, 87, 88, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 99, 100, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 122, 123, 124, 125,
+ 126, 127, 128, 129, 130, 131, -1, 133, 134, 51,
+ 52, -1, -1, 55, -1, 141, 142, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, -1, -1, 81,
+ 82, -1, -1, 85, 86, 87, 88, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 99, 100, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ -1, 133, 134, 51, 52, -1, -1, 55, -1, 141,
+ 142, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 70, 71, 72, 73, 74, 75, 76, 77,
+ 78, -1, -1, 81, 82, -1, -1, 85, 86, 87,
+ 88, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 99, 100, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, -1, 133, 134, 51, 52, -1,
+ -1, 55, -1, 141, 142, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, -1, -1, 81, 82, -1,
+ -1, 85, 86, 87, 88, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 99, 100, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 122, 123,
+ 124, 125, 126, 127, 128, 129, 130, 131, -1, 133,
+ 134, 51, 52, -1, -1, 55, -1, 141, 142, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, -1,
+ -1, 81, 82, -1, -1, 85, 86, 87, 88, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 99,
+ 100, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 122, 123, 124, 125, 126, 127, 128, 129,
+ 130, 131, -1, 133, 134, 51, 52, -1, -1, 55,
+ -1, 141, 142, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, -1, -1, 81, 82, -1, -1, 85,
+ 86, 87, 88, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 99, 100, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 44, -1,
+ -1, -1, -1, -1, -1, -1, 122, 123, 124, 125,
+ 126, 127, 128, 129, 130, 131, -1, 133, 134, -1,
+ -1, -1, -1, -1, -1, 141, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 81, 82, 83, 84, -1,
+ -1, 87, 88, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, -1, -1, 87, 88,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 120, -1, 122, 123, 124, 125,
+ 126, 127, 128, 129, 130, 131, -1, -1, -1, -1,
+ -1, 120, -1, 122, 123, 124, 125, 126, 127, 128,
+ 129, 130, 131, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, -1, 146, 87, 88,
+ -1, -1, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, -1, -1, 87, 88, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 120, -1, 122, 123, 124, 125, 126, 127, 128,
+ 129, 130, 131, -1, -1, -1, -1, -1, -1, -1,
+ 120, 140, 122, 123, 124, 125, 126, 127, 128, 129,
+ 130, 131, -1, -1, -1, -1, -1, -1, -1, -1,
+ 140, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+ 81, 82, 83, 84, -1, -1, 87, 88, -1, -1,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, -1, -1, 87, 88, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 120,
+ -1, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+ 131, -1, -1, -1, -1, -1, -1, -1, 120, 140,
+ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ -1, -1, -1, -1, -1, -1, -1, -1, 140, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+ 83, 84, -1, -1, 87, 88, -1, -1, -1, 92,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, -1, -1, 87, 88, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 120, -1, 122,
+ 123, 124, 125, 126, 127, 128, 129, 130, 131, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 120, -1,
+ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, -1, -1, 87, 88, 72, 73, 74,
+ 75, 76, 77, 78, 79, -1, 81, 82, -1, -1,
+ -1, -1, 87, 88, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ -1, -1, -1, -1, -1, -1, -1, 122, 123, 124,
+ 125, 126, 127, 128, 129, 130, 131, 72, 73, 74,
+ 75, 76, 77, 78, -1, -1, 81, 82, -1, -1,
+ -1, -1, 87, 88, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 122, 123, 124,
+ 125, 126, 127, 128, 129, 130, 131
+};
+
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_int16 yystos[] =
+{
+ 0, 148, 149, 0, 1, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 19, 21, 22, 23, 24,
+ 30, 31, 32, 33, 34, 35, 36, 39, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 58, 59, 60, 63, 66, 67, 69, 70, 71, 90,
+ 93, 94, 96, 97, 99, 102, 104, 105, 106, 107,
+ 108, 109, 112, 132, 133, 134, 150, 151, 152, 157,
+ 159, 161, 163, 164, 167, 168, 170, 171, 172, 174,
+ 175, 184, 198, 219, 240, 241, 251, 252, 253, 257,
+ 258, 259, 265, 266, 267, 269, 270, 271, 272, 273,
+ 274, 309, 322, 152, 21, 22, 30, 31, 32, 39,
+ 51, 55, 69, 87, 90, 93, 132, 176, 177, 198,
+ 219, 271, 274, 309, 177, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 45,
+ 46, 47, 48, 49, 50, 51, 52, 55, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 81, 82, 85,
+ 86, 87, 88, 99, 100, 122, 123, 124, 125, 126,
+ 127, 128, 129, 130, 131, 133, 134, 141, 142, 178,
+ 182, 183, 273, 303, 199, 90, 161, 162, 175, 219,
+ 271, 272, 274, 162, 205, 207, 69, 90, 168, 175,
+ 219, 224, 271, 274, 33, 34, 35, 36, 48, 49,
+ 50, 51, 55, 104, 178, 179, 180, 267, 113, 116,
+ 117, 144, 146, 162, 261, 262, 263, 315, 319, 320,
+ 321, 51, 99, 100, 101, 133, 167, 184, 190, 193,
+ 196, 253, 306, 308, 190, 190, 142, 187, 188, 191,
+ 192, 322, 187, 191, 142, 316, 320, 179, 153, 136,
+ 184, 219, 184, 55, 1, 93, 155, 156, 157, 169,
+ 170, 322, 200, 202, 185, 196, 306, 322, 184, 305,
+ 306, 322, 90, 140, 174, 219, 271, 274, 203, 53,
+ 54, 56, 63, 108, 178, 268, 62, 64, 65, 114,
+ 115, 254, 255, 63, 254, 63, 254, 63, 254, 61,
+ 254, 58, 59, 163, 184, 184, 315, 321, 40, 41,
+ 42, 43, 44, 37, 38, 28, 238, 119, 140, 93,
+ 99, 171, 119, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, 87, 88, 120, 122,
+ 123, 124, 125, 126, 127, 128, 129, 130, 131, 89,
+ 103, 138, 145, 313, 89, 313, 314, 26, 136, 242,
+ 253, 91, 91, 187, 191, 242, 161, 51, 55, 176,
+ 58, 59, 123, 275, 89, 138, 313, 214, 304, 215,
+ 89, 145, 312, 154, 155, 55, 16, 220, 319, 119,
+ 89, 138, 313, 91, 91, 220, 162, 162, 55, 89,
+ 138, 313, 25, 108, 140, 264, 315, 113, 263, 20,
+ 245, 319, 57, 307, 184, 184, 184, 92, 140, 194,
+ 195, 322, 307, 194, 195, 84, 189, 190, 196, 306,
+ 322, 190, 161, 315, 317, 161, 158, 136, 155, 89,
+ 313, 91, 157, 169, 143, 315, 321, 317, 157, 317,
+ 139, 195, 318, 321, 195, 318, 137, 318, 55, 171,
+ 172, 173, 140, 89, 138, 313, 51, 53, 54, 55,
+ 56, 69, 72, 93, 99, 100, 101, 126, 129, 142,
+ 236, 278, 279, 282, 283, 284, 285, 287, 288, 289,
+ 290, 292, 293, 294, 297, 298, 299, 300, 301, 63,
+ 254, 256, 260, 261, 62, 255, 63, 63, 63, 61,
+ 72, 72, 152, 162, 162, 162, 162, 157, 161, 161,
+ 239, 99, 163, 184, 196, 197, 169, 140, 174, 140,
+ 159, 160, 163, 175, 184, 186, 197, 219, 274, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 51, 52, 55, 182, 187,
+ 310, 311, 189, 51, 52, 55, 182, 187, 310, 51,
+ 55, 310, 244, 243, 160, 184, 186, 160, 186, 98,
+ 165, 212, 276, 211, 51, 55, 176, 310, 189, 310,
+ 154, 161, 216, 217, 15, 13, 247, 322, 155, 16,
+ 51, 55, 189, 51, 55, 155, 27, 221, 319, 221,
+ 51, 55, 189, 51, 55, 209, 181, 155, 245, 184,
+ 196, 15, 260, 184, 184, 316, 99, 184, 193, 306,
+ 184, 308, 317, 143, 315, 195, 195, 317, 143, 179,
+ 150, 137, 186, 317, 157, 201, 306, 171, 173, 51,
+ 55, 189, 51, 55, 57, 119, 291, 287, 204, 184,
+ 140, 302, 322, 51, 140, 302, 140, 286, 184, 140,
+ 286, 51, 140, 286, 51, 63, 155, 261, 184, 184,
+ 80, 124, 230, 231, 322, 184, 195, 317, 173, 140,
+ 44, 119, 44, 89, 138, 313, 316, 91, 91, 187,
+ 191, 139, 91, 91, 188, 191, 188, 191, 230, 230,
+ 166, 319, 162, 154, 139, 15, 317, 142, 277, 287,
+ 178, 184, 197, 248, 322, 18, 223, 322, 17, 222,
+ 223, 91, 91, 139, 91, 91, 223, 206, 208, 139,
+ 162, 179, 137, 15, 195, 220, 260, 184, 194, 306,
+ 137, 317, 318, 139, 51, 99, 225, 292, 233, 316,
+ 29, 111, 237, 51, 279, 284, 301, 285, 290, 297,
+ 299, 292, 294, 299, 51, 292, 137, 227, 229, 232,
+ 278, 280, 281, 284, 292, 293, 295, 296, 299, 301,
+ 154, 99, 184, 173, 157, 184, 51, 55, 189, 51,
+ 55, 57, 121, 160, 186, 163, 186, 165, 91, 160,
+ 186, 160, 186, 165, 242, 238, 154, 155, 230, 213,
+ 319, 15, 84, 287, 154, 319, 218, 92, 249, 322,
+ 155, 14, 250, 322, 162, 15, 91, 15, 155, 155,
+ 221, 184, 155, 195, 140, 289, 317, 140, 143, 144,
+ 154, 155, 302, 140, 286, 140, 286, 140, 286, 140,
+ 286, 286, 233, 233, 90, 219, 140, 302, 302, 140,
+ 228, 219, 140, 228, 140, 228, 15, 184, 139, 184,
+ 184, 160, 186, 15, 137, 155, 154, 317, 317, 15,
+ 277, 90, 175, 219, 271, 274, 220, 155, 220, 15,
+ 15, 210, 223, 245, 246, 226, 140, 99, 51, 234,
+ 235, 288, 15, 137, 292, 299, 292, 292, 124, 124,
+ 55, 89, 280, 284, 140, 227, 228, 296, 299, 292,
+ 295, 299, 292, 137, 15, 154, 55, 89, 138, 313,
+ 155, 155, 155, 292, 292, 140, 289, 140, 316, 286,
+ 140, 286, 286, 286, 51, 55, 302, 140, 228, 140,
+ 228, 140, 228, 140, 228, 228, 15, 51, 55, 189,
+ 51, 55, 247, 222, 15, 140, 292, 140, 235, 292,
+ 292, 299, 292, 292, 139, 292, 286, 228, 140, 228,
+ 228, 228, 292, 228
+};
+
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_int16 yyr1[] =
+{
+ 0, 147, 149, 148, 150, 151, 151, 151, 151, 152,
+ 153, 152, 154, 155, 156, 156, 156, 156, 158, 157,
+ 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
+ 157, 157, 157, 159, 159, 159, 159, 159, 159, 159,
+ 159, 160, 160, 160, 161, 161, 161, 161, 161, 161,
+ 162, 163, 163, 164, 164, 166, 165, 167, 167, 167,
+ 167, 167, 167, 167, 167, 167, 167, 167, 168, 168,
+ 169, 169, 170, 170, 170, 170, 170, 170, 170, 170,
+ 170, 170, 171, 171, 172, 172, 173, 173, 174, 174,
+ 174, 174, 174, 174, 174, 174, 175, 175, 175, 175,
+ 175, 175, 175, 175, 175, 176, 176, 177, 177, 177,
+ 178, 178, 178, 178, 178, 179, 179, 180, 181, 180,
+ 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
+ 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
+ 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
+ 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
+ 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
+ 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
+ 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,
+ 184, 184, 184, 185, 185, 185, 185, 186, 186, 187,
+ 187, 188, 188, 189, 189, 189, 189, 189, 190, 190,
+ 190, 190, 190, 192, 191, 193, 194, 194, 195, 195,
+ 196, 196, 196, 196, 197, 197, 197, 198, 198, 198,
+ 198, 198, 198, 198, 198, 198, 199, 198, 200, 201,
+ 198, 202, 198, 198, 198, 198, 198, 198, 198, 198,
+ 198, 198, 198, 198, 198, 203, 204, 198, 198, 198,
+ 205, 206, 198, 207, 208, 198, 198, 198, 209, 210,
+ 198, 211, 198, 212, 213, 198, 214, 198, 215, 216,
+ 198, 217, 218, 198, 198, 198, 198, 198, 219, 220,
+ 220, 220, 221, 221, 222, 222, 223, 223, 224, 224,
+ 225, 225, 225, 225, 225, 225, 225, 225, 226, 225,
+ 227, 227, 227, 227, 228, 228, 229, 229, 229, 229,
+ 229, 229, 229, 229, 229, 229, 229, 229, 229, 229,
+ 229, 230, 230, 232, 231, 231, 231, 233, 233, 234,
+ 234, 235, 235, 236, 236, 237, 237, 239, 238, 240,
+ 240, 240, 240, 241, 241, 241, 241, 241, 241, 241,
+ 241, 241, 243, 242, 244, 242, 245, 246, 246, 247,
+ 247, 248, 248, 248, 249, 249, 250, 250, 251, 251,
+ 251, 251, 252, 252, 253, 253, 253, 253, 254, 254,
+ 255, 256, 255, 255, 255, 257, 257, 258, 258, 259,
+ 260, 260, 261, 261, 262, 262, 263, 264, 263, 265,
+ 265, 266, 266, 267, 268, 268, 268, 268, 268, 268,
+ 269, 269, 270, 270, 270, 270, 271, 271, 271, 271,
+ 271, 272, 272, 273, 273, 273, 273, 273, 273, 273,
+ 273, 274, 274, 275, 276, 275, 277, 277, 277, 278,
+ 279, 279, 280, 280, 281, 281, 282, 282, 283, 283,
+ 284, 284, 285, 285, 285, 285, 286, 286, 287, 287,
+ 287, 287, 287, 287, 287, 287, 287, 287, 287, 287,
+ 287, 287, 287, 288, 288, 288, 288, 288, 289, 289,
+ 290, 291, 290, 292, 292, 293, 294, 295, 296, 296,
+ 297, 297, 298, 298, 299, 299, 300, 300, 301, 302,
+ 302, 303, 304, 303, 305, 305, 306, 306, 307, 307,
+ 308, 308, 308, 308, 309, 309, 309, 310, 310, 310,
+ 310, 311, 311, 311, 312, 312, 313, 313, 314, 314,
+ 315, 315, 316, 316, 317, 318, 318, 318, 319, 319,
+ 319, 320, 321, 321, 322
+};
+
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_int8 yyr2[] =
+{
+ 0, 2, 0, 2, 2, 1, 1, 3, 2, 1,
+ 0, 5, 4, 2, 1, 1, 3, 2, 0, 4,
+ 2, 3, 3, 3, 3, 3, 4, 1, 3, 3,
+ 3, 3, 1, 3, 3, 6, 5, 5, 5, 5,
+ 3, 1, 3, 1, 1, 3, 3, 3, 2, 1,
+ 1, 1, 1, 1, 4, 0, 5, 2, 3, 4,
+ 5, 4, 5, 2, 2, 2, 2, 2, 1, 3,
+ 1, 3, 1, 2, 3, 5, 2, 4, 2, 4,
+ 1, 3, 1, 3, 2, 3, 1, 2, 1, 4,
+ 3, 3, 3, 3, 2, 1, 1, 4, 3, 3,
+ 3, 3, 2, 1, 1, 1, 1, 2, 1, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 0, 4,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 3, 3, 6, 5, 5, 5, 5, 4, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 4, 4, 2,
+ 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 2, 2, 3, 3, 3, 3,
+ 6, 6, 1, 1, 2, 4, 2, 1, 3, 3,
+ 3, 1, 1, 1, 2, 2, 4, 2, 1, 2,
+ 2, 4, 1, 0, 2, 2, 2, 1, 1, 3,
+ 1, 2, 3, 4, 3, 4, 2, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 0, 4, 0, 0,
+ 5, 0, 3, 3, 3, 2, 3, 3, 1, 2,
+ 4, 3, 2, 1, 2, 0, 0, 5, 6, 6,
+ 0, 0, 7, 0, 0, 7, 5, 4, 0, 0,
+ 9, 0, 6, 0, 0, 8, 0, 5, 0, 0,
+ 7, 0, 0, 9, 1, 1, 1, 1, 1, 1,
+ 1, 2, 1, 1, 1, 5, 1, 2, 1, 1,
+ 1, 4, 6, 3, 5, 2, 4, 1, 0, 4,
+ 4, 2, 2, 1, 2, 0, 6, 8, 4, 6,
+ 4, 3, 6, 2, 4, 6, 2, 4, 2, 4,
+ 1, 1, 1, 0, 4, 1, 4, 1, 4, 1,
+ 3, 1, 1, 4, 1, 3, 3, 0, 5, 2,
+ 4, 5, 5, 2, 4, 4, 3, 3, 3, 2,
+ 1, 4, 0, 5, 0, 5, 5, 1, 1, 6,
+ 1, 1, 1, 1, 2, 1, 2, 1, 1, 1,
+ 1, 1, 1, 2, 1, 1, 2, 3, 1, 2,
+ 1, 0, 4, 1, 2, 2, 3, 2, 3, 1,
+ 1, 2, 1, 2, 1, 2, 1, 0, 4, 2,
+ 3, 1, 4, 2, 1, 1, 1, 1, 1, 2,
+ 2, 3, 1, 1, 2, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 4, 3, 3, 2, 2,
+ 2, 1, 2, 1, 1, 3, 1, 3, 1, 1,
+ 2, 1, 4, 2, 2, 1, 2, 0, 6, 8,
+ 4, 6, 4, 6, 2, 4, 6, 2, 4, 2,
+ 4, 1, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 4, 1, 3, 2, 2, 2, 1, 3,
+ 1, 3, 1, 1, 2, 1, 1, 1, 2, 2,
+ 1, 1, 0, 4, 1, 2, 1, 3, 1, 2,
+ 3, 3, 3, 2, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 0, 1, 2, 0, 1, 1, 1, 1,
+ 1, 1, 1, 2, 0
+};
+
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+ do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (p, YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (0)
+
+/* Error token number */
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
+
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
+
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, p); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+
+/*-----------------------------------.
+| Print this symbol's value on YYO. |
+`-----------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_state *p)
+{
+ FILE *yyoutput = yyo;
+ YYUSE (yyoutput);
+ YYUSE (p);
+ if (!yyvaluep)
+ return;
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
+# endif
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+/*---------------------------.
+| Print this symbol on YYO. |
+`---------------------------*/
+
+static void
+yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_state *p)
+{
+ YYFPRINTF (yyo, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+
+ yy_symbol_value_print (yyo, yytype, yyvaluep, p);
+ YYFPRINTF (yyo, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+static void
+yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+static void
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule, parser_state *p)
+{
+ int yylno = yyrline[yyrule];
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
+ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr,
+ yystos[+yyssp[yyi + 1 - yynrhs]],
+ &yyvsp[(yyi + 1) - (yynrhs)]
+ , p);
+ YYFPRINTF (stderr, "\n");
+ }
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, Rule, p); \
+} while (0)
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
+# else
+/* Return the length of YYSTR. */
+static YYPTRDIFF_T
+yystrlen (const char *yystr)
+{
+ YYPTRDIFF_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+{
+ char *yyd = yydest;
+ const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYPTRDIFF_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYPTRDIFF_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ else
+ goto append;
+
+ append:
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (yyres)
+ return yystpcpy (yyres, yystr) - yyres;
+ else
+ return yystrlen (yystr);
+}
+# endif
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
+
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
+ yy_state_t *yyssp, int yytoken)
+{
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = YY_NULLPTR;
+ /* Arguments of yyformat: reported tokens (one for the "unexpected",
+ one per "expected"). */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Actual size of YYARG. */
+ int yycount = 0;
+ /* Cumulated lengths of YYARG. */
+ YYPTRDIFF_T yysize = 0;
+
+ /* There are many possibilities here to consider:
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
+ {
+ int yyn = yypact[+*yyssp];
+ YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ yysize = yysize0;
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ {
+ YYPTRDIFF_T yysize1
+ = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
+ return 2;
+ }
+ }
+ }
+ }
+
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ default: /* Avoid compiler warnings. */
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
+
+ {
+ /* Don't count the "%s"s in the final size, but reserve room for
+ the terminator. */
+ YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
+ if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+ yysize = yysize1;
+ else
+ return 2;
+ }
+
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ ++yyp;
+ ++yyformat;
+ }
+ }
+ return 0;
+}
+#endif /* YYERROR_VERBOSE */
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, parser_state *p)
+{
+ YYUSE (yyvaluep);
+ YYUSE (p);
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YYUSE (yytype);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+int
+yyparse (parser_state *p)
+{
+/* The lookahead symbol. */
+int yychar;
+
+
+/* The semantic value of the lookahead symbol. */
+/* Default value used for initialization, for pacifying older GCCs
+ or non-GCC compilers. */
+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
+
+ /* Number of syntax errors so far. */
+ int yynerrs;
+
+ yy_state_fast_t yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+
+ /* The stacks and their tools:
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
+
+ Refer to the stacks through separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yy_state_t yyssa[YYINITDEPTH];
+ yy_state_t *yyss;
+ yy_state_t *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
+
+ YYPTRDIFF_T yystacksize;
+
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken = 0;
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+ goto yysetstate;
+
+
+/*------------------------------------------------------------.
+| yynewstate -- push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
+
+
+/*--------------------------------------------------------------------.
+| yysetstate -- set current state (the top of the stack) to yystate. |
+`--------------------------------------------------------------------*/
+yysetstate:
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+ YY_IGNORE_USELESS_CAST_BEGIN
+ *yyssp = YY_CAST (yy_state_t, yystate);
+ YY_IGNORE_USELESS_CAST_END
+
+ if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+#else
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYPTRDIFF_T yysize = yyssp - yyss + 1;
+
+# if defined yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ yy_state_t *yyss1 = yyss;
+ YYSTYPE *yyvs1 = yyvs;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * YYSIZEOF (*yyssp),
+ &yyvs1, yysize * YYSIZEOF (*yyvsp),
+ &yystacksize);
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+# else /* defined YYSTACK_RELOCATE */
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yy_state_t *yyss1 = yyss;
+ union yyalloc *yyptr =
+ YY_CAST (union yyalloc *,
+ YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+
+ YY_IGNORE_USELESS_CAST_BEGIN
+ YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+ YY_CAST (long, yystacksize)));
+ YY_IGNORE_USELESS_CAST_END
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
+
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
+ goto yybackup;
+
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+ /* Do appropriate processing given the current state. Read a
+ lookahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to lookahead token. */
+ yyn = yypact[yystate];
+ if (yypact_value_is_default (yyn))
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = yylex (&yylval, p);
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the lookahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+ yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ '$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 2:
+#line 1508 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->lstate = EXPR_BEG;
+ if (!p->locals) p->locals = cons(0,0);
+ }
+#line 5675 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 3:
+#line 1513 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->tree = new_scope(p, (yyvsp[0].nd));
+ NODE_LINENO(p->tree, (yyvsp[0].nd));
+ }
+#line 5684 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 4:
+#line 1520 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 5692 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 5:
+#line 1526 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_begin(p, 0);
+ }
+#line 5700 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 6:
+#line 1530 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_begin(p, (yyvsp[0].nd));
+ NODE_LINENO((yyval.nd), (yyvsp[0].nd));
+ }
+#line 5709 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 7:
+#line 1535 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-2].nd), newline_node((yyvsp[0].nd)));
+ }
+#line 5717 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 8:
+#line 1539 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_begin(p, 0);
+ }
+#line 5725 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 10:
+#line 1546 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = local_switch(p);
+ nvars_block(p);
+ }
+#line 5734 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 11:
+#line 1551 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "BEGIN not supported");
+ local_resume(p, (yyvsp[-3].nd));
+ nvars_unnest(p);
+ (yyval.nd) = 0;
+ }
+#line 5745 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 12:
+#line 1563 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if ((yyvsp[-2].nd)) {
+ (yyval.nd) = new_rescue(p, (yyvsp[-3].nd), (yyvsp[-2].nd), (yyvsp[-1].nd));
+ NODE_LINENO((yyval.nd), (yyvsp[-3].nd));
+ }
+ else if ((yyvsp[-1].nd)) {
+ yywarn(p, "else without rescue is useless");
+ (yyval.nd) = push((yyvsp[-3].nd), (yyvsp[-1].nd));
+ }
+ else {
+ (yyval.nd) = (yyvsp[-3].nd);
+ }
+ if ((yyvsp[0].nd)) {
+ if ((yyval.nd)) {
+ (yyval.nd) = new_ensure(p, (yyval.nd), (yyvsp[0].nd));
+ }
+ else {
+ (yyval.nd) = push((yyvsp[0].nd), new_nil(p));
+ }
+ }
+ }
+#line 5771 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 13:
+#line 1587 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 5779 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 14:
+#line 1593 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_begin(p, 0);
+ }
+#line 5787 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 15:
+#line 1597 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_begin(p, (yyvsp[0].nd));
+ NODE_LINENO((yyval.nd), (yyvsp[0].nd));
+ }
+#line 5796 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 16:
+#line 1602 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-2].nd), newline_node((yyvsp[0].nd)));
+ }
+#line 5804 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 17:
+#line 1606 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_begin(p, (yyvsp[0].nd));
+ }
+#line 5812 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 18:
+#line 1611 "mrbgems/mruby-compiler/core/parse.y"
+ {p->lstate = EXPR_FNAME;}
+#line 5818 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 19:
+#line 1612 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_alias(p, (yyvsp[-2].id), (yyvsp[0].id));
+ }
+#line 5826 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 20:
+#line 1616 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 5834 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 21:
+#line 1620 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_if(p, cond((yyvsp[0].nd)), (yyvsp[-2].nd), 0);
+ }
+#line 5842 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 22:
+#line 1624 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_unless(p, cond((yyvsp[0].nd)), (yyvsp[-2].nd), 0);
+ }
+#line 5850 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 23:
+#line 1628 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_while(p, cond((yyvsp[0].nd)), (yyvsp[-2].nd));
+ }
+#line 5858 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 24:
+#line 1632 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_until(p, cond((yyvsp[0].nd)), (yyvsp[-2].nd));
+ }
+#line 5866 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 25:
+#line 1636 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_mod_rescue(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 5874 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 26:
+#line 1640 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "END not supported");
+ (yyval.nd) = new_postexe(p, (yyvsp[-1].nd));
+ }
+#line 5883 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 28:
+#line 1646 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_masgn(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 5891 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 29:
+#line 1650 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_asgn(p, (yyvsp[-2].nd), new_array(p, (yyvsp[0].nd)));
+ }
+#line 5899 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 30:
+#line 1654 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_masgn(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 5907 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 31:
+#line 1658 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_masgn(p, (yyvsp[-2].nd), new_array(p, (yyvsp[0].nd)));
+ }
+#line 5915 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 33:
+#line 1665 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_asgn(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 5923 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 34:
+#line 1669 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_op_asgn(p, (yyvsp[-2].nd), (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 5931 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 35:
+#line 1673 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-5].nd), intern_lit("[]"), (yyvsp[-3].nd), '.'), (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 5939 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 36:
+#line 1677 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, (yyvsp[-3].num)), (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 5947 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 37:
+#line 1681 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, (yyvsp[-3].num)), (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 5955 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 38:
+#line 1685 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "constant re-assignment");
+ (yyval.nd) = 0;
+ }
+#line 5964 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 39:
+#line 1690 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, tCOLON2), (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 5972 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 40:
+#line 1694 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ backref_error(p, (yyvsp[-2].nd));
+ (yyval.nd) = new_begin(p, 0);
+ }
+#line 5981 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 42:
+#line 1702 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_mod_rescue(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 5989 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 45:
+#line 1711 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_and(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 5997 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 46:
+#line 1715 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_or(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 6005 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 47:
+#line 1719 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_uni_op(p, cond((yyvsp[0].nd)), "!");
+ }
+#line 6013 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 48:
+#line 1723 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_uni_op(p, cond((yyvsp[0].nd)), "!");
+ }
+#line 6021 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 50:
+#line 1730 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if (!(yyvsp[0].nd)) (yyval.nd) = new_nil(p);
+ else {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+ }
+#line 6032 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 54:
+#line 1744 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), (yyvsp[-2].num));
+ }
+#line 6040 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 55:
+#line 1750 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_nest(p);
+ nvars_nest(p);
+ }
+#line 6049 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 56:
+#line 1757 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_block(p, (yyvsp[-2].nd), (yyvsp[-1].nd));
+ local_unnest(p);
+ nvars_unnest(p);
+ }
+#line 6059 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 57:
+#line 1765 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_fcall(p, (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 6067 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 58:
+#line 1769 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ args_with_block(p, (yyvsp[-1].nd), (yyvsp[0].nd));
+ (yyval.nd) = new_fcall(p, (yyvsp[-2].id), (yyvsp[-1].nd));
+ }
+#line 6076 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 59:
+#line 1774 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), (yyvsp[-2].num));
+ }
+#line 6084 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 60:
+#line 1778 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ args_with_block(p, (yyvsp[-1].nd), (yyvsp[0].nd));
+ (yyval.nd) = new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), (yyvsp[-1].nd), (yyvsp[-3].num));
+ }
+#line 6093 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 61:
+#line 1783 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), tCOLON2);
+ }
+#line 6101 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 62:
+#line 1787 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ args_with_block(p, (yyvsp[-1].nd), (yyvsp[0].nd));
+ (yyval.nd) = new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), (yyvsp[-1].nd), tCOLON2);
+ }
+#line 6110 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 63:
+#line 1792 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_super(p, (yyvsp[0].nd));
+ }
+#line 6118 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 64:
+#line 1796 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_yield(p, (yyvsp[0].nd));
+ }
+#line 6126 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 65:
+#line 1800 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_return(p, ret_args(p, (yyvsp[0].nd)));
+ }
+#line 6134 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 66:
+#line 1804 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_break(p, ret_args(p, (yyvsp[0].nd)));
+ }
+#line 6142 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 67:
+#line 1808 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_next(p, ret_args(p, (yyvsp[0].nd)));
+ }
+#line 6150 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 68:
+#line 1814 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 6158 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 69:
+#line 1818 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 6166 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 71:
+#line 1825 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 6174 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 72:
+#line 1831 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[0].nd));
+ }
+#line 6182 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 73:
+#line 1835 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1(push((yyvsp[-1].nd),(yyvsp[0].nd)));
+ }
+#line 6190 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 74:
+#line 1839 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list2((yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 6198 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 75:
+#line 1843 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3((yyvsp[-4].nd), (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 6206 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 76:
+#line 1847 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list2((yyvsp[-1].nd), new_nil(p));
+ }
+#line 6214 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 77:
+#line 1851 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3((yyvsp[-3].nd), new_nil(p), (yyvsp[0].nd));
+ }
+#line 6222 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 78:
+#line 1855 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list2(0, (yyvsp[0].nd));
+ }
+#line 6230 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 79:
+#line 1859 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3(0, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 6238 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 80:
+#line 1863 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list2(0, new_nil(p));
+ }
+#line 6246 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 81:
+#line 1867 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3(0, new_nil(p), (yyvsp[0].nd));
+ }
+#line 6254 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 83:
+#line 1874 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_masgn(p, (yyvsp[-1].nd), NULL);
+ }
+#line 6262 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 84:
+#line 1880 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[-1].nd));
+ }
+#line 6270 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 85:
+#line 1884 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[-1].nd));
+ }
+#line 6278 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 86:
+#line 1890 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[0].nd));
+ }
+#line 6286 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 87:
+#line 1894 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 6294 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 88:
+#line 1900 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ assignable(p, (yyvsp[0].nd));
+ }
+#line 6302 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 89:
+#line 1904 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-3].nd), intern_lit("[]"), (yyvsp[-1].nd), '.');
+ }
+#line 6310 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 90:
+#line 1908 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, (yyvsp[-1].num));
+ }
+#line 6318 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 91:
+#line 1912 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, tCOLON2);
+ }
+#line 6326 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 92:
+#line 1916 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, (yyvsp[-1].num));
+ }
+#line 6334 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 93:
+#line 1920 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if (p->in_def || p->in_single)
+ yyerror(p, "dynamic constant assignment");
+ (yyval.nd) = new_colon2(p, (yyvsp[-2].nd), (yyvsp[0].id));
+ }
+#line 6344 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 94:
+#line 1926 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if (p->in_def || p->in_single)
+ yyerror(p, "dynamic constant assignment");
+ (yyval.nd) = new_colon3(p, (yyvsp[0].id));
+ }
+#line 6354 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 95:
+#line 1932 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ backref_error(p, (yyvsp[0].nd));
+ (yyval.nd) = 0;
+ }
+#line 6363 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 96:
+#line 1939 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ assignable(p, (yyvsp[0].nd));
+ }
+#line 6371 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 97:
+#line 1943 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-3].nd), intern_lit("[]"), (yyvsp[-1].nd), '.');
+ }
+#line 6379 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 98:
+#line 1947 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, (yyvsp[-1].num));
+ }
+#line 6387 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 99:
+#line 1951 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, tCOLON2);
+ }
+#line 6395 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 100:
+#line 1955 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, (yyvsp[-1].num));
+ }
+#line 6403 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 101:
+#line 1959 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if (p->in_def || p->in_single)
+ yyerror(p, "dynamic constant assignment");
+ (yyval.nd) = new_colon2(p, (yyvsp[-2].nd), (yyvsp[0].id));
+ }
+#line 6413 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 102:
+#line 1965 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if (p->in_def || p->in_single)
+ yyerror(p, "dynamic constant assignment");
+ (yyval.nd) = new_colon3(p, (yyvsp[0].id));
+ }
+#line 6423 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 103:
+#line 1971 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ backref_error(p, (yyvsp[0].nd));
+ (yyval.nd) = 0;
+ }
+#line 6432 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 104:
+#line 1976 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "can't assign to numbered parameter");
+ }
+#line 6440 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 105:
+#line 1982 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "class/module name must be CONSTANT");
+ }
+#line 6448 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 107:
+#line 1989 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons((node*)1, nsym((yyvsp[0].id)));
+ }
+#line 6456 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 108:
+#line 1993 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons((node*)0, nsym((yyvsp[0].id)));
+ }
+#line 6464 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 109:
+#line 1997 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[-2].nd));
+ (yyval.nd) = cons((yyvsp[-2].nd), nsym((yyvsp[0].id)));
+ }
+#line 6473 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 113:
+#line 2007 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->lstate = EXPR_ENDFN;
+ (yyval.id) = (yyvsp[0].id);
+ }
+#line 6482 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 114:
+#line 2012 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->lstate = EXPR_ENDFN;
+ (yyval.id) = (yyvsp[0].id);
+ }
+#line 6491 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 117:
+#line 2023 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_undef(p, (yyvsp[0].id));
+ }
+#line 6499 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 118:
+#line 2026 "mrbgems/mruby-compiler/core/parse.y"
+ {p->lstate = EXPR_FNAME;}
+#line 6505 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 119:
+#line 2027 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-3].nd), nsym((yyvsp[0].id)));
+ }
+#line 6513 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 120:
+#line 2032 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("|"); }
+#line 6519 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 121:
+#line 2033 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("^"); }
+#line 6525 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 122:
+#line 2034 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("&"); }
+#line 6531 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 123:
+#line 2035 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("<=>"); }
+#line 6537 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 124:
+#line 2036 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("=="); }
+#line 6543 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 125:
+#line 2037 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("==="); }
+#line 6549 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 126:
+#line 2038 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("=~"); }
+#line 6555 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 127:
+#line 2039 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("!~"); }
+#line 6561 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 128:
+#line 2040 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit(">"); }
+#line 6567 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 129:
+#line 2041 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit(">="); }
+#line 6573 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 130:
+#line 2042 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("<"); }
+#line 6579 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 131:
+#line 2043 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("<="); }
+#line 6585 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 132:
+#line 2044 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("!="); }
+#line 6591 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 133:
+#line 2045 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("<<"); }
+#line 6597 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 134:
+#line 2046 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit(">>"); }
+#line 6603 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 135:
+#line 2047 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("+"); }
+#line 6609 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 136:
+#line 2048 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("-"); }
+#line 6615 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 137:
+#line 2049 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("*"); }
+#line 6621 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 138:
+#line 2050 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("*"); }
+#line 6627 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 139:
+#line 2051 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("/"); }
+#line 6633 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 140:
+#line 2052 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("%"); }
+#line 6639 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 141:
+#line 2053 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("**"); }
+#line 6645 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 142:
+#line 2054 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("**"); }
+#line 6651 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 143:
+#line 2055 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("!"); }
+#line 6657 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 144:
+#line 2056 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("~"); }
+#line 6663 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 145:
+#line 2057 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("+@"); }
+#line 6669 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 146:
+#line 2058 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("-@"); }
+#line 6675 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 147:
+#line 2059 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("[]"); }
+#line 6681 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 148:
+#line 2060 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("[]="); }
+#line 6687 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 149:
+#line 2061 "mrbgems/mruby-compiler/core/parse.y"
+ { (yyval.id) = intern_lit("`"); }
+#line 6693 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 190:
+#line 2079 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_asgn(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 6701 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 191:
+#line 2083 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_op_asgn(p, (yyvsp[-2].nd), (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 6709 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 192:
+#line 2087 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-5].nd), intern_lit("[]"), (yyvsp[-3].nd), '.'), (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 6717 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 193:
+#line 2091 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, (yyvsp[-3].num)), (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 6725 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 194:
+#line 2095 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, (yyvsp[-3].num)), (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 6733 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 195:
+#line 2099 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, tCOLON2), (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 6741 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 196:
+#line 2103 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "constant re-assignment");
+ (yyval.nd) = new_begin(p, 0);
+ }
+#line 6750 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 197:
+#line 2108 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "constant re-assignment");
+ (yyval.nd) = new_begin(p, 0);
+ }
+#line 6759 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 198:
+#line 2113 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ backref_error(p, (yyvsp[-2].nd));
+ (yyval.nd) = new_begin(p, 0);
+ }
+#line 6768 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 199:
+#line 2118 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_dot2(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 6776 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 200:
+#line 2122 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_dot3(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 6784 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 201:
+#line 2126 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "+", (yyvsp[0].nd));
+ }
+#line 6792 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 202:
+#line 2130 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "-", (yyvsp[0].nd));
+ }
+#line 6800 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 203:
+#line 2134 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "*", (yyvsp[0].nd));
+ }
+#line 6808 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 204:
+#line 2138 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "/", (yyvsp[0].nd));
+ }
+#line 6816 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 205:
+#line 2142 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "%", (yyvsp[0].nd));
+ }
+#line 6824 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 206:
+#line 2146 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "**", (yyvsp[0].nd));
+ }
+#line 6832 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 207:
+#line 2150 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_uni_op(p, call_bin_op(p, (yyvsp[-2].nd), "**", (yyvsp[0].nd)), "-@");
+ }
+#line 6840 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 208:
+#line 2154 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_uni_op(p, call_bin_op(p, (yyvsp[-2].nd), "**", (yyvsp[0].nd)), "-@");
+ }
+#line 6848 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 209:
+#line 2158 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_uni_op(p, (yyvsp[0].nd), "+@");
+ }
+#line 6856 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 210:
+#line 2162 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_uni_op(p, (yyvsp[0].nd), "-@");
+ }
+#line 6864 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 211:
+#line 2166 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "|", (yyvsp[0].nd));
+ }
+#line 6872 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 212:
+#line 2170 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "^", (yyvsp[0].nd));
+ }
+#line 6880 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 213:
+#line 2174 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "&", (yyvsp[0].nd));
+ }
+#line 6888 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 214:
+#line 2178 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "<=>", (yyvsp[0].nd));
+ }
+#line 6896 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 215:
+#line 2182 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), ">", (yyvsp[0].nd));
+ }
+#line 6904 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 216:
+#line 2186 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), ">=", (yyvsp[0].nd));
+ }
+#line 6912 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 217:
+#line 2190 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "<", (yyvsp[0].nd));
+ }
+#line 6920 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 218:
+#line 2194 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "<=", (yyvsp[0].nd));
+ }
+#line 6928 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 219:
+#line 2198 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "==", (yyvsp[0].nd));
+ }
+#line 6936 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 220:
+#line 2202 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "===", (yyvsp[0].nd));
+ }
+#line 6944 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 221:
+#line 2206 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "!=", (yyvsp[0].nd));
+ }
+#line 6952 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 222:
+#line 2210 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "=~", (yyvsp[0].nd));
+ }
+#line 6960 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 223:
+#line 2214 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "!~", (yyvsp[0].nd));
+ }
+#line 6968 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 224:
+#line 2218 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_uni_op(p, cond((yyvsp[0].nd)), "!");
+ }
+#line 6976 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 225:
+#line 2222 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_uni_op(p, cond((yyvsp[0].nd)), "~");
+ }
+#line 6984 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 226:
+#line 2226 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "<<", (yyvsp[0].nd));
+ }
+#line 6992 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 227:
+#line 2230 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), ">>", (yyvsp[0].nd));
+ }
+#line 7000 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 228:
+#line 2234 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_and(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 7008 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 229:
+#line 2238 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_or(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 7016 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 230:
+#line 2242 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_if(p, cond((yyvsp[-5].nd)), (yyvsp[-3].nd), (yyvsp[0].nd));
+ }
+#line 7024 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 231:
+#line 2246 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_if(p, cond((yyvsp[-5].nd)), (yyvsp[-3].nd), (yyvsp[0].nd));
+ }
+#line 7032 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 232:
+#line 2250 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 7040 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 234:
+#line 2257 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ NODE_LINENO((yyval.nd), (yyvsp[-1].nd));
+ }
+#line 7049 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 235:
+#line 2262 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-3].nd), new_kw_hash(p, (yyvsp[-1].nd)));
+ }
+#line 7057 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 236:
+#line 2266 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons(new_kw_hash(p, (yyvsp[-1].nd)), 0);
+ NODE_LINENO((yyval.nd), (yyvsp[-1].nd));
+ }
+#line 7066 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 237:
+#line 2273 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 7074 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 238:
+#line 2277 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[-2].nd));
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = new_mod_rescue(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 7084 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 239:
+#line 2285 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 7092 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 240:
+#line 2289 "mrbgems/mruby-compiler/core/parse.y"
+ {
+#if 1
+ mrb_sym r = mrb_intern_lit(p->mrb, "*");
+ mrb_sym b = mrb_intern_lit(p->mrb, "&");
+ if (local_var_p(p, r) && local_var_p(p, b)) {
+ (yyval.nd) = cons(list1(new_splat(p, new_lvar(p, r))),
+ new_block_arg(p, new_lvar(p, b)));
+ }
+#else
+ mrb_sym r = mrb_intern_lit(p->mrb, "*");
+ mrb_sym k = mrb_intern_lit(p->mrb, "**");
+ mrb_sym b = mrb_intern_lit(p->mrb, "&");
+ if (local_var_p(p, r) && local_var_p(p, k) && local_var_p(p, b)) {
+ (yyval.nd) = cons(list2(new_splat(p, new_lvar(p, r)),
+ new_kw_hash(p, list1(cons(new_kw_rest_args(p, 0), new_lvar(p, k))))),
+ new_block_arg(p, new_lvar(p, b)));
+ }
+#endif
+ else {
+ yyerror(p, "unexpected argument forwarding ...");
+ (yyval.nd) = 0;
+ }
+ }
+#line 7120 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 245:
+#line 2321 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons((yyvsp[-1].nd),0);
+ NODE_LINENO((yyval.nd), (yyvsp[-1].nd));
+ }
+#line 7129 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 246:
+#line 2326 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons(push((yyvsp[-3].nd), new_kw_hash(p, (yyvsp[-1].nd))), 0);
+ NODE_LINENO((yyval.nd), (yyvsp[-3].nd));
+ }
+#line 7138 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 247:
+#line 2331 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons(list1(new_kw_hash(p, (yyvsp[-1].nd))), 0);
+ NODE_LINENO((yyval.nd), (yyvsp[-1].nd));
+ }
+#line 7147 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 248:
+#line 2338 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = cons(list1((yyvsp[0].nd)), 0);
+ NODE_LINENO((yyval.nd), (yyvsp[0].nd));
+ }
+#line 7157 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 249:
+#line 2344 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons((yyvsp[-1].nd), (yyvsp[0].nd));
+ NODE_LINENO((yyval.nd), (yyvsp[-1].nd));
+ }
+#line 7166 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 250:
+#line 2349 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons(list1(new_kw_hash(p, (yyvsp[-1].nd))), (yyvsp[0].nd));
+ NODE_LINENO((yyval.nd), (yyvsp[-1].nd));
+ }
+#line 7175 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 251:
+#line 2354 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons(push((yyvsp[-3].nd), new_kw_hash(p, (yyvsp[-1].nd))), (yyvsp[0].nd));
+ NODE_LINENO((yyval.nd), (yyvsp[-3].nd));
+ }
+#line 7184 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 252:
+#line 2359 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons(0, (yyvsp[0].nd));
+ NODE_LINENO((yyval.nd), (yyvsp[0].nd));
+ }
+#line 7193 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 253:
+#line 2365 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.stack) = p->cmdarg_stack;
+ CMDARG_PUSH(1);
+ }
+#line 7202 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 254:
+#line 2370 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->cmdarg_stack = (yyvsp[-1].stack);
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 7211 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 255:
+#line 2377 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_block_arg(p, (yyvsp[0].nd));
+ }
+#line 7219 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 256:
+#line 2383 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 7227 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 257:
+#line 2387 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = 0;
+ }
+#line 7235 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 260:
+#line 2397 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = cons((yyvsp[0].nd), 0);
+ NODE_LINENO((yyval.nd), (yyvsp[0].nd));
+ }
+#line 7245 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 261:
+#line 2403 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = cons(new_splat(p, (yyvsp[0].nd)), 0);
+ NODE_LINENO((yyval.nd), (yyvsp[0].nd));
+ }
+#line 7255 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 262:
+#line 2409 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 7264 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 263:
+#line 2414 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = push((yyvsp[-3].nd), new_splat(p, (yyvsp[0].nd)));
+ }
+#line 7273 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 264:
+#line 2421 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 7282 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 265:
+#line 2426 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = push((yyvsp[-3].nd), new_splat(p, (yyvsp[0].nd)));
+ }
+#line 7291 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 266:
+#line 2431 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = list1(new_splat(p, (yyvsp[0].nd)));
+ }
+#line 7300 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 274:
+#line 2445 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_nvar(p, (yyvsp[0].num));
+ }
+#line 7308 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 275:
+#line 2449 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_fcall(p, (yyvsp[0].id), 0);
+ }
+#line 7316 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 276:
+#line 2453 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.stack) = p->cmdarg_stack;
+ p->cmdarg_stack = 0;
+ }
+#line 7325 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 277:
+#line 2459 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->cmdarg_stack = (yyvsp[-2].stack);
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 7334 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 278:
+#line 2464 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.stack) = p->cmdarg_stack;
+ p->cmdarg_stack = 0;
+ }
+#line 7343 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 279:
+#line 2468 "mrbgems/mruby-compiler/core/parse.y"
+ {p->lstate = EXPR_ENDARG;}
+#line 7349 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 280:
+#line 2469 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->cmdarg_stack = (yyvsp[-3].stack);
+ (yyval.nd) = (yyvsp[-2].nd);
+ }
+#line 7358 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 281:
+#line 2473 "mrbgems/mruby-compiler/core/parse.y"
+ {p->lstate = EXPR_ENDARG;}
+#line 7364 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 282:
+#line 2474 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_nil(p);
+ }
+#line 7372 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 283:
+#line 2478 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 7380 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 284:
+#line 2482 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_colon2(p, (yyvsp[-2].nd), (yyvsp[0].id));
+ }
+#line 7388 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 285:
+#line 2486 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_colon3(p, (yyvsp[0].id));
+ }
+#line 7396 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 286:
+#line 2490 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_array(p, (yyvsp[-1].nd));
+ NODE_LINENO((yyval.nd), (yyvsp[-1].nd));
+ }
+#line 7405 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 287:
+#line 2495 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_hash(p, (yyvsp[-1].nd));
+ NODE_LINENO((yyval.nd), (yyvsp[-1].nd));
+ }
+#line 7414 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 288:
+#line 2500 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_return(p, 0);
+ }
+#line 7422 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 289:
+#line 2504 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_yield(p, (yyvsp[0].nd));
+ }
+#line 7430 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 290:
+#line 2508 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_uni_op(p, cond((yyvsp[-1].nd)), "!");
+ }
+#line 7438 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 291:
+#line 2512 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = call_uni_op(p, new_nil(p), "!");
+ }
+#line 7446 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 292:
+#line 2516 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_fcall(p, (yyvsp[-1].id), cons(0, (yyvsp[0].nd)));
+ }
+#line 7454 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 294:
+#line 2521 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ call_with_block(p, (yyvsp[-1].nd), (yyvsp[0].nd));
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 7463 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 295:
+#line 2526 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_nest(p);
+ (yyval.num) = p->lpar_beg;
+ p->lpar_beg = ++p->paren_nest;
+ }
+#line 7473 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 296:
+#line 2532 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.stack) = p->cmdarg_stack;
+ p->cmdarg_stack = 0;
+ }
+#line 7482 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 297:
+#line 2537 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->lpar_beg = (yyvsp[-3].num);
+ (yyval.nd) = new_lambda(p, (yyvsp[-2].nd), (yyvsp[0].nd));
+ local_unnest(p);
+ p->cmdarg_stack = (yyvsp[-1].stack);
+ CMDARG_LEXPOP();
+ }
+#line 7494 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 298:
+#line 2548 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_if(p, cond((yyvsp[-4].nd)), (yyvsp[-2].nd), (yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-5].num));
+ }
+#line 7503 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 299:
+#line 2556 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_unless(p, cond((yyvsp[-4].nd)), (yyvsp[-2].nd), (yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-5].num));
+ }
+#line 7512 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 300:
+#line 2560 "mrbgems/mruby-compiler/core/parse.y"
+ {COND_PUSH(1);}
+#line 7518 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 301:
+#line 2560 "mrbgems/mruby-compiler/core/parse.y"
+ {COND_POP();}
+#line 7524 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 302:
+#line 2563 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_while(p, cond((yyvsp[-4].nd)), (yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-6].num));
+ }
+#line 7533 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 303:
+#line 2567 "mrbgems/mruby-compiler/core/parse.y"
+ {COND_PUSH(1);}
+#line 7539 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 304:
+#line 2567 "mrbgems/mruby-compiler/core/parse.y"
+ {COND_POP();}
+#line 7545 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 305:
+#line 2570 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_until(p, cond((yyvsp[-4].nd)), (yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-6].num));
+ }
+#line 7554 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 306:
+#line 2577 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_case(p, (yyvsp[-3].nd), (yyvsp[-1].nd));
+ }
+#line 7562 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 307:
+#line 2581 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_case(p, 0, (yyvsp[-1].nd));
+ }
+#line 7570 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 308:
+#line 2585 "mrbgems/mruby-compiler/core/parse.y"
+ {COND_PUSH(1);}
+#line 7576 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 309:
+#line 2587 "mrbgems/mruby-compiler/core/parse.y"
+ {COND_POP();}
+#line 7582 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 310:
+#line 2590 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_for(p, (yyvsp[-7].nd), (yyvsp[-4].nd), (yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-8].num));
+ }
+#line 7591 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 311:
+#line 2596 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if (p->in_def || p->in_single)
+ yyerror(p, "class definition in method body");
+ (yyval.nd) = local_switch(p);
+ nvars_block(p);
+ }
+#line 7602 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 312:
+#line 2604 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_class(p, (yyvsp[-4].nd), (yyvsp[-3].nd), (yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-5].num));
+ local_resume(p, (yyvsp[-2].nd));
+ nvars_unnest(p);
+ }
+#line 7613 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 313:
+#line 2612 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.num) = p->in_def;
+ p->in_def = 0;
+ }
+#line 7622 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 314:
+#line 2617 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons(local_switch(p), nint(p->in_single));
+ nvars_block(p);
+ p->in_single = 0;
+ }
+#line 7632 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 315:
+#line 2624 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_sclass(p, (yyvsp[-5].nd), (yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-7].num));
+ local_resume(p, (yyvsp[-2].nd)->car);
+ nvars_unnest(p);
+ p->in_def = (yyvsp[-4].num);
+ p->in_single = intn((yyvsp[-2].nd)->cdr);
+ }
+#line 7645 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 316:
+#line 2634 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if (p->in_def || p->in_single)
+ yyerror(p, "module definition in method body");
+ (yyval.nd) = local_switch(p);
+ nvars_block(p);
+ }
+#line 7656 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 317:
+#line 2642 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_module(p, (yyvsp[-3].nd), (yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-4].num));
+ local_resume(p, (yyvsp[-2].nd));
+ nvars_unnest(p);
+ }
+#line 7667 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 318:
+#line 2649 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.stack) = p->cmdarg_stack;
+ p->cmdarg_stack = 0;
+ }
+#line 7676 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 319:
+#line 2653 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->in_def++;
+ (yyval.nd) = local_switch(p);
+ nvars_block(p);
+ }
+#line 7686 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 320:
+#line 2661 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_def(p, (yyvsp[-5].id), (yyvsp[-2].nd), (yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-6].num));
+ local_resume(p, (yyvsp[-3].nd));
+ nvars_unnest(p);
+ p->in_def--;
+ p->cmdarg_stack = (yyvsp[-4].stack);
+ }
+#line 7699 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 321:
+#line 2670 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->lstate = EXPR_FNAME;
+ (yyval.stack) = p->cmdarg_stack;
+ p->cmdarg_stack = 0;
+ }
+#line 7709 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 322:
+#line 2676 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->in_single++;
+ p->lstate = EXPR_ENDFN; /* force for args */
+ (yyval.nd) = local_switch(p);
+ nvars_block(p);
+ }
+#line 7720 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 323:
+#line 2685 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_sdef(p, (yyvsp[-7].nd), (yyvsp[-4].id), (yyvsp[-2].nd), (yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-8].num));
+ local_resume(p, (yyvsp[-3].nd));
+ nvars_unnest(p);
+ p->in_single--;
+ p->cmdarg_stack = (yyvsp[-5].stack);
+ }
+#line 7733 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 324:
+#line 2694 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_break(p, 0);
+ }
+#line 7741 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 325:
+#line 2698 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_next(p, 0);
+ }
+#line 7749 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 326:
+#line 2702 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_redo(p);
+ }
+#line 7757 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 327:
+#line 2706 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_retry(p);
+ }
+#line 7765 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 328:
+#line 2712 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ if (!(yyval.nd)) (yyval.nd) = new_nil(p);
+ }
+#line 7774 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 335:
+#line 2731 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_if(p, cond((yyvsp[-3].nd)), (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 7782 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 337:
+#line 2738 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 7790 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 338:
+#line 2744 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1(list1((yyvsp[0].nd)));
+ }
+#line 7798 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 340:
+#line 2751 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3((yyvsp[0].nd),0,0);
+ }
+#line 7806 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 341:
+#line 2755 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3((yyvsp[-3].nd), new_arg(p, (yyvsp[0].id)), 0);
+ }
+#line 7814 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 342:
+#line 2759 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3((yyvsp[-5].nd), new_arg(p, (yyvsp[-2].id)), (yyvsp[0].nd));
+ }
+#line 7822 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 343:
+#line 2763 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_f(p, 0);
+ (yyval.nd) = list3((yyvsp[-2].nd), (node*)-1, 0);
+ }
+#line 7831 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 344:
+#line 2768 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3((yyvsp[-4].nd), (node*)-1, (yyvsp[0].nd));
+ }
+#line 7839 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 345:
+#line 2772 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3(0, new_arg(p, (yyvsp[0].id)), 0);
+ }
+#line 7847 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 346:
+#line 2776 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3(0, new_arg(p, (yyvsp[-2].id)), (yyvsp[0].nd));
+ }
+#line 7855 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 347:
+#line 2780 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_f(p, 0);
+ (yyval.nd) = list3(0, (node*)-1, 0);
+ }
+#line 7864 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 348:
+#line 2785 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_f(p, 0);
+ }
+#line 7872 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 349:
+#line 2789 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list3(0, (node*)-1, (yyvsp[0].nd));
+ }
+#line 7880 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 350:
+#line 2795 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args_tail(p, (yyvsp[-3].nd), (yyvsp[-1].nd), (yyvsp[0].id));
+ }
+#line 7888 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 351:
+#line 2799 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args_tail(p, (yyvsp[-1].nd), 0, (yyvsp[0].id));
+ }
+#line 7896 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 352:
+#line 2803 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args_tail(p, 0, (yyvsp[-1].nd), (yyvsp[0].id));
+ }
+#line 7904 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 353:
+#line 2807 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args_tail(p, 0, 0, (yyvsp[0].id));
+ }
+#line 7912 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 354:
+#line 2813 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 7920 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 355:
+#line 2817 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args_tail(p, 0, 0, 0);
+ }
+#line 7928 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 356:
+#line 2823 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-5].nd), (yyvsp[-3].nd), (yyvsp[-1].id), 0, (yyvsp[0].nd));
+ }
+#line 7936 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 357:
+#line 2827 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-7].nd), (yyvsp[-5].nd), (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 7944 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 358:
+#line 2831 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-3].nd), (yyvsp[-1].nd), 0, 0, (yyvsp[0].nd));
+ }
+#line 7952 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 359:
+#line 2835 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-5].nd), (yyvsp[-3].nd), 0, (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 7960 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 360:
+#line 2839 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-3].nd), 0, (yyvsp[-1].id), 0, (yyvsp[0].nd));
+ }
+#line 7968 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 361:
+#line 2843 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-2].nd), 0, 0, 0, (yyvsp[0].nd));
+ }
+#line 7976 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 362:
+#line 2847 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-5].nd), 0, (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 7984 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 363:
+#line 2851 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-1].nd), 0, 0, 0, (yyvsp[0].nd));
+ }
+#line 7992 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 364:
+#line 2855 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, (yyvsp[-3].nd), (yyvsp[-1].id), 0, (yyvsp[0].nd));
+ }
+#line 8000 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 365:
+#line 2859 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, (yyvsp[-5].nd), (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 8008 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 366:
+#line 2863 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, (yyvsp[-1].nd), 0, 0, (yyvsp[0].nd));
+ }
+#line 8016 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 367:
+#line 2867 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, (yyvsp[-3].nd), 0, (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 8024 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 368:
+#line 2871 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, 0, (yyvsp[-1].id), 0, (yyvsp[0].nd));
+ }
+#line 8032 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 369:
+#line 2875 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, 0, (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 8040 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 370:
+#line 2879 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, 0, 0, 0, (yyvsp[0].nd));
+ }
+#line 8048 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 371:
+#line 2885 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_blk(p, 0);
+ (yyval.nd) = 0;
+ }
+#line 8057 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 372:
+#line 2890 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->cmd_start = TRUE;
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 8066 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 373:
+#line 2896 "mrbgems/mruby-compiler/core/parse.y"
+ {local_add_blk(p, 0);}
+#line 8072 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 374:
+#line 2897 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = 0;
+ }
+#line 8080 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 375:
+#line 2901 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_blk(p, 0);
+ (yyval.nd) = 0;
+ }
+#line 8089 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 376:
+#line 2906 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-2].nd);
+ }
+#line 8097 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 377:
+#line 2913 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = 0;
+ }
+#line 8105 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 378:
+#line 2917 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = 0;
+ }
+#line 8113 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 381:
+#line 2927 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_f(p, (yyvsp[0].id));
+ new_bv(p, (yyvsp[0].id));
+ }
+#line 8122 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 383:
+#line 2935 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-2].nd);
+ }
+#line 8130 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 384:
+#line 2939 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 8138 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 385:
+#line 2945 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 8146 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 386:
+#line 2949 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 8154 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 387:
+#line 2955 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_nest(p);
+ nvars_nest(p);
+ }
+#line 8163 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 388:
+#line 2962 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_block(p,(yyvsp[-2].nd),(yyvsp[-1].nd));
+ local_unnest(p);
+ nvars_unnest(p);
+ }
+#line 8173 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 389:
+#line 2970 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if ((yyvsp[-1].nd)->car == (node*)NODE_YIELD) {
+ yyerror(p, "block given to yield");
+ }
+ else {
+ call_with_block(p, (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 8187 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 390:
+#line 2980 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), (yyvsp[-2].num));
+ }
+#line 8195 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 391:
+#line 2984 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), (yyvsp[-1].nd), (yyvsp[-3].num));
+ call_with_block(p, (yyval.nd), (yyvsp[0].nd));
+ }
+#line 8204 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 392:
+#line 2989 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), (yyvsp[-1].nd), (yyvsp[-3].num));
+ call_with_block(p, (yyval.nd), (yyvsp[0].nd));
+ }
+#line 8213 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 393:
+#line 2996 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_fcall(p, (yyvsp[-1].id), (yyvsp[0].nd));
+ }
+#line 8221 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 394:
+#line 3000 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), (yyvsp[-2].num));
+ }
+#line 8229 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 395:
+#line 3004 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), tCOLON2);
+ }
+#line 8237 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 396:
+#line 3008 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, tCOLON2);
+ }
+#line 8245 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 397:
+#line 3012 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-2].nd), intern_lit("call"), (yyvsp[0].nd), (yyvsp[-1].num));
+ }
+#line 8253 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 398:
+#line 3016 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-2].nd), intern_lit("call"), (yyvsp[0].nd), tCOLON2);
+ }
+#line 8261 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 399:
+#line 3020 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_super(p, (yyvsp[0].nd));
+ }
+#line 8269 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 400:
+#line 3024 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_zsuper(p);
+ }
+#line 8277 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 401:
+#line 3028 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_call(p, (yyvsp[-3].nd), intern_lit("[]"), (yyvsp[-1].nd), '.');
+ }
+#line 8285 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 402:
+#line 3034 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_nest(p);
+ nvars_nest(p);
+ (yyval.num) = p->lineno;
+ }
+#line 8295 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 403:
+#line 3041 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_block(p,(yyvsp[-2].nd),(yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-3].num));
+ local_unnest(p);
+ nvars_unnest(p);
+ }
+#line 8306 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 404:
+#line 3048 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_nest(p);
+ nvars_nest(p);
+ (yyval.num) = p->lineno;
+ }
+#line 8316 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 405:
+#line 3055 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_block(p,(yyvsp[-2].nd),(yyvsp[-1].nd));
+ SET_LINENO((yyval.nd), (yyvsp[-3].num));
+ local_unnest(p);
+ nvars_unnest(p);
+ }
+#line 8327 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 406:
+#line 3066 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = cons(cons((yyvsp[-3].nd), (yyvsp[-1].nd)), (yyvsp[0].nd));
+ }
+#line 8335 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 407:
+#line 3072 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if ((yyvsp[0].nd)) {
+ (yyval.nd) = cons(cons(0, (yyvsp[0].nd)), 0);
+ }
+ else {
+ (yyval.nd) = 0;
+ }
+ }
+#line 8348 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 409:
+#line 3086 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1(list3((yyvsp[-4].nd), (yyvsp[-3].nd), (yyvsp[-1].nd)));
+ if ((yyvsp[0].nd)) (yyval.nd) = append((yyval.nd), (yyvsp[0].nd));
+ }
+#line 8357 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 411:
+#line 3094 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[0].nd));
+ }
+#line 8365 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 414:
+#line 3102 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 8373 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 416:
+#line 3109 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 8381 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 423:
+#line 3123 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = concat_string(p, (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 8389 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 426:
+#line 3131 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 8397 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 427:
+#line 3135 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_dstr(p, push((yyvsp[-1].nd), (yyvsp[0].nd)));
+ }
+#line 8405 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 429:
+#line 3142 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = append((yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 8413 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 430:
+#line 3148 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[0].nd));
+ }
+#line 8421 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 431:
+#line 3152 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = p->lex_strterm;
+ p->lex_strterm = NULL;
+ }
+#line 8430 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 432:
+#line 3158 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->lex_strterm = (yyvsp[-2].nd);
+ (yyval.nd) = list2((yyvsp[-3].nd), (yyvsp[-1].nd));
+ }
+#line 8439 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 433:
+#line 3163 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1(new_literal_delim(p));
+ }
+#line 8447 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 434:
+#line 3167 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1(new_literal_delim(p));
+ }
+#line 8455 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 435:
+#line 3173 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 8463 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 436:
+#line 3177 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_dxstr(p, push((yyvsp[-1].nd), (yyvsp[0].nd)));
+ }
+#line 8471 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 437:
+#line 3183 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 8479 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 438:
+#line 3187 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_dregx(p, (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 8487 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 442:
+#line 3200 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ parser_heredoc_info * inf = parsing_heredoc_inf(p);
+ inf->doc = push(inf->doc, new_str(p, "", 0));
+ heredoc_end(p);
+ }
+#line 8497 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 443:
+#line 3206 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ heredoc_end(p);
+ }
+#line 8505 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 446:
+#line 3216 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ parser_heredoc_info * inf = parsing_heredoc_inf(p);
+ inf->doc = push(inf->doc, (yyvsp[0].nd));
+ heredoc_treat_nextline(p);
+ }
+#line 8515 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 447:
+#line 3222 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = p->lex_strterm;
+ p->lex_strterm = NULL;
+ }
+#line 8524 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 448:
+#line 3228 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ parser_heredoc_info * inf = parsing_heredoc_inf(p);
+ p->lex_strterm = (yyvsp[-2].nd);
+ inf->doc = push(push(inf->doc, (yyvsp[-3].nd)), (yyvsp[-1].nd));
+ }
+#line 8534 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 449:
+#line 3236 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_words(p, list1((yyvsp[0].nd)));
+ }
+#line 8542 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 450:
+#line 3240 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_words(p, push((yyvsp[-1].nd), (yyvsp[0].nd)));
+ }
+#line 8550 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 451:
+#line 3247 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->lstate = EXPR_ENDARG;
+ (yyval.nd) = new_sym(p, (yyvsp[0].id));
+ }
+#line 8559 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 452:
+#line 3252 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->lstate = EXPR_ENDARG;
+ (yyval.nd) = new_dsym(p, new_dstr(p, push((yyvsp[-1].nd), (yyvsp[0].nd))));
+ }
+#line 8568 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 453:
+#line 3259 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.id) = (yyvsp[0].id);
+ }
+#line 8576 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 458:
+#line 3269 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.id) = new_strsym(p, (yyvsp[0].nd));
+ }
+#line 8584 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 459:
+#line 3273 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.id) = new_strsym(p, (yyvsp[0].nd));
+ }
+#line 8592 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 460:
+#line 3279 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_symbols(p, list1((yyvsp[0].nd)));
+ }
+#line 8600 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 461:
+#line 3283 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_symbols(p, push((yyvsp[-1].nd), (yyvsp[0].nd)));
+ }
+#line 8608 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 464:
+#line 3291 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = negate_lit(p, (yyvsp[0].nd));
+ }
+#line 8616 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 465:
+#line 3295 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = negate_lit(p, (yyvsp[0].nd));
+ }
+#line 8624 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 466:
+#line 3301 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_lvar(p, (yyvsp[0].id));
+ }
+#line 8632 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 467:
+#line 3305 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_ivar(p, (yyvsp[0].id));
+ }
+#line 8640 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 468:
+#line 3309 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_gvar(p, (yyvsp[0].id));
+ }
+#line 8648 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 469:
+#line 3313 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_cvar(p, (yyvsp[0].id));
+ }
+#line 8656 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 470:
+#line 3317 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_const(p, (yyvsp[0].id));
+ }
+#line 8664 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 471:
+#line 3323 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ assignable(p, (yyvsp[0].nd));
+ }
+#line 8672 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 472:
+#line 3327 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "can't assign to numbered parameter");
+ }
+#line 8680 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 473:
+#line 3333 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = var_reference(p, (yyvsp[0].nd));
+ }
+#line 8688 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 474:
+#line 3337 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_nil(p);
+ }
+#line 8696 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 475:
+#line 3341 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_self(p);
+ }
+#line 8704 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 476:
+#line 3345 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_true(p);
+ }
+#line 8712 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 477:
+#line 3349 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_false(p);
+ }
+#line 8720 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 478:
+#line 3353 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ const char *fn = mrb_sym_name_len(p->mrb, p->filename_sym, NULL);
+ if (!fn) {
+ fn = "(null)";
+ }
+ (yyval.nd) = new_str(p, fn, strlen(fn));
+ }
+#line 8732 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 479:
+#line 3361 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ char buf[16];
+
+ dump_int(p->lineno, buf);
+ (yyval.nd) = new_int(p, buf, 10, 0);
+ }
+#line 8743 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 480:
+#line 3368 "mrbgems/mruby-compiler/core/parse.y"
+ {
+#ifdef MRB_UTF8_STRING
+ const char *enc = "UTF-8";
+#else
+ const char *enc = "ASCII-8BIT";
+#endif
+ (yyval.nd) = new_str(p, enc, strlen(enc));
+ }
+#line 8756 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 483:
+#line 3383 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = 0;
+ }
+#line 8764 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 484:
+#line 3387 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->lstate = EXPR_BEG;
+ p->cmd_start = TRUE;
+ }
+#line 8773 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 485:
+#line 3392 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 8781 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 486:
+#line 3403 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ p->lstate = EXPR_BEG;
+ p->cmd_start = TRUE;
+ }
+#line 8791 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 487:
+#line 3409 "mrbgems/mruby-compiler/core/parse.y"
+ {
+#if 1
+ /* til real keyword args implemented */
+ mrb_sym r = mrb_intern_lit(p->mrb, "*");
+ mrb_sym b = mrb_intern_lit(p->mrb, "&");
+ local_add_f(p, r);
+ (yyval.nd) = new_args(p, 0, 0, r, 0,
+ new_args_tail(p, 0, 0, b));
+#else
+ mrb_sym r = mrb_intern_lit(p->mrb, "*");
+ mrb_sym k = mrb_intern_lit(p->mrb, "**");
+ mrb_sym b = mrb_intern_lit(p->mrb, "&");
+ local_add_f(p, r); local_add_f(p, k);
+ (yyval.nd) = new_args(p, 0, 0, r, 0,
+ new_args_tail(p, 0, new_kw_rest_args(p, nsym(k)), b));
+#endif
+ }
+#line 8813 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 488:
+#line 3427 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 8821 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 489:
+#line 3433 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_nest(p);
+ }
+#line 8829 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 490:
+#line 3439 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = new_kw_arg(p, (yyvsp[-1].id), cons((yyvsp[0].nd), locals_node(p)));
+ local_unnest(p);
+ }
+#line 8839 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 491:
+#line 3445 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_kw_arg(p, (yyvsp[0].id), 0);
+ local_unnest(p);
+ }
+#line 8848 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 492:
+#line 3452 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_kw_arg(p, (yyvsp[-1].id), cons((yyvsp[0].nd), locals_node(p)));
+ local_unnest(p);
+ }
+#line 8857 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 493:
+#line 3457 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_kw_arg(p, (yyvsp[0].id), 0);
+ local_unnest(p);
+ }
+#line 8866 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 494:
+#line 3464 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[0].nd));
+ }
+#line 8874 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 495:
+#line 3468 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 8882 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 496:
+#line 3474 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[0].nd));
+ }
+#line 8890 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 497:
+#line 3478 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 8898 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 500:
+#line 3488 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_kw_rest_args(p, nsym((yyvsp[0].id)));
+ }
+#line 8906 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 501:
+#line 3492 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_kw_rest_args(p, 0);
+ }
+#line 8914 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 502:
+#line 3498 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args_tail(p, (yyvsp[-3].nd), (yyvsp[-1].nd), (yyvsp[0].id));
+ }
+#line 8922 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 503:
+#line 3502 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args_tail(p, (yyvsp[-1].nd), 0, (yyvsp[0].id));
+ }
+#line 8930 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 504:
+#line 3506 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args_tail(p, 0, (yyvsp[-1].nd), (yyvsp[0].id));
+ }
+#line 8938 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 505:
+#line 3510 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args_tail(p, 0, 0, (yyvsp[0].id));
+ }
+#line 8946 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 506:
+#line 3516 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ }
+#line 8954 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 507:
+#line 3520 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args_tail(p, 0, 0, 0);
+ }
+#line 8962 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 508:
+#line 3526 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-5].nd), (yyvsp[-3].nd), (yyvsp[-1].id), 0, (yyvsp[0].nd));
+ }
+#line 8970 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 509:
+#line 3530 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-7].nd), (yyvsp[-5].nd), (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 8978 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 510:
+#line 3534 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-3].nd), (yyvsp[-1].nd), 0, 0, (yyvsp[0].nd));
+ }
+#line 8986 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 511:
+#line 3538 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-5].nd), (yyvsp[-3].nd), 0, (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 8994 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 512:
+#line 3542 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-3].nd), 0, (yyvsp[-1].id), 0, (yyvsp[0].nd));
+ }
+#line 9002 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 513:
+#line 3546 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-5].nd), 0, (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 9010 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 514:
+#line 3550 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, (yyvsp[-1].nd), 0, 0, 0, (yyvsp[0].nd));
+ }
+#line 9018 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 515:
+#line 3554 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, (yyvsp[-3].nd), (yyvsp[-1].id), 0, (yyvsp[0].nd));
+ }
+#line 9026 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 516:
+#line 3558 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, (yyvsp[-5].nd), (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 9034 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 517:
+#line 3562 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, (yyvsp[-1].nd), 0, 0, (yyvsp[0].nd));
+ }
+#line 9042 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 518:
+#line 3566 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, (yyvsp[-3].nd), 0, (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 9050 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 519:
+#line 3570 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, 0, (yyvsp[-1].id), 0, (yyvsp[0].nd));
+ }
+#line 9058 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 520:
+#line 3574 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, 0, (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd));
+ }
+#line 9066 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 521:
+#line 3578 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_args(p, 0, 0, 0, 0, (yyvsp[0].nd));
+ }
+#line 9074 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 522:
+#line 3582 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_f(p, mrb_intern_lit(p->mrb, "&"));
+ (yyval.nd) = new_args(p, 0, 0, 0, 0, 0);
+ }
+#line 9083 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 523:
+#line 3589 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "formal argument cannot be a constant");
+ (yyval.nd) = 0;
+ }
+#line 9092 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 524:
+#line 3594 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "formal argument cannot be an instance variable");
+ (yyval.nd) = 0;
+ }
+#line 9101 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 525:
+#line 3599 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "formal argument cannot be a global variable");
+ (yyval.nd) = 0;
+ }
+#line 9110 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 526:
+#line 3604 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "formal argument cannot be a class variable");
+ (yyval.nd) = 0;
+ }
+#line 9119 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 527:
+#line 3609 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ yyerror(p, "formal argument cannot be a numbered parameter");
+ (yyval.nd) = 0;
+ }
+#line 9128 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 528:
+#line 3616 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.id) = 0;
+ }
+#line 9136 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 529:
+#line 3620 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_f(p, (yyvsp[0].id));
+ (yyval.id) = (yyvsp[0].id);
+ }
+#line 9145 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 530:
+#line 3627 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_arg(p, (yyvsp[0].id));
+ }
+#line 9153 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 531:
+#line 3631 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = local_switch(p);
+ }
+#line 9161 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 532:
+#line 3635 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = new_masgn_param(p, (yyvsp[-1].nd), p->locals->car);
+ local_resume(p, (yyvsp[-2].nd));
+ local_add_f(p, 0);
+ }
+#line 9171 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 533:
+#line 3643 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[0].nd));
+ }
+#line 9179 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 534:
+#line 3647 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 9187 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 535:
+#line 3653 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_f(p, (yyvsp[-1].id));
+ local_nest(p);
+ (yyval.id) = (yyvsp[-1].id);
+ }
+#line 9197 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 536:
+#line 3661 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = cons(nsym((yyvsp[-1].id)), cons((yyvsp[0].nd), locals_node(p)));
+ local_unnest(p);
+ }
+#line 9207 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 537:
+#line 3669 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = cons(nsym((yyvsp[-1].id)), cons((yyvsp[0].nd), locals_node(p)));
+ local_unnest(p);
+ }
+#line 9217 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 538:
+#line 3677 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[0].nd));
+ }
+#line 9225 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 539:
+#line 3681 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 9233 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 540:
+#line 3687 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[0].nd));
+ }
+#line 9241 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 541:
+#line 3691 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 9249 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 544:
+#line 3701 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_f(p, (yyvsp[0].id));
+ (yyval.id) = (yyvsp[0].id);
+ }
+#line 9258 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 545:
+#line 3706 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ local_add_f(p, mrb_intern_lit(p->mrb, "*"));
+ (yyval.id) = -1;
+ }
+#line 9267 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 548:
+#line 3717 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.id) = (yyvsp[0].id);
+ }
+#line 9275 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 549:
+#line 3723 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.id) = (yyvsp[0].id);
+ }
+#line 9283 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 550:
+#line 3727 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.id) = 0;
+ }
+#line 9291 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 551:
+#line 3733 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[0].nd);
+ if (!(yyval.nd)) (yyval.nd) = new_nil(p);
+ }
+#line 9300 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 552:
+#line 3737 "mrbgems/mruby-compiler/core/parse.y"
+ {p->lstate = EXPR_BEG;}
+#line 9306 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 553:
+#line 3738 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ if ((yyvsp[-1].nd) == 0) {
+ yyerror(p, "can't define singleton method for ().");
+ }
+ else {
+ switch ((enum node_type)intn((yyvsp[-1].nd)->car)) {
+ case NODE_STR:
+ case NODE_DSTR:
+ case NODE_XSTR:
+ case NODE_DXSTR:
+ case NODE_DREGX:
+ case NODE_MATCH:
+ case NODE_FLOAT:
+ case NODE_ARRAY:
+ case NODE_HEREDOC:
+ yyerror(p, "can't define singleton method for literals");
+ default:
+ break;
+ }
+ }
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 9333 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 555:
+#line 3764 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = (yyvsp[-1].nd);
+ }
+#line 9341 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 556:
+#line 3770 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = list1((yyvsp[0].nd));
+ NODE_LINENO((yyval.nd), (yyvsp[0].nd));
+ }
+#line 9350 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 557:
+#line 3775 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 9358 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 560:
+#line 3785 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[-2].nd));
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = cons((yyvsp[-2].nd), (yyvsp[0].nd));
+ }
+#line 9368 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 561:
+#line 3791 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = cons(new_sym(p, (yyvsp[-2].id)), (yyvsp[0].nd));
+ }
+#line 9377 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 562:
+#line 3796 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ if ((yyvsp[-2].nd)->car == (node*)NODE_DSTR) {
+ (yyval.nd) = cons(new_dsym(p, (yyvsp[-2].nd)), (yyvsp[0].nd));
+ }
+ else {
+ (yyval.nd) = cons(new_sym(p, new_strsym(p, (yyvsp[-2].nd))), (yyvsp[0].nd));
+ }
+ }
+#line 9391 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 563:
+#line 3806 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ void_expr_error(p, (yyvsp[0].nd));
+ (yyval.nd) = cons(new_kw_rest_args(p, 0), (yyvsp[0].nd));
+ }
+#line 9400 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 576:
+#line 3833 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.num) = '.';
+ }
+#line 9408 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 577:
+#line 3837 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.num) = 0;
+ }
+#line 9416 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 579:
+#line 3844 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.num) = tCOLON2;
+ }
+#line 9424 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 588:
+#line 3865 "mrbgems/mruby-compiler/core/parse.y"
+ {yyerrok;}
+#line 9430 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 591:
+#line 3871 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ p->lineno += (yyvsp[0].num);
+ p->column = 0;
+ }
+#line 9439 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+ case 594:
+#line 3882 "mrbgems/mruby-compiler/core/parse.y"
+ {
+ (yyval.nd) = 0;
+ }
+#line 9447 "mrbgems/mruby-compiler/core/y.tab.c"
+ break;
+
+
+#line 9451 "mrbgems/mruby-compiler/core/y.tab.c"
+
+ default: break;
+ }
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+ /* Now 'shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+ {
+ const int yylhs = yyr1[yyn] - YYNTOKENS;
+ const int yyi = yypgoto[yylhs] + *yyssp;
+ yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+ ? yytable[yyi]
+ : yydefgoto[yylhs]);
+ }
+
+ goto yynewstate;
+
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
+yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if ! YYERROR_VERBOSE
+ yyerror (p, YY_("syntax error"));
+#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
+ {
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (p, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
+ }
+# undef YYSYNTAX_ERROR
+#endif
+ }
+
+
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, p);
+ yychar = YYEMPTY;
+ }
+ }
+
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+ /* Pacify compilers when the user code never invokes YYERROR and the
+ label yyerrorlab therefore never appears in user code. */
+ if (0)
+ YYERROR;
+
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (!yypact_value_is_default (yyn))
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp, p);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+
+#if !defined yyoverflow || YYERROR_VERBOSE
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror (p, YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+
+/*-----------------------------------------------------.
+| yyreturn -- parsing is finished, return the result. |
+`-----------------------------------------------------*/
+yyreturn:
+ if (yychar != YYEMPTY)
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, p);
+ }
+ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[+*yyssp], yyvsp, p);
+ YYPOPSTACK (1);
+ }
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+#endif
+ return yyresult;
+}
+#line 3886 "mrbgems/mruby-compiler/core/parse.y"
+
+#define pylval (*((YYSTYPE*)(p->ylval)))
+
+static void
+yyerror(parser_state *p, const char *s)
+{
+ char* c;
+ size_t n;
+
+ if (! p->capture_errors) {
+#ifndef MRB_DISABLE_STDIO
+ if (p->filename_sym) {
+ const char *filename = mrb_sym_name_len(p->mrb, p->filename_sym, NULL);
+ fprintf(stderr, "%s:%d:%d: %s\n", filename, p->lineno, p->column, s);
+ }
+ else {
+ fprintf(stderr, "line %d:%d: %s\n", p->lineno, p->column, s);
+ }
+#endif
+ }
+ else if (p->nerr < sizeof(p->error_buffer) / sizeof(p->error_buffer[0])) {
+ n = strlen(s);
+ c = (char *)parser_palloc(p, n + 1);
+ memcpy(c, s, n + 1);
+ p->error_buffer[p->nerr].message = c;
+ p->error_buffer[p->nerr].lineno = p->lineno;
+ p->error_buffer[p->nerr].column = p->column;
+ }
+ p->nerr++;
+}
+
+static void
+yyerror_c(parser_state *p, const char *msg, char c)
+{
+ char buf[256];
+
+ strncpy(buf, msg, sizeof(buf) - 2);
+ buf[sizeof(buf) - 2] = '\0';
+ strncat(buf, &c, 1);
+ yyerror(p, buf);
+}
+
+static void
+yywarn(parser_state *p, const char *s)
+{
+ char* c;
+ size_t n;
+
+ if (! p->capture_errors) {
+#ifndef MRB_DISABLE_STDIO
+ if (p->filename_sym) {
+ const char *filename = mrb_sym_name_len(p->mrb, p->filename_sym, NULL);
+ fprintf(stderr, "%s:%d:%d: warning: %s\n", filename, p->lineno, p->column, s);
+ }
+ else {
+ fprintf(stderr, "line %d:%d: warning: %s\n", p->lineno, p->column, s);
+ }
+#endif
+ }
+ else if (p->nwarn < sizeof(p->warn_buffer) / sizeof(p->warn_buffer[0])) {
+ n = strlen(s);
+ c = (char *)parser_palloc(p, n + 1);
+ memcpy(c, s, n + 1);
+ p->warn_buffer[p->nwarn].message = c;
+ p->warn_buffer[p->nwarn].lineno = p->lineno;
+ p->warn_buffer[p->nwarn].column = p->column;
+ }
+ p->nwarn++;
+}
+
+static void
+yywarning(parser_state *p, const char *s)
+{
+ yywarn(p, s);
+}
+
+static void
+yywarning_s(parser_state *p, const char *msg, const char *s)
+{
+ char buf[256];
+
+ strncpy(buf, msg, sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = '\0';
+ strncat(buf, ": ", sizeof(buf) - strlen(buf) - 1);
+ strncat(buf, s, sizeof(buf) - strlen(buf) - 1);
+ yywarning(p, buf);
+}
+
+static void
+backref_error(parser_state *p, node *n)
+{
+ int c;
+
+ c = intn(n->car);
+
+ if (c == NODE_NTH_REF) {
+ yyerror_c(p, "can't set variable $", (char)intn(n->cdr)+'0');
+ }
+ else if (c == NODE_BACK_REF) {
+ yyerror_c(p, "can't set variable $", (char)intn(n->cdr));
+ }
+ else {
+ mrb_bug(p->mrb, "Internal error in backref_error() : n=>car == %d", c);
+ }
+}
+
+static void
+void_expr_error(parser_state *p, node *n)
+{
+ int c;
+
+ if (n == NULL) return;
+ c = intn(n->car);
+ switch (c) {
+ case NODE_BREAK:
+ case NODE_RETURN:
+ case NODE_NEXT:
+ case NODE_REDO:
+ case NODE_RETRY:
+ yyerror(p, "void value expression");
+ break;
+ case NODE_AND:
+ case NODE_OR:
+ if (n->cdr) {
+ void_expr_error(p, n->cdr->car);
+ void_expr_error(p, n->cdr->cdr);
+ }
+ break;
+ case NODE_BEGIN:
+ if (n->cdr) {
+ while (n->cdr) {
+ n = n->cdr;
+ }
+ void_expr_error(p, n->car);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+static void pushback(parser_state *p, int c);
+static mrb_bool peeks(parser_state *p, const char *s);
+static mrb_bool skips(parser_state *p, const char *s);
+
+static inline int
+nextc0(parser_state *p)
+{
+ int c;
+#ifndef MRB_DISABLE_STDIO
+ if (p->f) {
+ if (feof(p->f)) return -1;
+ c = fgetc(p->f);
+ if (c == EOF) return -1;
+ }
+ else
+#endif
+ if (!p->s || p->s >= p->send) {
+ return -1;
+ }
+ else {
+ c = (unsigned char)*p->s++;
+ }
+ return c;
+}
+
+static inline int
+nextc(parser_state *p)
+{
+ int c;
+
+ if (p->pb) {
+ node *tmp;
+
+ c = intn(p->pb->car);
+ tmp = p->pb;
+ p->pb = p->pb->cdr;
+ cons_free(tmp);
+ }
+ else {
+ c = nextc0(p);
+ if (c < 0) goto eof;
+ }
+ if (c >= 0) {
+ p->column++;
+ }
+ if (c == '\r') {
+ const int lf = nextc0(p);
+ if (lf == '\n') {
+ return '\n';
+ }
+ if (lf > 0) pushback(p, lf);
+ }
+ return c;
+
+ eof:
+ if (!p->cxt) return -1;
+ else {
+ if (p->cxt->partial_hook(p) < 0)
+ return -1; /* end of program(s) */
+ return -2; /* end of a file in the program files */
+ }
+}
+
+static void
+pushback(parser_state *p, int c)
+{
+ if (c >= 0) {
+ p->column--;
+ }
+ p->pb = cons(nint(c), p->pb);
+}
+
+static void
+skip(parser_state *p, char term)
+{
+ int c;
+
+ for (;;) {
+ c = nextc(p);
+ if (c < 0) break;
+ if (c == term) break;
+ }
+}
+
+static int
+peekc_n(parser_state *p, int n)
+{
+ node *list = 0;
+ int c0;
+
+ do {
+ c0 = nextc(p);
+ if (c0 == -1) return c0; /* do not skip partial EOF */
+ if (c0 >= 0) --p->column;
+ list = push(list, nint(c0));
+ } while(n--);
+ if (p->pb) {
+ p->pb = append((node*)list, p->pb);
+ }
+ else {
+ p->pb = list;
+ }
+ return c0;
+}
+
+static mrb_bool
+peek_n(parser_state *p, int c, int n)
+{
+ return peekc_n(p, n) == c && c >= 0;
+}
+#define peek(p,c) peek_n((p), (c), 0)
+
+static mrb_bool
+peeks(parser_state *p, const char *s)
+{
+ size_t len = strlen(s);
+
+#ifndef MRB_DISABLE_STDIO
+ if (p->f) {
+ int n = 0;
+ while (*s) {
+ if (!peek_n(p, *s++, n++)) return FALSE;
+ }
+ return TRUE;
+ }
+ else
+#endif
+ if (p->s && p->s + len <= p->send) {
+ if (memcmp(p->s, s, len) == 0) return TRUE;
+ }
+ return FALSE;
+}
+
+static mrb_bool
+skips(parser_state *p, const char *s)
+{
+ int c;
+
+ for (;;) {
+ /* skip until first char */
+ for (;;) {
+ c = nextc(p);
+ if (c < 0) return FALSE;
+ if (c == '\n') {
+ p->lineno++;
+ p->column = 0;
+ }
+ if (c == *s) break;
+ }
+ s++;
+ if (peeks(p, s)) {
+ size_t len = strlen(s);
+
+ while (len--) {
+ if (nextc(p) == '\n') {
+ p->lineno++;
+ p->column = 0;
+ }
+ }
+ return TRUE;
+ }
+ else{
+ s--;
+ }
+ }
+ return FALSE;
+}
+
+
+static int
+newtok(parser_state *p)
+{
+ if (p->tokbuf != p->buf) {
+ mrb_free(p->mrb, p->tokbuf);
+ p->tokbuf = p->buf;
+ p->tsiz = MRB_PARSER_TOKBUF_SIZE;
+ }
+ p->tidx = 0;
+ return p->column - 1;
+}
+
+static void
+tokadd(parser_state *p, int32_t c)
+{
+ char utf8[4];
+ int i, len;
+
+ /* mrb_assert(-0x10FFFF <= c && c <= 0xFF); */
+ if (c >= 0) {
+ /* Single byte from source or non-Unicode escape */
+ utf8[0] = (char)c;
+ len = 1;
+ }
+ else {
+ /* Unicode character */
+ c = -c;
+ if (c < 0x80) {
+ utf8[0] = (char)c;
+ len = 1;
+ }
+ else if (c < 0x800) {
+ utf8[0] = (char)(0xC0 | (c >> 6));
+ utf8[1] = (char)(0x80 | (c & 0x3F));
+ len = 2;
+ }
+ else if (c < 0x10000) {
+ utf8[0] = (char)(0xE0 | (c >> 12) );
+ utf8[1] = (char)(0x80 | ((c >> 6) & 0x3F));
+ utf8[2] = (char)(0x80 | ( c & 0x3F));
+ len = 3;
+ }
+ else {
+ utf8[0] = (char)(0xF0 | (c >> 18) );
+ utf8[1] = (char)(0x80 | ((c >> 12) & 0x3F));
+ utf8[2] = (char)(0x80 | ((c >> 6) & 0x3F));
+ utf8[3] = (char)(0x80 | ( c & 0x3F));
+ len = 4;
+ }
+ }
+ if (p->tidx+len >= p->tsiz) {
+ if (p->tsiz >= MRB_PARSER_TOKBUF_MAX) {
+ p->tidx += len;
+ return;
+ }
+ p->tsiz *= 2;
+ if (p->tokbuf == p->buf) {
+ p->tokbuf = (char*)mrb_malloc(p->mrb, p->tsiz);
+ memcpy(p->tokbuf, p->buf, MRB_PARSER_TOKBUF_SIZE);
+ }
+ else {
+ p->tokbuf = (char*)mrb_realloc(p->mrb, p->tokbuf, p->tsiz);
+ }
+ }
+ for (i = 0; i < len; i++) {
+ p->tokbuf[p->tidx++] = utf8[i];
+ }
+}
+
+static int
+toklast(parser_state *p)
+{
+ return p->tokbuf[p->tidx-1];
+}
+
+static void
+tokfix(parser_state *p)
+{
+ if (p->tidx >= MRB_PARSER_TOKBUF_MAX) {
+ p->tidx = MRB_PARSER_TOKBUF_MAX-1;
+ yyerror(p, "string too long (truncated)");
+ }
+ p->tokbuf[p->tidx] = '\0';
+}
+
+static const char*
+tok(parser_state *p)
+{
+ return p->tokbuf;
+}
+
+static int
+toklen(parser_state *p)
+{
+ return p->tidx;
+}
+
+#define IS_ARG() (p->lstate == EXPR_ARG || p->lstate == EXPR_CMDARG)
+#define IS_END() (p->lstate == EXPR_END || p->lstate == EXPR_ENDARG || p->lstate == EXPR_ENDFN)
+#define IS_BEG() (p->lstate == EXPR_BEG || p->lstate == EXPR_MID || p->lstate == EXPR_VALUE || p->lstate == EXPR_CLASS)
+#define IS_SPCARG(c) (IS_ARG() && space_seen && !ISSPACE(c))
+#define IS_LABEL_POSSIBLE() ((p->lstate == EXPR_BEG && !cmd_state) || IS_ARG())
+#define IS_LABEL_SUFFIX(n) (peek_n(p, ':',(n)) && !peek_n(p, ':', (n)+1))
+
+static int32_t
+scan_oct(const int *start, int len, int *retlen)
+{
+ const int *s = start;
+ int32_t retval = 0;
+
+ /* mrb_assert(len <= 3) */
+ while (len-- && *s >= '0' && *s <= '7') {
+ retval <<= 3;
+ retval |= *s++ - '0';
+ }
+ *retlen = (int)(s - start);
+
+ return retval;
+}
+
+static int32_t
+scan_hex(parser_state *p, const int *start, int len, int *retlen)
+{
+ static const char hexdigit[] = "0123456789abcdef0123456789ABCDEF";
+ const int *s = start;
+ uint32_t retval = 0;
+ char *tmp;
+
+ /* mrb_assert(len <= 8) */
+ while (len-- && *s && (tmp = (char*)strchr(hexdigit, *s))) {
+ retval <<= 4;
+ retval |= (tmp - hexdigit) & 15;
+ s++;
+ }
+ *retlen = (int)(s - start);
+
+ return (int32_t)retval;
+}
+
+static int32_t
+read_escape_unicode(parser_state *p, int limit)
+{
+ int buf[9];
+ int i;
+ int32_t hex;
+
+ /* Look for opening brace */
+ i = 0;
+ buf[0] = nextc(p);
+ if (buf[0] < 0) {
+ eof:
+ yyerror(p, "invalid escape character syntax");
+ return -1;
+ }
+ if (ISXDIGIT(buf[0])) {
+ /* \uxxxx form */
+ for (i=1; i<limit; i++) {
+ buf[i] = nextc(p);
+ if (buf[i] < 0) goto eof;
+ if (!ISXDIGIT(buf[i])) {
+ pushback(p, buf[i]);
+ break;
+ }
+ }
+ }
+ else {
+ pushback(p, buf[0]);
+ }
+ hex = scan_hex(p, buf, i, &i);
+ if (i == 0 || hex > 0x10FFFF || (hex & 0xFFFFF800) == 0xD800) {
+ yyerror(p, "invalid Unicode code point");
+ return -1;
+ }
+ return hex;
+}
+
+/* Return negative to indicate Unicode code point */
+static int32_t
+read_escape(parser_state *p)
+{
+ int32_t c;
+
+ switch (c = nextc(p)) {
+ case '\\':/* Backslash */
+ return c;
+
+ case 'n':/* newline */
+ return '\n';
+
+ case 't':/* horizontal tab */
+ return '\t';
+
+ case 'r':/* carriage-return */
+ return '\r';
+
+ case 'f':/* form-feed */
+ return '\f';
+
+ case 'v':/* vertical tab */
+ return '\13';
+
+ case 'a':/* alarm(bell) */
+ return '\007';
+
+ case 'e':/* escape */
+ return 033;
+
+ case '0': case '1': case '2': case '3': /* octal constant */
+ case '4': case '5': case '6': case '7':
+ {
+ int buf[3];
+ int i;
+
+ buf[0] = c;
+ for (i=1; i<3; i++) {
+ buf[i] = nextc(p);
+ if (buf[i] < 0) goto eof;
+ if (buf[i] < '0' || '7' < buf[i]) {
+ pushback(p, buf[i]);
+ break;
+ }
+ }
+ c = scan_oct(buf, i, &i);
+ }
+ return c;
+
+ case 'x': /* hex constant */
+ {
+ int buf[2];
+ int i;
+
+ for (i=0; i<2; i++) {
+ buf[i] = nextc(p);
+ if (buf[i] < 0) goto eof;
+ if (!ISXDIGIT(buf[i])) {
+ pushback(p, buf[i]);
+ break;
+ }
+ }
+ if (i == 0) {
+ yyerror(p, "invalid hex escape");
+ return -1;
+ }
+ return scan_hex(p, buf, i, &i);
+ }
+
+ case 'u': /* Unicode */
+ if (peek(p, '{')) {
+ /* \u{xxxxxxxx} form */
+ nextc(p);
+ c = read_escape_unicode(p, 8);
+ if (c < 0) return 0;
+ if (nextc(p) != '}') goto eof;
+ }
+ else {
+ c = read_escape_unicode(p, 4);
+ if (c < 0) return 0;
+ }
+ return -c;
+
+ case 'b':/* backspace */
+ return '\010';
+
+ case 's':/* space */
+ return ' ';
+
+ case 'M':
+ if ((c = nextc(p)) != '-') {
+ yyerror(p, "Invalid escape character syntax");
+ pushback(p, c);
+ return '\0';
+ }
+ if ((c = nextc(p)) == '\\') {
+ return read_escape(p) | 0x80;
+ }
+ else if (c < 0) goto eof;
+ else {
+ return ((c & 0xff) | 0x80);
+ }
+
+ case 'C':
+ if ((c = nextc(p)) != '-') {
+ yyerror(p, "Invalid escape character syntax");
+ pushback(p, c);
+ return '\0';
+ }
+ case 'c':
+ if ((c = nextc(p))== '\\') {
+ c = read_escape(p);
+ }
+ else if (c == '?')
+ return 0177;
+ else if (c < 0) goto eof;
+ return c & 0x9f;
+
+ eof:
+ case -1:
+ case -2: /* end of a file */
+ yyerror(p, "Invalid escape character syntax");
+ return '\0';
+
+ default:
+ return c;
+ }
+}
+
+static int
+parse_string(parser_state *p)
+{
+ int c;
+ string_type type = (string_type)(intptr_t)p->lex_strterm->car;
+ int nest_level = intn(p->lex_strterm->cdr->car);
+ int beg = intn(p->lex_strterm->cdr->cdr->car);
+ int end = intn(p->lex_strterm->cdr->cdr->cdr);
+ parser_heredoc_info *hinf = (type & STR_FUNC_HEREDOC) ? parsing_heredoc_inf(p) : NULL;
+
+ if (beg == 0) beg = -3; /* should never happen */
+ if (end == 0) end = -3;
+ newtok(p);
+ while ((c = nextc(p)) != end || nest_level != 0) {
+ if (hinf && (c == '\n' || c < 0)) {
+ mrb_bool line_head;
+ tokadd(p, '\n');
+ tokfix(p);
+ p->lineno++;
+ p->column = 0;
+ line_head = hinf->line_head;
+ hinf->line_head = TRUE;
+ if (line_head) {
+ /* check whether end of heredoc */
+ const char *s = tok(p);
+ int len = toklen(p);
+ if (hinf->allow_indent) {
+ while (ISSPACE(*s) && len > 0) {
+ ++s;
+ --len;
+ }
+ }
+ if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) {
+ return tHEREDOC_END;
+ }
+ }
+ if (c < 0) {
+ char buf[256];
+ const char s1[] = "can't find heredoc delimiter \"";
+ const char s2[] = "\" anywhere before EOF";
+
+ if (sizeof(s1)+sizeof(s2)+strlen(hinf->term)+1 >= sizeof(buf)) {
+ yyerror(p, "can't find heredoc delimiter anywhere before EOF");
+ } else {
+ strcpy(buf, s1);
+ strcat(buf, hinf->term);
+ strcat(buf, s2);
+ yyerror(p, buf);
+ }
+ return 0;
+ }
+ pylval.nd = new_str(p, tok(p), toklen(p));
+ return tHD_STRING_MID;
+ }
+ if (c < 0) {
+ yyerror(p, "unterminated string meets end of file");
+ return 0;
+ }
+ else if (c == beg) {
+ nest_level++;
+ p->lex_strterm->cdr->car = nint(nest_level);
+ }
+ else if (c == end) {
+ nest_level--;
+ p->lex_strterm->cdr->car = nint(nest_level);
+ }
+ else if (c == '\\') {
+ c = nextc(p);
+ if (type & STR_FUNC_EXPAND) {
+ if (c == end || c == beg) {
+ tokadd(p, c);
+ }
+ else if (c == '\n') {
+ p->lineno++;
+ p->column = 0;
+ if (type & STR_FUNC_ARRAY) {
+ tokadd(p, '\n');
+ }
+ }
+ else if (type & STR_FUNC_REGEXP) {
+ tokadd(p, '\\');
+ tokadd(p, c);
+ }
+ else if (c == 'u' && peek(p, '{')) {
+ /* \u{xxxx xxxx xxxx} form */
+ nextc(p);
+ while (1) {
+ do c = nextc(p); while (ISSPACE(c));
+ if (c == '}') break;
+ pushback(p, c);
+ c = read_escape_unicode(p, 8);
+ if (c < 0) break;
+ tokadd(p, -c);
+ }
+ if (hinf)
+ hinf->line_head = FALSE;
+ }
+ else {
+ pushback(p, c);
+ tokadd(p, read_escape(p));
+ if (hinf)
+ hinf->line_head = FALSE;
+ }
+ }
+ else {
+ if (c != beg && c != end) {
+ if (c == '\n') {
+ p->lineno++;
+ p->column = 0;
+ }
+ if (!(c == '\\' || ((type & STR_FUNC_ARRAY) && ISSPACE(c)))) {
+ tokadd(p, '\\');
+ }
+ }
+ tokadd(p, c);
+ }
+ continue;
+ }
+ else if ((c == '#') && (type & STR_FUNC_EXPAND)) {
+ c = nextc(p);
+ if (c == '{') {
+ tokfix(p);
+ p->lstate = EXPR_BEG;
+ p->cmd_start = TRUE;
+ pylval.nd = new_str(p, tok(p), toklen(p));
+ if (hinf) {
+ hinf->line_head = FALSE;
+ return tHD_STRING_PART;
+ }
+ return tSTRING_PART;
+ }
+ tokadd(p, '#');
+ pushback(p, c);
+ continue;
+ }
+ if ((type & STR_FUNC_ARRAY) && ISSPACE(c)) {
+ if (toklen(p) == 0) {
+ do {
+ if (c == '\n') {
+ p->lineno++;
+ p->column = 0;
+ heredoc_treat_nextline(p);
+ if (p->parsing_heredoc != NULL) {
+ return tHD_LITERAL_DELIM;
+ }
+ }
+ c = nextc(p);
+ } while (ISSPACE(c));
+ pushback(p, c);
+ return tLITERAL_DELIM;
+ }
+ else {
+ pushback(p, c);
+ tokfix(p);
+ pylval.nd = new_str(p, tok(p), toklen(p));
+ return tSTRING_MID;
+ }
+ }
+ if (c == '\n') {
+ p->lineno++;
+ p->column = 0;
+ }
+ tokadd(p, c);
+ }
+
+ tokfix(p);
+ p->lstate = EXPR_ENDARG;
+ end_strterm(p);
+
+ if (type & STR_FUNC_XQUOTE) {
+ pylval.nd = new_xstr(p, tok(p), toklen(p));
+ return tXSTRING;
+ }
+
+ if (type & STR_FUNC_REGEXP) {
+ int f = 0;
+ int re_opt;
+ char *s = strndup(tok(p), toklen(p));
+ char flags[3];
+ char *flag = flags;
+ char enc = '\0';
+ char *encp;
+ char *dup;
+
+ newtok(p);
+ while (re_opt = nextc(p), re_opt >= 0 && ISALPHA(re_opt)) {
+ switch (re_opt) {
+ case 'i': f |= 1; break;
+ case 'x': f |= 2; break;
+ case 'm': f |= 4; break;
+ case 'u': f |= 16; break;
+ case 'n': f |= 32; break;
+ case 'o': break;
+ default: tokadd(p, re_opt); break;
+ }
+ }
+ pushback(p, re_opt);
+ if (toklen(p)) {
+ char msg[128];
+
+ strcpy(msg, "unknown regexp option");
+ tokfix(p);
+ if (toklen(p) > 1) {
+ strcat(msg, "s");
+ }
+ strcat(msg, " - ");
+ strncat(msg, tok(p), sizeof(msg) - strlen(msg) - 1);
+ yyerror(p, msg);
+ }
+ if (f != 0) {
+ if (f & 1) *flag++ = 'i';
+ if (f & 2) *flag++ = 'x';
+ if (f & 4) *flag++ = 'm';
+ if (f & 16) enc = 'u';
+ if (f & 32) enc = 'n';
+ }
+ if (flag > flags) {
+ dup = strndup(flags, (size_t)(flag - flags));
+ }
+ else {
+ dup = NULL;
+ }
+ if (enc) {
+ encp = strndup(&enc, 1);
+ }
+ else {
+ encp = NULL;
+ }
+ pylval.nd = new_regx(p, s, dup, encp);
+
+ return tREGEXP;
+ }
+ pylval.nd = new_str(p, tok(p), toklen(p));
+
+ return tSTRING;
+}
+
+static int
+number_literal_suffix(parser_state *p)
+{
+ int c, result = 0;
+ node *list = 0;
+ int column = p->column;
+ int mask = NUM_SUFFIX_R|NUM_SUFFIX_I;
+
+ while ((c = nextc(p)) != -1) {
+ list = push(list, (node*)(intptr_t)c);
+
+ if ((mask & NUM_SUFFIX_I) && c == 'i') {
+ result |= (mask & NUM_SUFFIX_I);
+ mask &= ~NUM_SUFFIX_I;
+ /* r after i, rational of complex is disallowed */
+ mask &= ~NUM_SUFFIX_R;
+ continue;
+ }
+ if ((mask & NUM_SUFFIX_R) && c == 'r') {
+ result |= (mask & NUM_SUFFIX_R);
+ mask &= ~NUM_SUFFIX_R;
+ continue;
+ }
+ if (!ISASCII(c) || ISALPHA(c) || c == '_') {
+ p->column = column;
+ if (p->pb) {
+ p->pb = append((node*)list, p->pb);
+ }
+ else {
+ p->pb = list;
+ }
+ return 0;
+ }
+ pushback(p, c);
+ break;
+ }
+ return result;
+}
+
+static int
+heredoc_identifier(parser_state *p)
+{
+ int c;
+ int type = str_heredoc;
+ mrb_bool indent = FALSE;
+ mrb_bool quote = FALSE;
+ node *newnode;
+ parser_heredoc_info *info;
+
+ c = nextc(p);
+ if (ISSPACE(c) || c == '=') {
+ pushback(p, c);
+ return 0;
+ }
+ if (c == '-') {
+ indent = TRUE;
+ c = nextc(p);
+ }
+ if (c == '\'' || c == '"') {
+ int term = c;
+ if (c == '\'')
+ quote = TRUE;
+ newtok(p);
+ while ((c = nextc(p)) >= 0 && c != term) {
+ if (c == '\n') {
+ c = -1;
+ break;
+ }
+ tokadd(p, c);
+ }
+ if (c < 0) {
+ yyerror(p, "unterminated here document identifier");
+ return 0;
+ }
+ }
+ else {
+ if (c < 0) {
+ return 0; /* missing here document identifier */
+ }
+ if (! identchar(c)) {
+ pushback(p, c);
+ if (indent) pushback(p, '-');
+ return 0;
+ }
+ newtok(p);
+ do {
+ tokadd(p, c);
+ } while ((c = nextc(p)) >= 0 && identchar(c));
+ pushback(p, c);
+ }
+ tokfix(p);
+ newnode = new_heredoc(p);
+ info = (parser_heredoc_info*)newnode->cdr;
+ info->term = strndup(tok(p), toklen(p));
+ info->term_len = toklen(p);
+ if (! quote)
+ type |= STR_FUNC_EXPAND;
+ info->type = (string_type)type;
+ info->allow_indent = indent;
+ info->line_head = TRUE;
+ info->doc = NULL;
+ p->heredocs_from_nextline = push(p->heredocs_from_nextline, newnode);
+ p->lstate = EXPR_END;
+
+ pylval.nd = newnode;
+ return tHEREDOC_BEG;
+}
+
+static int
+arg_ambiguous(parser_state *p)
+{
+ yywarning(p, "ambiguous first argument; put parentheses or even spaces");
+ return 1;
+}
+
+#include "lex.def"
+
+static int
+parser_yylex(parser_state *p)
+{
+ int32_t c;
+ int nlines = 1;
+ int space_seen = 0;
+ int cmd_state;
+ enum mrb_lex_state_enum last_state;
+ int token_column;
+
+ if (p->lex_strterm) {
+ if (is_strterm_type(p, STR_FUNC_HEREDOC)) {
+ if (p->parsing_heredoc != NULL)
+ return parse_string(p);
+ }
+ else
+ return parse_string(p);
+ }
+ cmd_state = p->cmd_start;
+ p->cmd_start = FALSE;
+ retry:
+ last_state = p->lstate;
+ switch (c = nextc(p)) {
+ case '\004': /* ^D */
+ case '\032': /* ^Z */
+ case '\0': /* NUL */
+ case -1: /* end of script. */
+ if (p->heredocs_from_nextline)
+ goto maybe_heredoc;
+ return 0;
+
+ /* white spaces */
+ case ' ': case '\t': case '\f': case '\r':
+ case '\13': /* '\v' */
+ space_seen = 1;
+ goto retry;
+
+ case '#': /* it's a comment */
+ skip(p, '\n');
+ /* fall through */
+ case -2: /* end of a file */
+ case '\n':
+ maybe_heredoc:
+ heredoc_treat_nextline(p);
+ p->column = 0;
+ switch (p->lstate) {
+ case EXPR_BEG:
+ case EXPR_FNAME:
+ case EXPR_DOT:
+ case EXPR_CLASS:
+ case EXPR_VALUE:
+ p->lineno++;
+ if (p->parsing_heredoc != NULL) {
+ if (p->lex_strterm) {
+ return parse_string(p);
+ }
+ }
+ goto retry;
+ default:
+ break;
+ }
+ if (p->parsing_heredoc != NULL) {
+ pylval.num = nlines;
+ return '\n';
+ }
+ while ((c = nextc(p))) {
+ switch (c) {
+ case ' ': case '\t': case '\f': case '\r':
+ case '\13': /* '\v' */
+ space_seen = 1;
+ break;
+ case '#': /* comment as a whitespace */
+ skip(p, '\n');
+ nlines++;
+ break;
+ case '.':
+ if (!peek(p, '.')) {
+ pushback(p, '.');
+ p->lineno+=nlines; nlines=1;
+ goto retry;
+ }
+ pushback(p, c);
+ goto normal_newline;
+ case '&':
+ if (peek(p, '.')) {
+ pushback(p, '&');
+ p->lineno+=nlines; nlines=1;
+ goto retry;
+ }
+ pushback(p, c);
+ goto normal_newline;
+ case -1: /* EOF */
+ case -2: /* end of a file */
+ goto normal_newline;
+ default:
+ pushback(p, c);
+ goto normal_newline;
+ }
+ }
+ normal_newline:
+ p->cmd_start = TRUE;
+ p->lstate = EXPR_BEG;
+ pylval.num = nlines;
+ return '\n';
+
+ case '*':
+ if ((c = nextc(p)) == '*') {
+ if ((c = nextc(p)) == '=') {
+ pylval.id = intern_lit("**");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ pushback(p, c);
+ if (IS_SPCARG(c)) {
+ yywarning(p, "'**' interpreted as argument prefix");
+ c = tDSTAR;
+ }
+ else if (IS_BEG()) {
+ c = tDSTAR;
+ }
+ else {
+ c = tPOW; /* "**", "argument prefix" */
+ }
+ }
+ else {
+ if (c == '=') {
+ pylval.id = intern_lit("*");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ pushback(p, c);
+ if (IS_SPCARG(c)) {
+ yywarning(p, "'*' interpreted as argument prefix");
+ c = tSTAR;
+ }
+ else if (IS_BEG()) {
+ c = tSTAR;
+ }
+ else {
+ c = '*';
+ }
+ }
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ }
+ return c;
+
+ case '!':
+ c = nextc(p);
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ if (c == '@') {
+ return '!';
+ }
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ }
+ if (c == '=') {
+ return tNEQ;
+ }
+ if (c == '~') {
+ return tNMATCH;
+ }
+ pushback(p, c);
+ return '!';
+
+ case '=':
+ if (p->column == 1) {
+ static const char begin[] = "begin";
+ static const char end[] = "\n=end";
+ if (peeks(p, begin)) {
+ c = peekc_n(p, sizeof(begin)-1);
+ if (c < 0 || ISSPACE(c)) {
+ do {
+ if (!skips(p, end)) {
+ yyerror(p, "embedded document meets end of file");
+ return 0;
+ }
+ c = nextc(p);
+ } while (!(c < 0 || ISSPACE(c)));
+ if (c != '\n') skip(p, '\n');
+ p->lineno+=nlines; nlines=1;
+ p->column = 0;
+ goto retry;
+ }
+ }
+ }
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ }
+ if ((c = nextc(p)) == '=') {
+ if ((c = nextc(p)) == '=') {
+ return tEQQ;
+ }
+ pushback(p, c);
+ return tEQ;
+ }
+ if (c == '~') {
+ return tMATCH;
+ }
+ else if (c == '>') {
+ return tASSOC;
+ }
+ pushback(p, c);
+ return '=';
+
+ case '<':
+ c = nextc(p);
+ if (c == '<' &&
+ p->lstate != EXPR_DOT &&
+ p->lstate != EXPR_CLASS &&
+ !IS_END() &&
+ (!IS_ARG() || space_seen)) {
+ int token = heredoc_identifier(p);
+ if (token)
+ return token;
+ }
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ if (p->lstate == EXPR_CLASS) {
+ p->cmd_start = TRUE;
+ }
+ }
+ if (c == '=') {
+ if ((c = nextc(p)) == '>') {
+ return tCMP;
+ }
+ pushback(p, c);
+ return tLEQ;
+ }
+ if (c == '<') {
+ if ((c = nextc(p)) == '=') {
+ pylval.id = intern_lit("<<");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ pushback(p, c);
+ return tLSHFT;
+ }
+ pushback(p, c);
+ return '<';
+
+ case '>':
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ }
+ if ((c = nextc(p)) == '=') {
+ return tGEQ;
+ }
+ if (c == '>') {
+ if ((c = nextc(p)) == '=') {
+ pylval.id = intern_lit(">>");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ pushback(p, c);
+ return tRSHFT;
+ }
+ pushback(p, c);
+ return '>';
+
+ case '"':
+ p->lex_strterm = new_strterm(p, str_dquote, '"', 0);
+ return tSTRING_BEG;
+
+ case '\'':
+ p->lex_strterm = new_strterm(p, str_squote, '\'', 0);
+ return parse_string(p);
+
+ case '`':
+ if (p->lstate == EXPR_FNAME) {
+ p->lstate = EXPR_ENDFN;
+ return '`';
+ }
+ if (p->lstate == EXPR_DOT) {
+ if (cmd_state)
+ p->lstate = EXPR_CMDARG;
+ else
+ p->lstate = EXPR_ARG;
+ return '`';
+ }
+ p->lex_strterm = new_strterm(p, str_xquote, '`', 0);
+ return tXSTRING_BEG;
+
+ case '?':
+ if (IS_END()) {
+ p->lstate = EXPR_VALUE;
+ return '?';
+ }
+ c = nextc(p);
+ if (c < 0) {
+ yyerror(p, "incomplete character syntax");
+ return 0;
+ }
+ if (ISSPACE(c)) {
+ if (!IS_ARG()) {
+ int c2;
+ switch (c) {
+ case ' ':
+ c2 = 's';
+ break;
+ case '\n':
+ c2 = 'n';
+ break;
+ case '\t':
+ c2 = 't';
+ break;
+ case '\v':
+ c2 = 'v';
+ break;
+ case '\r':
+ c2 = 'r';
+ break;
+ case '\f':
+ c2 = 'f';
+ break;
+ default:
+ c2 = 0;
+ break;
+ }
+ if (c2) {
+ char buf[256];
+ char cc[] = { (char)c2, '\0' };
+
+ strcpy(buf, "invalid character syntax; use ?\\");
+ strncat(buf, cc, 2);
+ yyerror(p, buf);
+ }
+ }
+ ternary:
+ pushback(p, c);
+ p->lstate = EXPR_VALUE;
+ return '?';
+ }
+ newtok(p);
+ /* need support UTF-8 if configured */
+ if ((ISALNUM(c) || c == '_')) {
+ int c2 = nextc(p);
+ pushback(p, c2);
+ if ((ISALNUM(c2) || c2 == '_')) {
+ goto ternary;
+ }
+ }
+ if (c == '\\') {
+ c = read_escape(p);
+ tokadd(p, c);
+ }
+ else {
+ tokadd(p, c);
+ }
+ tokfix(p);
+ pylval.nd = new_str(p, tok(p), toklen(p));
+ p->lstate = EXPR_ENDARG;
+ return tCHAR;
+
+ case '&':
+ if ((c = nextc(p)) == '&') {
+ p->lstate = EXPR_BEG;
+ if ((c = nextc(p)) == '=') {
+ pylval.id = intern_lit("&&");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ pushback(p, c);
+ return tANDOP;
+ }
+ else if (c == '.') {
+ p->lstate = EXPR_DOT;
+ return tANDDOT;
+ }
+ else if (c == '=') {
+ pylval.id = intern_lit("&");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ pushback(p, c);
+ if (IS_SPCARG(c)) {
+ yywarning(p, "'&' interpreted as argument prefix");
+ c = tAMPER;
+ }
+ else if (IS_BEG()) {
+ c = tAMPER;
+ }
+ else {
+ c = '&';
+ }
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ }
+ return c;
+
+ case '|':
+ if ((c = nextc(p)) == '|') {
+ p->lstate = EXPR_BEG;
+ if ((c = nextc(p)) == '=') {
+ pylval.id = intern_lit("||");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ pushback(p, c);
+ return tOROP;
+ }
+ if (c == '=') {
+ pylval.id = intern_lit("|");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ }
+ pushback(p, c);
+ return '|';
+
+ case '+':
+ c = nextc(p);
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ if (c == '@') {
+ return tUPLUS;
+ }
+ pushback(p, c);
+ return '+';
+ }
+ if (c == '=') {
+ pylval.id = intern_lit("+");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous(p))) {
+ p->lstate = EXPR_BEG;
+ pushback(p, c);
+ if (c >= 0 && ISDIGIT(c)) {
+ c = '+';
+ goto start_num;
+ }
+ return tUPLUS;
+ }
+ p->lstate = EXPR_BEG;
+ pushback(p, c);
+ return '+';
+
+ case '-':
+ c = nextc(p);
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ if (c == '@') {
+ return tUMINUS;
+ }
+ pushback(p, c);
+ return '-';
+ }
+ if (c == '=') {
+ pylval.id = intern_lit("-");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ if (c == '>') {
+ p->lstate = EXPR_ENDFN;
+ return tLAMBDA;
+ }
+ if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous(p))) {
+ p->lstate = EXPR_BEG;
+ pushback(p, c);
+ if (c >= 0 && ISDIGIT(c)) {
+ return tUMINUS_NUM;
+ }
+ return tUMINUS;
+ }
+ p->lstate = EXPR_BEG;
+ pushback(p, c);
+ return '-';
+
+ case '.':
+ p->lstate = EXPR_BEG;
+ if ((c = nextc(p)) == '.') {
+ if ((c = nextc(p)) == '.') {
+ return tDOT3;
+ }
+ pushback(p, c);
+ return tDOT2;
+ }
+ pushback(p, c);
+ if (c >= 0 && ISDIGIT(c)) {
+ yyerror(p, "no .<digit> floating literal anymore; put 0 before dot");
+ }
+ p->lstate = EXPR_DOT;
+ return '.';
+
+ start_num:
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ {
+ int is_float, seen_point, seen_e, nondigit;
+ int suffix = 0;
+
+ is_float = seen_point = seen_e = nondigit = 0;
+ p->lstate = EXPR_ENDARG;
+ newtok(p);
+ if (c == '-' || c == '+') {
+ tokadd(p, c);
+ c = nextc(p);
+ }
+ if (c == '0') {
+#define no_digits() do {yyerror(p,"numeric literal without digits"); return 0;} while (0)
+ int start = toklen(p);
+ c = nextc(p);
+ if (c == 'x' || c == 'X') {
+ /* hexadecimal */
+ c = nextc(p);
+ if (c >= 0 && ISXDIGIT(c)) {
+ do {
+ if (c == '_') {
+ if (nondigit) break;
+ nondigit = c;
+ continue;
+ }
+ if (!ISXDIGIT(c)) break;
+ nondigit = 0;
+ tokadd(p, tolower(c));
+ } while ((c = nextc(p)) >= 0);
+ }
+ pushback(p, c);
+ tokfix(p);
+ if (toklen(p) == start) {
+ no_digits();
+ }
+ else if (nondigit) goto trailing_uc;
+ suffix = number_literal_suffix(p);
+ pylval.nd = new_int(p, tok(p), 16, suffix);
+ return tINTEGER;
+ }
+ if (c == 'b' || c == 'B') {
+ /* binary */
+ c = nextc(p);
+ if (c == '0' || c == '1') {
+ do {
+ if (c == '_') {
+ if (nondigit) break;
+ nondigit = c;
+ continue;
+ }
+ if (c != '0' && c != '1') break;
+ nondigit = 0;
+ tokadd(p, c);
+ } while ((c = nextc(p)) >= 0);
+ }
+ pushback(p, c);
+ tokfix(p);
+ if (toklen(p) == start) {
+ no_digits();
+ }
+ else if (nondigit) goto trailing_uc;
+ suffix = number_literal_suffix(p);
+ pylval.nd = new_int(p, tok(p), 2, suffix);
+ return tINTEGER;
+ }
+ if (c == 'd' || c == 'D') {
+ /* decimal */
+ c = nextc(p);
+ if (c >= 0 && ISDIGIT(c)) {
+ do {
+ if (c == '_') {
+ if (nondigit) break;
+ nondigit = c;
+ continue;
+ }
+ if (!ISDIGIT(c)) break;
+ nondigit = 0;
+ tokadd(p, c);
+ } while ((c = nextc(p)) >= 0);
+ }
+ pushback(p, c);
+ tokfix(p);
+ if (toklen(p) == start) {
+ no_digits();
+ }
+ else if (nondigit) goto trailing_uc;
+ suffix = number_literal_suffix(p);
+ pylval.nd = new_int(p, tok(p), 10, suffix);
+ return tINTEGER;
+ }
+ if (c == '_') {
+ /* 0_0 */
+ goto octal_number;
+ }
+ if (c == 'o' || c == 'O') {
+ /* prefixed octal */
+ c = nextc(p);
+ if (c < 0 || c == '_' || !ISDIGIT(c)) {
+ no_digits();
+ }
+ }
+ if (c >= '0' && c <= '7') {
+ /* octal */
+ octal_number:
+ do {
+ if (c == '_') {
+ if (nondigit) break;
+ nondigit = c;
+ continue;
+ }
+ if (c < '0' || c > '9') break;
+ if (c > '7') goto invalid_octal;
+ nondigit = 0;
+ tokadd(p, c);
+ } while ((c = nextc(p)) >= 0);
+
+ if (toklen(p) > start) {
+ pushback(p, c);
+ tokfix(p);
+ if (nondigit) goto trailing_uc;
+ suffix = number_literal_suffix(p);
+ pylval.nd = new_int(p, tok(p), 8, suffix);
+ return tINTEGER;
+ }
+ if (nondigit) {
+ pushback(p, c);
+ goto trailing_uc;
+ }
+ }
+ if (c > '7' && c <= '9') {
+ invalid_octal:
+ yyerror(p, "Invalid octal digit");
+ }
+ else if (c == '.' || c == 'e' || c == 'E') {
+ tokadd(p, '0');
+ }
+ else {
+ pushback(p, c);
+ suffix = number_literal_suffix(p);
+ pylval.nd = new_int(p, "0", 10, suffix);
+ return tINTEGER;
+ }
+ }
+
+ for (;;) {
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ nondigit = 0;
+ tokadd(p, c);
+ break;
+
+ case '.':
+ if (nondigit) goto trailing_uc;
+ if (seen_point || seen_e) {
+ goto decode_num;
+ }
+ else {
+ int c0 = nextc(p);
+ if (c0 < 0 || !ISDIGIT(c0)) {
+ pushback(p, c0);
+ goto decode_num;
+ }
+ c = c0;
+ }
+ tokadd(p, '.');
+ tokadd(p, c);
+ is_float++;
+ seen_point++;
+ nondigit = 0;
+ break;
+
+ case 'e':
+ case 'E':
+ if (nondigit) {
+ pushback(p, c);
+ c = nondigit;
+ goto decode_num;
+ }
+ if (seen_e) {
+ goto decode_num;
+ }
+ tokadd(p, c);
+ seen_e++;
+ is_float++;
+ nondigit = c;
+ c = nextc(p);
+ if (c != '-' && c != '+') continue;
+ tokadd(p, c);
+ nondigit = c;
+ break;
+
+ case '_': /* '_' in number just ignored */
+ if (nondigit) goto decode_num;
+ nondigit = c;
+ break;
+
+ default:
+ goto decode_num;
+ }
+ c = nextc(p);
+ }
+
+ decode_num:
+ pushback(p, c);
+ if (nondigit) {
+ trailing_uc:
+ yyerror_c(p, "trailing non digit in number: ", (char)nondigit);
+ }
+ tokfix(p);
+ if (is_float) {
+#ifdef MRB_WITHOUT_FLOAT
+ yywarning_s(p, "floating point numbers are not supported", tok(p));
+ pylval.nd = new_int(p, "0", 10, 0);
+ return tINTEGER;
+#else
+ double d;
+ char *endp;
+
+ errno = 0;
+ d = mrb_float_read(tok(p), &endp);
+ if (d == 0 && endp == tok(p)) {
+ yywarning_s(p, "corrupted float value", tok(p));
+ }
+ else if (errno == ERANGE) {
+ yywarning_s(p, "float out of range", tok(p));
+ errno = 0;
+ }
+ suffix = number_literal_suffix(p);
+ pylval.nd = new_float(p, tok(p), suffix);
+ return tFLOAT;
+#endif
+ }
+ suffix = number_literal_suffix(p);
+ pylval.nd = new_int(p, tok(p), 10, suffix);
+ return tINTEGER;
+ }
+
+ case ')':
+ case ']':
+ p->paren_nest--;
+ /* fall through */
+ case '}':
+ COND_LEXPOP();
+ CMDARG_LEXPOP();
+ if (c == ')')
+ p->lstate = EXPR_ENDFN;
+ else
+ p->lstate = EXPR_END;
+ return c;
+
+ case ':':
+ c = nextc(p);
+ if (c == ':') {
+ if (IS_BEG() || p->lstate == EXPR_CLASS || IS_SPCARG(-1)) {
+ p->lstate = EXPR_BEG;
+ return tCOLON3;
+ }
+ p->lstate = EXPR_DOT;
+ return tCOLON2;
+ }
+ if (!space_seen && IS_END()) {
+ pushback(p, c);
+ p->lstate = EXPR_BEG;
+ return tLABEL_TAG;
+ }
+ if (!ISSPACE(c) || IS_BEG()) {
+ pushback(p, c);
+ p->lstate = EXPR_FNAME;
+ return tSYMBEG;
+ }
+ pushback(p, c);
+ p->lstate = EXPR_BEG;
+ return ':';
+
+ case '/':
+ if (IS_BEG()) {
+ p->lex_strterm = new_strterm(p, str_regexp, '/', 0);
+ return tREGEXP_BEG;
+ }
+ if ((c = nextc(p)) == '=') {
+ pylval.id = intern_lit("/");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ pushback(p, c);
+ if (IS_SPCARG(c)) {
+ p->lex_strterm = new_strterm(p, str_regexp, '/', 0);
+ return tREGEXP_BEG;
+ }
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ }
+ return '/';
+
+ case '^':
+ if ((c = nextc(p)) == '=') {
+ pylval.id = intern_lit("^");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ }
+ pushback(p, c);
+ return '^';
+
+ case ';':
+ p->lstate = EXPR_BEG;
+ return ';';
+
+ case ',':
+ p->lstate = EXPR_BEG;
+ return ',';
+
+ case '~':
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ if ((c = nextc(p)) != '@') {
+ pushback(p, c);
+ }
+ p->lstate = EXPR_ARG;
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ }
+ return '~';
+
+ case '(':
+ if (IS_BEG()) {
+ c = tLPAREN;
+ }
+ else if (IS_SPCARG(-1)) {
+ c = tLPAREN_ARG;
+ }
+ else if (p->lstate == EXPR_END && space_seen) {
+ c = tLPAREN_ARG;
+ }
+ p->paren_nest++;
+ COND_PUSH(0);
+ CMDARG_PUSH(0);
+ p->lstate = EXPR_BEG;
+ return c;
+
+ case '[':
+ p->paren_nest++;
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ if ((c = nextc(p)) == ']') {
+ if ((c = nextc(p)) == '=') {
+ return tASET;
+ }
+ pushback(p, c);
+ return tAREF;
+ }
+ pushback(p, c);
+ return '[';
+ }
+ else if (IS_BEG()) {
+ c = tLBRACK;
+ }
+ else if (IS_ARG() && space_seen) {
+ c = tLBRACK;
+ }
+ p->lstate = EXPR_BEG;
+ COND_PUSH(0);
+ CMDARG_PUSH(0);
+ return c;
+
+ case '{':
+ if (p->lpar_beg && p->lpar_beg == p->paren_nest) {
+ p->lstate = EXPR_BEG;
+ p->lpar_beg = 0;
+ p->paren_nest--;
+ COND_PUSH(0);
+ CMDARG_PUSH(0);
+ return tLAMBEG;
+ }
+ if (IS_ARG() || p->lstate == EXPR_END || p->lstate == EXPR_ENDFN)
+ c = '{'; /* block (primary) */
+ else if (p->lstate == EXPR_ENDARG)
+ c = tLBRACE_ARG; /* block (expr) */
+ else
+ c = tLBRACE; /* hash */
+ COND_PUSH(0);
+ CMDARG_PUSH(0);
+ p->lstate = EXPR_BEG;
+ return c;
+
+ case '\\':
+ c = nextc(p);
+ if (c == '\n') {
+ p->lineno+=nlines; nlines=1;
+ p->column = 0;
+ space_seen = 1;
+ goto retry; /* skip \\n */
+ }
+ pushback(p, c);
+ return '\\';
+
+ case '%':
+ if (IS_BEG()) {
+ int term;
+ int paren;
+
+ c = nextc(p);
+ quotation:
+ if (c < 0 || !ISALNUM(c)) {
+ term = c;
+ c = 'Q';
+ }
+ else {
+ term = nextc(p);
+ if (ISALNUM(term)) {
+ yyerror(p, "unknown type of %string");
+ return 0;
+ }
+ }
+ if (c < 0 || term < 0) {
+ yyerror(p, "unterminated quoted string meets end of file");
+ return 0;
+ }
+ paren = term;
+ if (term == '(') term = ')';
+ else if (term == '[') term = ']';
+ else if (term == '{') term = '}';
+ else if (term == '<') term = '>';
+ else paren = 0;
+
+ switch (c) {
+ case 'Q':
+ p->lex_strterm = new_strterm(p, str_dquote, term, paren);
+ return tSTRING_BEG;
+
+ case 'q':
+ p->lex_strterm = new_strterm(p, str_squote, term, paren);
+ return parse_string(p);
+
+ case 'W':
+ p->lex_strterm = new_strterm(p, str_dword, term, paren);
+ return tWORDS_BEG;
+
+ case 'w':
+ p->lex_strterm = new_strterm(p, str_sword, term, paren);
+ return tWORDS_BEG;
+
+ case 'x':
+ p->lex_strterm = new_strterm(p, str_xquote, term, paren);
+ return tXSTRING_BEG;
+
+ case 'r':
+ p->lex_strterm = new_strterm(p, str_regexp, term, paren);
+ return tREGEXP_BEG;
+
+ case 's':
+ p->lex_strterm = new_strterm(p, str_ssym, term, paren);
+ return tSYMBEG;
+
+ case 'I':
+ p->lex_strterm = new_strterm(p, str_dsymbols, term, paren);
+ return tSYMBOLS_BEG;
+
+ case 'i':
+ p->lex_strterm = new_strterm(p, str_ssymbols, term, paren);
+ return tSYMBOLS_BEG;
+
+ default:
+ yyerror(p, "unknown type of %string");
+ return 0;
+ }
+ }
+ if ((c = nextc(p)) == '=') {
+ pylval.id = intern_lit("%");
+ p->lstate = EXPR_BEG;
+ return tOP_ASGN;
+ }
+ if (IS_SPCARG(c)) {
+ goto quotation;
+ }
+ if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) {
+ p->lstate = EXPR_ARG;
+ }
+ else {
+ p->lstate = EXPR_BEG;
+ }
+ pushback(p, c);
+ return '%';
+
+ case '$':
+ p->lstate = EXPR_END;
+ token_column = newtok(p);
+ c = nextc(p);
+ if (c < 0) {
+ yyerror(p, "incomplete global variable syntax");
+ return 0;
+ }
+ switch (c) {
+ case '_': /* $_: last read line string */
+ c = nextc(p);
+ if (c >= 0 && identchar(c)) { /* if there is more after _ it is a variable */
+ tokadd(p, '$');
+ tokadd(p, c);
+ break;
+ }
+ pushback(p, c);
+ c = '_';
+ /* fall through */
+ case '~': /* $~: match-data */
+ case '*': /* $*: argv */
+ case '$': /* $$: pid */
+ case '?': /* $?: last status */
+ case '!': /* $!: error string */
+ case '@': /* $@: error position */
+ case '/': /* $/: input record separator */
+ case '\\': /* $\: output record separator */
+ case ';': /* $;: field separator */
+ case ',': /* $,: output field separator */
+ case '.': /* $.: last read line number */
+ case '=': /* $=: ignorecase */
+ case ':': /* $:: load path */
+ case '<': /* $<: reading filename */
+ case '>': /* $>: default output handle */
+ case '\"': /* $": already loaded files */
+ tokadd(p, '$');
+ tokadd(p, c);
+ tokfix(p);
+ pylval.id = intern(tok(p), toklen(p));
+ return tGVAR;
+
+ case '-':
+ tokadd(p, '$');
+ tokadd(p, c);
+ c = nextc(p);
+ pushback(p, c);
+ gvar:
+ tokfix(p);
+ pylval.id = intern(tok(p), toklen(p));
+ return tGVAR;
+
+ case '&': /* $&: last match */
+ case '`': /* $`: string before last match */
+ case '\'': /* $': string after last match */
+ case '+': /* $+: string matches last pattern */
+ if (last_state == EXPR_FNAME) {
+ tokadd(p, '$');
+ tokadd(p, c);
+ goto gvar;
+ }
+ pylval.nd = new_back_ref(p, c);
+ return tBACK_REF;
+
+ case '1': case '2': case '3':
+ case '4': case '5': case '6':
+ case '7': case '8': case '9':
+ do {
+ tokadd(p, c);
+ c = nextc(p);
+ } while (c >= 0 && ISDIGIT(c));
+ pushback(p, c);
+ if (last_state == EXPR_FNAME) goto gvar;
+ tokfix(p);
+ {
+ unsigned long n = strtoul(tok(p), NULL, 10);
+ if (n > INT_MAX) {
+ yyerror(p, "capture group index must be <= " MRB_STRINGIZE(INT_MAX));
+ return 0;
+ }
+ pylval.nd = new_nth_ref(p, (int)n);
+ }
+ return tNTH_REF;
+
+ default:
+ if (!identchar(c)) {
+ pushback(p, c);
+ return '$';
+ }
+ /* fall through */
+ case '0':
+ tokadd(p, '$');
+ }
+ break;
+
+ case '@':
+ c = nextc(p);
+ token_column = newtok(p);
+ tokadd(p, '@');
+ if (c == '@') {
+ tokadd(p, '@');
+ c = nextc(p);
+ }
+ if (c < 0) {
+ if (p->tidx == 1) {
+ yyerror(p, "incomplete instance variable syntax");
+ }
+ else {
+ yyerror(p, "incomplete class variable syntax");
+ }
+ return 0;
+ }
+ else if (ISDIGIT(c)) {
+ if (p->tidx == 1) {
+ yyerror_c(p, "wrong instance variable name: @", c);
+ }
+ else {
+ yyerror_c(p, "wrong class variable name: @@", c);
+ }
+ return 0;
+ }
+ if (!identchar(c)) {
+ pushback(p, c);
+ return '@';
+ }
+ break;
+
+ case '_':
+ token_column = newtok(p);
+ break;
+
+ default:
+ if (!identchar(c)) {
+ char buf[36];
+ const char s[] = "Invalid char in expression: 0x";
+ const char hexdigits[] = "0123456789ABCDEF";
+
+ strcpy(buf, s);
+ buf[sizeof(s)-1] = hexdigits[(c & 0xf0) >> 4];
+ buf[sizeof(s)] = hexdigits[(c & 0x0f)];
+ buf[sizeof(s)+1] = 0;
+ yyerror(p, buf);
+ goto retry;
+ }
+
+ token_column = newtok(p);
+ break;
+ }
+
+ do {
+ tokadd(p, c);
+ c = nextc(p);
+ if (c < 0) break;
+ } while (identchar(c));
+ if (token_column == 0 && toklen(p) == 7 && (c < 0 || c == '\n') &&
+ strncmp(tok(p), "__END__", toklen(p)) == 0)
+ return -1;
+
+ switch (tok(p)[0]) {
+ case '@': case '$':
+ pushback(p, c);
+ break;
+ default:
+ if ((c == '!' || c == '?') && !peek(p, '=')) {
+ tokadd(p, c);
+ }
+ else {
+ pushback(p, c);
+ }
+ }
+ tokfix(p);
+ {
+ int result = 0;
+
+ switch (tok(p)[0]) {
+ case '$':
+ p->lstate = EXPR_END;
+ result = tGVAR;
+ break;
+ case '@':
+ p->lstate = EXPR_END;
+ if (tok(p)[1] == '@')
+ result = tCVAR;
+ else
+ result = tIVAR;
+ break;
+
+ case '_':
+ if (toklen(p) == 2 && ISDIGIT(tok(p)[1]) && p->nvars) {
+ int n = tok(p)[1] - '0';
+ int nvar;
+
+ if (n > 0) {
+ node *nvars = p->nvars->cdr;
+
+ while (nvars) {
+ nvar = intn(nvars->car);
+ if (nvar == -2) break; /* top of the scope */
+ if (nvar > 0) {
+ yywarning(p, "numbered parameter used in outer block");
+ break;
+ }
+ nvars->car = nint(-1);
+ nvars = nvars->cdr;
+ }
+ nvar = intn(p->nvars->car);
+ if (nvar == -1) {
+ yywarning(p, "numbered parameter used in inner block");
+ }
+ if (nvar >= -1) {
+ pylval.num = n;
+ p->lstate = EXPR_END;
+ return tNUMPARAM;
+ }
+ else {
+ yywarning(p, "identifier for numbered parameter; consider another name");
+ }
+ }
+ }
+ /* fall through */
+ default:
+ if (toklast(p) == '!' || toklast(p) == '?') {
+ result = tFID;
+ }
+ else {
+ if (p->lstate == EXPR_FNAME) {
+ if ((c = nextc(p)) == '=' && !peek(p, '~') && !peek(p, '>') &&
+ (!peek(p, '=') || (peek_n(p, '>', 1)))) {
+ result = tIDENTIFIER;
+ tokadd(p, c);
+ tokfix(p);
+ }
+ else {
+ pushback(p, c);
+ }
+ if ((c = nextc(p)) == '=' && !peek(p, '~') && !peek(p, '>') &&
+ (!peek(p, '=') || (peek_n(p, '>', 1)))) {
+ result = tIDENTIFIER;
+ tokadd(p, c);
+ tokfix(p);
+ }
+ else {
+ pushback(p, c);
+ }
+ }
+ if (result == 0 && ISUPPER(tok(p)[0])) {
+ result = tCONSTANT;
+ }
+ else {
+ result = tIDENTIFIER;
+ }
+ }
+
+ if (IS_LABEL_POSSIBLE()) {
+ if (IS_LABEL_SUFFIX(0)) {
+ p->lstate = EXPR_END;
+ tokfix(p);
+ pylval.id = intern(tok(p), toklen(p));
+ return tIDENTIFIER;
+ }
+ }
+ if (p->lstate != EXPR_DOT) {
+ const struct kwtable *kw;
+
+ /* See if it is a reserved word. */
+ kw = mrb_reserved_word(tok(p), toklen(p));
+ if (kw) {
+ enum mrb_lex_state_enum state = p->lstate;
+ pylval.num = p->lineno;
+ p->lstate = kw->state;
+ if (state == EXPR_FNAME) {
+ pylval.id = intern_cstr(kw->name);
+ return kw->id[0];
+ }
+ if (p->lstate == EXPR_BEG) {
+ p->cmd_start = TRUE;
+ }
+ if (kw->id[0] == keyword_do) {
+ if (p->lpar_beg && p->lpar_beg == p->paren_nest) {
+ p->lpar_beg = 0;
+ p->paren_nest--;
+ return keyword_do_LAMBDA;
+ }
+ if (COND_P()) return keyword_do_cond;
+ if (CMDARG_P() && state != EXPR_CMDARG)
+ return keyword_do_block;
+ if (state == EXPR_ENDARG || state == EXPR_BEG)
+ return keyword_do_block;
+ return keyword_do;
+ }
+ if (state == EXPR_BEG || state == EXPR_VALUE)
+ return kw->id[0];
+ else {
+ if (kw->id[0] != kw->id[1])
+ p->lstate = EXPR_BEG;
+ return kw->id[1];
+ }
+ }
+ }
+
+ if (IS_BEG() || p->lstate == EXPR_DOT || IS_ARG()) {
+ if (cmd_state) {
+ p->lstate = EXPR_CMDARG;
+ }
+ else {
+ p->lstate = EXPR_ARG;
+ }
+ }
+ else if (p->lstate == EXPR_FNAME) {
+ p->lstate = EXPR_ENDFN;
+ }
+ else {
+ p->lstate = EXPR_END;
+ }
+ }
+ {
+ mrb_sym ident = intern(tok(p), toklen(p));
+
+ pylval.id = ident;
+ if (last_state != EXPR_DOT && ISLOWER(tok(p)[0]) && local_var_p(p, ident)) {
+ p->lstate = EXPR_END;
+ }
+ }
+ return result;
+ }
+}
+
+static int
+yylex(void *lval, parser_state *p)
+{
+ p->ylval = lval;
+ return parser_yylex(p);
+}
+
+static void
+parser_init_cxt(parser_state *p, mrbc_context *cxt)
+{
+ if (!cxt) return;
+ if (cxt->filename) mrb_parser_set_filename(p, cxt->filename);
+ if (cxt->lineno) p->lineno = cxt->lineno;
+ if (cxt->syms) {
+ int i;
+
+ p->locals = cons(0,0);
+ for (i=0; i<cxt->slen; i++) {
+ local_add_f(p, cxt->syms[i]);
+ }
+ }
+ p->capture_errors = cxt->capture_errors;
+ p->no_optimize = cxt->no_optimize;
+ p->upper = cxt->upper;
+ if (cxt->partial_hook) {
+ p->cxt = cxt;
+ }
+}
+
+static void
+parser_update_cxt(parser_state *p, mrbc_context *cxt)
+{
+ node *n, *n0;
+ int i = 0;
+
+ if (!cxt) return;
+ if (intn(p->tree->car) != NODE_SCOPE) return;
+ n0 = n = p->tree->cdr->car;
+ while (n) {
+ i++;
+ n = n->cdr;
+ }
+ cxt->syms = (mrb_sym *)mrb_realloc(p->mrb, cxt->syms, i*sizeof(mrb_sym));
+ cxt->slen = i;
+ for (i=0, n=n0; n; i++,n=n->cdr) {
+ cxt->syms[i] = sym(n->car);
+ }
+}
+
+void mrb_codedump_all(mrb_state*, struct RProc*);
+void mrb_parser_dump(mrb_state *mrb, node *tree, int offset);
+
+MRB_API void
+mrb_parser_parse(parser_state *p, mrbc_context *c)
+{
+ struct mrb_jmpbuf buf1;
+ p->jmp = &buf1;
+
+ MRB_TRY(p->jmp) {
+ int n = 1;
+
+ p->cmd_start = TRUE;
+ p->in_def = p->in_single = 0;
+ p->nerr = p->nwarn = 0;
+ p->lex_strterm = NULL;
+
+ parser_init_cxt(p, c);
+
+ if (p->mrb->jmp) {
+ n = yyparse(p);
+ }
+ else {
+ struct mrb_jmpbuf buf2;
+
+ p->mrb->jmp = &buf2;
+ MRB_TRY(p->mrb->jmp) {
+ n = yyparse(p);
+ }
+ MRB_CATCH(p->mrb->jmp) {
+ p->nerr++;
+ }
+ MRB_END_EXC(p->mrb->jmp);
+ p->mrb->jmp = 0;
+ }
+ if (n != 0 || p->nerr > 0) {
+ p->tree = 0;
+ return;
+ }
+ if (!p->tree) {
+ p->tree = new_nil(p);
+ }
+ parser_update_cxt(p, c);
+ if (c && c->dump_result) {
+ mrb_parser_dump(p->mrb, p->tree, 0);
+ }
+ }
+ MRB_CATCH(p->jmp) {
+ yyerror(p, "memory allocation error");
+ p->nerr++;
+ p->tree = 0;
+ return;
+ }
+ MRB_END_EXC(p->jmp);
+}
+
+MRB_API parser_state*
+mrb_parser_new(mrb_state *mrb)
+{
+ mrb_pool *pool;
+ parser_state *p;
+ static const parser_state parser_state_zero = { 0 };
+
+ pool = mrb_pool_open(mrb);
+ if (!pool) return NULL;
+ p = (parser_state *)mrb_pool_alloc(pool, sizeof(parser_state));
+ if (!p) return NULL;
+
+ *p = parser_state_zero;
+ p->mrb = mrb;
+ p->pool = pool;
+
+ p->s = p->send = NULL;
+#ifndef MRB_DISABLE_STDIO
+ p->f = NULL;
+#endif
+
+ p->cmd_start = TRUE;
+ p->in_def = p->in_single = 0;
+
+ p->capture_errors = FALSE;
+ p->lineno = 1;
+ p->column = 0;
+#if defined(PARSER_TEST) || defined(PARSER_DEBUG)
+ yydebug = 1;
+#endif
+ p->tsiz = MRB_PARSER_TOKBUF_SIZE;
+ p->tokbuf = p->buf;
+
+ p->lex_strterm = NULL;
+ p->all_heredocs = p->parsing_heredoc = NULL;
+ p->lex_strterm_before_heredoc = NULL;
+
+ p->current_filename_index = -1;
+ p->filename_table = NULL;
+ p->filename_table_length = 0;
+
+ return p;
+}
+
+MRB_API void
+mrb_parser_free(parser_state *p) {
+ if (p->tokbuf != p->buf) {
+ mrb_free(p->mrb, p->tokbuf);
+ }
+ mrb_pool_close(p->pool);
+}
+
+MRB_API mrbc_context*
+mrbc_context_new(mrb_state *mrb)
+{
+ return (mrbc_context *)mrb_calloc(mrb, 1, sizeof(mrbc_context));
+}
+
+MRB_API void
+mrbc_context_free(mrb_state *mrb, mrbc_context *cxt)
+{
+ mrb_free(mrb, cxt->filename);
+ mrb_free(mrb, cxt->syms);
+ mrb_free(mrb, cxt);
+}
+
+MRB_API const char*
+mrbc_filename(mrb_state *mrb, mrbc_context *c, const char *s)
+{
+ if (s) {
+ size_t len = strlen(s);
+ char *p = (char *)mrb_malloc(mrb, len + 1);
+
+ memcpy(p, s, len + 1);
+ if (c->filename) {
+ mrb_free(mrb, c->filename);
+ }
+ c->filename = p;
+ }
+ return c->filename;
+}
+
+MRB_API void
+mrbc_partial_hook(mrb_state *mrb, mrbc_context *c, int (*func)(struct mrb_parser_state*), void *data)
+{
+ c->partial_hook = func;
+ c->partial_data = data;
+}
+
+MRB_API void
+mrb_parser_set_filename(struct mrb_parser_state *p, const char *f)
+{
+ mrb_sym sym;
+ size_t i;
+ mrb_sym* new_table;
+
+ sym = mrb_intern_cstr(p->mrb, f);
+ p->filename_sym = sym;
+ p->lineno = (p->filename_table_length > 0)? 0 : 1;
+
+ for (i = 0; i < p->filename_table_length; ++i) {
+ if (p->filename_table[i] == sym) {
+ p->current_filename_index = (int)i;
+ return;
+ }
+ }
+
+ if (p->filename_table_length == UINT16_MAX) {
+ yyerror(p, "too many files to compile");
+ return;
+ }
+ p->current_filename_index = p->filename_table_length++;
+
+ new_table = (mrb_sym*)parser_palloc(p, sizeof(mrb_sym) * p->filename_table_length);
+ if (p->filename_table) {
+ memmove(new_table, p->filename_table, sizeof(mrb_sym) * p->current_filename_index);
+ }
+ p->filename_table = new_table;
+ p->filename_table[p->filename_table_length - 1] = sym;
+}
+
+MRB_API mrb_sym
+mrb_parser_get_filename(struct mrb_parser_state* p, uint16_t idx) {
+ if (idx >= p->filename_table_length) return 0;
+ else {
+ return p->filename_table[idx];
+ }
+}
+
+#ifndef MRB_DISABLE_STDIO
+MRB_API parser_state*
+mrb_parse_file(mrb_state *mrb, FILE *f, mrbc_context *c)
+{
+ parser_state *p;
+
+ p = mrb_parser_new(mrb);
+ if (!p) return NULL;
+ p->s = p->send = NULL;
+ p->f = f;
+
+ mrb_parser_parse(p, c);
+ return p;
+}
+#endif
+
+MRB_API parser_state*
+mrb_parse_nstring(mrb_state *mrb, const char *s, size_t len, mrbc_context *c)
+{
+ parser_state *p;
+
+ p = mrb_parser_new(mrb);
+ if (!p) return NULL;
+ p->s = s;
+ p->send = s + len;
+
+ mrb_parser_parse(p, c);
+ return p;
+}
+
+MRB_API parser_state*
+mrb_parse_string(mrb_state *mrb, const char *s, mrbc_context *c)
+{
+ return mrb_parse_nstring(mrb, s, strlen(s), c);
+}
+
+MRB_API mrb_value
+mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c)
+{
+ struct RClass *target = mrb->object_class;
+ struct RProc *proc;
+ mrb_value v;
+ unsigned int keep = 0;
+
+ if (!p) {
+ return mrb_undef_value();
+ }
+ if (!p->tree || p->nerr) {
+ if (c) c->parser_nerr = p->nerr;
+ if (p->capture_errors) {
+ char buf[256];
+
+ strcpy(buf, "line ");
+ dump_int(p->error_buffer[0].lineno, buf+5);
+ strcat(buf, ": ");
+ strncat(buf, p->error_buffer[0].message, sizeof(buf) - strlen(buf) - 1);
+ mrb->exc = mrb_obj_ptr(mrb_exc_new(mrb, E_SYNTAX_ERROR, buf, strlen(buf)));
+ mrb_parser_free(p);
+ return mrb_undef_value();
+ }
+ else {
+ if (mrb->exc == NULL) {
+ mrb->exc = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, E_SYNTAX_ERROR, "syntax error"));
+ }
+ mrb_parser_free(p);
+ return mrb_undef_value();
+ }
+ }
+ proc = mrb_generate_code(mrb, p);
+ mrb_parser_free(p);
+ if (proc == NULL) {
+ if (mrb->exc == NULL) {
+ mrb->exc = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, E_SCRIPT_ERROR, "codegen error"));
+ }
+ return mrb_undef_value();
+ }
+ if (c) {
+ if (c->dump_result) mrb_codedump_all(mrb, proc);
+ if (c->no_exec) return mrb_obj_value(proc);
+ if (c->target_class) {
+ target = c->target_class;
+ }
+ if (c->keep_lv) {
+ keep = c->slen + 1;
+ }
+ else {
+ c->keep_lv = TRUE;
+ }
+ }
+ MRB_PROC_SET_TARGET_CLASS(proc, target);
+ if (mrb->c->ci) {
+ mrb->c->ci->target_class = target;
+ }
+ v = mrb_top_run(mrb, proc, mrb_top_self(mrb), keep);
+ if (mrb->exc) return mrb_nil_value();
+ return v;
+}
+
+#ifndef MRB_DISABLE_STDIO
+MRB_API mrb_value
+mrb_load_file_cxt(mrb_state *mrb, FILE *f, mrbc_context *c)
+{
+ return mrb_load_exec(mrb, mrb_parse_file(mrb, f, c), c);
+}
+
+MRB_API mrb_value
+mrb_load_file(mrb_state *mrb, FILE *f)
+{
+ return mrb_load_file_cxt(mrb, f, NULL);
+}
+#endif
+
+MRB_API mrb_value
+mrb_load_nstring_cxt(mrb_state *mrb, const char *s, size_t len, mrbc_context *c)
+{
+ return mrb_load_exec(mrb, mrb_parse_nstring(mrb, s, len, c), c);
+}
+
+MRB_API mrb_value
+mrb_load_nstring(mrb_state *mrb, const char *s, size_t len)
+{
+ return mrb_load_nstring_cxt(mrb, s, len, NULL);
+}
+
+MRB_API mrb_value
+mrb_load_string_cxt(mrb_state *mrb, const char *s, mrbc_context *c)
+{
+ return mrb_load_nstring_cxt(mrb, s, strlen(s), c);
+}
+
+MRB_API mrb_value
+mrb_load_string(mrb_state *mrb, const char *s)
+{
+ return mrb_load_string_cxt(mrb, s, NULL);
+}
+
+#ifndef MRB_DISABLE_STDIO
+
+static void
+dump_prefix(node *tree, int offset)
+{
+ printf("%05d ", tree->lineno);
+ while (offset--) {
+ putc(' ', stdout);
+ putc(' ', stdout);
+ }
+}
+
+static void
+dump_recur(mrb_state *mrb, node *tree, int offset)
+{
+ while (tree) {
+ mrb_parser_dump(mrb, tree->car, offset);
+ tree = tree->cdr;
+ }
+}
+
+static void
+dump_args(mrb_state *mrb, node *n, int offset)
+{
+ if (n->car) {
+ dump_prefix(n, offset+1);
+ printf("mandatory args:\n");
+ dump_recur(mrb, n->car, offset+2);
+ }
+ n = n->cdr;
+ if (n->car) {
+ dump_prefix(n, offset+1);
+ printf("optional args:\n");
+ {
+ node *n2 = n->car;
+
+ while (n2) {
+ dump_prefix(n2, offset+2);
+ printf("%s=\n", mrb_sym_name(mrb, sym(n2->car->car)));
+ mrb_parser_dump(mrb, n2->car->cdr, offset+3);
+ n2 = n2->cdr;
+ }
+ }
+ }
+ n = n->cdr;
+ if (n->car) {
+ dump_prefix(n, offset+1);
+ printf("rest=*%s\n", mrb_sym_name(mrb, sym(n->car)));
+ }
+ n = n->cdr;
+ if (n->car) {
+ dump_prefix(n, offset+1);
+ printf("post mandatory args:\n");
+ dump_recur(mrb, n->car, offset+2);
+ }
+
+ n = n->cdr;
+ if (n) {
+ mrb_assert(intn(n->car) == NODE_ARGS_TAIL);
+ mrb_parser_dump(mrb, n, offset);
+ }
+}
+
+/*
+ * This function restores the GC arena on return.
+ * For this reason, if a process that further generates an object is
+ * performed at the caller, the string pointer returned as the return
+ * value may become invalid.
+ */
+static const char*
+str_dump(mrb_state *mrb, const char *str, int len)
+{
+ mrb_int ai = mrb_gc_arena_save(mrb);
+ mrb_value s;
+# if INT_MAX > MRB_INT_MAX / 4
+ /* check maximum length with "\xNN" charactor */
+ if (len > MRB_INT_MAX / 4) {
+ len = MRB_INT_MAX / 4;
+ }
+# endif
+ s = mrb_str_new(mrb, str, (mrb_int)len);
+ s = mrb_str_dump(mrb, s);
+ mrb_gc_arena_restore(mrb, ai);
+ return RSTRING_PTR(s);
+}
+#endif
+
+void
+mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
+{
+#ifndef MRB_DISABLE_STDIO
+ int nodetype;
+
+ if (!tree) return;
+ again:
+ dump_prefix(tree, offset);
+ nodetype = intn(tree->car);
+ tree = tree->cdr;
+ switch (nodetype) {
+ case NODE_BEGIN:
+ printf("NODE_BEGIN:\n");
+ dump_recur(mrb, tree, offset+1);
+ break;
+
+ case NODE_RESCUE:
+ printf("NODE_RESCUE:\n");
+ if (tree->car) {
+ dump_prefix(tree, offset+1);
+ printf("body:\n");
+ mrb_parser_dump(mrb, tree->car, offset+2);
+ }
+ tree = tree->cdr;
+ if (tree->car) {
+ node *n2 = tree->car;
+
+ dump_prefix(n2, offset+1);
+ printf("rescue:\n");
+ while (n2) {
+ node *n3 = n2->car;
+ if (n3->car) {
+ dump_prefix(n2, offset+2);
+ printf("handle classes:\n");
+ dump_recur(mrb, n3->car, offset+3);
+ }
+ if (n3->cdr->car) {
+ dump_prefix(n3, offset+2);
+ printf("exc_var:\n");
+ mrb_parser_dump(mrb, n3->cdr->car, offset+3);
+ }
+ if (n3->cdr->cdr->car) {
+ dump_prefix(n3, offset+2);
+ printf("rescue body:\n");
+ mrb_parser_dump(mrb, n3->cdr->cdr->car, offset+3);
+ }
+ n2 = n2->cdr;
+ }
+ }
+ tree = tree->cdr;
+ if (tree->car) {
+ dump_prefix(tree, offset+1);
+ printf("else:\n");
+ mrb_parser_dump(mrb, tree->car, offset+2);
+ }
+ break;
+
+ case NODE_ENSURE:
+ printf("NODE_ENSURE:\n");
+ dump_prefix(tree, offset+1);
+ printf("body:\n");
+ mrb_parser_dump(mrb, tree->car, offset+2);
+ dump_prefix(tree, offset+1);
+ printf("ensure:\n");
+ mrb_parser_dump(mrb, tree->cdr->cdr, offset+2);
+ break;
+
+ case NODE_LAMBDA:
+ printf("NODE_LAMBDA:\n");
+ dump_prefix(tree, offset);
+ goto block;
+
+ case NODE_BLOCK:
+ block:
+ printf("NODE_BLOCK:\n");
+ tree = tree->cdr;
+ if (tree->car) {
+ dump_args(mrb, tree->car, offset+1);
+ }
+ dump_prefix(tree, offset+1);
+ printf("body:\n");
+ mrb_parser_dump(mrb, tree->cdr->car, offset+2);
+ break;
+
+ case NODE_IF:
+ printf("NODE_IF:\n");
+ dump_prefix(tree, offset+1);
+ printf("cond:\n");
+ mrb_parser_dump(mrb, tree->car, offset+2);
+ dump_prefix(tree, offset+1);
+ printf("then:\n");
+ mrb_parser_dump(mrb, tree->cdr->car, offset+2);
+ if (tree->cdr->cdr->car) {
+ dump_prefix(tree, offset+1);
+ printf("else:\n");
+ mrb_parser_dump(mrb, tree->cdr->cdr->car, offset+2);
+ }
+ break;
+
+ case NODE_AND:
+ printf("NODE_AND:\n");
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ mrb_parser_dump(mrb, tree->cdr, offset+1);
+ break;
+
+ case NODE_OR:
+ printf("NODE_OR:\n");
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ mrb_parser_dump(mrb, tree->cdr, offset+1);
+ break;
+
+ case NODE_CASE:
+ printf("NODE_CASE:\n");
+ if (tree->car) {
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ }
+ tree = tree->cdr;
+ while (tree) {
+ dump_prefix(tree, offset+1);
+ printf("case:\n");
+ dump_recur(mrb, tree->car->car, offset+2);
+ dump_prefix(tree, offset+1);
+ printf("body:\n");
+ mrb_parser_dump(mrb, tree->car->cdr, offset+2);
+ tree = tree->cdr;
+ }
+ break;
+
+ case NODE_WHILE:
+ printf("NODE_WHILE:\n");
+ dump_prefix(tree, offset+1);
+ printf("cond:\n");
+ mrb_parser_dump(mrb, tree->car, offset+2);
+ dump_prefix(tree, offset+1);
+ printf("body:\n");
+ mrb_parser_dump(mrb, tree->cdr, offset+2);
+ break;
+
+ case NODE_UNTIL:
+ printf("NODE_UNTIL:\n");
+ dump_prefix(tree, offset+1);
+ printf("cond:\n");
+ mrb_parser_dump(mrb, tree->car, offset+2);
+ dump_prefix(tree, offset+1);
+ printf("body:\n");
+ mrb_parser_dump(mrb, tree->cdr, offset+2);
+ break;
+
+ case NODE_FOR:
+ printf("NODE_FOR:\n");
+ dump_prefix(tree, offset+1);
+ printf("var:\n");
+ {
+ node *n2 = tree->car;
+
+ if (n2->car) {
+ dump_prefix(n2, offset+2);
+ printf("pre:\n");
+ dump_recur(mrb, n2->car, offset+3);
+ }
+ n2 = n2->cdr;
+ if (n2) {
+ if (n2->car) {
+ dump_prefix(n2, offset+2);
+ printf("rest:\n");
+ mrb_parser_dump(mrb, n2->car, offset+3);
+ }
+ n2 = n2->cdr;
+ if (n2) {
+ if (n2->car) {
+ dump_prefix(n2, offset+2);
+ printf("post:\n");
+ dump_recur(mrb, n2->car, offset+3);
+ }
+ }
+ }
+ }
+ tree = tree->cdr;
+ dump_prefix(tree, offset+1);
+ printf("in:\n");
+ mrb_parser_dump(mrb, tree->car, offset+2);
+ tree = tree->cdr;
+ dump_prefix(tree, offset+1);
+ printf("do:\n");
+ mrb_parser_dump(mrb, tree->car, offset+2);
+ break;
+
+ case NODE_SCOPE:
+ printf("NODE_SCOPE:\n");
+ {
+ node *n2 = tree->car;
+ mrb_bool first_lval = TRUE;
+
+ if (n2 && (n2->car || n2->cdr)) {
+ dump_prefix(n2, offset+1);
+ printf("local variables:\n");
+ dump_prefix(n2, offset+2);
+ while (n2) {
+ if (n2->car) {
+ if (!first_lval) printf(", ");
+ printf("%s", mrb_sym_name(mrb, sym(n2->car)));
+ first_lval = FALSE;
+ }
+ n2 = n2->cdr;
+ }
+ printf("\n");
+ }
+ }
+ tree = tree->cdr;
+ offset++;
+ goto again;
+
+ case NODE_FCALL:
+ case NODE_CALL:
+ case NODE_SCALL:
+ switch (nodetype) {
+ case NODE_FCALL:
+ printf("NODE_FCALL:\n"); break;
+ case NODE_CALL:
+ printf("NODE_CALL(.):\n"); break;
+ case NODE_SCALL:
+ printf("NODE_SCALL(&.):\n"); break;
+ default:
+ break;
+ }
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ dump_prefix(tree, offset+1);
+ printf("method='%s' (%d)\n",
+ mrb_sym_dump(mrb, sym(tree->cdr->car)),
+ intn(tree->cdr->car));
+ tree = tree->cdr->cdr->car;
+ if (tree) {
+ dump_prefix(tree, offset+1);
+ printf("args:\n");
+ dump_recur(mrb, tree->car, offset+2);
+ if (tree->cdr) {
+ dump_prefix(tree, offset+1);
+ printf("block:\n");
+ mrb_parser_dump(mrb, tree->cdr, offset+2);
+ }
+ }
+ break;
+
+ case NODE_DOT2:
+ printf("NODE_DOT2:\n");
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ mrb_parser_dump(mrb, tree->cdr, offset+1);
+ break;
+
+ case NODE_DOT3:
+ printf("NODE_DOT3:\n");
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ mrb_parser_dump(mrb, tree->cdr, offset+1);
+ break;
+
+ case NODE_COLON2:
+ printf("NODE_COLON2:\n");
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ dump_prefix(tree, offset+1);
+ printf("::%s\n", mrb_sym_name(mrb, sym(tree->cdr)));
+ break;
+
+ case NODE_COLON3:
+ printf("NODE_COLON3: ::%s\n", mrb_sym_name(mrb, sym(tree)));
+ break;
+
+ case NODE_ARRAY:
+ printf("NODE_ARRAY:\n");
+ dump_recur(mrb, tree, offset+1);
+ break;
+
+ case NODE_HASH:
+ printf("NODE_HASH:\n");
+ while (tree) {
+ dump_prefix(tree, offset+1);
+ printf("key:\n");
+ mrb_parser_dump(mrb, tree->car->car, offset+2);
+ dump_prefix(tree, offset+1);
+ printf("value:\n");
+ mrb_parser_dump(mrb, tree->car->cdr, offset+2);
+ tree = tree->cdr;
+ }
+ break;
+
+ case NODE_KW_HASH:
+ printf("NODE_KW_HASH:\n");
+ while (tree) {
+ dump_prefix(tree, offset+1);
+ printf("key:\n");
+ mrb_parser_dump(mrb, tree->car->car, offset+2);
+ dump_prefix(tree, offset+1);
+ printf("value:\n");
+ mrb_parser_dump(mrb, tree->car->cdr, offset+2);
+ tree = tree->cdr;
+ }
+ break;
+
+ case NODE_SPLAT:
+ printf("NODE_SPLAT:\n");
+ mrb_parser_dump(mrb, tree, offset+1);
+ break;
+
+ case NODE_ASGN:
+ printf("NODE_ASGN:\n");
+ dump_prefix(tree, offset+1);
+ printf("lhs:\n");
+ mrb_parser_dump(mrb, tree->car, offset+2);
+ dump_prefix(tree, offset+1);
+ printf("rhs:\n");
+ mrb_parser_dump(mrb, tree->cdr, offset+2);
+ break;
+
+ case NODE_MASGN:
+ printf("NODE_MASGN:\n");
+ dump_prefix(tree, offset+1);
+ printf("mlhs:\n");
+ {
+ node *n2 = tree->car;
+
+ if (n2->car) {
+ dump_prefix(tree, offset+2);
+ printf("pre:\n");
+ dump_recur(mrb, n2->car, offset+3);
+ }
+ n2 = n2->cdr;
+ if (n2) {
+ if (n2->car) {
+ dump_prefix(n2, offset+2);
+ printf("rest:\n");
+ if (n2->car == (node*)-1) {
+ dump_prefix(n2, offset+2);
+ printf("(empty)\n");
+ }
+ else {
+ mrb_parser_dump(mrb, n2->car, offset+3);
+ }
+ }
+ n2 = n2->cdr;
+ if (n2) {
+ if (n2->car) {
+ dump_prefix(n2, offset+2);
+ printf("post:\n");
+ dump_recur(mrb, n2->car, offset+3);
+ }
+ }
+ }
+ }
+ dump_prefix(tree, offset+1);
+ printf("rhs:\n");
+ mrb_parser_dump(mrb, tree->cdr, offset+2);
+ break;
+
+ case NODE_OP_ASGN:
+ printf("NODE_OP_ASGN:\n");
+ dump_prefix(tree, offset+1);
+ printf("lhs:\n");
+ mrb_parser_dump(mrb, tree->car, offset+2);
+ tree = tree->cdr;
+ dump_prefix(tree, offset+1);
+ printf("op='%s' (%d)\n", mrb_sym_name(mrb, sym(tree->car)), intn(tree->car));
+ tree = tree->cdr;
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ break;
+
+ case NODE_SUPER:
+ printf("NODE_SUPER:\n");
+ if (tree) {
+ dump_prefix(tree, offset+1);
+ printf("args:\n");
+ dump_recur(mrb, tree->car, offset+2);
+ if (tree->cdr) {
+ dump_prefix(tree, offset+1);
+ printf("block:\n");
+ mrb_parser_dump(mrb, tree->cdr, offset+2);
+ }
+ }
+ break;
+
+ case NODE_ZSUPER:
+ printf("NODE_ZSUPER\n");
+ break;
+
+ case NODE_RETURN:
+ printf("NODE_RETURN:\n");
+ mrb_parser_dump(mrb, tree, offset+1);
+ break;
+
+ case NODE_YIELD:
+ printf("NODE_YIELD:\n");
+ dump_recur(mrb, tree, offset+1);
+ break;
+
+ case NODE_BREAK:
+ printf("NODE_BREAK:\n");
+ mrb_parser_dump(mrb, tree, offset+1);
+ break;
+
+ case NODE_NEXT:
+ printf("NODE_NEXT:\n");
+ mrb_parser_dump(mrb, tree, offset+1);
+ break;
+
+ case NODE_REDO:
+ printf("NODE_REDO\n");
+ break;
+
+ case NODE_RETRY:
+ printf("NODE_RETRY\n");
+ break;
+
+ case NODE_LVAR:
+ printf("NODE_LVAR %s\n", mrb_sym_name(mrb, sym(tree)));
+ break;
+
+ case NODE_GVAR:
+ printf("NODE_GVAR %s\n", mrb_sym_name(mrb, sym(tree)));
+ break;
+
+ case NODE_IVAR:
+ printf("NODE_IVAR %s\n", mrb_sym_name(mrb, sym(tree)));
+ break;
+
+ case NODE_CVAR:
+ printf("NODE_CVAR %s\n", mrb_sym_name(mrb, sym(tree)));
+ break;
+
+ case NODE_NVAR:
+ printf("NODE_NVAR %d\n", intn(tree));
+ break;
+
+ case NODE_CONST:
+ printf("NODE_CONST %s\n", mrb_sym_name(mrb, sym(tree)));
+ break;
+
+ case NODE_MATCH:
+ printf("NODE_MATCH:\n");
+ dump_prefix(tree, offset + 1);
+ printf("lhs:\n");
+ mrb_parser_dump(mrb, tree->car, offset + 2);
+ dump_prefix(tree, offset + 1);
+ printf("rhs:\n");
+ mrb_parser_dump(mrb, tree->cdr, offset + 2);
+ break;
+
+ case NODE_BACK_REF:
+ printf("NODE_BACK_REF: $%c\n", intn(tree));
+ break;
+
+ case NODE_NTH_REF:
+ printf("NODE_NTH_REF: $%d\n", intn(tree));
+ break;
+
+ case NODE_ARG:
+ printf("NODE_ARG %s\n", mrb_sym_name(mrb, sym(tree)));
+ break;
+
+ case NODE_BLOCK_ARG:
+ printf("NODE_BLOCK_ARG:\n");
+ mrb_parser_dump(mrb, tree, offset+1);
+ break;
+
+ case NODE_INT:
+ printf("NODE_INT %s base %d\n", (char*)tree->car, intn(tree->cdr->car));
+ break;
+
+ case NODE_FLOAT:
+ printf("NODE_FLOAT %s\n", (char*)tree);
+ break;
+
+ case NODE_NEGATE:
+ printf("NODE_NEGATE:\n");
+ mrb_parser_dump(mrb, tree, offset+1);
+ break;
+
+ case NODE_STR:
+ printf("NODE_STR %s len %d\n", str_dump(mrb, (char*)tree->car, intn(tree->cdr)), intn(tree->cdr));
+ break;
+
+ case NODE_DSTR:
+ printf("NODE_DSTR:\n");
+ dump_recur(mrb, tree, offset+1);
+ break;
+
+ case NODE_XSTR:
+ printf("NODE_XSTR %s len %d\n", str_dump(mrb, (char*)tree->car, intn(tree->cdr)), intn(tree->cdr));
+ break;
+
+ case NODE_DXSTR:
+ printf("NODE_DXSTR:\n");
+ dump_recur(mrb, tree, offset+1);
+ break;
+
+ case NODE_REGX:
+ printf("NODE_REGX /%s/%s\n", (char*)tree->car, (char*)tree->cdr);
+ break;
+
+ case NODE_DREGX:
+ printf("NODE_DREGX:\n");
+ dump_recur(mrb, tree->car, offset+1);
+ dump_prefix(tree, offset);
+ printf("tail: %s\n", (char*)tree->cdr->cdr->car);
+ if (tree->cdr->cdr->cdr->car) {
+ dump_prefix(tree, offset);
+ printf("opt: %s\n", (char*)tree->cdr->cdr->cdr->car);
+ }
+ if (tree->cdr->cdr->cdr->cdr) {
+ dump_prefix(tree, offset);
+ printf("enc: %s\n", (char*)tree->cdr->cdr->cdr->cdr);
+ }
+ break;
+
+ case NODE_SYM:
+ printf("NODE_SYM :%s (%d)\n", mrb_sym_dump(mrb, sym(tree)),
+ intn(tree));
+ break;
+
+ case NODE_DSYM:
+ printf("NODE_DSYM:\n");
+ mrb_parser_dump(mrb, tree, offset+1);
+ break;
+
+ case NODE_WORDS:
+ printf("NODE_WORDS:\n");
+ dump_recur(mrb, tree, offset+1);
+ break;
+
+ case NODE_SYMBOLS:
+ printf("NODE_SYMBOLS:\n");
+ dump_recur(mrb, tree, offset+1);
+ break;
+
+ case NODE_LITERAL_DELIM:
+ printf("NODE_LITERAL_DELIM\n");
+ break;
+
+ case NODE_SELF:
+ printf("NODE_SELF\n");
+ break;
+
+ case NODE_NIL:
+ printf("NODE_NIL\n");
+ break;
+
+ case NODE_TRUE:
+ printf("NODE_TRUE\n");
+ break;
+
+ case NODE_FALSE:
+ printf("NODE_FALSE\n");
+ break;
+
+ case NODE_ALIAS:
+ printf("NODE_ALIAS %s %s:\n",
+ mrb_sym_dump(mrb, sym(tree->car)),
+ mrb_sym_dump(mrb, sym(tree->cdr)));
+ break;
+
+ case NODE_UNDEF:
+ printf("NODE_UNDEF");
+ {
+ node *t = tree;
+ while (t) {
+ printf(" %s", mrb_sym_dump(mrb, sym(t->car)));
+ t = t->cdr;
+ }
+ }
+ printf(":\n");
+ break;
+
+ case NODE_CLASS:
+ printf("NODE_CLASS:\n");
+ if (tree->car->car == (node*)0) {
+ dump_prefix(tree, offset+1);
+ printf(":%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
+ }
+ else if (tree->car->car == (node*)1) {
+ dump_prefix(tree, offset+1);
+ printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
+ }
+ else {
+ mrb_parser_dump(mrb, tree->car->car, offset+1);
+ dump_prefix(tree, offset+1);
+ printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
+ }
+ if (tree->cdr->car) {
+ dump_prefix(tree, offset+1);
+ printf("super:\n");
+ mrb_parser_dump(mrb, tree->cdr->car, offset+2);
+ }
+ dump_prefix(tree, offset+1);
+ printf("body:\n");
+ mrb_parser_dump(mrb, tree->cdr->cdr->car->cdr, offset+2);
+ break;
+
+ case NODE_MODULE:
+ printf("NODE_MODULE:\n");
+ if (tree->car->car == (node*)0) {
+ dump_prefix(tree, offset+1);
+ printf(":%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
+ }
+ else if (tree->car->car == (node*)1) {
+ dump_prefix(tree, offset+1);
+ printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
+ }
+ else {
+ mrb_parser_dump(mrb, tree->car->car, offset+1);
+ dump_prefix(tree, offset+1);
+ printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr)));
+ }
+ dump_prefix(tree, offset+1);
+ printf("body:\n");
+ mrb_parser_dump(mrb, tree->cdr->car->cdr, offset+2);
+ break;
+
+ case NODE_SCLASS:
+ printf("NODE_SCLASS:\n");
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ dump_prefix(tree, offset+1);
+ printf("body:\n");
+ mrb_parser_dump(mrb, tree->cdr->car->cdr, offset+2);
+ break;
+
+ case NODE_DEF:
+ printf("NODE_DEF:\n");
+ dump_prefix(tree, offset+1);
+ printf("%s\n", mrb_sym_dump(mrb, sym(tree->car)));
+ tree = tree->cdr;
+ {
+ node *n2 = tree->car;
+ mrb_bool first_lval = TRUE;
+
+ if (n2 && (n2->car || n2->cdr)) {
+ dump_prefix(n2, offset+1);
+ printf("local variables:\n");
+ dump_prefix(n2, offset+2);
+ while (n2) {
+ if (n2->car) {
+ if (!first_lval) printf(", ");
+ printf("%s", mrb_sym_name(mrb, sym(n2->car)));
+ first_lval = FALSE;
+ }
+ n2 = n2->cdr;
+ }
+ printf("\n");
+ }
+ }
+ tree = tree->cdr;
+ if (tree->car) {
+ dump_args(mrb, tree->car, offset);
+ }
+ mrb_parser_dump(mrb, tree->cdr->car, offset+1);
+ break;
+
+ case NODE_SDEF:
+ printf("NODE_SDEF:\n");
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ tree = tree->cdr;
+ dump_prefix(tree, offset+1);
+ printf(":%s\n", mrb_sym_dump(mrb, sym(tree->car)));
+ tree = tree->cdr->cdr;
+ if (tree->car) {
+ dump_args(mrb, tree->car, offset+1);
+ }
+ tree = tree->cdr;
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ break;
+
+ case NODE_POSTEXE:
+ printf("NODE_POSTEXE:\n");
+ mrb_parser_dump(mrb, tree, offset+1);
+ break;
+
+ case NODE_HEREDOC:
+ printf("NODE_HEREDOC (<<%s):\n", ((parser_heredoc_info*)tree)->term);
+ dump_recur(mrb, ((parser_heredoc_info*)tree)->doc, offset+1);
+ break;
+
+ case NODE_ARGS_TAIL:
+ printf("NODE_ARGS_TAIL:\n");
+ {
+ node *kws = tree->car;
+
+ while (kws) {
+ mrb_parser_dump(mrb, kws->car, offset+1);
+ kws = kws->cdr;
+ }
+ }
+ tree = tree->cdr;
+ if (tree->car) {
+ mrb_assert(intn(tree->car->car) == NODE_KW_REST_ARGS);
+ mrb_parser_dump(mrb, tree->car, offset+1);
+ }
+ tree = tree->cdr;
+ if (tree->car) {
+ dump_prefix(tree, offset+1);
+ printf("block='%s'\n", mrb_sym_name(mrb, sym(tree->car)));
+ }
+ break;
+
+ case NODE_KW_ARG:
+ printf("NODE_KW_ARG %s:\n", mrb_sym_name(mrb, sym(tree->car)));
+ mrb_parser_dump(mrb, tree->cdr->car, offset + 1);
+ break;
+
+ case NODE_KW_REST_ARGS:
+ printf("NODE_KW_REST_ARGS %s\n", mrb_sym_name(mrb, sym(tree)));
+ break;
+
+ default:
+ printf("node type: %d (0x%x)\n", nodetype, (unsigned)nodetype);
+ break;
+ }
+#endif
+}
diff --git a/mrbgems/mruby-compiler/mrbgem.rake b/mrbgems/mruby-compiler/mrbgem.rake
index fa191e69b..b25bdaff7 100644
--- a/mrbgems/mruby-compiler/mrbgem.rake
+++ b/mrbgems/mruby-compiler/mrbgem.rake
@@ -3,35 +3,33 @@ MRuby::Gem::Specification.new 'mruby-compiler' do |spec|
spec.author = 'mruby developers'
spec.summary = 'mruby compiler library'
- current_dir = spec.dir
- current_build_dir = spec.build_dir
-
- lex_def = "#{current_dir}/core/lex.def"
- core_objs = Dir.glob("#{current_dir}/core/*.c").map { |f|
+ lex_def = "#{dir}/core/lex.def"
+ core_objs = Dir.glob("#{dir}/core/*.c").map { |f|
next nil if build.cxx_exception_enabled? and f =~ /(codegen).c$/
- objfile(f.pathmap("#{current_build_dir}/core/%n"))
+ objfile(f.pathmap("#{build_dir}/core/%n"))
}.compact
if build.cxx_exception_enabled?
core_objs <<
- build.compile_as_cxx("#{current_build_dir}/core/y.tab.c", "#{current_build_dir}/core/y.tab.cxx",
- objfile("#{current_build_dir}/y.tab"), ["#{current_dir}/core"]) <<
- build.compile_as_cxx("#{current_dir}/core/codegen.c", "#{current_build_dir}/core/codegen.cxx")
+ build.compile_as_cxx("#{dir}/core/y.tab.c", "#{build_dir}/core/y.tab.cxx",
+ objfile("#{build_dir}/y.tab"), ["#{dir}/core"]) <<
+ build.compile_as_cxx("#{dir}/core/codegen.c", "#{build_dir}/core/codegen.cxx")
else
- core_objs << objfile("#{current_build_dir}/core/y.tab")
- file objfile("#{current_build_dir}/core/y.tab") => "#{current_build_dir}/core/y.tab.c" do |t|
- cc.run t.name, t.prerequisites.first, [], ["#{current_dir}/core"]
+ core_objs << objfile("#{build_dir}/core/y.tab")
+ file objfile("#{build_dir}/core/y.tab") => "#{dir}/core/y.tab.c" do |t|
+ cc.run t.name, t.prerequisites.first, [], ["#{dir}/core"]
end
end
# Parser
- file "#{current_build_dir}/core/y.tab.c" => ["#{current_dir}/core/parse.y", lex_def] do |t|
- FileUtils.mkdir_p File.dirname t.name
+ file "#{dir}/core/y.tab.c" => ["#{dir}/core/parse.y", lex_def] do |t|
yacc.run t.name, t.prerequisites.first
+ content = File.read(t.name).gsub(/^#line +\d+ +"\K.*$/){$&.relative_path}
+ File.write(t.name, content)
end
# Lexical analyzer
- file lex_def => "#{current_dir}/core/keywords" do |t|
+ file lex_def => "#{dir}/core/keywords" do |t|
gperf.run t.name, t.prerequisites.first
end
diff --git a/mrbgems/mruby-complex/mrbgem.rake b/mrbgems/mruby-complex/mrbgem.rake
index 19612e74d..8f782ae18 100644
--- a/mrbgems/mruby-complex/mrbgem.rake
+++ b/mrbgems/mruby-complex/mrbgem.rake
@@ -3,8 +3,5 @@ MRuby::Gem::Specification.new('mruby-complex') do |spec|
spec.author = 'mruby developers'
spec.summary = 'Complex class'
- spec.add_dependency 'mruby-metaprog', core: 'mruby-metaprog'
- spec.add_dependency 'mruby-object-ext', core: 'mruby-object-ext'
- spec.add_dependency 'mruby-numeric-ext', core: 'mruby-numeric-ext'
spec.add_dependency 'mruby-math', core: 'mruby-math'
end
diff --git a/mrbgems/mruby-complex/mrblib/complex.rb b/mrbgems/mruby-complex/mrblib/complex.rb
index f32b84c8b..ea8530919 100644
--- a/mrbgems/mruby-complex/mrblib/complex.rb
+++ b/mrbgems/mruby-complex/mrblib/complex.rb
@@ -8,7 +8,7 @@ class Complex < Numeric
end
def to_s
- "#{real}#{'+' unless imaginary.negative?}#{imaginary}i"
+ "#{real}#{'+' unless imaginary < 0}#{imaginary}i"
end
def +@
@@ -56,7 +56,7 @@ class Complex < Numeric
if rhs.is_a? Complex
real == rhs.real && imaginary == rhs.imaginary
elsif rhs.is_a? Numeric
- imaginary.zero? && real == rhs
+ imaginary == 0 && real == rhs
end
end
@@ -106,14 +106,14 @@ class Complex < Numeric
[Fixnum, Float].each do |cls|
[:+, :-, :*, :/, :==].each do |op|
- cls.instance_exec do
+ cls.instance_eval do
original_operator_name = "__original_operator_#{op}_complex"
alias_method original_operator_name, op
define_method op do |rhs|
if rhs.is_a? Complex
- Complex(self).send(op, rhs)
+ Complex(self).__send__(op, rhs)
else
- send(original_operator_name, rhs)
+ __send__(original_operator_name, rhs)
end
end
end
diff --git a/mrbgems/mruby-error/src/exception.c b/mrbgems/mruby-error/src/exception.c
index ec4870dc0..e0ea28ac8 100644
--- a/mrbgems/mruby-error/src/exception.c
+++ b/mrbgems/mruby-error/src/exception.c
@@ -8,7 +8,7 @@ mrb_protect(mrb_state *mrb, mrb_func_t body, mrb_value data, mrb_bool *state)
struct mrb_jmpbuf *prev_jmp = mrb->jmp;
struct mrb_jmpbuf c_jmp;
mrb_value result = mrb_nil_value();
- mrb_int ai = mrb_gc_arena_save(mrb);
+ int ai = mrb_gc_arena_save(mrb);
if (state) { *state = FALSE; }
@@ -34,7 +34,7 @@ mrb_ensure(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_func_t ensure,
struct mrb_jmpbuf *prev_jmp = mrb->jmp;
struct mrb_jmpbuf c_jmp;
mrb_value result;
- mrb_int ai = mrb_gc_arena_save(mrb);
+ int ai = mrb_gc_arena_save(mrb);
MRB_TRY(&c_jmp) {
mrb->jmp = &c_jmp;
@@ -71,7 +71,7 @@ mrb_rescue_exceptions(mrb_state *mrb, mrb_func_t body, mrb_value b_data, mrb_fun
mrb_value result;
mrb_bool error_matched = FALSE;
mrb_int i;
- mrb_int ai = mrb_gc_arena_save(mrb);
+ int ai = mrb_gc_arena_save(mrb);
MRB_TRY(&c_jmp) {
mrb->jmp = &c_jmp;
diff --git a/mrbgems/mruby-eval/src/eval.c b/mrbgems/mruby-eval/src/eval.c
index e2388f026..73e23392b 100644
--- a/mrbgems/mruby-eval/src/eval.c
+++ b/mrbgems/mruby-eval/src/eval.c
@@ -9,217 +9,6 @@
mrb_value mrb_exec_irep(mrb_state *mrb, mrb_value self, struct RProc *p);
mrb_value mrb_obj_instance_eval(mrb_state *mrb, mrb_value self);
-static struct mrb_irep *
-get_closure_irep(mrb_state *mrb, int level)
-{
- struct RProc *proc = mrb->c->ci[-1].proc;
-
- while (level--) {
- if (!proc) return NULL;
- proc = proc->upper;
- }
- if (!proc) return NULL;
- if (MRB_PROC_CFUNC_P(proc)) {
- return NULL;
- }
- return proc->body.irep;
-}
-
-/* search for irep lev above the bottom */
-static mrb_irep*
-search_irep(mrb_irep *top, int bnest, int lev, mrb_irep *bottom)
-{
- int i;
-
- for (i=0; i<top->rlen; i++) {
- mrb_irep* tmp = top->reps[i];
-
- if (tmp == bottom) return top;
- tmp = search_irep(tmp, bnest-1, lev, bottom);
- if (tmp) {
- if (bnest == lev) return top;
- return tmp;
- }
- }
- return NULL;
-}
-
-static uint16_t
-search_variable(mrb_state *mrb, mrb_sym vsym, int bnest)
-{
- mrb_irep *virep;
- int level;
- int pos;
-
- for (level = 0; (virep = get_closure_irep(mrb, level)); level++) {
- if (virep->lv == NULL) {
- continue;
- }
- for (pos = 0; pos < virep->nlocals - 1; pos++) {
- if (vsym == virep->lv[pos].name) {
- return (pos+1)<<8 | (level+bnest);
- }
- }
- }
-
- return 0;
-}
-
-static int
-irep_argc(mrb_irep *irep)
-{
- mrb_code c;
-
- c = irep->iseq[0];
- if (c == OP_ENTER) {
- mrb_aspec ax = PEEK_W(irep->iseq+1);
- /* extra 1 means a slot for block */
- return MRB_ASPEC_REQ(ax)+MRB_ASPEC_OPT(ax)+MRB_ASPEC_REST(ax)+MRB_ASPEC_POST(ax)+1;
- }
- return 0;
-}
-
-static mrb_bool
-potential_upvar_p(struct mrb_locals *lv, uint16_t v, int argc, uint16_t nlocals)
-{
- if (v >= nlocals) return FALSE;
- /* skip arguments */
- if (v < argc+1) return FALSE;
- return TRUE;
-}
-
-extern uint8_t mrb_insn_size[];
-extern uint8_t mrb_insn_size1[];
-extern uint8_t mrb_insn_size2[];
-extern uint8_t mrb_insn_size3[];
-
-static void
-patch_irep(mrb_state *mrb, mrb_irep *irep, int bnest, mrb_irep *top)
-{
- int i;
- uint32_t a;
- uint16_t b;
- uint8_t c;
- mrb_code insn;
- int argc = irep_argc(irep);
- mrb_code *iseq = (mrb_code *)irep->iseq;
-
- mrb_assert((irep->flags & MRB_ISEQ_NO_FREE) == 0);
-
- for (i = 0; i < irep->ilen; ) {
- insn = iseq[i];
- switch(insn){
- case OP_EPUSH:
- b = PEEK_S(iseq+i+1);
- patch_irep(mrb, irep->reps[b], bnest + 1, top);
- break;
-
- case OP_LAMBDA:
- case OP_BLOCK:
- a = PEEK_B(iseq+i+1);
- b = PEEK_B(iseq+i+2);
- patch_irep(mrb, irep->reps[b], bnest + 1, top);
- break;
-
- case OP_SEND:
- b = PEEK_B(iseq+i+2);
- c = PEEK_B(iseq+i+3);
- if (c != 0) {
- break;
- }
- else {
- uint16_t arg = search_variable(mrb, irep->syms[b], bnest);
- if (arg != 0) {
- /* must replace */
- iseq[i] = OP_GETUPVAR;
- iseq[i+2] = arg >> 8;
- iseq[i+3] = arg & 0xff;
- }
- }
- break;
-
- case OP_MOVE:
- a = PEEK_B(iseq+i+1);
- b = PEEK_B(iseq+i+2);
- /* src part */
- if (potential_upvar_p(irep->lv, b, argc, irep->nlocals)) {
- uint16_t arg = search_variable(mrb, irep->lv[b - 1].name, bnest);
- if (arg != 0) {
- /* must replace */
- iseq[i] = insn = OP_GETUPVAR;
- iseq[i+2] = arg >> 8;
- iseq[i+3] = arg & 0xff;
- }
- }
- /* dst part */
- if (potential_upvar_p(irep->lv, a, argc, irep->nlocals)) {
- uint16_t arg = search_variable(mrb, irep->lv[a - 1].name, bnest);
- if (arg != 0) {
- /* must replace */
- iseq[i] = insn = OP_SETUPVAR;
- iseq[i+1] = (mrb_code)b;
- iseq[i+2] = arg >> 8;
- iseq[i+3] = arg & 0xff;
- }
- }
- break;
-
- case OP_GETUPVAR:
- a = PEEK_B(iseq+i+1);
- b = PEEK_B(iseq+i+2);
- c = PEEK_B(iseq+i+3);
- {
- int lev = c+1;
- mrb_irep *tmp = search_irep(top, bnest, lev, irep);
- if (potential_upvar_p(tmp->lv, b, irep_argc(tmp), tmp->nlocals)) {
- uint16_t arg = search_variable(mrb, tmp->lv[b-1].name, bnest);
- if (arg != 0) {
- /* must replace */
- iseq[i] = OP_GETUPVAR;
- iseq[i+2] = arg >> 8;
- iseq[i+3] = arg & 0xff;
- }
- }
- }
- break;
-
- case OP_SETUPVAR:
- a = PEEK_B(iseq+i+1);
- b = PEEK_B(iseq+i+2);
- c = PEEK_B(iseq+i+3);
- {
- int lev = c+1;
- mrb_irep *tmp = search_irep(top, bnest, lev, irep);
- if (potential_upvar_p(tmp->lv, b, irep_argc(tmp), tmp->nlocals)) {
- uint16_t arg = search_variable(mrb, tmp->lv[b-1].name, bnest);
- if (arg != 0) {
- /* must replace */
- iseq[i] = OP_SETUPVAR;
- iseq[i+1] = a;
- iseq[i+2] = arg >> 8;
- iseq[i+3] = arg & 0xff;
- }
- }
- }
- break;
-
- case OP_EXT1:
- insn = PEEK_B(iseq+i+1);
- i += mrb_insn_size1[insn]+1;
- continue;
- case OP_EXT2:
- insn = PEEK_B(iseq+i+1);
- i += mrb_insn_size2[insn]+1;
- continue;
- case OP_EXT3:
- insn = PEEK_B(iseq+i+1);
- i += mrb_insn_size3[insn]+1;
- continue;
- }
- i+=mrb_insn_size[insn];
- }
-}
-
void mrb_codedump_all(mrb_state*, struct RProc*);
static struct RProc*
@@ -243,7 +32,8 @@ create_proc_from_string(mrb_state *mrb, char *s, mrb_int len, mrb_value binding,
mrbc_filename(mrb, cxt, file ? file : "(eval)");
cxt->capture_errors = TRUE;
cxt->no_optimize = TRUE;
- cxt->on_eval = TRUE;
+ ci = (mrb->c->ci > mrb->c->cibase) ? mrb->c->ci - 1 : mrb->c->cibase;
+ cxt->upper = ci->proc && MRB_PROC_CFUNC_P(ci->proc) ? NULL : ci->proc;
p = mrb_parse_nstring(mrb, s, len, cxt);
@@ -311,7 +101,6 @@ create_proc_from_string(mrb_state *mrb, char *s, mrb_int len, mrb_value binding,
}
proc->upper = ci->proc;
mrb->c->ci->target_class = target_class;
- patch_irep(mrb, proc->body.irep, 0, proc->body.irep);
/* mrb_codedump_all(mrb, proc); */
mrb_parser_free(p);
@@ -390,7 +179,7 @@ void
mrb_mruby_eval_gem_init(mrb_state* mrb)
{
mrb_define_module_function(mrb, mrb->kernel_module, "eval", f_eval, MRB_ARGS_ARG(1, 3));
- mrb_define_method(mrb, mrb_class_get(mrb, "BasicObject"), "instance_eval", f_instance_eval, MRB_ARGS_ARG(1, 2));
+ mrb_define_method(mrb, mrb_class_get(mrb, "BasicObject"), "instance_eval", f_instance_eval, MRB_ARGS_OPT(3)|MRB_ARGS_BLOCK());
}
void
diff --git a/mrbgems/mruby-eval/test/eval.rb b/mrbgems/mruby-eval/test/eval.rb
index 4930259c1..639ed68f9 100644
--- a/mrbgems/mruby-eval/test/eval.rb
+++ b/mrbgems/mruby-eval/test/eval.rb
@@ -130,3 +130,24 @@ Proc.new { foo }
EOS
}
end
+
+assert('Calling the same method as the variable name') do
+ hoge = Object.new
+ def hoge.fuga
+ "Hit!"
+ end
+ assert_equal("Hit!") { fuga = "Miss!"; eval "hoge.fuga" }
+ assert_equal("Hit!") { fuga = "Miss!"; -> { eval "hoge.fuga" }.call }
+ assert_equal("Hit!") { -> { fuga = "Miss!"; eval "hoge.fuga" }.call }
+ assert_equal("Hit!") { fuga = "Miss!"; eval("-> { hoge.fuga }").call }
+end
+
+assert('Access numbered parameter from eval') do
+ hoge = Object.new
+ def hoge.fuga(a, &b)
+ b.call(a)
+ end
+ assert_equal(6) {
+ hoge.fuga(3) { _1 + eval("_1") }
+ }
+end
diff --git a/mrbgems/mruby-exit/src/mruby-exit.c b/mrbgems/mruby-exit/src/mruby-exit.c
index 05c929622..4ff2f932c 100644
--- a/mrbgems/mruby-exit/src/mruby-exit.c
+++ b/mrbgems/mruby-exit/src/mruby-exit.c
@@ -4,12 +4,17 @@
static mrb_value
f_exit(mrb_state *mrb, mrb_value self)
{
- mrb_int i = EXIT_SUCCESS;
+ mrb_value status = mrb_true_value();
+ int istatus;
+
+ mrb_get_args(mrb, "|o", &status);
+ istatus = mrb_true_p(status) ? EXIT_SUCCESS :
+ mrb_false_p(status) ? EXIT_FAILURE :
+ (int)mrb_int(mrb, status);
+ exit(istatus);
- mrb_get_args(mrb, "|i", &i);
- exit((int)i);
/* not reached */
- return mrb_nil_value();
+ return status;
}
void
diff --git a/mrbgems/mruby-hash-ext/mrbgem.rake b/mrbgems/mruby-hash-ext/mrbgem.rake
index 103410ab9..e0681c1cb 100644
--- a/mrbgems/mruby-hash-ext/mrbgem.rake
+++ b/mrbgems/mruby-hash-ext/mrbgem.rake
@@ -2,7 +2,5 @@ MRuby::Gem::Specification.new('mruby-hash-ext') do |spec|
spec.license = 'MIT'
spec.author = 'mruby developers'
spec.summary = 'Hash class extension'
- spec.add_dependency 'mruby-enum-ext', core: 'mruby-enum-ext'
spec.add_dependency 'mruby-array-ext', core: 'mruby-array-ext'
- spec.add_test_dependency 'mruby-enumerator', core: 'mruby-enumerator'
end
diff --git a/mrbgems/mruby-hash-ext/src/hash-ext.c b/mrbgems/mruby-hash-ext/src/hash-ext.c
index e6112667b..75ebd412b 100644
--- a/mrbgems/mruby-hash-ext/src/hash-ext.c
+++ b/mrbgems/mruby-hash-ext/src/hash-ext.c
@@ -53,10 +53,8 @@ hash_slice(mrb_state *mrb, mrb_value hash)
mrb_int argc, i;
mrb_get_args(mrb, "*", &argv, &argc);
- if (argc == 0) {
- return mrb_hash_new_capa(mrb, argc);
- }
result = mrb_hash_new_capa(mrb, argc);
+ if (argc == 0) return result; /* empty hash */
for (i = 0; i < argc; i++) {
mrb_value key = argv[i];
mrb_value val;
diff --git a/mrbgems/mruby-hash-ext/test/hash.rb b/mrbgems/mruby-hash-ext/test/hash.rb
index b5d0aaaf8..fdf4c57a8 100644
--- a/mrbgems/mruby-hash-ext/test/hash.rb
+++ b/mrbgems/mruby-hash-ext/test/hash.rb
@@ -269,10 +269,8 @@ assert("Hash#transform_keys") do
h.transform_keys{|k| k+"!"})
assert_equal({1 => 100, 2 => 200},
h.transform_keys{|k|k.to_i})
- assert_equal({"1.0" => 100, "2.1" => 200},
- h.transform_keys.with_index{|k, i| "#{k}.#{i}"})
- assert_equal(h, h.transform_keys!{|k|k.to_i})
- assert_equal(h, {1 => 100, 2 => 200})
+ assert_same(h, h.transform_keys!{|k|k.to_i})
+ assert_equal({1 => 100, 2 => 200}, h)
end
assert("Hash#transform_values") do
@@ -281,9 +279,7 @@ assert("Hash#transform_values") do
h.transform_values{|v| v * v + 1})
assert_equal({a: "1", b: "2", c: "3"},
h.transform_values{|v|v.to_s})
- assert_equal({a: "1.0", b: "2.1", c: "3.2"},
- h.transform_values.with_index{|v, i| "#{v}.#{i}"})
- assert_equal(h, h.transform_values!{|v|v.to_s})
+ assert_same(h, h.transform_values!{|v|v.to_s})
assert_equal({a: "1", b: "2", c: "3"}, h)
end
diff --git a/mrbgems/mruby-io/README.md b/mrbgems/mruby-io/README.md
index ccf56f970..2c5b762d8 100644
--- a/mrbgems/mruby-io/README.md
+++ b/mrbgems/mruby-io/README.md
@@ -171,6 +171,7 @@ Add the line below to your `build_config.rb`:
## License
Copyright (c) 2013 Internet Initiative Japan Inc.
+Copyright (c) 2017 mruby developers
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
diff --git a/mrbgems/mruby-io/include/mruby/ext/io.h b/mrbgems/mruby-io/include/mruby/ext/io.h
index ba088156e..dfff8e0e0 100644
--- a/mrbgems/mruby-io/include/mruby/ext/io.h
+++ b/mrbgems/mruby-io/include/mruby/ext/io.h
@@ -5,10 +5,24 @@
#ifndef MRUBY_IO_H
#define MRUBY_IO_H
+#include <mruby.h>
+
+#ifdef MRB_DISABLE_STDIO
+# error IO and File conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
+#endif
+
#if defined(__cplusplus)
extern "C" {
#endif
+#if defined(MRB_WITHOUT_IO_PREAD_PWRITE)
+# undef MRB_WITH_IO_PREAD_PWRITE
+#elif !defined(MRB_WITH_IO_PREAD_PWRITE)
+# if defined(__unix__) || defined(__MACH__)
+# define MRB_WITH_IO_PREAD_PWRITE
+# endif
+#endif
+
struct mrb_io {
int fd; /* file descriptor, or -1 */
int fd2; /* file descriptor to write if it's different from fd, or -1 */
@@ -19,18 +33,36 @@ struct mrb_io {
is_socket:1;
};
-#define FMODE_READABLE 0x00000001
-#define FMODE_WRITABLE 0x00000002
-#define FMODE_READWRITE (FMODE_READABLE|FMODE_WRITABLE)
-#define FMODE_BINMODE 0x00000004
-#define FMODE_APPEND 0x00000040
-#define FMODE_CREATE 0x00000080
-#define FMODE_TRUNC 0x00000800
+#define MRB_O_RDONLY 0x0000
+#define MRB_O_WRONLY 0x0001
+#define MRB_O_RDWR 0x0002
+#define MRB_O_ACCMODE (MRB_O_RDONLY | MRB_O_WRONLY | MRB_O_RDWR)
+#define MRB_O_NONBLOCK 0x0004
+#define MRB_O_APPEND 0x0008
+#define MRB_O_SYNC 0x0010
+#define MRB_O_NOFOLLOW 0x0020
+#define MRB_O_CREAT 0x0040
+#define MRB_O_TRUNC 0x0080
+#define MRB_O_EXCL 0x0100
+#define MRB_O_NOCTTY 0x0200
+#define MRB_O_DIRECT 0x0400
+#define MRB_O_BINARY 0x0800
+#define MRB_O_SHARE_DELETE 0x1000
+#define MRB_O_TMPFILE 0x2000
+#define MRB_O_NOATIME 0x4000
+#define MRB_O_DSYNC 0x00008000
+#define MRB_O_RSYNC 0x00010000
+
+#define MRB_O_RDONLY_P(f) ((mrb_bool)(((f) & MRB_O_ACCMODE) == MRB_O_RDONLY))
+#define MRB_O_WRONLY_P(f) ((mrb_bool)(((f) & MRB_O_ACCMODE) == MRB_O_WRONLY))
+#define MRB_O_RDWR_P(f) ((mrb_bool)(((f) & MRB_O_ACCMODE) == MRB_O_RDWR))
+#define MRB_O_READABLE_P(f) ((mrb_bool)((((f) & MRB_O_ACCMODE) | 2) == 2))
+#define MRB_O_WRITABLE_P(f) ((mrb_bool)(((((f) & MRB_O_ACCMODE) + 1) & 2) == 2))
#define E_IO_ERROR (mrb_class_get(mrb, "IOError"))
#define E_EOF_ERROR (mrb_class_get(mrb, "EOFError"))
-mrb_value mrb_io_fileno(mrb_state *mrb, mrb_value io);
+int mrb_io_fileno(mrb_state *mrb, mrb_value io);
#if defined(__cplusplus)
} /* extern "C" { */
diff --git a/mrbgems/mruby-io/mrbgem.rake b/mrbgems/mruby-io/mrbgem.rake
index e4f0b7bb6..d0c8fb052 100644
--- a/mrbgems/mruby-io/mrbgem.rake
+++ b/mrbgems/mruby-io/mrbgem.rake
@@ -1,18 +1,12 @@
MRuby::Gem::Specification.new('mruby-io') do |spec|
spec.license = 'MIT'
- spec.authors = 'Internet Initiative Japan Inc.'
+ spec.authors = ['Internet Initiative Japan Inc.', 'mruby developers']
spec.summary = 'IO and File class'
spec.cc.include_paths << "#{build.root}/src"
- case RUBY_PLATFORM
- when /mingw|mswin|msys/
- spec.linker.libraries += ['Ws2_32']
- #spec.cc.include_paths += ["C:/Windows/system/include"]
- spec.linker.library_paths += ["C:/Windows/system"]
- end
- if build.kind_of?(MRuby::CrossBuild) && %w(x86_64-w64-mingw32 i686-w64-mingw32).include?(build.host_target)
- spec.linker.libraries += ['ws2_32']
+ if for_windows?
+ spec.linker.libraries << "ws2_32"
end
spec.add_test_dependency 'mruby-time', core: 'mruby-time'
end
diff --git a/mrbgems/mruby-io/mrblib/file.rb b/mrbgems/mruby-io/mrblib/file.rb
index 710333d6f..d3a4b1ec7 100644
--- a/mrbgems/mruby-io/mrblib/file.rb
+++ b/mrbgems/mruby-io/mrblib/file.rb
@@ -55,46 +55,46 @@ class File < IO
s
end
- def self.expand_path(path, default_dir = '.')
- def concat_path(path, base_path)
- if path[0] == "/" || path[1] == ':' # Windows root!
- expanded_path = path
- elsif path[0] == "~"
- if (path[1] == "/" || path[1] == nil)
- dir = path[1, path.size]
- home_dir = _gethome
-
- unless home_dir
- raise ArgumentError, "couldn't find HOME environment -- expanding '~'"
- end
-
- expanded_path = home_dir
- expanded_path += dir if dir
- expanded_path += "/"
- else
- splitted_path = path.split("/")
- user = splitted_path[0][1, splitted_path[0].size]
- dir = "/" + splitted_path[1, splitted_path.size].join("/")
+ def self._concat_path(path, base_path)
+ if path[0] == "/" || path[1] == ':' # Windows root!
+ expanded_path = path
+ elsif path[0] == "~"
+ if (path[1] == "/" || path[1] == nil)
+ dir = path[1, path.size]
+ home_dir = _gethome
+
+ unless home_dir
+ raise ArgumentError, "couldn't find HOME environment -- expanding '~'"
+ end
- home_dir = _gethome(user)
+ expanded_path = home_dir
+ expanded_path += dir if dir
+ expanded_path += "/"
+ else
+ splitted_path = path.split("/")
+ user = splitted_path[0][1, splitted_path[0].size]
+ dir = "/" + splitted_path[1, splitted_path.size].join("/")
- unless home_dir
- raise ArgumentError, "user #{user} doesn't exist"
- end
+ home_dir = _gethome(user)
- expanded_path = home_dir
- expanded_path += dir if dir
- expanded_path += "/"
+ unless home_dir
+ raise ArgumentError, "user #{user} doesn't exist"
end
- else
- expanded_path = concat_path(base_path, _getwd)
- expanded_path += "/" + path
- end
- expanded_path
+ expanded_path = home_dir
+ expanded_path += dir if dir
+ expanded_path += "/"
+ end
+ else
+ expanded_path = _concat_path(base_path, _getwd)
+ expanded_path += "/" + path
end
- expanded_path = concat_path(path, default_dir)
+ expanded_path
+ end
+
+ def self.expand_path(path, default_dir = '.')
+ expanded_path = _concat_path(path, default_dir)
drive_prefix = ""
if File::ALT_SEPARATOR && expanded_path.size > 2 &&
("A".."Z").include?(expanded_path[0].upcase) && expanded_path[1] == ":"
diff --git a/mrbgems/mruby-io/mrblib/file_constants.rb b/mrbgems/mruby-io/mrblib/file_constants.rb
index a68ee2598..bd77d53fe 100644
--- a/mrbgems/mruby-io/mrblib/file_constants.rb
+++ b/mrbgems/mruby-io/mrblib/file_constants.rb
@@ -1,21 +1,5 @@
class File
module Constants
- RDONLY = 0
- WRONLY = 1
- RDWR = 2
- NONBLOCK = 4
- APPEND = 8
-
- BINARY = 0
- SYNC = 128
- NOFOLLOW = 256
- CREAT = 512
- TRUNC = 1024
- EXCL = 2048
-
- NOCTTY = 131072
- DSYNC = 4194304
-
FNM_SYSCASE = 0
FNM_NOESCAPE = 1
FNM_PATHNAME = 2
diff --git a/mrbgems/mruby-io/mrblib/io.rb b/mrbgems/mruby-io/mrblib/io.rb
index 5df1932df..e597db886 100644
--- a/mrbgems/mruby-io/mrblib/io.rb
+++ b/mrbgems/mruby-io/mrblib/io.rb
@@ -170,21 +170,16 @@ class IO
end
def _read_buf
- return @buf if @buf && @buf.bytesize >= 4 # maximum UTF-8 character is 4 bytes
- @buf ||= ""
- begin
- @buf += sysread(BUF_SIZE)
- rescue EOFError => e
- raise e if @buf.empty?
- end
+ return @buf if @buf && @buf.bytesize > 0
+ sysread(BUF_SIZE, @buf)
end
def ungetc(substr)
raise TypeError.new "expect String, got #{substr.class}" unless substr.is_a?(String)
if @buf.empty?
- @buf = substr.dup
+ @buf.replace(substr)
else
- @buf = substr + @buf
+ @buf[0,0] = substr
end
nil
end
@@ -288,15 +283,15 @@ class IO
def readchar
_read_buf
- c = @buf[0]
- @buf[0] = ""
- c
+ _readchar(@buf)
end
def getc
begin
readchar
rescue EOFError
+ c = @buf[0]
+ @buf[0,1]="" if c
nil
end
end
diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c
index f9633535c..004eb0a5f 100644
--- a/mrbgems/mruby-io/src/file.c
+++ b/mrbgems/mruby-io/src/file.c
@@ -7,12 +7,7 @@
#include "mruby/data.h"
#include "mruby/string.h"
#include "mruby/ext/io.h"
-
-#if MRUBY_RELEASE_NO < 10000
-#include "error.h"
-#else
#include "mruby/error.h"
-#endif
#include <sys/types.h>
#include <sys/stat.h>
@@ -53,6 +48,7 @@
#if defined(_WIN32) || defined(_WIN64)
#define PATH_SEPARATOR ";"
#define FILE_ALT_SEPARATOR "\\"
+ #define VOLUME_SEPARATOR ":"
#else
#define PATH_SEPARATOR ":"
#endif
@@ -70,7 +66,15 @@
#define LOCK_UN 8
#endif
-#define STAT(p, s) stat(p, s)
+#ifndef _WIN32
+typedef struct stat mrb_stat;
+# define mrb_stat(path, sb) stat(path, sb)
+# define mrb_fstat(fd, sb) fstat(fd, sb)
+#else
+typedef struct __stat64 mrb_stat;
+# define mrb_stat(path, sb) _stat64(path, sb)
+# define mrb_fstat(fd, sb) _fstat64(fd, sb)
+#endif
#ifdef _WIN32
static int
@@ -276,12 +280,59 @@ mrb_file__getwd(mrb_state *mrb, mrb_value klass)
return path;
}
+#ifdef _WIN32
+#define IS_FILESEP(x) (x == (*(char*)(FILE_SEPARATOR)) || x == (*(char*)(FILE_ALT_SEPARATOR)))
+#define IS_VOLSEP(x) (x == (*(char*)(VOLUME_SEPARATOR)))
+#define IS_DEVICEID(x) (x == '.' || x == '?')
+#define CHECK_UNCDEV_PATH (IS_FILESEP(path[0]) && IS_FILESEP(path[1]))
+
+static int
+is_absolute_traditional_path(const char *path, size_t len)
+{
+ if (len < 3) return 0;
+ return (ISALPHA(path[0]) && IS_VOLSEP(path[1]) && IS_FILESEP(path[2]));
+}
+
+static int
+is_aboslute_unc_path(const char *path, size_t len) {
+ if (len < 2) return 0;
+ return (CHECK_UNCDEV_PATH && !IS_DEVICEID(path[2]));
+}
+
+static int
+is_absolute_device_path(const char *path, size_t len) {
+ if (len < 4) return 0;
+ return (CHECK_UNCDEV_PATH && IS_DEVICEID(path[2]) && IS_FILESEP(path[3]));
+}
+
static int
mrb_file_is_absolute_path(const char *path)
{
- return (path[0] == '/');
+ size_t len = strlen(path);
+ if (IS_FILESEP(path[0])) return 1;
+ if (len > 0)
+ return (
+ is_absolute_traditional_path(path, len) ||
+ is_aboslute_unc_path(path, len) ||
+ is_absolute_device_path(path, len)
+ );
+ else
+ return 0;
}
+#undef IS_FILESEP
+#undef IS_VOLSEP
+#undef IS_DEVICEID
+#undef CHECK_UNCDEV_PATH
+
+#else
+static int
+mrb_file_is_absolute_path(const char *path)
+{
+ return (path[0] == *(char*)(FILE_SEPARATOR));
+}
+#endif
+
static mrb_value
mrb_file__gethome(mrb_state *mrb, mrb_value klass)
{
@@ -316,7 +367,7 @@ mrb_file__gethome(mrb_state *mrb, mrb_value klass)
path = mrb_str_new_cstr(mrb, home);
mrb_locale_free(home);
return path;
-#else
+#else /* _WIN32 */
argc = mrb_get_argc(mrb);
if (argc == 0) {
home = getenv("USERPROFILE");
@@ -344,7 +395,7 @@ mrb_file_mtime(mrb_state *mrb, mrb_value self)
int fd;
obj = mrb_obj_value(mrb_class_get(mrb, "Time"));
- fd = (int)mrb_fixnum(mrb_io_fileno(mrb, self));
+ fd = mrb_io_fileno(mrb, self);
if (fstat(fd, &st) == -1)
return mrb_false_value();
return mrb_funcall(mrb, obj, "at", 1, mrb_fixnum_value(st.st_mtime));
@@ -360,7 +411,7 @@ mrb_file_flock(mrb_state *mrb, mrb_value self)
int fd;
mrb_get_args(mrb, "i", &operation);
- fd = (int)mrb_fixnum(mrb_io_fileno(mrb, self));
+ fd = mrb_io_fileno(mrb, self);
while (flock(fd, (int)operation) == -1) {
switch (errno) {
@@ -385,6 +436,75 @@ mrb_file_flock(mrb_state *mrb, mrb_value self)
}
static mrb_value
+mrb_file_size(mrb_state *mrb, mrb_value self)
+{
+ mrb_stat st;
+ int fd;
+
+ fd = mrb_io_fileno(mrb, self);
+ if (mrb_fstat(fd, &st) == -1) {
+ mrb_raise(mrb, E_RUNTIME_ERROR, "fstat failed");
+ }
+
+ if (st.st_size > MRB_INT_MAX) {
+#ifdef MRB_WITHOUT_FLOAT
+ mrb_raise(mrb, E_RUNTIME_ERROR, "File#size too large for MRB_WITHOUT_FLOAT");
+#else
+ return mrb_float_value(mrb, (mrb_float)st.st_size);
+#endif
+ }
+
+ return mrb_fixnum_value((mrb_int)st.st_size);
+}
+
+static int
+mrb_ftruncate(int fd, mrb_int length)
+{
+#ifndef _WIN32
+ return ftruncate(fd, (off_t)length);
+#else
+ HANDLE file;
+ __int64 cur;
+
+ file = (HANDLE)_get_osfhandle(fd);
+ if (file == INVALID_HANDLE_VALUE) {
+ return -1;
+ }
+
+ cur = _lseeki64(fd, 0, SEEK_CUR);
+ if (cur == -1) return -1;
+
+ if (_lseeki64(fd, (__int64)length, SEEK_SET) == -1) return -1;
+
+ if (!SetEndOfFile(file)) {
+ errno = EINVAL; /* TODO: GetLastError to errno */
+ return -1;
+ }
+
+ if (_lseeki64(fd, cur, SEEK_SET) == -1) return -1;
+
+ return 0;
+#endif /* _WIN32 */
+}
+
+static mrb_value
+mrb_file_truncate(mrb_state *mrb, mrb_value self)
+{
+ int fd;
+ mrb_int length;
+ mrb_value lenv;
+
+ fd = mrb_io_fileno(mrb, self);
+ mrb_get_args(mrb, "o", &lenv);
+ length = mrb_int(mrb, lenv);
+ if (mrb_ftruncate(fd, length) != 0) {
+ mrb_raise(mrb, E_IO_ERROR, "ftruncate failed");
+ }
+
+ return mrb_fixnum_value(0);
+}
+
+static mrb_value
mrb_file_s_symlink(mrb_state *mrb, mrb_value klass)
{
#if defined(_WIN32) || defined(_WIN64)
@@ -474,7 +594,7 @@ mrb_init_file(mrb_state *mrb)
io = mrb_class_get(mrb, "IO");
file = mrb_define_class(mrb, "File", io);
MRB_SET_INSTANCE_TT(file, MRB_TT_DATA);
- mrb_define_class_method(mrb, file, "umask", mrb_file_s_umask, MRB_ARGS_REQ(1));
+ mrb_define_class_method(mrb, file, "umask", mrb_file_s_umask, MRB_ARGS_OPT(1));
mrb_define_class_method(mrb, file, "delete", mrb_file_s_unlink, MRB_ARGS_ANY());
mrb_define_class_method(mrb, file, "unlink", mrb_file_s_unlink, MRB_ARGS_ANY());
mrb_define_class_method(mrb, file, "rename", mrb_file_s_rename, MRB_ARGS_REQ(2));
@@ -490,6 +610,8 @@ mrb_init_file(mrb_state *mrb)
mrb_define_method(mrb, file, "flock", mrb_file_flock, MRB_ARGS_REQ(1));
mrb_define_method(mrb, file, "mtime", mrb_file_mtime, MRB_ARGS_NONE());
+ mrb_define_method(mrb, file, "size", mrb_file_size, MRB_ARGS_NONE());
+ mrb_define_method(mrb, file, "truncate", mrb_file_truncate, MRB_ARGS_REQ(1));
cnst = mrb_define_module_under(mrb, file, "Constants");
mrb_define_const(mrb, cnst, "LOCK_SH", mrb_fixnum_value(LOCK_SH));
@@ -505,4 +627,22 @@ mrb_init_file(mrb_state *mrb)
#endif
mrb_define_const(mrb, cnst, "NULL", mrb_str_new_cstr(mrb, NULL_FILE));
+ mrb_define_const(mrb, cnst, "RDONLY", mrb_fixnum_value(MRB_O_RDONLY));
+ mrb_define_const(mrb, cnst, "WRONLY", mrb_fixnum_value(MRB_O_WRONLY));
+ mrb_define_const(mrb, cnst, "RDWR", mrb_fixnum_value(MRB_O_RDWR));
+ mrb_define_const(mrb, cnst, "APPEND", mrb_fixnum_value(MRB_O_APPEND));
+ mrb_define_const(mrb, cnst, "CREAT", mrb_fixnum_value(MRB_O_CREAT));
+ mrb_define_const(mrb, cnst, "EXCL", mrb_fixnum_value(MRB_O_EXCL));
+ mrb_define_const(mrb, cnst, "TRUNC", mrb_fixnum_value(MRB_O_TRUNC));
+ mrb_define_const(mrb, cnst, "NONBLOCK", mrb_fixnum_value(MRB_O_NONBLOCK));
+ mrb_define_const(mrb, cnst, "NOCTTY", mrb_fixnum_value(MRB_O_NOCTTY));
+ mrb_define_const(mrb, cnst, "BINARY", mrb_fixnum_value(MRB_O_BINARY));
+ mrb_define_const(mrb, cnst, "SHARE_DELETE", mrb_fixnum_value(MRB_O_SHARE_DELETE));
+ mrb_define_const(mrb, cnst, "SYNC", mrb_fixnum_value(MRB_O_SYNC));
+ mrb_define_const(mrb, cnst, "DSYNC", mrb_fixnum_value(MRB_O_DSYNC));
+ mrb_define_const(mrb, cnst, "RSYNC", mrb_fixnum_value(MRB_O_RSYNC));
+ mrb_define_const(mrb, cnst, "NOFOLLOW", mrb_fixnum_value(MRB_O_NOFOLLOW));
+ mrb_define_const(mrb, cnst, "NOATIME", mrb_fixnum_value(MRB_O_NOATIME));
+ mrb_define_const(mrb, cnst, "DIRECT", mrb_fixnum_value(MRB_O_DIRECT));
+ mrb_define_const(mrb, cnst, "TMPFILE", mrb_fixnum_value(MRB_O_TMPFILE));
}
diff --git a/mrbgems/mruby-io/src/file_test.c b/mrbgems/mruby-io/src/file_test.c
index 445bafde9..d75cbd598 100644
--- a/mrbgems/mruby-io/src/file_test.c
+++ b/mrbgems/mruby-io/src/file_test.c
@@ -7,12 +7,7 @@
#include "mruby/data.h"
#include "mruby/string.h"
#include "mruby/ext/io.h"
-
-#if MRUBY_RELEASE_NO < 10000
-#include "error.h"
-#else
#include "mruby/error.h"
-#endif
#include <sys/types.h>
#include <sys/stat.h>
@@ -33,7 +28,6 @@
#include <fcntl.h>
#include <errno.h>
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/mrbgems/mruby-io/src/io.c b/mrbgems/mruby-io/src/io.c
index 3a6932b3a..3bf3d28be 100644
--- a/mrbgems/mruby-io/src/io.c
+++ b/mrbgems/mruby-io/src/io.c
@@ -10,12 +10,7 @@
#include "mruby/string.h"
#include "mruby/variable.h"
#include "mruby/ext/io.h"
-
-#if MRUBY_RELEASE_NO < 10000
-#include "error.h"
-#else
#include "mruby/error.h"
-#endif
#include <sys/types.h>
#include <sys/stat.h>
@@ -36,14 +31,21 @@
typedef long ftime_t;
typedef long fsuseconds_t;
typedef int fmode_t;
+ typedef int mrb_io_read_write_size;
+
+ #ifndef O_TMPFILE
+ #define O_TMPFILE O_TEMPORARY
+ #endif
#else
#include <sys/wait.h>
+ #include <sys/time.h>
#include <unistd.h>
typedef size_t fsize_t;
typedef time_t ftime_t;
typedef suseconds_t fsuseconds_t;
typedef mode_t fmode_t;
+ typedef ssize_t mrb_io_read_write_size;
#endif
#ifdef _MSC_VER
@@ -53,9 +55,14 @@ typedef mrb_int pid_t;
#include <fcntl.h>
#include <errno.h>
-#include <stdio.h>
#include <string.h>
+#define OPEN_ACCESS_MODE_FLAGS (O_RDONLY | O_WRONLY | O_RDWR)
+#define OPEN_RDONLY_P(f) ((mrb_bool)(((f) & OPEN_ACCESS_MODE_FLAGS) == O_RDONLY))
+#define OPEN_WRONLY_P(f) ((mrb_bool)(((f) & OPEN_ACCESS_MODE_FLAGS) == O_WRONLY))
+#define OPEN_RDWR_P(f) ((mrb_bool)(((f) & OPEN_ACCESS_MODE_FLAGS) == O_RDWR))
+#define OPEN_READABLE_P(f) ((mrb_bool)(OPEN_RDONLY_P(f) || OPEN_RDWR_P(f)))
+#define OPEN_WRITABLE_P(f) ((mrb_bool)(OPEN_WRONLY_P(f) || OPEN_RDWR_P(f)))
static void mrb_io_free(mrb_state *mrb, void *ptr);
struct mrb_data_type mrb_io_type = { "IO", mrb_io_free };
@@ -63,17 +70,9 @@ struct mrb_data_type mrb_io_type = { "IO", mrb_io_free };
static struct mrb_io *io_get_open_fptr(mrb_state *mrb, mrb_value self);
static int mrb_io_modestr_to_flags(mrb_state *mrb, const char *modestr);
-static int mrb_io_flags_to_modenum(mrb_state *mrb, int flags);
+static int mrb_io_mode_to_flags(mrb_state *mrb, mrb_value mode);
static void fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int quiet);
-#if MRUBY_RELEASE_NO < 10000
-static struct RClass *
-mrb_module_get(mrb_state *mrb, const char *name)
-{
- return mrb_class_get(mrb, name);
-}
-#endif
-
static struct mrb_io *
io_get_open_fptr(mrb_state *mrb, mrb_value self)
{
@@ -113,30 +112,33 @@ io_set_process_status(mrb_state *mrb, pid_t pid, int status)
static int
mrb_io_modestr_to_flags(mrb_state *mrb, const char *mode)
{
- int flags = 0;
+ int flags;
const char *m = mode;
switch (*m++) {
case 'r':
- flags |= FMODE_READABLE;
+ flags = O_RDONLY;
break;
case 'w':
- flags |= FMODE_WRITABLE | FMODE_CREATE | FMODE_TRUNC;
+ flags = O_WRONLY | O_CREAT | O_TRUNC;
break;
case 'a':
- flags |= FMODE_WRITABLE | FMODE_APPEND | FMODE_CREATE;
+ flags = O_WRONLY | O_CREAT | O_APPEND;
break;
default:
mrb_raisef(mrb, E_ARGUMENT_ERROR, "illegal access mode %s", mode);
+ flags = 0; /* not reached */
}
while (*m) {
switch (*m++) {
case 'b':
- flags |= FMODE_BINMODE;
+#ifdef O_BINARY
+ flags |= O_BINARY;
+#endif
break;
case '+':
- flags |= FMODE_READWRITE;
+ flags = (flags & ~OPEN_ACCESS_MODE_FLAGS) | O_RDWR;
break;
case ':':
/* XXX: PASSTHROUGH*/
@@ -149,38 +151,72 @@ mrb_io_modestr_to_flags(mrb_state *mrb, const char *mode)
}
static int
-mrb_io_flags_to_modenum(mrb_state *mrb, int flags)
+mrb_io_mode_to_flags(mrb_state *mrb, mrb_value mode)
{
- int modenum = 0;
-
- switch(flags & (FMODE_READABLE|FMODE_WRITABLE|FMODE_READWRITE)) {
- case FMODE_READABLE:
- modenum = O_RDONLY;
- break;
- case FMODE_WRITABLE:
- modenum = O_WRONLY;
- break;
- case FMODE_READWRITE:
- modenum = O_RDWR;
- break;
- }
-
- if (flags & FMODE_APPEND) {
- modenum |= O_APPEND;
- }
- if (flags & FMODE_TRUNC) {
- modenum |= O_TRUNC;
+ if (mrb_nil_p(mode)) {
+ return mrb_io_modestr_to_flags(mrb, "r");
}
- if (flags & FMODE_CREATE) {
- modenum |= O_CREAT;
+ else if (mrb_string_p(mode)) {
+ return mrb_io_modestr_to_flags(mrb, RSTRING_CSTR(mrb, mode));
}
+ else {
+ int flags = 0;
+ mrb_int flags0 = mrb_int(mrb, mode);
+
+ switch (flags0 & MRB_O_ACCMODE) {
+ case MRB_O_RDONLY:
+ flags |= O_RDONLY;
+ break;
+ case MRB_O_WRONLY:
+ flags |= O_WRONLY;
+ break;
+ case MRB_O_RDWR:
+ flags |= O_RDWR;
+ break;
+ default:
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, "illegal access mode %v", mode);
+ }
+
+ if (flags0 & MRB_O_APPEND) flags |= O_APPEND;
+ if (flags0 & MRB_O_CREAT) flags |= O_CREAT;
+ if (flags0 & MRB_O_EXCL) flags |= O_EXCL;
+ if (flags0 & MRB_O_TRUNC) flags |= O_TRUNC;
+#ifdef O_NONBLOCK
+ if (flags0 & MRB_O_NONBLOCK) flags |= O_NONBLOCK;
+#endif
+#ifdef O_NOCTTY
+ if (flags0 & MRB_O_NOCTTY) flags |= O_NOCTTY;
+#endif
#ifdef O_BINARY
- if (flags & FMODE_BINMODE) {
- modenum |= O_BINARY;
- }
+ if (flags0 & MRB_O_BINARY) flags |= O_BINARY;
+#endif
+#ifdef O_SHARE_DELETE
+ if (flags0 & MRB_O_SHARE_DELETE) flags |= O_SHARE_DELETE;
+#endif
+#ifdef O_SYNC
+ if (flags0 & MRB_O_SYNC) flags |= O_SYNC;
+#endif
+#ifdef O_DSYNC
+ if (flags0 & MRB_O_DSYNC) flags |= O_DSYNC;
+#endif
+#ifdef O_RSYNC
+ if (flags0 & MRB_O_RSYNC) flags |= O_RSYNC;
+#endif
+#ifdef O_NOFOLLOW
+ if (flags0 & MRB_O_NOFOLLOW) flags |= O_NOFOLLOW;
+#endif
+#ifdef O_NOATIME
+ if (flags0 & MRB_O_NOATIME) flags |= O_NOATIME;
+#endif
+#ifdef O_DIRECT
+ if (flags0 & MRB_O_DIRECT) flags |= O_DIRECT;
+#endif
+#ifdef O_TMPFILE
+ if (flags0 & MRB_O_TMPFILE) flags |= O_TMPFILE;
#endif
- return modenum;
+ return flags;
+ }
}
static void
@@ -294,7 +330,7 @@ option_to_fd(mrb_state *mrb, mrb_value hash, const char *key)
switch (mrb_type(opt)) {
case MRB_TT_DATA: /* IO */
- return (int)mrb_fixnum(mrb_io_fileno(mrb, opt));
+ return mrb_io_fileno(mrb, opt);
case MRB_TT_FIXNUM:
return (int)mrb_fixnum(opt);
default:
@@ -330,11 +366,11 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
ofd[0] = INVALID_HANDLE_VALUE;
ofd[1] = INVALID_HANDLE_VALUE;
- mrb_get_args(mrb, "S|SH", &cmd, &mode, &opt);
+ mrb_get_args(mrb, "S|oH", &cmd, &mode, &opt);
io = mrb_obj_value(mrb_data_object_alloc(mrb, mrb_class_ptr(klass), NULL, &mrb_io_type));
pname = RSTRING_CSTR(mrb, cmd);
- flags = mrb_io_modestr_to_flags(mrb, RSTRING_CSTR(mrb, mode));
+ flags = mrb_io_mode_to_flags(mrb, mode);
doexec = (strcmp("-", pname) != 0);
opt_in = option_to_fd(mrb, opt, "in");
@@ -345,14 +381,14 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
saAttr.bInheritHandle = TRUE;
saAttr.lpSecurityDescriptor = NULL;
- if (flags & FMODE_READABLE) {
+ if (OPEN_READABLE_P(flags)) {
if (!CreatePipe(&ofd[0], &ofd[1], &saAttr, 0)
|| !SetHandleInformation(ofd[0], HANDLE_FLAG_INHERIT, 0)) {
mrb_sys_fail(mrb, "pipe");
}
}
- if (flags & FMODE_WRITABLE) {
+ if (OPEN_WRITABLE_P(flags)) {
if (!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0)
|| !SetHandleInformation(ifd[1], HANDLE_FLAG_INHERIT, 0)) {
mrb_sys_fail(mrb, "pipe");
@@ -366,11 +402,11 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
si.dwFlags |= STARTF_USESTDHANDLES;
- if (flags & FMODE_READABLE) {
+ if (OPEN_READABLE_P(flags)) {
si.hStdOutput = ofd[1];
si.hStdError = ofd[1];
}
- if (flags & FMODE_WRITABLE) {
+ if (OPEN_WRITABLE_P(flags)) {
si.hStdInput = ifd[0];
}
if (!CreateProcess(
@@ -394,8 +430,8 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
fptr->fd = _open_osfhandle((intptr_t)ofd[0], 0);
fptr->fd2 = _open_osfhandle((intptr_t)ifd[1], 0);
fptr->pid = pid;
- fptr->readable = ((flags & FMODE_READABLE) != 0);
- fptr->writable = ((flags & FMODE_WRITABLE) != 0);
+ fptr->readable = OPEN_READABLE_P(flags);
+ fptr->writable = OPEN_WRITABLE_P(flags);
fptr->sync = 0;
DATA_TYPE(io) = &mrb_io_type;
@@ -426,18 +462,18 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
int saved_errno;
int opt_in, opt_out, opt_err;
- mrb_get_args(mrb, "S|SH", &cmd, &mode, &opt);
+ mrb_get_args(mrb, "S|oH", &cmd, &mode, &opt);
io = mrb_obj_value(mrb_data_object_alloc(mrb, mrb_class_ptr(klass), NULL, &mrb_io_type));
pname = RSTRING_CSTR(mrb, cmd);
- flags = mrb_io_modestr_to_flags(mrb, RSTRING_CSTR(mrb, mode));
+ flags = mrb_io_mode_to_flags(mrb, mode);
doexec = (strcmp("-", pname) != 0);
opt_in = option_to_fd(mrb, opt, "in");
opt_out = option_to_fd(mrb, opt, "out");
opt_err = option_to_fd(mrb, opt, "err");
- if (flags & FMODE_READABLE) {
+ if (OPEN_READABLE_P(flags)) {
if (pipe(pr) == -1) {
mrb_sys_fail(mrb, "pipe");
}
@@ -445,7 +481,7 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
mrb_fd_cloexec(mrb, pr[1]);
}
- if (flags & FMODE_WRITABLE) {
+ if (OPEN_WRITABLE_P(flags)) {
if (pipe(pw) == -1) {
if (pr[0] != -1) close(pr[0]);
if (pr[1] != -1) close(pr[1]);
@@ -474,14 +510,14 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
if (opt_err != -1) {
dup2(opt_err, 2);
}
- if (flags & FMODE_READABLE) {
+ if (OPEN_READABLE_P(flags)) {
close(pr[0]);
if (pr[1] != 1) {
dup2(pr[1], 1);
close(pr[1]);
}
}
- if (flags & FMODE_WRITABLE) {
+ if (OPEN_WRITABLE_P(flags)) {
close(pw[1]);
if (pw[0] != 0) {
dup2(pw[0], 0);
@@ -500,12 +536,12 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
break;
default: /* parent */
- if ((flags & FMODE_READABLE) && (flags & FMODE_WRITABLE)) {
+ if (OPEN_RDWR_P(flags)) {
close(pr[1]);
fd = pr[0];
close(pw[0]);
write_fd = pw[1];
- } else if (flags & FMODE_READABLE) {
+ } else if (OPEN_RDONLY_P(flags)) {
close(pr[1]);
fd = pr[0];
} else {
@@ -519,8 +555,8 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
fptr->fd = fd;
fptr->fd2 = write_fd;
fptr->pid = pid;
- fptr->readable = ((flags & FMODE_READABLE) != 0);
- fptr->writable = ((flags & FMODE_WRITABLE) != 0);
+ fptr->readable = OPEN_READABLE_P(flags);
+ fptr->writable = OPEN_WRITABLE_P(flags);
fptr->sync = 0;
DATA_TYPE(io) = &mrb_io_type;
@@ -530,11 +566,11 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
case -1: /* error */
saved_errno = errno;
- if (flags & FMODE_READABLE) {
+ if (OPEN_READABLE_P(flags)) {
close(pr[0]);
close(pr[1]);
}
- if (flags & FMODE_WRITABLE) {
+ if (OPEN_WRITABLE_P(flags)) {
close(pw[0]);
close(pw[1]);
}
@@ -609,6 +645,43 @@ mrb_io_initialize_copy(mrb_state *mrb, mrb_value copy)
return copy;
}
+static void
+check_file_descriptor(mrb_state *mrb, mrb_int fd)
+{
+ struct stat sb;
+ int fdi = (int)fd;
+
+#if MRB_INT_MIN < INT_MIN || MRB_INT_MAX > INT_MAX
+ if (fdi != fd) {
+ goto badfd;
+ }
+#endif
+
+#ifdef _WIN32
+ {
+ DWORD err;
+ int len = sizeof(err);
+
+ if (getsockopt(fdi, SOL_SOCKET, SO_ERROR, (char*)&err, &len) == 0) {
+ return;
+ }
+ }
+
+ if (fdi < 0 || fdi > _getmaxstdio()) {
+ goto badfd;
+ }
+#endif /* _WIN32 */
+
+ if (fstat(fdi, &sb) != 0) {
+ goto badfd;
+ }
+
+ return;
+
+badfd:
+ mrb_sys_fail(mrb, "bad file descriptor");
+}
+
mrb_value
mrb_io_initialize(mrb_state *mrb, mrb_value io)
{
@@ -619,7 +692,8 @@ mrb_io_initialize(mrb_state *mrb, mrb_value io)
mode = opt = mrb_nil_value();
- mrb_get_args(mrb, "i|So", &fd, &mode, &opt);
+ mrb_get_args(mrb, "i|oo", &fd, &mode, &opt);
+ check_file_descriptor(mrb, fd);
if (mrb_nil_p(mode)) {
mode = mrb_str_new_cstr(mrb, "r");
}
@@ -627,7 +701,7 @@ mrb_io_initialize(mrb_state *mrb, mrb_value io)
opt = mrb_hash_new(mrb);
}
- flags = mrb_io_modestr_to_flags(mrb, RSTRING_CSTR(mrb, mode));
+ flags = mrb_io_mode_to_flags(mrb, mode);
mrb_iv_set(mrb, io, mrb_intern_cstr(mrb, "@buf"), mrb_str_new_cstr(mrb, ""));
@@ -642,8 +716,8 @@ mrb_io_initialize(mrb_state *mrb, mrb_value io)
DATA_PTR(io) = fptr;
fptr->fd = (int)fd;
- fptr->readable = ((flags & FMODE_READABLE) != 0);
- fptr->writable = ((flags & FMODE_WRITABLE) != 0);
+ fptr->readable = OPEN_READABLE_P(flags);
+ fptr->writable = OPEN_WRITABLE_P(flags);
fptr->sync = 0;
return io;
}
@@ -798,32 +872,48 @@ mrb_io_s_sysopen(mrb_state *mrb, mrb_value klass)
mrb_value mode = mrb_nil_value();
mrb_int fd, perm = -1;
const char *pat;
- int flags, modenum;
+ int flags;
- mrb_get_args(mrb, "S|Si", &path, &mode, &perm);
- if (mrb_nil_p(mode)) {
- mode = mrb_str_new_cstr(mrb, "r");
- }
+ mrb_get_args(mrb, "S|oi", &path, &mode, &perm);
if (perm < 0) {
perm = 0666;
}
pat = RSTRING_CSTR(mrb, path);
- flags = mrb_io_modestr_to_flags(mrb, RSTRING_CSTR(mrb, mode));
- modenum = mrb_io_flags_to_modenum(mrb, flags);
- fd = mrb_cloexec_open(mrb, pat, modenum, perm);
+ flags = mrb_io_mode_to_flags(mrb, mode);
+ fd = mrb_cloexec_open(mrb, pat, flags, perm);
return mrb_fixnum_value(fd);
}
+static mrb_value mrb_io_sysread_common(mrb_state *mrb,
+ mrb_io_read_write_size (*readfunc)(int, void *, fsize_t, off_t),
+ mrb_value io, mrb_value buf, mrb_int maxlen, off_t offset);
+
+static mrb_io_read_write_size
+mrb_sysread_dummy(int fd, void *buf, fsize_t nbytes, off_t offset)
+{
+ return (mrb_io_read_write_size)read(fd, buf, nbytes);
+}
+
mrb_value
mrb_io_sysread(mrb_state *mrb, mrb_value io)
{
- struct mrb_io *fptr;
mrb_value buf = mrb_nil_value();
mrb_int maxlen;
- int ret;
mrb_get_args(mrb, "i|S", &maxlen, &buf);
+
+ return mrb_io_sysread_common(mrb, mrb_sysread_dummy, io, buf, maxlen, 0);
+}
+
+static mrb_value
+mrb_io_sysread_common(mrb_state *mrb,
+ mrb_io_read_write_size (*readfunc)(int, void *, fsize_t, off_t),
+ mrb_value io, mrb_value buf, mrb_int maxlen, off_t offset)
+{
+ struct mrb_io *fptr;
+ int ret;
+
if (maxlen < 0) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "negative expanding string size");
}
@@ -837,7 +927,8 @@ mrb_io_sysread(mrb_state *mrb, mrb_value io)
if (RSTRING_LEN(buf) != maxlen) {
buf = mrb_str_resize(mrb, buf, maxlen);
- } else {
+ }
+ else {
mrb_str_modify(mrb, RSTRING(buf));
}
@@ -845,25 +936,16 @@ mrb_io_sysread(mrb_state *mrb, mrb_value io)
if (!fptr->readable) {
mrb_raise(mrb, E_IO_ERROR, "not opened for reading");
}
- ret = read(fptr->fd, RSTRING_PTR(buf), (fsize_t)maxlen);
- switch (ret) {
- case 0: /* EOF */
- if (maxlen == 0) {
- buf = mrb_str_new_cstr(mrb, "");
- } else {
- mrb_raise(mrb, E_EOF_ERROR, "sysread failed: End of File");
- }
- break;
- case -1: /* Error */
- mrb_sys_fail(mrb, "sysread failed");
- break;
- default:
- if (RSTRING_LEN(buf) != ret) {
- buf = mrb_str_resize(mrb, buf, ret);
- }
- break;
+ ret = readfunc(fptr->fd, RSTRING_PTR(buf), (fsize_t)maxlen, offset);
+ if (ret < 0) {
+ mrb_sys_fail(mrb, "sysread failed");
+ }
+ if (RSTRING_LEN(buf) != ret) {
+ buf = mrb_str_resize(mrb, buf, ret);
+ }
+ if (ret == 0 && maxlen > 0) {
+ mrb_raise(mrb, E_EOF_ERROR, "sysread failed: End of File");
}
-
return buf;
}
@@ -895,11 +977,12 @@ mrb_io_sysseek(mrb_state *mrb, mrb_value io)
}
}
-mrb_value
-mrb_io_syswrite(mrb_state *mrb, mrb_value io)
+static mrb_value
+mrb_io_syswrite_common(mrb_state *mrb,
+ mrb_io_read_write_size (*writefunc)(int, const void *, fsize_t, off_t),
+ mrb_value io, mrb_value buf, off_t offset)
{
struct mrb_io *fptr;
- mrb_value str, buf;
int fd, length;
fptr = io_get_open_fptr(mrb, io);
@@ -907,15 +990,12 @@ mrb_io_syswrite(mrb_state *mrb, mrb_value io)
mrb_raise(mrb, E_IO_ERROR, "not opened for writing");
}
- mrb_get_args(mrb, "S", &str);
- buf = str;
-
if (fptr->fd2 == -1) {
fd = fptr->fd;
} else {
fd = fptr->fd2;
}
- length = write(fd, RSTRING_PTR(buf), (fsize_t)RSTRING_LEN(buf));
+ length = writefunc(fd, RSTRING_PTR(buf), (fsize_t)RSTRING_LEN(buf), offset);
if (length == -1) {
mrb_sys_fail(mrb, 0);
}
@@ -923,6 +1003,22 @@ mrb_io_syswrite(mrb_state *mrb, mrb_value io)
return mrb_fixnum_value(length);
}
+static mrb_io_read_write_size
+mrb_syswrite_dummy(int fd, const void *buf, fsize_t nbytes, off_t offset)
+{
+ return (mrb_io_read_write_size)write(fd, buf, nbytes);
+}
+
+mrb_value
+mrb_io_syswrite(mrb_state *mrb, mrb_value io)
+{
+ mrb_value buf;
+
+ mrb_get_args(mrb, "S", &buf);
+
+ return mrb_io_syswrite_common(mrb, mrb_syswrite_dummy, io, buf, 0);
+}
+
mrb_value
mrb_io_close(mrb_state *mrb, mrb_value self)
{
@@ -1060,7 +1156,7 @@ mrb_io_s_select(mrb_state *mrb, mrb_value klass)
mrb_get_args(mrb, "*", &argv, &argc);
if (argc < 1 || argc > 4) {
- mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%i for 1..4)", argc);
+ mrb_argnum_error(mrb, argc, 1, 4);
}
timeout = mrb_nil_value();
@@ -1089,6 +1185,7 @@ mrb_io_s_select(mrb_state *mrb, mrb_value klass)
for (i = 0; i < RARRAY_LEN(read); i++) {
read_io = RARRAY_PTR(read)[i];
fptr = io_get_open_fptr(mrb, read_io);
+ if (fptr->fd >= FD_SETSIZE) continue;
FD_SET(fptr->fd, rp);
if (mrb_io_read_data_pending(mrb, read_io)) {
pending++;
@@ -1111,6 +1208,7 @@ mrb_io_s_select(mrb_state *mrb, mrb_value klass)
FD_ZERO(wp);
for (i = 0; i < RARRAY_LEN(write); i++) {
fptr = io_get_open_fptr(mrb, RARRAY_PTR(write)[i]);
+ if (fptr->fd >= FD_SETSIZE) continue;
FD_SET(fptr->fd, wp);
if (max < fptr->fd)
max = fptr->fd;
@@ -1130,6 +1228,7 @@ mrb_io_s_select(mrb_state *mrb, mrb_value klass)
FD_ZERO(ep);
for (i = 0; i < RARRAY_LEN(except); i++) {
fptr = io_get_open_fptr(mrb, RARRAY_PTR(except)[i]);
+ if (fptr->fd >= FD_SETSIZE) continue;
FD_SET(fptr->fd, ep);
if (max < fptr->fd)
max = fptr->fd;
@@ -1203,12 +1302,19 @@ retry:
return result;
}
-mrb_value
+int
mrb_io_fileno(mrb_state *mrb, mrb_value io)
{
struct mrb_io *fptr;
fptr = io_get_open_fptr(mrb, io);
- return mrb_fixnum_value(fptr->fd);
+ return fptr->fd;
+}
+
+static mrb_value
+mrb_io_fileno_m(mrb_state *mrb, mrb_value io)
+{
+ int fd = mrb_io_fileno(mrb, io);
+ return mrb_fixnum_value(fd);
}
mrb_value
@@ -1291,15 +1397,55 @@ mrb_io_sync(mrb_state *mrb, mrb_value self)
return mrb_bool_value(fptr->sync);
}
+#ifndef MRB_WITH_IO_PREAD_PWRITE
+# define mrb_io_pread mrb_notimplement_m
+# define mrb_io_pwrite mrb_notimplement_m
+#else
+static off_t
+value2off(mrb_state *mrb, mrb_value offv)
+{
+ return (off_t)mrb_int(mrb, offv);
+}
+
+/*
+ * call-seq:
+ * pread(maxlen, offset, outbuf = "") -> outbuf
+ */
+static mrb_value
+mrb_io_pread(mrb_state *mrb, mrb_value io)
+{
+ mrb_value buf = mrb_nil_value();
+ mrb_value off;
+ mrb_int maxlen;
+
+ mrb_get_args(mrb, "io|S!", &maxlen, &off, &buf);
+
+ return mrb_io_sysread_common(mrb, pread, io, buf, maxlen, value2off(mrb, off));
+}
+
+/*
+ * call-seq:
+ * pwrite(buffer, offset) -> wrote_bytes
+ */
+static mrb_value
+mrb_io_pwrite(mrb_state *mrb, mrb_value io)
+{
+ mrb_value buf, off;
+
+ mrb_get_args(mrb, "So", &buf, &off);
+
+ return mrb_io_syswrite_common(mrb, pwrite, io, buf, value2off(mrb, off));
+}
+#endif /* MRB_WITH_IO_PREAD_PWRITE */
+
static mrb_value
-io_bufread(mrb_state *mrb, mrb_value self)
+io_bufread(mrb_state *mrb, mrb_value str, mrb_int len)
{
- mrb_value str, str2;
- mrb_int len, newlen;
+ mrb_value str2;
+ mrb_int newlen;
struct RString *s;
char *p;
- mrb_get_args(mrb, "Si", &str, &len);
s = RSTRING(str);
mrb_str_modify(mrb, s);
p = RSTR_PTR(s);
@@ -1312,6 +1458,54 @@ io_bufread(mrb_state *mrb, mrb_value self)
return str2;
}
+static mrb_value
+mrb_io_bufread(mrb_state *mrb, mrb_value self)
+{
+ mrb_value str;
+ mrb_int len;
+
+ mrb_get_args(mrb, "Si", &str, &len);
+ return io_bufread(mrb, str, len);
+}
+
+static mrb_value
+mrb_io_readchar(mrb_state *mrb, mrb_value self)
+{
+ mrb_value buf;
+ mrb_int len = 1;
+#ifdef MRB_UTF8_STRING
+ unsigned char c;
+#endif
+
+ mrb_get_args(mrb, "S", &buf);
+ mrb_assert(RSTRING_LEN(buf) > 0);
+ mrb_assert(RSTRING_PTR(buf) != NULL);
+ mrb_str_modify(mrb, RSTRING(buf));
+#ifdef MRB_UTF8_STRING
+ c = RSTRING_PTR(buf)[0];
+ if (c & 0x80) {
+ len = mrb_utf8len(RSTRING_PTR(buf), RSTRING_END(buf));
+ if (len == 1 && RSTRING_LEN(buf) < 4) { /* partial UTF-8 */
+ mrb_int blen = RSTRING_LEN(buf);
+ ssize_t n;
+
+ struct mrb_io *fptr = (struct mrb_io*)io_get_open_fptr(mrb, self);
+
+ if (!fptr->readable) {
+ mrb_raise(mrb, E_IO_ERROR, "not opened for reading");
+ }
+ /* refill the buffer */
+ mrb_str_resize(mrb, buf, 4096);
+ n = read(fptr->fd, RSTRING_PTR(buf)+blen, 4096-blen);
+ if (n < 0) mrb_sys_fail(mrb, "sysread failed");
+ mrb_str_resize(mrb, buf, blen+n);
+ }
+ len = mrb_utf8len(RSTRING_PTR(buf), RSTRING_END(buf));
+ }
+#endif
+ return io_bufread(mrb, buf, len);
+}
+
void
mrb_init_io(mrb_state *mrb)
{
@@ -1321,23 +1515,23 @@ mrb_init_io(mrb_state *mrb)
MRB_SET_INSTANCE_TT(io, MRB_TT_DATA);
mrb_include_module(mrb, io, mrb_module_get(mrb, "Enumerable")); /* 15.2.20.3 */
- mrb_define_class_method(mrb, io, "_popen", mrb_io_s_popen, MRB_ARGS_ANY());
+ mrb_define_class_method(mrb, io, "_popen", mrb_io_s_popen, MRB_ARGS_ARG(1,2));
mrb_define_class_method(mrb, io, "_sysclose", mrb_io_s_sysclose, MRB_ARGS_REQ(1));
- mrb_define_class_method(mrb, io, "for_fd", mrb_io_s_for_fd, MRB_ARGS_ANY());
- mrb_define_class_method(mrb, io, "select", mrb_io_s_select, MRB_ARGS_ANY());
- mrb_define_class_method(mrb, io, "sysopen", mrb_io_s_sysopen, MRB_ARGS_ANY());
+ mrb_define_class_method(mrb, io, "for_fd", mrb_io_s_for_fd, MRB_ARGS_ARG(1,2));
+ mrb_define_class_method(mrb, io, "select", mrb_io_s_select, MRB_ARGS_ARG(1,3));
+ mrb_define_class_method(mrb, io, "sysopen", mrb_io_s_sysopen, MRB_ARGS_ARG(1,2));
#if !defined(_WIN32) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
mrb_define_class_method(mrb, io, "_pipe", mrb_io_s_pipe, MRB_ARGS_NONE());
#endif
- mrb_define_method(mrb, io, "initialize", mrb_io_initialize, MRB_ARGS_ANY()); /* 15.2.20.5.21 (x)*/
+ mrb_define_method(mrb, io, "initialize", mrb_io_initialize, MRB_ARGS_ARG(1,2)); /* 15.2.20.5.21 (x)*/
mrb_define_method(mrb, io, "initialize_copy", mrb_io_initialize_copy, MRB_ARGS_REQ(1));
mrb_define_method(mrb, io, "_check_readable", mrb_io_check_readable, MRB_ARGS_NONE());
mrb_define_method(mrb, io, "isatty", mrb_io_isatty, MRB_ARGS_NONE());
mrb_define_method(mrb, io, "sync", mrb_io_sync, MRB_ARGS_NONE());
mrb_define_method(mrb, io, "sync=", mrb_io_set_sync, MRB_ARGS_REQ(1));
- mrb_define_method(mrb, io, "sysread", mrb_io_sysread, MRB_ARGS_ANY());
- mrb_define_method(mrb, io, "sysseek", mrb_io_sysseek, MRB_ARGS_REQ(1));
+ mrb_define_method(mrb, io, "sysread", mrb_io_sysread, MRB_ARGS_ARG(1,1));
+ mrb_define_method(mrb, io, "sysseek", mrb_io_sysseek, MRB_ARGS_ARG(1,1));
mrb_define_method(mrb, io, "syswrite", mrb_io_syswrite, MRB_ARGS_REQ(1));
mrb_define_method(mrb, io, "close", mrb_io_close, MRB_ARGS_NONE()); /* 15.2.20.5.1 */
mrb_define_method(mrb, io, "close_write", mrb_io_close_write, MRB_ARGS_NONE());
@@ -1345,7 +1539,10 @@ mrb_init_io(mrb_state *mrb)
mrb_define_method(mrb, io, "close_on_exec?", mrb_io_close_on_exec_p, MRB_ARGS_NONE());
mrb_define_method(mrb, io, "closed?", mrb_io_closed, MRB_ARGS_NONE()); /* 15.2.20.5.2 */
mrb_define_method(mrb, io, "pid", mrb_io_pid, MRB_ARGS_NONE()); /* 15.2.20.5.2 */
- mrb_define_method(mrb, io, "fileno", mrb_io_fileno, MRB_ARGS_NONE());
+ mrb_define_method(mrb, io, "fileno", mrb_io_fileno_m, MRB_ARGS_NONE());
+ mrb_define_method(mrb, io, "pread", mrb_io_pread, MRB_ARGS_ANY()); /* ruby 2.5 feature */
+ mrb_define_method(mrb, io, "pwrite", mrb_io_pwrite, MRB_ARGS_ANY()); /* ruby 2.5 feature */
- mrb_define_class_method(mrb, io, "_bufread", io_bufread, MRB_ARGS_REQ(2));
+ mrb_define_method(mrb, io, "_readchar", mrb_io_readchar, MRB_ARGS_REQ(1));
+ mrb_define_class_method(mrb, io, "_bufread", mrb_io_bufread, MRB_ARGS_REQ(2));
}
diff --git a/mrbgems/mruby-io/test/file.rb b/mrbgems/mruby-io/test/file.rb
index 143096759..ef4d7fcb1 100644
--- a/mrbgems/mruby-io/test/file.rb
+++ b/mrbgems/mruby-io/test/file.rb
@@ -80,6 +80,22 @@ assert('File#mtime') do
end
end
+assert('File#size and File#truncate') do
+ fname = "#{$mrbtest_io_wfname}.resize"
+ begin
+ File.open(fname, 'w') do |f|
+ assert_equal 0, f.size
+ assert_equal 0, f.truncate(100)
+ assert_equal 100, f.size
+ assert_equal 0, f.pos
+ assert_equal 0, f.truncate(5)
+ assert_equal 5, f.size
+ end
+ ensure
+ File.delete(fname)
+ end
+end
+
assert('File.join') do
assert_equal "", File.join()
assert_equal "a", File.join("a")
@@ -94,18 +110,22 @@ assert('File.join') do
end
assert('File.realpath') do
- if File::ALT_SEPARATOR
- readme_path = File._getwd + File::ALT_SEPARATOR + "README.md"
- assert_equal readme_path, File.realpath("README.md")
- else
- dir = MRubyIOTestUtil.mkdtemp("mruby-io-test.XXXXXX")
- begin
- dir1 = File.realpath($mrbtest_io_rfname)
- dir2 = File.realpath("./#{dir}//./../#{$mrbtest_io_symlinkname}")
- assert_equal dir1, dir2
- ensure
- MRubyIOTestUtil.rmdir dir
+ dir = MRubyIOTestUtil.mkdtemp("mruby-io-test.XXXXXX")
+ begin
+ sep = File::ALT_SEPARATOR || File::SEPARATOR
+ relative_path = "#{File.basename(dir)}#{sep}realpath_test"
+ path = "#{File._getwd}#{sep}#{relative_path}"
+ File.open(path, "w"){}
+ assert_equal path, File.realpath(relative_path)
+
+ unless MRubyIOTestUtil.win?
+ path1 = File.realpath($mrbtest_io_rfname)
+ path2 = File.realpath($mrbtest_io_symlinkname)
+ assert_equal path1, path2
end
+ ensure
+ File.delete path rescue nil
+ MRubyIOTestUtil.rmdir dir
end
assert_raise(ArgumentError) { File.realpath("TO\0DO") }
@@ -113,7 +133,9 @@ end
assert("File.readlink") do
begin
- assert_equal $mrbtest_io_rfname, File.readlink($mrbtest_io_symlinkname)
+ exp = File.basename($mrbtest_io_rfname)
+ act = File.readlink($mrbtest_io_symlinkname)
+ assert_equal exp, act
rescue NotImplementedError => e
skip e.message
end
diff --git a/mrbgems/mruby-io/test/io.rb b/mrbgems/mruby-io/test/io.rb
index e3024cf9a..2088a61e3 100644
--- a/mrbgems/mruby-io/test/io.rb
+++ b/mrbgems/mruby-io/test/io.rb
@@ -24,6 +24,10 @@ def assert_io_open(meth)
end
end
io2.close unless meth == :open
+
+ assert_raise(RuntimeError) { IO.__send__(meth, 1023) } # For Windows
+ assert_raise(RuntimeError) { IO.__send__(meth, 1 << 26) }
+ assert_raise(RuntimeError) { IO.__send__(meth, 1 << 32) } if (1 << 32).kind_of?(Integer)
end
end
@@ -564,6 +568,34 @@ assert('IO#sysseek') do
end
end
+assert('IO#pread') do
+ skip "IO#pread is not implemented on this configuration" unless MRubyIOTestUtil::MRB_WITH_IO_PREAD_PWRITE
+
+ IO.open(IO.sysopen($mrbtest_io_rfname, 'r'), 'r') do |io|
+ assert_equal $mrbtest_io_msg.byteslice(5, 8), io.pread(8, 5)
+ assert_equal 0, io.pos
+ assert_equal $mrbtest_io_msg.byteslice(1, 5), io.pread(5, 1)
+ assert_equal 0, io.pos
+ assert_raise(RuntimeError) { io.pread(20, -9) }
+ end
+end
+
+assert('IO#pwrite') do
+ skip "IO#pwrite is not implemented on this configuration" unless MRubyIOTestUtil::MRB_WITH_IO_PREAD_PWRITE
+
+ IO.open(IO.sysopen($mrbtest_io_wfname, 'w+'), 'w+') do |io|
+ assert_equal 6, io.pwrite("Warld!", 7)
+ assert_equal 0, io.pos
+ assert_equal 7, io.pwrite("Hello, ", 0)
+ assert_equal 0, io.pos
+ assert_equal "Hello, Warld!", io.read
+ assert_equal 6, io.pwrite("world!", 7)
+ assert_equal 13, io.pos
+ io.pos = 0
+ assert_equal "Hello, world!", io.read
+ end
+end
+
assert('IO.pipe') do
begin
called = false
diff --git a/mrbgems/mruby-io/test/mruby_io_test.c b/mrbgems/mruby-io/test/mruby_io_test.c
index eb552c41a..d4c8eb13c 100644
--- a/mrbgems/mruby-io/test/mruby_io_test.c
+++ b/mrbgems/mruby-io/test/mruby_io_test.c
@@ -1,5 +1,7 @@
+#include <mruby/common.h>
#include <sys/types.h>
#include <errno.h>
+#include <string.h>
#if defined(_WIN32) || defined(_WIN64)
@@ -7,7 +9,6 @@
#include <io.h>
#include <fcntl.h>
#include <direct.h>
-#include <string.h>
#include <stdlib.h>
#include <malloc.h>
@@ -18,7 +19,9 @@ typedef int mode_t;
#define open _open
#define close _close
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || \
+ (defined(MRB_MINGW32_VERSION) && MRB_MINGW32_VERSION < 3021) || \
+ (defined(MRB_MINGW64_VERSION) && MRB_MINGW64_VERSION < 4000)
#include <sys/stat.h>
static int
@@ -50,10 +53,11 @@ mkdtemp(char *temp)
#include <sys/socket.h>
#include <unistd.h>
#include <sys/un.h>
+ #include <fcntl.h>
+ #include <libgen.h>
#endif
#include <sys/stat.h>
-#include <stdio.h>
#include <stdlib.h>
#include "mruby.h"
@@ -61,51 +65,55 @@ mkdtemp(char *temp)
#include "mruby/error.h"
#include "mruby/string.h"
#include "mruby/variable.h"
+#include <mruby/ext/io.h>
static mrb_value
mrb_io_test_io_setup(mrb_state *mrb, mrb_value self)
{
- char rfname[] = "tmp.mruby-io-test-r.XXXXXXXX";
- char wfname[] = "tmp.mruby-io-test-w.XXXXXXXX";
- char symlinkname[] = "tmp.mruby-io-test-l.XXXXXXXX";
- char socketname[] = "tmp.mruby-io-test-s.XXXXXXXX";
+#define GVNAME(n) "$mrbtest_io_" #n "name"
+ enum {IDX_READ, IDX_WRITE, IDX_LINK, IDX_SOCKET, IDX_COUNT};
+ const char *gvnames[] = {GVNAME(rf), GVNAME(wf), GVNAME(symlink), GVNAME(socket)};
+ char *fnames[IDX_COUNT];
+ int fds[IDX_COUNT];
char msg[] = "mruby io test\n";
mode_t mask;
- int fd0, fd1;
FILE *fp;
-
+ int i;
#if !defined(_WIN32) && !defined(_WIN64)
- int fd2, fd3;
struct sockaddr_un sun0;
#endif
- mask = umask(077);
- fd0 = mkstemp(rfname);
- fd1 = mkstemp(wfname);
- if (fd0 == -1 || fd1 == -1) {
- mrb_raise(mrb, E_RUNTIME_ERROR, "can't create temporary file");
- return mrb_nil_value();
- }
- close(fd0);
- close(fd1);
+ mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_msg"), mrb_str_new_cstr(mrb, msg));
+ mask = umask(077);
+ for (i = 0; i < IDX_COUNT; i++) {
+ mrb_value fname = mrb_str_new_capa(mrb, 0);
#if !defined(_WIN32) && !defined(_WIN64)
- fd2 = mkstemp(symlinkname);
- fd3 = mkstemp(socketname);
- if (fd2 == -1 || fd3 == -1) {
- mrb_raise(mrb, E_RUNTIME_ERROR, "can't create temporary file");
- return mrb_nil_value();
- }
+ /*
+ * Workaround for not being able to bind a socket to some file systems
+ * (e.g. vboxsf, NFS). [#4981]
+ */
+ char *tmpdir = getenv("TMPDIR");
+ if (tmpdir && strlen(tmpdir) > 0) {
+ mrb_str_cat_cstr(mrb, fname, tmpdir);
+ if (*(RSTRING_END(fname)-1) != '/') mrb_str_cat_lit(mrb, fname, "/");
+ } else {
+ mrb_str_cat_lit(mrb, fname, "/tmp/");
+ }
#endif
+ mrb_str_cat_cstr(mrb, fname, gvnames[i]+1);
+ mrb_str_cat_cstr(mrb, fname, ".XXXXXXXX");
+ fnames[i] = RSTRING_PTR(fname);
+ fds[i] = mkstemp(fnames[i]);
+ if (fds[i] == -1) {
+ mrb_raise(mrb, E_RUNTIME_ERROR, "can't create temporary file");
+ }
+ close(fds[i]);
+ mrb_gv_set(mrb, mrb_intern_cstr(mrb, gvnames[i]), fname);
+ }
umask(mask);
- mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_rfname"), mrb_str_new_cstr(mrb, rfname));
- mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_wfname"), mrb_str_new_cstr(mrb, wfname));
- mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_symlinkname"), mrb_str_new_cstr(mrb, symlinkname));
- mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_socketname"), mrb_str_new_cstr(mrb, socketname));
- mrb_gv_set(mrb, mrb_intern_cstr(mrb, "$mrbtest_io_msg"), mrb_str_new_cstr(mrb, msg));
-
- fp = fopen(rfname, "wb");
+ fp = fopen(fnames[IDX_READ], "wb");
if (fp == NULL) {
mrb_raise(mrb, E_RUNTIME_ERROR, "can't open temporary file");
return mrb_nil_value();
@@ -113,7 +121,7 @@ mrb_io_test_io_setup(mrb_state *mrb, mrb_value self)
fputs(msg, fp);
fclose(fp);
- fp = fopen(wfname, "wb");
+ fp = fopen(fnames[IDX_WRITE], "wb");
if (fp == NULL) {
mrb_raise(mrb, E_RUNTIME_ERROR, "can't open temporary file");
return mrb_nil_value();
@@ -121,29 +129,29 @@ mrb_io_test_io_setup(mrb_state *mrb, mrb_value self)
fclose(fp);
#if !defined(_WIN32) && !defined(_WIN64)
- unlink(symlinkname);
- close(fd2);
- if (symlink(rfname, symlinkname) == -1) {
+ unlink(fnames[IDX_LINK]);
+ if (symlink(basename(fnames[IDX_READ]), fnames[IDX_LINK]) == -1) {
mrb_raise(mrb, E_RUNTIME_ERROR, "can't make a symbolic link");
}
- unlink(socketname);
- close(fd3);
- fd3 = socket(AF_UNIX, SOCK_STREAM, 0);
- if (fd3 == -1) {
+ unlink(fnames[IDX_SOCKET]);
+ fds[IDX_SOCKET] = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (fds[IDX_SOCKET] == -1) {
mrb_raise(mrb, E_RUNTIME_ERROR, "can't make a socket");
}
sun0.sun_family = AF_UNIX;
- snprintf(sun0.sun_path, sizeof(sun0.sun_path), "%s", socketname);
- if (bind(fd3, (struct sockaddr *)&sun0, sizeof(sun0)) == -1) {
+ strncpy(sun0.sun_path, fnames[IDX_SOCKET], sizeof(sun0.sun_path)-1);
+ sun0.sun_path[sizeof(sun0.sun_path)-1] = 0;
+ if (bind(fds[IDX_SOCKET], (struct sockaddr *)&sun0, sizeof(sun0)) == -1) {
mrb_raisef(mrb, E_RUNTIME_ERROR, "can't bind AF_UNIX socket to %s: %d",
sun0.sun_path,
errno);
}
- close(fd3);
+ close(fds[IDX_SOCKET]);
#endif
return mrb_true_value();
+#undef GVNAME
}
static mrb_value
@@ -177,28 +185,6 @@ mrb_io_test_io_cleanup(mrb_state *mrb, mrb_value self)
}
static mrb_value
-mrb_io_test_file_setup(mrb_state *mrb, mrb_value self)
-{
- mrb_value ary = mrb_io_test_io_setup(mrb, self);
-#if !defined(_WIN32) && !defined(_WIN64)
- if (symlink("/usr/bin", "test-bin") == -1) {
- mrb_raise(mrb, E_RUNTIME_ERROR, "can't make a symbolic link");
- }
-#endif
-
- return ary;
-}
-
-static mrb_value
-mrb_io_test_file_cleanup(mrb_state *mrb, mrb_value self)
-{
- mrb_io_test_io_cleanup(mrb, self);
- remove("test-bin");
-
- return mrb_nil_value();
-}
-
-static mrb_value
mrb_io_test_mkdtemp(mrb_state *mrb, mrb_value klass)
{
mrb_value str;
@@ -238,6 +224,12 @@ mrb_io_win_p(mrb_state *mrb, mrb_value klass)
#endif
}
+#ifdef MRB_WITH_IO_PREAD_PWRITE
+# define MRB_WITH_IO_PREAD_PWRITE_ENABLED TRUE
+#else
+# define MRB_WITH_IO_PREAD_PWRITE_ENABLED FALSE
+#endif
+
void
mrb_mruby_io_gem_test(mrb_state* mrb)
{
@@ -245,10 +237,9 @@ mrb_mruby_io_gem_test(mrb_state* mrb)
mrb_define_class_method(mrb, io_test, "io_test_setup", mrb_io_test_io_setup, MRB_ARGS_NONE());
mrb_define_class_method(mrb, io_test, "io_test_cleanup", mrb_io_test_io_cleanup, MRB_ARGS_NONE());
- mrb_define_class_method(mrb, io_test, "file_test_setup", mrb_io_test_file_setup, MRB_ARGS_NONE());
- mrb_define_class_method(mrb, io_test, "file_test_cleanup", mrb_io_test_file_cleanup, MRB_ARGS_NONE());
-
mrb_define_class_method(mrb, io_test, "mkdtemp", mrb_io_test_mkdtemp, MRB_ARGS_REQ(1));
mrb_define_class_method(mrb, io_test, "rmdir", mrb_io_test_rmdir, MRB_ARGS_REQ(1));
mrb_define_class_method(mrb, io_test, "win?", mrb_io_win_p, MRB_ARGS_NONE());
+
+ mrb_define_const(mrb, io_test, "MRB_WITH_IO_PREAD_PWRITE", mrb_bool_value(MRB_WITH_IO_PREAD_PWRITE_ENABLED));
}
diff --git a/mrbgems/mruby-kernel-ext/src/kernel.c b/mrbgems/mruby-kernel-ext/src/kernel.c
index a2af6b46f..427740c1c 100644
--- a/mrbgems/mruby-kernel-ext/src/kernel.c
+++ b/mrbgems/mruby-kernel-ext/src/kernel.c
@@ -213,7 +213,7 @@ mrb_mruby_kernel_ext_gem_init(mrb_state *mrb)
mrb_define_module_function(mrb, krn, "fail", mrb_f_raise, MRB_ARGS_OPT(2));
mrb_define_module_function(mrb, krn, "caller", mrb_f_caller, MRB_ARGS_OPT(2));
mrb_define_method(mrb, krn, "__method__", mrb_f_method, MRB_ARGS_NONE());
- mrb_define_module_function(mrb, krn, "Integer", mrb_f_integer, MRB_ARGS_ANY());
+ mrb_define_module_function(mrb, krn, "Integer", mrb_f_integer, MRB_ARGS_ARG(1,1));
#ifndef MRB_WITHOUT_FLOAT
mrb_define_module_function(mrb, krn, "Float", mrb_f_float, MRB_ARGS_REQ(1));
#endif
diff --git a/mrbgems/mruby-kernel-ext/test/kernel.rb b/mrbgems/mruby-kernel-ext/test/kernel.rb
index ad9177165..cf78faaad 100644
--- a/mrbgems/mruby-kernel-ext/test/kernel.rb
+++ b/mrbgems/mruby-kernel-ext/test/kernel.rb
@@ -49,24 +49,52 @@ assert('Kernel#__method__') do
end
assert('Kernel#Integer') do
- assert_equal(26, Integer("0x1a"))
- assert_equal(930, Integer("0930", 10))
- assert_equal(7, Integer("111", 2))
- assert_equal(0, Integer("0"))
- assert_equal(0, Integer("00000"))
+ assert_operator(26, :eql?, Integer("0x1a"))
+ assert_operator(930, :eql?, Integer("0930", 10))
+ assert_operator(7, :eql?, Integer("111", 2))
+ assert_operator(0, :eql?, Integer("0"))
+ assert_operator(0, :eql?, Integer("00000"))
+ assert_operator(123, :eql?, Integer('1_2_3'))
+ assert_operator(123, :eql?, Integer("\t\r\n\f\v 123 \t\r\n\f\v"))
assert_raise(TypeError) { Integer(nil) }
+ assert_raise(ArgumentError) { Integer('a') }
+ assert_raise(ArgumentError) { Integer('4a5') }
+ assert_raise(ArgumentError) { Integer('1_2__3') }
+ assert_raise(ArgumentError) { Integer('68_') }
+ assert_raise(ArgumentError) { Integer('68_ ') }
+ assert_raise(ArgumentError) { Integer('_68') }
+ assert_raise(ArgumentError) { Integer(' _68') }
+ assert_raise(ArgumentError) { Integer('6 8') }
+ assert_raise(ArgumentError) { Integer("15\0") }
+ assert_raise(ArgumentError) { Integer("15.0") }
skip unless Object.const_defined?(:Float)
- assert_equal(123, Integer(123.999))
+ assert_operator(123, :eql?, Integer(123.999))
end
assert('Kernel#Float') do
skip unless Object.const_defined?(:Float)
- assert_equal(1.0, Float(1))
- assert_equal(123.456, Float(123.456))
- assert_equal(123.456, Float("123.456"))
+ assert_operator(1.0, :eql?, Float(1))
+ assert_operator(123.456, :eql?, Float(123.456))
+ assert_operator(123.456, :eql?, Float("123.456"))
+ assert_operator(123.0, :eql?, Float('1_2_3'))
+ assert_operator(12.34, :eql?, Float('1_2.3_4'))
+ assert_operator(0.9, :eql?, Float('.9'))
+ assert_operator(0.9, :eql?, Float(" \t\r\n\f\v.9 \t\r\n\f\v"))
+ assert_operator(16.0, :eql?, Float("0x10"))
assert_raise(TypeError) { Float(nil) }
+ assert_raise(ArgumentError) { Float("1. 5") }
assert_raise(ArgumentError) { Float("1.5a") }
assert_raise(ArgumentError) { Float("1.5\0") }
+ assert_raise(ArgumentError) { Float('a') }
+ assert_raise(ArgumentError) { Float('4a5') }
+ assert_raise(ArgumentError) { Float('1_2__3') }
+ assert_raise(ArgumentError) { Float('68_') }
+ assert_raise(ArgumentError) { Float('68._7') }
+ assert_raise(ArgumentError) { Float('68.7_') }
+ assert_raise(ArgumentError) { Float('68.7_ ') }
+ assert_raise(ArgumentError) { Float('_68') }
+ assert_raise(ArgumentError) { Float(' _68') }
+ assert_raise(ArgumentError) { Float('1_2.3__4') }
end
assert('Kernel#String') do
diff --git a/mrbgems/mruby-math/test/math.rb b/mrbgems/mruby-math/test/math.rb
index 86a4fc12c..d2790e289 100644
--- a/mrbgems/mruby-math/test/math.rb
+++ b/mrbgems/mruby-math/test/math.rb
@@ -1,6 +1,14 @@
##
# Math Test
+def assert_float_and_int(exp_ary, act_ary)
+ assert('assert_float_and_int') do
+ flo_exp, int_exp, flo_act, int_act = *exp_ary, *act_ary
+ assert_float(flo_exp, flo_act)
+ assert_operator(int_exp, :eql?, int_act)
+ end
+end
+
assert('Math.sin 0') do
assert_float(0, Math.sin(0))
end
@@ -109,12 +117,6 @@ assert('Math.hypot') do
assert_float(5.0, Math.hypot(3, 4))
end
-assert('Math.frexp 1234') do
- n = 1234
- fraction, exponent = Math.frexp(n)
- assert_float(n, Math.ldexp(fraction, exponent))
-end
-
assert('Math.erf 1') do
assert_float(0.842700792949715, Math.erf(1))
end
@@ -130,3 +132,108 @@ end
assert('Math.erfc -1') do
assert_float(1.8427007929497148, Math.erfc(-1))
end
+
+assert('Math.acos') do
+ assert_float(0 * Math::PI / 4, Math.acos( 1.0))
+ assert_float(1 * Math::PI / 4, Math.acos( 1.0 / Math.sqrt(2)))
+ assert_float(2 * Math::PI / 4, Math.acos( 0.0))
+ assert_float(4 * Math::PI / 4, Math.acos(-1.0))
+ assert_raise(Math::DomainError) { Math.acos(+1.1) }
+ assert_raise(Math::DomainError) { Math.acos(-1.1) }
+end
+
+assert('Math.asin') do
+ assert_float( 0 * Math::PI / 4, Math.asin( 0.0))
+ assert_float( 1 * Math::PI / 4, Math.asin( 1.0 / Math.sqrt(2)))
+ assert_float( 2 * Math::PI / 4, Math.asin( 1.0))
+ assert_float(-2 * Math::PI / 4, Math.asin(-1.0))
+ assert_raise(Math::DomainError) { Math.asin(+1.1) }
+ assert_raise(Math::DomainError) { Math.asin(-1.1) }
+ assert_raise(Math::DomainError) { Math.asin(2.0) }
+end
+
+assert('Math.atan') do
+ assert_float( 0 * Math::PI / 4, Math.atan( 0.0))
+ assert_float( 1 * Math::PI / 4, Math.atan( 1.0))
+ assert_float( 2 * Math::PI / 4, Math.atan(1.0 / 0.0))
+ assert_float(-1 * Math::PI / 4, Math.atan(-1.0))
+end
+
+assert('Math.cosh') do
+ assert_float(1, Math.cosh(0))
+ assert_float((Math::E ** 1 + Math::E ** -1) / 2, Math.cosh(1))
+ assert_float((Math::E ** 2 + Math::E ** -2) / 2, Math.cosh(2))
+end
+
+assert('Math.sinh') do
+ assert_float(0, Math.sinh(0))
+ assert_float((Math::E ** 1 - Math::E ** -1) / 2, Math.sinh(1))
+ assert_float((Math::E ** 2 - Math::E ** -2) / 2, Math.sinh(2))
+end
+
+assert('Math.tanh') do
+ assert_float(Math.sinh(0) / Math.cosh(0), Math.tanh(0))
+ assert_float(Math.sinh(1) / Math.cosh(1), Math.tanh(1))
+ assert_float(Math.sinh(2) / Math.cosh(2), Math.tanh(2))
+ assert_float(+1.0, Math.tanh(+1000.0))
+ assert_float(-1.0, Math.tanh(-1000.0))
+end
+
+assert('Math.acosh') do
+ assert_float(0, Math.acosh(1))
+ assert_float(1, Math.acosh((Math::E ** 1 + Math::E ** -1) / 2))
+ assert_float(2, Math.acosh((Math::E ** 2 + Math::E ** -2) / 2))
+ assert_raise(Math::DomainError) { Math.acosh(0.9) }
+ assert_raise(Math::DomainError) { Math.acosh(0) }
+end
+
+assert('Math.asinh') do
+ assert_float(0, Math.asinh(0))
+ assert_float(1, Math.asinh((Math::E ** 1 - Math::E ** -1) / 2))
+ assert_float(2, Math.asinh((Math::E ** 2 - Math::E ** -2) / 2))
+end
+
+assert('Math.atanh') do
+ assert_float(0, Math.atanh(Math.sinh(0) / Math.cosh(0)))
+ assert_float(1, Math.atanh(Math.sinh(1) / Math.cosh(1)))
+ assert_float(2, Math.atanh(Math.sinh(2) / Math.cosh(2)))
+ assert_float(Float::INFINITY, Math.atanh(1))
+ assert_float(-Float::INFINITY, Math.atanh(-1))
+ assert_raise(Math::DomainError) { Math.atanh(+1.1) }
+ assert_raise(Math::DomainError) { Math.atanh(-1.1) }
+end
+
+assert('Math.atan2') do
+ assert_float(+0.0, Math.atan2(+0.0, +0.0))
+ assert_float(-0.0, Math.atan2(-0.0, +0.0))
+ assert_float(+Math::PI, Math.atan2(+0.0, -0.0))
+ assert_float(-Math::PI, Math.atan2(-0.0, -0.0))
+
+ inf = Float::INFINITY
+ expected = 3.0 * Math::PI / 4.0
+ assert_float(+expected, Math.atan2(+inf, -inf))
+ assert_float(-expected, Math.atan2(-inf, -inf))
+ expected = Math::PI / 4.0
+ assert_float(+expected, Math.atan2(+inf, +inf))
+ assert_float(-expected, Math.atan2(-inf, +inf))
+
+ assert_float(0, Math.atan2(0, 1))
+ assert_float(Math::PI / 4, Math.atan2(1, 1))
+ assert_float(Math::PI / 2, Math.atan2(1, 0))
+end
+
+assert('Math.ldexp') do
+ assert_float(0.0, Math.ldexp(0.0, 0.0))
+ assert_float(0.5, Math.ldexp(0.5, 0.0))
+ assert_float(1.0, Math.ldexp(0.5, 1.0))
+ assert_float(2.0, Math.ldexp(0.5, 2.0))
+ assert_float(3.0, Math.ldexp(0.75, 2.0))
+end
+
+assert('Math.frexp') do
+ assert_float_and_int([0.0, 0], Math.frexp(0.0))
+ assert_float_and_int([0.5, 0], Math.frexp(0.5))
+ assert_float_and_int([0.5, 1], Math.frexp(1.0))
+ assert_float_and_int([0.5, 2], Math.frexp(2.0))
+ assert_float_and_int([0.75, 2], Math.frexp(3.0))
+end
diff --git a/mrbgems/mruby-metaprog/src/metaprog.c b/mrbgems/mruby-metaprog/src/metaprog.c
index 3f22596eb..4334fe983 100644
--- a/mrbgems/mruby-metaprog/src/metaprog.c
+++ b/mrbgems/mruby-metaprog/src/metaprog.c
@@ -139,31 +139,30 @@ mrb_local_variables(mrb_state *mrb, mrb_value self)
proc = mrb->c->ci[-1].proc;
- if (MRB_PROC_CFUNC_P(proc)) {
+ if (proc == NULL || MRB_PROC_CFUNC_P(proc)) {
return mrb_ary_new(mrb);
}
vars = mrb_hash_new(mrb);
while (proc) {
if (MRB_PROC_CFUNC_P(proc)) break;
irep = proc->body.irep;
- if (!irep->lv) break;
- for (i = 0; i + 1 < irep->nlocals; ++i) {
- if (irep->lv[i].name) {
- mrb_sym sym = irep->lv[i].name;
- const char *name = mrb_sym_name(mrb, sym);
- switch (name[0]) {
- case '*': case '&':
- break;
- default:
- mrb_hash_set(mrb, vars, mrb_symbol_value(sym), mrb_true_value());
- break;
+ if (irep->lv) {
+ for (i = 0; i + 1 < irep->nlocals; ++i) {
+ if (irep->lv[i].name) {
+ mrb_sym sym = irep->lv[i].name;
+ const char *name = mrb_sym_name(mrb, sym);
+ switch (name[0]) {
+ case '*': case '&':
+ break;
+ default:
+ mrb_hash_set(mrb, vars, mrb_symbol_value(sym), mrb_true_value());
+ break;
+ }
}
}
}
- if (!MRB_PROC_ENV_P(proc)) break;
+ if (MRB_PROC_SCOPE_P(proc)) break;
proc = proc->upper;
- //if (MRB_PROC_SCOPE_P(proc)) break;
- if (!proc->c) break;
}
return mrb_hash_keys(mrb, vars);
@@ -172,7 +171,7 @@ mrb_local_variables(mrb_state *mrb, mrb_value self)
KHASH_DECLARE(st, mrb_sym, char, FALSE)
static void
-method_entry_loop(mrb_state *mrb, struct RClass* klass, khash_t(st)* set)
+method_entry_loop(mrb_state *mrb, struct RClass *klass, khash_t(st) *set, khash_t(st) *undef)
{
khint_t i;
@@ -181,20 +180,28 @@ method_entry_loop(mrb_state *mrb, struct RClass* klass, khash_t(st)* set)
for (i=0;i<kh_end(h);i++) {
if (kh_exist(h, i)) {
mrb_method_t m = kh_value(h, i);
- if (MRB_METHOD_UNDEF_P(m)) continue;
- kh_put(st, mrb, set, kh_key(h, i));
+ if (MRB_METHOD_UNDEF_P(m)) {
+ if (undef) {
+ kh_put(st, mrb, undef, kh_key(h, i));
+ }
+ }
+ else if (undef == NULL ||
+ kh_get(st, mrb, undef, kh_key(h, i)) == kh_end(undef)) {
+ kh_put(st, mrb, set, kh_key(h, i));
+ }
}
}
}
static mrb_value
-mrb_class_instance_method_list(mrb_state *mrb, mrb_bool recur, struct RClass* klass, int obj)
+mrb_class_instance_method_list(mrb_state *mrb, mrb_bool recur, struct RClass *klass, int obj)
{
khint_t i;
mrb_value ary;
mrb_bool prepended = FALSE;
- struct RClass* oldklass;
- khash_t(st)* set = kh_init(st, mrb);
+ struct RClass *oldklass;
+ khash_t(st) *set = kh_init(st, mrb);
+ khash_t(st) *undef = (recur ? kh_init(st, mrb) : NULL);
if (!recur && (klass->flags & MRB_FL_CLASS_IS_PREPENDED)) {
MRB_CLASS_ORIGIN(klass);
@@ -203,7 +210,7 @@ mrb_class_instance_method_list(mrb_state *mrb, mrb_bool recur, struct RClass* kl
oldklass = 0;
while (klass && (klass != oldklass)) {
- method_entry_loop(mrb, klass, set);
+ method_entry_loop(mrb, klass, set, undef);
if ((klass->tt == MRB_TT_ICLASS && !prepended) ||
(klass->tt == MRB_TT_SCLASS)) {
}
@@ -221,6 +228,7 @@ mrb_class_instance_method_list(mrb_state *mrb, mrb_bool recur, struct RClass* kl
}
}
kh_destroy(st, mrb, set);
+ if (undef) kh_destroy(st, mrb, undef);
return ary;
}
@@ -313,18 +321,19 @@ mrb_obj_singleton_methods(mrb_state *mrb, mrb_bool recur, mrb_value obj)
{
khint_t i;
mrb_value ary;
- struct RClass* klass;
- khash_t(st)* set = kh_init(st, mrb);
+ struct RClass *klass;
+ khash_t(st) *set = kh_init(st, mrb);
+ khash_t(st) *undef = (recur ? kh_init(st, mrb) : NULL);
klass = mrb_class(mrb, obj);
if (klass && (klass->tt == MRB_TT_SCLASS)) {
- method_entry_loop(mrb, klass, set);
+ method_entry_loop(mrb, klass, set, undef);
klass = klass->super;
}
if (recur) {
while (klass && ((klass->tt == MRB_TT_SCLASS) || (klass->tt == MRB_TT_ICLASS))) {
- method_entry_loop(mrb, klass, set);
+ method_entry_loop(mrb, klass, set, undef);
klass = klass->super;
}
}
@@ -336,6 +345,7 @@ mrb_obj_singleton_methods(mrb_state *mrb, mrb_bool recur, mrb_value obj)
}
}
kh_destroy(st, mrb, set);
+ if (undef) kh_destroy(st, mrb, undef);
return ary;
}
@@ -694,8 +704,8 @@ mrb_mruby_metaprog_gem_init(mrb_state* mrb)
mrb_define_method(mrb, krn, "protected_methods", mrb_obj_protected_methods, MRB_ARGS_OPT(1)); /* 15.3.1.3.37 */
mrb_define_method(mrb, krn, "public_methods", mrb_obj_public_methods, MRB_ARGS_OPT(1)); /* 15.3.1.3.38 */
mrb_define_method(mrb, krn, "singleton_methods", mrb_obj_singleton_methods_m, MRB_ARGS_OPT(1)); /* 15.3.1.3.45 */
- mrb_define_method(mrb, krn, "define_singleton_method", mod_define_singleton_method, MRB_ARGS_ANY());
- mrb_define_method(mrb, krn, "send", mrb_f_send, MRB_ARGS_ANY()); /* 15.3.1.3.44 */
+ mrb_define_method(mrb, krn, "define_singleton_method", mod_define_singleton_method, MRB_ARGS_REQ(1)|MRB_ARGS_BLOCK());
+ mrb_define_method(mrb, krn, "send", mrb_f_send, MRB_ARGS_REQ(1)|MRB_ARGS_REST()|MRB_ARGS_BLOCK()); /* 15.3.1.3.44 */
mrb_define_method(mrb, mod, "class_variables", mrb_mod_class_variables, MRB_ARGS_OPT(1)); /* 15.2.2.4.19 */
mrb_define_method(mrb, mod, "remove_class_variable", mrb_mod_remove_cvar, MRB_ARGS_REQ(1)); /* 15.2.2.4.39 */
diff --git a/mrbgems/mruby-metaprog/test/metaprog.rb b/mrbgems/mruby-metaprog/test/metaprog.rb
index 30b75bd60..82ba0a3a5 100644
--- a/mrbgems/mruby-metaprog/test/metaprog.rb
+++ b/mrbgems/mruby-metaprog/test/metaprog.rb
@@ -114,6 +114,15 @@ assert('Kernel.local_variables', '15.3.1.2.7') do
# Kernel#local_variables: 15.3.1.3.28
local_variables.sort
}.call(-1, -2)
+
+ a = Object.new
+ def a.hoge(vars, *, **)
+ Proc.new {
+ x, y = 1, 2
+ local_variables.sort
+ }
+ end
+ assert_equal([:vars, :x, :y]) { a.hoge(0).call }
end
assert('Kernel#define_singleton_method') do
diff --git a/mrbgems/mruby-object-ext/src/object.c b/mrbgems/mruby-object-ext/src/object.c
index 8d5604cad..31bb689f6 100644
--- a/mrbgems/mruby-object-ext/src/object.c
+++ b/mrbgems/mruby-object-ext/src/object.c
@@ -101,18 +101,9 @@ mrb_obj_instance_exec(mrb_state *mrb, mrb_value self)
struct RClass *c;
mrb_get_args(mrb, "*&!", &argv, &argc, &blk);
-
- switch (mrb_type(self)) {
- case MRB_TT_SYMBOL:
- case MRB_TT_FIXNUM:
-#ifndef MRB_WITHOUT_FLOAT
- case MRB_TT_FLOAT:
-#endif
- c = NULL;
- break;
- default:
- c = mrb_class_ptr(mrb_singleton_class(mrb, self));
- break;
+ c = mrb_singleton_class_ptr(mrb, self);
+ if (mrb->c->ci->acc < 0) {
+ return mrb_yield_with_class(mrb, blk, argc, argv, self, c);
}
mrb->c->ci->target_class = c;
return mrb_yield_cont(mrb, blk, self, argc, argv);
diff --git a/mrbgems/mruby-pack/README.md b/mrbgems/mruby-pack/README.md
index 95733e2d5..c8a653fba 100644
--- a/mrbgems/mruby-pack/README.md
+++ b/mrbgems/mruby-pack/README.md
@@ -49,6 +49,7 @@ There is no dependency on other mrbgems.
## License
Copyright (c) 2012 Internet Initiative Japan Inc.
+Copyright (c) 2017 mruby developers
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
diff --git a/mrbgems/mruby-pack/mrbgem.rake b/mrbgems/mruby-pack/mrbgem.rake
index 6e8375d1e..f1c0306b1 100644
--- a/mrbgems/mruby-pack/mrbgem.rake
+++ b/mrbgems/mruby-pack/mrbgem.rake
@@ -1,6 +1,6 @@
MRuby::Gem::Specification.new('mruby-pack') do |spec|
spec.license = 'MIT'
- spec.authors = 'Internet Initiative Japan Inc.'
+ spec.authors = ['Internet Initiative Japan Inc.', 'mruby developers']
spec.summary = 'Array#pack and String#unpack method'
spec.cc.include_paths << "#{build.root}/src"
diff --git a/mrbgems/mruby-pack/src/pack.c b/mrbgems/mruby-pack/src/pack.c
index 73b6ce635..3a2c3367a 100644
--- a/mrbgems/mruby-pack/src/pack.c
+++ b/mrbgems/mruby-pack/src/pack.c
@@ -2,7 +2,7 @@
** pack.c - Array#pack, String#unpack
*/
-#include "mruby.h"
+#include <mruby.h>
#include "mruby/error.h"
#include "mruby/array.h"
#include "mruby/class.h"
@@ -13,7 +13,6 @@
#include <ctype.h>
#include <errno.h>
#include <limits.h>
-#include <stdio.h>
#include <string.h>
struct tmpl {
@@ -213,6 +212,59 @@ pack_l(mrb_state *mrb, mrb_value o, mrb_value str, mrb_int sidx, unsigned int fl
return 4;
}
+#ifndef MRB_INT64
+static void
+u32tostr(char *buf, size_t len, uint32_t n)
+{
+#ifdef MRB_DISABLE_STDIO
+ char *bufend = buf + len;
+ char *p = bufend - 1;
+
+ if (len < 1) {
+ return;
+ }
+
+ *p -- = '\0';
+ len --;
+
+ if (n > 0) {
+ for (; len > 0 && n > 0; len --, n /= 10) {
+ *p -- = '0' + (n % 10);
+ }
+ p ++;
+ }
+ else if (len > 0) {
+ *p = '0';
+ len --;
+ }
+
+ memmove(buf, p, bufend - p);
+#else
+ snprintf(buf, len, "%" PRIu32, n);
+#endif /* MRB_DISABLE_STDIO */
+}
+
+static void
+i32tostr(char *buf, size_t len, int32_t n)
+{
+#ifdef MRB_DISABLE_STDIO
+ if (len < 1) {
+ return;
+ }
+
+ if (n < 0) {
+ *buf ++ = '-';
+ len --;
+ n = -n;
+ }
+
+ u32tostr(buf, len, (uint32_t)n);
+#else
+ snprintf(buf, len, "%" PRId32, n);
+#endif /* MRB_DISABLE_STDIO */
+}
+#endif /* MRB_INT64 */
+
static int
unpack_l(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, unsigned int flags)
{
@@ -237,16 +289,16 @@ unpack_l(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
int32_t sl = ul;
#ifndef MRB_INT64
if (!FIXABLE(sl)) {
- snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %" PRId32, sl);
- mrb_raise(mrb, E_RANGE_ERROR, msg);
+ i32tostr(msg, sizeof(msg), sl);
+ mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Fixnum: %s", msg);
}
#endif
n = sl;
} else {
#ifndef MRB_INT64
if (!POSFIXABLE(ul)) {
- snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %" PRIu32, ul);
- mrb_raise(mrb, E_RANGE_ERROR, msg);
+ u32tostr(msg, sizeof(msg), ul);
+ mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Fixnum: %s", msg);
}
#endif
n = ul;
@@ -284,6 +336,57 @@ pack_q(mrb_state *mrb, mrb_value o, mrb_value str, mrb_int sidx, unsigned int fl
return 8;
}
+static void
+u64tostr(char *buf, size_t len, uint64_t n)
+{
+#ifdef MRB_DISABLE_STDIO
+ char *bufend = buf + len;
+ char *p = bufend - 1;
+
+ if (len < 1) {
+ return;
+ }
+
+ *p -- = '\0';
+ len --;
+
+ if (n > 0) {
+ for (; len > 0 && n > 0; len --, n /= 10) {
+ *p -- = '0' + (n % 10);
+ }
+ p ++;
+ }
+ else if (len > 0) {
+ *p = '0';
+ len --;
+ }
+
+ memmove(buf, p, bufend - p);
+#else
+ snprintf(buf, len, "%" PRIu64, n);
+#endif /* MRB_DISABLE_STDIO */
+}
+
+static void
+i64tostr(char *buf, size_t len, int64_t n)
+{
+#ifdef MRB_DISABLE_STDIO
+ if (len < 1) {
+ return;
+ }
+
+ if (n < 0) {
+ *buf ++ = '-';
+ len --;
+ n = -n;
+ }
+
+ u64tostr(buf, len, (uint64_t)n);
+#else
+ snprintf(buf, len, "%" PRId64, n);
+#endif /* MRB_DISABLE_STDIO */
+}
+
static int
unpack_q(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, unsigned int flags)
{
@@ -307,14 +410,14 @@ unpack_q(mrb_state *mrb, const unsigned char *src, int srclen, mrb_value ary, un
if (flags & PACK_FLAG_SIGNED) {
int64_t sll = ull;
if (!FIXABLE(sll)) {
- snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %" PRId64, sll);
- mrb_raise(mrb, E_RANGE_ERROR, msg);
+ i64tostr(msg, sizeof(msg), sll);
+ mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Fixnum: %s", msg);
}
n = sll;
} else {
if (!POSFIXABLE(ull)) {
- snprintf(msg, sizeof(msg), "cannot unpack to Fixnum: %" PRIu64, ull);
- mrb_raise(mrb, E_RANGE_ERROR, msg);
+ u64tostr(msg, sizeof(msg), ull);
+ mrb_raisef(mrb, E_RANGE_ERROR, "cannot unpack to Fixnum: %s", msg);
}
n = ull;
}
diff --git a/mrbgems/mruby-print/src/print.c b/mrbgems/mruby-print/src/print.c
index f7f99fc77..66d070f60 100644
--- a/mrbgems/mruby-print/src/print.c
+++ b/mrbgems/mruby-print/src/print.c
@@ -1,6 +1,10 @@
#include <mruby.h>
+
+#ifdef MRB_DISABLE_STDIO
+# error print conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
+#endif
+
#include <mruby/string.h>
-#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#if defined(_WIN32)
diff --git a/mrbgems/mruby-proc-ext/src/proc.c b/mrbgems/mruby-proc-ext/src/proc.c
index a7faeebea..5343c478f 100644
--- a/mrbgems/mruby-proc-ext/src/proc.c
+++ b/mrbgems/mruby-proc-ext/src/proc.c
@@ -6,7 +6,7 @@
#include <mruby/debug.h>
static mrb_value
-mrb_proc_lambda(mrb_state *mrb, mrb_value self)
+mrb_proc_lambda_p(mrb_state *mrb, mrb_value self)
{
struct RProc *p = mrb_proc_ptr(self);
return mrb_bool_value(MRB_PROC_STRICT_P(p));
@@ -169,14 +169,14 @@ void
mrb_mruby_proc_ext_gem_init(mrb_state* mrb)
{
struct RClass *p = mrb->proc_class;
- mrb_define_method(mrb, p, "lambda?", mrb_proc_lambda, MRB_ARGS_NONE());
+ mrb_define_method(mrb, p, "lambda?", mrb_proc_lambda_p, MRB_ARGS_NONE());
mrb_define_method(mrb, p, "source_location", mrb_proc_source_location, MRB_ARGS_NONE());
mrb_define_method(mrb, p, "to_s", mrb_proc_inspect, MRB_ARGS_NONE());
mrb_define_method(mrb, p, "inspect", mrb_proc_inspect, MRB_ARGS_NONE());
mrb_define_method(mrb, p, "parameters", mrb_proc_parameters, MRB_ARGS_NONE());
- mrb_define_class_method(mrb, mrb->kernel_module, "proc", mrb_kernel_proc, MRB_ARGS_NONE());
- mrb_define_method(mrb, mrb->kernel_module, "proc", mrb_kernel_proc, MRB_ARGS_NONE());
+ mrb_define_class_method(mrb, mrb->kernel_module, "proc", mrb_kernel_proc, MRB_ARGS_NONE()|MRB_ARGS_BLOCK());
+ mrb_define_method(mrb, mrb->kernel_module, "proc", mrb_kernel_proc, MRB_ARGS_NONE()|MRB_ARGS_BLOCK());
}
void
diff --git a/mrbgems/mruby-sleep/mrbgem.rake b/mrbgems/mruby-sleep/mrbgem.rake
index 8827b3580..7a303b81c 100644
--- a/mrbgems/mruby-sleep/mrbgem.rake
+++ b/mrbgems/mruby-sleep/mrbgem.rake
@@ -1,5 +1,5 @@
MRuby::Gem::Specification.new('mruby-sleep') do |spec|
spec.license = 'MIT'
- spec.authors = 'MATSUMOTO Ryosuke'
+ spec.authors = ['MATSUMOTO Ryosuke', 'mruby developers']
spec.version = '0.0.1'
end
diff --git a/mrbgems/mruby-sleep/src/mrb_sleep.c b/mrbgems/mruby-sleep/src/mrb_sleep.c
index 3f8ef90cf..ac9b07e85 100644
--- a/mrbgems/mruby-sleep/src/mrb_sleep.c
+++ b/mrbgems/mruby-sleep/src/mrb_sleep.c
@@ -2,6 +2,7 @@
** mrb_sleep - sleep methods for mruby
**
** Copyright (c) mod_mruby developers 2012-
+** Copyright (c) mruby developers 2018
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
diff --git a/mrbgems/mruby-socket/README.md b/mrbgems/mruby-socket/README.md
index ceb50c651..947a24e9e 100644
--- a/mrbgems/mruby-socket/README.md
+++ b/mrbgems/mruby-socket/README.md
@@ -35,6 +35,7 @@ Date: Tue, 21 May 2013 04:31:30 GMT
## License
Copyright (c) 2013 Internet Initiative Japan Inc.
+Copyright (c) 2017 mruby developers
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
diff --git a/mrbgems/mruby-socket/mrbgem.rake b/mrbgems/mruby-socket/mrbgem.rake
index b0894e095..6271c4559 100644
--- a/mrbgems/mruby-socket/mrbgem.rake
+++ b/mrbgems/mruby-socket/mrbgem.rake
@@ -1,13 +1,13 @@
MRuby::Gem::Specification.new('mruby-socket') do |spec|
spec.license = 'MIT'
- spec.authors = 'Internet Initiative Japan'
+ spec.authors = ['Internet Initiative Japan', 'mruby developers']
spec.summary = 'standard socket class'
spec.cc.include_paths << "#{build.root}/src"
#spec.cc.defines << "HAVE_SA_LEN=0"
# If Windows, use winsock
- if ( /mswin|mingw|win32/ =~ RUBY_PLATFORM ) then
+ if for_windows?
spec.linker.libraries << "wsock32"
spec.linker.libraries << "ws2_32"
end
diff --git a/mrbgems/mruby-socket/src/socket.c b/mrbgems/mruby-socket/src/socket.c
index 53cd9f4aa..8a0d9df6b 100644
--- a/mrbgems/mruby-socket/src/socket.c
+++ b/mrbgems/mruby-socket/src/socket.c
@@ -476,7 +476,7 @@ mrb_basicsocket_setsockopt(mrb_state *mrb, mrb_value self)
optname = mrb_fixnum(mrb_funcall(mrb, so, "optname", 0));
optval = mrb_funcall(mrb, so, "data", 0);
} else {
- mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%i for 3)", argc);
+ mrb_argnum_error(mrb, argc, 3, 3);
}
s = socket_fd(mrb, self);
diff --git a/mrbgems/mruby-socket/test/sockettest.c b/mrbgems/mruby-socket/test/sockettest.c
index 3017c7cc1..02eb1e1a8 100644
--- a/mrbgems/mruby-socket/test/sockettest.c
+++ b/mrbgems/mruby-socket/test/sockettest.c
@@ -1,4 +1,3 @@
-#include <stdio.h>
#include <stdlib.h>
#include "mruby.h"
@@ -8,7 +7,9 @@
#include <io.h>
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || \
+ (defined(MRB_MINGW32_VERSION) && MRB_MINGW32_VERSION < 3021) || \
+ (defined(MRB_MINGW64_VERSION) && MRB_MINGW64_VERSION < 4000)
#include <fcntl.h>
#include <sys/stat.h>
diff --git a/mrbgems/mruby-sprintf/src/kernel.c b/mrbgems/mruby-sprintf/src/kernel.c
index 946b43a8a..a0f0a78ba 100644
--- a/mrbgems/mruby-sprintf/src/kernel.c
+++ b/mrbgems/mruby-sprintf/src/kernel.c
@@ -18,8 +18,8 @@ mrb_mruby_sprintf_gem_init(mrb_state* mrb)
}
krn = mrb->kernel_module;
- mrb_define_method(mrb, krn, "sprintf", mrb_f_sprintf, MRB_ARGS_ANY());
- mrb_define_method(mrb, krn, "format", mrb_f_sprintf, MRB_ARGS_ANY());
+ mrb_define_method(mrb, krn, "sprintf", mrb_f_sprintf, MRB_ARGS_REQ(1)|MRB_ARGS_REST());
+ mrb_define_method(mrb, krn, "format", mrb_f_sprintf, MRB_ARGS_REQ(1)|MRB_ARGS_REST());
}
void
diff --git a/mrbgems/mruby-sprintf/src/sprintf.c b/mrbgems/mruby-sprintf/src/sprintf.c
index 6e4d8fd7e..9a7671a24 100644
--- a/mrbgems/mruby-sprintf/src/sprintf.c
+++ b/mrbgems/mruby-sprintf/src/sprintf.c
@@ -5,9 +5,7 @@
*/
#include <mruby.h>
-
#include <limits.h>
-#include <stdio.h>
#include <string.h>
#include <mruby/string.h>
#include <mruby/hash.h>
@@ -518,6 +516,50 @@ mrb_f_sprintf(mrb_state *mrb, mrb_value obj)
}
}
+static int
+mrb_int2str(char *buf, size_t len, mrb_int n)
+{
+#ifdef MRB_DISABLE_STDIO
+ char *bufend = buf + len;
+ char *p = bufend - 1;
+
+ if (len < 1) return -1;
+
+ *p -- = '\0';
+ len --;
+
+ if (n < 0) {
+ if (len < 1) return -1;
+
+ *p -- = '-';
+ len --;
+ n = -n;
+ }
+
+ if (n > 0) {
+ for (; n > 0; len --, n /= 10) {
+ if (len < 1) return -1;
+
+ *p -- = '0' + (n % 10);
+ }
+ p ++;
+ }
+ else if (len > 0) {
+ *p = '0';
+ len --;
+ }
+ else {
+ return -1;
+ }
+
+ memmove(buf, p, bufend - p);
+
+ return bufend - p - 1;
+#else
+ return snprintf(buf, len, "%" MRB_PRId, n);
+#endif /* MRB_DISABLE_STDIO */
+}
+
mrb_value
mrb_str_format(mrb_state *mrb, mrb_int argc, const mrb_value *argv, mrb_value fmt)
{
@@ -708,7 +750,12 @@ retry:
}
else if (mrb_fixnum_p(val)) {
mrb_int n = mrb_fixnum(val);
+#ifndef MRB_UTF8_STRING
+ char buf[1];
+ buf[0] = (char)n&0xff;
+ tmp = mrb_str_new(mrb, buf, 1);
+#else
if (n < 0x80) {
char buf[1];
@@ -719,6 +766,7 @@ retry:
tmp = mrb_funcall(mrb, val, "chr", 0);
mrb_check_type(mrb, tmp, MRB_TT_STRING);
}
+#endif
}
else {
mrb_raise(mrb, E_ARGUMENT_ERROR, "invalid character");
@@ -866,7 +914,7 @@ retry:
width--;
}
mrb_assert(base == 10);
- snprintf(nbuf, sizeof(nbuf), "%" MRB_PRId, v);
+ mrb_int2str(nbuf, sizeof(nbuf), v);
s = nbuf;
if (v < 0) s++; /* skip minus sign */
}
@@ -874,24 +922,12 @@ retry:
s = nbuf;
if (v < 0) {
dots = 1;
+ val = mrb_fix2binstr(mrb, mrb_fixnum_value(v), base);
}
- switch (base) {
- case 2:
- if (v < 0) {
- val = mrb_fix2binstr(mrb, mrb_fixnum_value(v), base);
- }
- else {
- val = mrb_fixnum_to_str(mrb, mrb_fixnum_value(v), base);
- }
- strncpy(++s, RSTRING_PTR(val), sizeof(nbuf)-1);
- break;
- case 8:
- snprintf(++s, sizeof(nbuf)-1, "%" MRB_PRIo, v);
- break;
- case 16:
- snprintf(++s, sizeof(nbuf)-1, "%" MRB_PRIx, v);
- break;
+ else {
+ val = mrb_fixnum_to_str(mrb, mrb_fixnum_value(v), base);
}
+ strncpy(++s, RSTRING_PTR(val), sizeof(nbuf)-1);
if (v < 0) {
char d;
@@ -1005,7 +1041,7 @@ retry:
mrb_value val = GETARG();
double fval;
mrb_int need = 6;
- char fbuf[32];
+ char fbuf[64];
fval = mrb_float(mrb_Float(mrb, val));
if (!isfinite(fval)) {
@@ -1046,7 +1082,6 @@ retry:
break;
}
- fmt_setup(fbuf, sizeof(fbuf), *p, flags, width, prec);
need = 0;
if (*p != 'e' && *p != 'E') {
int i;
@@ -1068,7 +1103,8 @@ retry:
need += 20;
CHECK(need);
- n = snprintf(&buf[blen], need, fbuf, fval);
+ fmt_setup(fbuf, sizeof(fbuf), *p, flags, width, prec);
+ n = mrb_float_to_cstr(mrb, &buf[blen], need, fbuf, fval);
if (n < 0 || n >= need) {
mrb_raise(mrb, E_RUNTIME_ERROR, "formatting error");
}
@@ -1110,12 +1146,13 @@ fmt_setup(char *buf, size_t size, int c, int flags, mrb_int width, mrb_int prec)
if (flags & FSPACE) *buf++ = ' ';
if (flags & FWIDTH) {
- n = snprintf(buf, end - buf, "%d", (int)width);
+ n = mrb_int2str(buf, end - buf, width);
buf += n;
}
if (flags & FPREC) {
- n = snprintf(buf, end - buf, ".%d", (int)prec);
+ *buf ++ = '.';
+ n = mrb_int2str(buf, end - buf, prec);
buf += n;
}
diff --git a/mrbgems/mruby-sprintf/test/sprintf.rb b/mrbgems/mruby-sprintf/test/sprintf.rb
index 137812ae7..0eb51f557 100644
--- a/mrbgems/mruby-sprintf/test/sprintf.rb
+++ b/mrbgems/mruby-sprintf/test/sprintf.rb
@@ -8,6 +8,11 @@ assert('String#%') do
assert_equal 15, ("%b" % (1<<14)).size
skip unless Object.const_defined?(:Float)
assert_equal "1.0", "%3.1f" % 1.01
+ assert_equal " 123456789.12", "% 4.2f" % 123456789.123456789
+ assert_equal "123456789.12", "%-4.2f" % 123456789.123456789
+ assert_equal "+123456789.12", "%+4.2f" % 123456789.123456789
+ assert_equal "123456789.12", "%04.2f" % 123456789.123456789
+ assert_equal "00000000123456789.12", "%020.2f" % 123456789.123456789
end
assert('String#% with inf') do
@@ -68,29 +73,6 @@ assert('String#% with nan') do
assert_equal " NaN", "% 5f" % nan
end
-assert("String#% with invalid chr") do
- begin
- class Fixnum
- alias_method :chr_, :chr if method_defined?(:chr)
-
- def chr
- nil
- end
- end
-
- assert_raise TypeError do
- "%c" % 0x80
- end
- ensure
- class Fixnum
- if method_defined?(:chr_)
- alias_method :chr, :chr_
- remove_method :chr_
- end
- end
- end
-end
-
assert("String#% %b") do
assert_equal("..10115", "%0b5" % -5)
end
diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c
index 2d82c2466..f42a5f1ea 100644
--- a/mrbgems/mruby-struct/src/struct.c
+++ b/mrbgems/mruby-struct/src/struct.c
@@ -274,7 +274,7 @@ mrb_struct_s_def(mrb_state *mrb, mrb_value klass)
name = mrb_nil_value();
mrb_get_args(mrb, "*&", &argv, &argc, &b);
if (argc == 0) { /* special case to avoid crash */
- mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments");
+ mrb_argnum_error(mrb, argc, 1, -1);
}
else {
pargv = argv;
diff --git a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
index 4b4cf83fe..99fa275d5 100644
--- a/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
+++ b/mrbgems/mruby-symbol-ext/mrblib/symbol.rb
@@ -10,7 +10,7 @@ class Symbol
# Same as <code>sym.to_s.capitalize.intern</code>.
def capitalize
- self.to_s.capitalize.to_sym
+ (self.to_s.capitalize! || self).to_sym
end
##
@@ -20,7 +20,7 @@ class Symbol
# Same as <code>sym.to_s.downcase.intern</code>.
def downcase
- self.to_s.downcase.to_sym
+ (self.to_s.downcase! || self).to_sym
end
##
@@ -30,7 +30,7 @@ class Symbol
# Same as <code>sym.to_s.upcase.intern</code>.
def upcase
- self.to_s.upcase.to_sym
+ (self.to_s.upcase! || self).to_sym
end
##
@@ -41,7 +41,7 @@ class Symbol
def casecmp(other)
return nil unless other.kind_of?(Symbol)
- lhs = self.to_s.upcase
+ lhs = self.to_s; lhs.upcase!
rhs = other.to_s.upcase
lhs <=> rhs
end
diff --git a/mrbgems/mruby-symbol-ext/src/symbol.c b/mrbgems/mruby-symbol-ext/src/symbol.c
index 87f8381b1..ad922ad2f 100644
--- a/mrbgems/mruby-symbol-ext/src/symbol.c
+++ b/mrbgems/mruby-symbol-ext/src/symbol.c
@@ -47,7 +47,7 @@ mrb_sym_length(mrb_state *mrb, mrb_value self)
#ifdef MRB_UTF8_STRING
mrb_int byte_len;
const char *name = mrb_sym_name_len(mrb, mrb_symbol(self), &byte_len);
- len = mrb_utf8_len(name, byte_len);
+ len = mrb_utf8_strlen(name, byte_len);
#else
mrb_sym_name_len(mrb, mrb_symbol(self), &len);
#endif
diff --git a/mrbgems/mruby-test/mrbgem.rake b/mrbgems/mruby-test/mrbgem.rake
index bf90e0791..6ce24bc94 100644
--- a/mrbgems/mruby-test/mrbgem.rake
+++ b/mrbgems/mruby-test/mrbgem.rake
@@ -40,7 +40,7 @@ MRuby::Gem::Specification.new('mruby-test') do |spec|
file test_rbobj => g.test_rbireps
file g.test_rbireps => [g.test_rbfiles, build.mrbcfile].flatten do |t|
- FileUtils.mkdir_p File.dirname(t.name)
+ mkdir_p File.dirname(t.name)
open(t.name, 'w') do |f|
g.print_gem_test_header(f)
test_preload = g.test_preload and [g.dir, MRUBY_ROOT].map {|dir|
@@ -149,15 +149,10 @@ MRuby::Gem::Specification.new('mruby-test') do |spec|
# of the test gem depending on a change to the gem
# selection
active_gems_path = "#{build_dir}/active_gems_path.lst"
- active_gem_list = if File.exist? active_gems_path
- File.read active_gems_path
- else
- FileUtils.mkdir_p File.dirname(active_gems_path)
- nil
- end
+ active_gem_list = File.read active_gems_path if File.exist? active_gems_path
current_gem_list = build.gems.map(&:name).join("\n")
task active_gems_path do |_t|
- FileUtils.mkdir_p File.dirname(active_gems_path)
+ mkdir_p File.dirname(active_gems_path)
File.write active_gems_path, current_gem_list
end
file clib => active_gems_path if active_gem_list != current_gem_list
@@ -165,7 +160,7 @@ MRuby::Gem::Specification.new('mruby-test') do |spec|
file mlib => clib
file clib => [build.mrbcfile, __FILE__] do |_t|
_pp "GEN", "*.rb", "#{clib.relative_path}"
- FileUtils.mkdir_p File.dirname(clib)
+ mkdir_p File.dirname(clib)
open(clib, 'w') do |f|
f.puts %Q[/*]
f.puts %Q[ * This file contains a list of all]
diff --git a/mrbgems/mruby-test/vformat.c b/mrbgems/mruby-test/vformat.c
index 6984aaeb1..e7ada02da 100644
--- a/mrbgems/mruby-test/vformat.c
+++ b/mrbgems/mruby-test/vformat.c
@@ -4,197 +4,176 @@
#include <mruby/data.h>
#include <mruby/string.h>
-#ifdef MRB_WITHOUT_FLOAT
-typedef mrb_int mrb_float;
-#define mrb_float(o) mrb_fixnum(o)
+/* no argument */
+static mrb_value
+vf_s_format_0(mrb_state *mrb, mrb_value klass)
+{
+ mrb_value fmt_str;
+ const char *fmt;
+
+ mrb_get_args(mrb, "S", &fmt_str);
+ fmt = RSTRING_CSTR(mrb, fmt_str);
+
+ return mrb_format(mrb, fmt);
+}
+
+/* c char */
+static mrb_value
+vf_s_format_c(mrb_state *mrb, mrb_value klass)
+{
+ mrb_value fmt_str, arg_str;
+ const char *fmt;
+ char c;
+
+ mrb_get_args(mrb, "SS", &fmt_str, &arg_str);
+ fmt = RSTRING_CSTR(mrb, fmt_str);
+ c = RSTRING_CSTR(mrb, arg_str)[0];
+
+ return mrb_format(mrb, fmt, c);
+}
+
+/* d int */
+static mrb_value
+vf_s_format_d(mrb_state *mrb, mrb_value klass)
+{
+ mrb_value fmt_str;
+ const char *fmt;
+ mrb_int i;
+ int d;
+
+ mrb_get_args(mrb, "Si", &fmt_str, &i);
+ fmt = RSTRING_CSTR(mrb, fmt_str);
+ d = (int)i;
+
+ return mrb_format(mrb, fmt, d);
+}
+
+#ifndef MRB_WITHOUT_FLOAT
+/* f float */
+static mrb_value
+vf_s_format_f(mrb_state *mrb, mrb_value klass)
+{
+ mrb_value fmt_str;
+ const char *fmt;
+ mrb_float f;
+
+ mrb_get_args(mrb, "Sf", &fmt_str, &f);
+ fmt = RSTRING_CSTR(mrb, fmt_str);
+
+ return mrb_format(mrb, fmt, f);
+}
#endif
-#define NATIVE_TYPES \
- char c; \
- int d; \
- mrb_float f; \
- mrb_int i; \
-/* size_t l; */\
- mrb_sym n; \
- char *s; \
- struct RClass *C
-
-#define NATIVE_DEFINE_TYPE_FUNC(t) \
- static mrb_value \
- native_s_##t(mrb_state *mrb, mrb_value klass) \
- { \
- mrb_value obj, type = mrb_fixnum_value(ARG_##t); \
- mrb_get_args(mrb, "o", &obj); \
- return mrb_funcall(mrb, klass, "new", 2, type, obj); \
- }
-
-#define NATIVE_DEFINE_TYPE_METHOD(t) \
- mrb_define_class_method(mrb, n, #t, native_s_##t, MRB_ARGS_REQ(1))
-
-typedef enum {
- ARG_c,
- ARG_d,
- ARG_f,
- ARG_i,
-/* ARG_l,*/
- ARG_n,
- ARG_s,
- ARG_C,
- ARG_v,
-} VFArgumentType;
-
-typedef struct {
- VFArgumentType type;
- union { NATIVE_TYPES; };
-} VFNative;
-
-typedef struct {
- VFArgumentType type;
- union {
- NATIVE_TYPES;
- mrb_value v;
- };
-} VFArgument;
-
-static void
-native_free(mrb_state *mrb, void *data)
+/* i fixnum */
+static mrb_value
+vf_s_format_i(mrb_state *mrb, mrb_value klass)
{
- VFNative *native = (VFNative*)data;
- if (native->type == ARG_s) mrb_free(mrb, native->s);
- mrb_free(mrb, native);
+ mrb_value fmt_str;
+ const char *fmt;
+ mrb_int i;
+
+ mrb_get_args(mrb, "Si", &fmt_str, &i);
+ fmt = RSTRING_CSTR(mrb, fmt_str);
+
+ return mrb_format(mrb, fmt, i);
}
-static const struct mrb_data_type native_data_type = {
- "TestVFormat::Native", native_free
-};
+/* l char*, size_t */
+static mrb_value
+vf_s_format_l(mrb_state *mrb, mrb_value klass)
+{
+ mrb_value fmt_str, arg_str;
+ const char *fmt;
+ const char *s;
+ mrb_int i;
+ size_t len;
+
+ mrb_get_args(mrb, "SSi", &fmt_str, &arg_str, &i);
+ fmt = RSTRING_CSTR(mrb, fmt_str);
+ s = RSTRING_PTR(arg_str);
+ len = (size_t)i;
+ if (len > (size_t)RSTRING_LEN(arg_str)) len = (size_t)RSTRING_LEN(arg_str);
+
+ return mrb_format(mrb, fmt, s, len);
+}
+/* n symbol */
static mrb_value
-native_initialize(mrb_state *mrb, mrb_value self)
+vf_s_format_n(mrb_state *mrb, mrb_value klass)
{
- VFNative data, *datap;
- mrb_int type;
- mrb_value obj;
-
- mrb_get_args(mrb, "io", &type, &obj);
- data.type = (VFArgumentType)type;
- switch (data.type) {
- case ARG_c: data.c = RSTRING_PTR(obj)[0]; break;
- case ARG_d: data.d = (int)mrb_fixnum(obj); break;
- case ARG_f: data.f = mrb_float(obj); break;
- case ARG_i: data.i = mrb_fixnum(obj); break;
-/* case ARG_l: data.l = (size_t)mrb_fixnum(obj); break;*/
- case ARG_n: data.n = mrb_symbol(obj); break;
- case ARG_s: data.s = (char*)mrb_malloc(mrb, RSTRING_LEN(obj) + 1);
- memcpy(data.s, RSTRING_PTR(obj), RSTRING_LEN(obj));
- data.s[RSTRING_LEN(obj)] = '\0'; break;
- case ARG_C: data.C = mrb_class_ptr(obj); break;
- default: mrb_raise(mrb, E_ARGUMENT_ERROR, "unknown type");
- }
- datap = (VFNative*)mrb_malloc(mrb, sizeof(VFNative));
- *datap = data;
- mrb_data_init(self, datap, &native_data_type);
- return self;
+ mrb_value fmt_str;
+ const char *fmt;
+ mrb_sym sym;
+
+ mrb_get_args(mrb, "Sn", &fmt_str, &sym);
+ fmt = RSTRING_CSTR(mrb, fmt_str);
+
+ return mrb_format(mrb, fmt, sym);
}
-NATIVE_DEFINE_TYPE_FUNC(c)
-NATIVE_DEFINE_TYPE_FUNC(d)
-NATIVE_DEFINE_TYPE_FUNC(f)
-NATIVE_DEFINE_TYPE_FUNC(i)
-/*NATIVE_DEFINE_TYPE_FUNC(l)*/
-NATIVE_DEFINE_TYPE_FUNC(n)
-NATIVE_DEFINE_TYPE_FUNC(s)
-NATIVE_DEFINE_TYPE_FUNC(C)
-
-static VFArgument*
-arg_from_obj(mrb_state *mrb, mrb_value obj, struct RClass *native_class,
- VFArgument *vf_arg)
+/* s char* */
+static mrb_value
+vf_s_format_s(mrb_state *mrb, mrb_value klass)
{
- if (mrb_obj_is_instance_of(mrb, obj, native_class)) {
- const VFNative *native = (VFNative*)DATA_PTR(obj);
- *(VFNative*)vf_arg = *native;
- }
- else {
- vf_arg->v = obj;
- vf_arg->type = ARG_v;
- }
- return vf_arg;
+ mrb_value fmt_str, arg_str;
+ const char *fmt;
+ const char *s;
+
+ mrb_get_args(mrb, "SS", &fmt_str, &arg_str);
+ fmt = RSTRING_CSTR(mrb, fmt_str);
+ s = RSTRING_CSTR(mrb, arg_str);
+
+ return mrb_format(mrb, fmt, s);
}
-#define VF_FORMAT_INIT(klass) \
- struct RClass *vf_native_class = \
- mrb_class_get_under(mrb, mrb_class_ptr(klass), "Native"); \
- VFArgument vf_args[2];
-
-#define VF_ARG(args, idx) \
- arg_from_obj(mrb, args[idx], vf_native_class, &vf_args[idx])
-
-#define VF_FORMAT0(fmt) mrb_format(mrb, fmt);
-#define VF_FORMAT1(fmt, args) \
- (VF_ARG(args, 0), VF_FORMAT_TYPED(fmt, 1, vf_args, NULL))
-#define VF_FORMAT2(fmt, args) ( \
- VF_ARG(args, 0), VF_ARG(args, 1), \
- VF_FORMAT2_COND_EXPR(fmt, vf_args, vf_args+1, c) : \
- VF_FORMAT2_COND_EXPR(fmt, vf_args, vf_args+1, d) : \
- VF_FORMAT2_COND_EXPR(fmt, vf_args, vf_args+1, f) : \
- VF_FORMAT2_COND_EXPR(fmt, vf_args, vf_args+1, i) : \
-/* VF_FORMAT2_COND_EXPR(fmt, vf_args, vf_args+1, l) : */\
- VF_FORMAT2_COND_EXPR(fmt, vf_args, vf_args+1, n) : \
- VF_FORMAT2_COND_EXPR(fmt, vf_args, vf_args+1, s) : \
- VF_FORMAT2_COND_EXPR(fmt, vf_args, vf_args+1, C) : \
- VF_FORMAT2_COND_EXPR(fmt, vf_args, vf_args+1, v) : \
- mrb_nil_value() /* not reached */ \
-)
-#define VF_FORMAT2_COND_EXPR(fmt, a1, a2, t) \
- a1->type == ARG_##t ? VF_FORMAT_TYPED(fmt, 2, a2, (a1)->t)
-#define VF_FORMAT_TYPED(fmt, n_arg, type_a, v1) \
- VF_FORMAT_TYPED_COND_EXPR(fmt, n_arg, type_a, v1, c) : \
- VF_FORMAT_TYPED_COND_EXPR(fmt, n_arg, type_a, v1, d) : \
- VF_FORMAT_TYPED_COND_EXPR(fmt, n_arg, type_a, v1, f) : \
- VF_FORMAT_TYPED_COND_EXPR(fmt, n_arg, type_a, v1, i) : \
-/* VF_FORMAT_TYPED_COND_EXPR(fmt, n_arg, type_a, v1, l) : */\
- VF_FORMAT_TYPED_COND_EXPR(fmt, n_arg, type_a, v1, n) : \
- VF_FORMAT_TYPED_COND_EXPR(fmt, n_arg, type_a, v1, s) : \
- VF_FORMAT_TYPED_COND_EXPR(fmt, n_arg, type_a, v1, C) : \
- VF_FORMAT_TYPED_COND_EXPR(fmt, n_arg, type_a, v1, v) : \
- mrb_nil_value() /* not reached */
-#define VF_FORMAT_TYPED_COND_EXPR(fmt, n_arg, type_a, v1, t) \
- (type_a)->type == ARG_##t ? n_arg == 1 ? \
- mrb_format(mrb, fmt, (type_a)->t) : mrb_format(mrb, fmt, v1, (type_a)->t)
+/* C RClass */
+static mrb_value
+vf_s_format_C(mrb_state *mrb, mrb_value klass)
+{
+ mrb_value fmt_str, arg_cls;
+ const char *fmt;
+ struct RClass *c;
+
+ mrb_get_args(mrb, "SC", &fmt_str, &arg_cls);
+ fmt = RSTRING_CSTR(mrb, fmt_str);
+ c = mrb_class_ptr(arg_cls);
+ return mrb_format(mrb, fmt, c);
+}
+
+/* v value */
static mrb_value
-vf_s_format(mrb_state *mrb, mrb_value klass)
+vf_s_format_v(mrb_state *mrb, mrb_value klass)
{
- mrb_value fmt_str, args[2];
- mrb_int argc = mrb_get_args(mrb, "S|oo", &fmt_str, args, args+1);
- const char *fmt = RSTRING_CSTR(mrb, fmt_str);
-
- VF_FORMAT_INIT(klass);
-
- switch (argc) {
- case 1: return VF_FORMAT0(fmt);
- case 2: return VF_FORMAT1(fmt, args);
- case 3: return VF_FORMAT2(fmt, args);
- default: return mrb_nil_value(); /* not reached */
- }
+ mrb_value fmt_str, arg_v;
+ const char *fmt;
+
+ mrb_get_args(mrb, "So", &fmt_str, &arg_v);
+ fmt = RSTRING_CSTR(mrb, fmt_str);
+
+ return mrb_format(mrb, fmt, arg_v);
}
void
mrb_init_test_vformat(mrb_state *mrb)
{
- struct RClass *vf, *n;
+ struct RClass *vf;
vf = mrb_define_module(mrb, "TestVFormat");
- mrb_define_class_method(mrb, vf, "format", vf_s_format, MRB_ARGS_ARG(1,2));
-
- n = mrb_define_class_under(mrb, vf, "Native", mrb->object_class);
- MRB_SET_INSTANCE_TT(n, MRB_TT_DATA);
- NATIVE_DEFINE_TYPE_METHOD(c);
- NATIVE_DEFINE_TYPE_METHOD(d);
- NATIVE_DEFINE_TYPE_METHOD(f);
- NATIVE_DEFINE_TYPE_METHOD(i);
-/* NATIVE_DEFINE_TYPE_METHOD(l);*/
- NATIVE_DEFINE_TYPE_METHOD(n);
- NATIVE_DEFINE_TYPE_METHOD(s);
- NATIVE_DEFINE_TYPE_METHOD(C);
- mrb_define_method(mrb, n, "initialize", native_initialize, MRB_ARGS_REQ(2));
+ mrb_define_class_method(mrb, vf, "z", vf_s_format_0, MRB_ARGS_REQ(1));
+
+#define VF_DEFINE_FORMAT_METHOD(t) VF_DEFINE_FORMAT_METHOD_n(t,2)
+#define VF_DEFINE_FORMAT_METHOD_n(t,n) mrb_define_class_method(mrb, vf, #t, vf_s_format_##t, MRB_ARGS_REQ(n));
+
+ VF_DEFINE_FORMAT_METHOD(c);
+ VF_DEFINE_FORMAT_METHOD(d);
+#ifndef MRB_WITHOUT_FLOAT
+ VF_DEFINE_FORMAT_METHOD(f);
+#endif
+ VF_DEFINE_FORMAT_METHOD(i);
+ VF_DEFINE_FORMAT_METHOD_n(l,3);
+ VF_DEFINE_FORMAT_METHOD(n);
+ VF_DEFINE_FORMAT_METHOD(s);
+ VF_DEFINE_FORMAT_METHOD(C);
+ VF_DEFINE_FORMAT_METHOD(v);
}
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c
index c6680056a..e76e11649 100644
--- a/mrbgems/mruby-time/src/time.c
+++ b/mrbgems/mruby-time/src/time.c
@@ -11,12 +11,11 @@
#include <mruby.h>
#include <mruby/class.h>
#include <mruby/data.h>
+#include <mruby/numeric.h>
#include <mruby/time.h>
#include <mruby/string.h>
-#ifndef MRB_DISABLE_STDIO
-#include <stdio.h>
-#else
+#ifdef MRB_DISABLE_STDIO
#include <string.h>
#endif
@@ -76,11 +75,6 @@ double round(double x) {
/* define following macro to use probably faster timegm() on the platform */
/* #define USE_SYSTEM_TIMEGM */
-/* time_t */
-/* If your platform supports time_t as uint (e.g. uint32_t, uint64_t), */
-/* uncomment following macro. */
-/* #define MRB_TIME_T_UINT */
-
/** end of Time class configuration */
#ifndef NO_GETTIMEOFDAY
@@ -214,15 +208,22 @@ typedef mrb_int mrb_sec;
#define mrb_sec_value(mrb, sec) mrb_fixnum_value(sec)
#endif
-#ifdef MRB_TIME_T_UINT
-typedef uint64_t mrb_time_int;
-# define MRB_TIME_MIN 0
-# define MRB_TIME_MAX (sizeof(time_t) <= 4 ? UINT32_MAX : UINT64_MAX)
-#else
-typedef int64_t mrb_time_int;
-# define MRB_TIME_MIN (sizeof(time_t) <= 4 ? INT32_MIN : INT64_MIN)
-# define MRB_TIME_MAX (sizeof(time_t) <= 4 ? INT32_MAX : INT64_MAX)
-#endif
+#define MRB_TIME_T_UINT (~(time_t)0 > 0)
+#define MRB_TIME_MIN ( \
+ MRB_TIME_T_UINT ? 0 : \
+ (sizeof(time_t) <= 4 ? INT32_MIN : INT64_MIN) \
+)
+#define MRB_TIME_MAX ( \
+ MRB_TIME_T_UINT ? (sizeof(time_t) <= 4 ? UINT32_MAX : UINT64_MAX) : \
+ (sizeof(time_t) <= 4 ? INT32_MAX : INT64_MAX) \
+)
+
+static mrb_bool
+fixable_time_t_p(time_t v)
+{
+ if (MRB_INT_MIN <= MRB_TIME_MIN && MRB_TIME_MAX <= MRB_INT_MAX) return TRUE;
+ return FIXABLE(v);
+}
static time_t
mrb_to_time_t(mrb_state *mrb, mrb_value obj, time_t *usec)
@@ -236,7 +237,7 @@ mrb_to_time_t(mrb_state *mrb, mrb_value obj, time_t *usec)
mrb_float f = mrb_float(obj);
mrb_check_num_exact(mrb, f);
- if (f > (mrb_float)MRB_TIME_MAX || (mrb_float)MRB_TIME_MIN > f) {
+ if (f >= ((mrb_float)MRB_TIME_MAX-1.0) || f < ((mrb_float)MRB_TIME_MIN+1.0)) {
goto out_of_range;
}
@@ -255,7 +256,8 @@ mrb_to_time_t(mrb_state *mrb, mrb_value obj, time_t *usec)
{
mrb_int i = mrb_int(mrb, obj);
- if ((mrb_time_int)i > MRB_TIME_MAX || MRB_TIME_MIN > i) {
+ if ((MRB_INT_MAX > MRB_TIME_MAX && i > 0 && i > (mrb_int)MRB_TIME_MAX) ||
+ (MRB_TIME_MIN > MRB_INT_MIN && MRB_TIME_MIN > i)) {
goto out_of_range;
}
@@ -868,7 +870,7 @@ mrb_time_to_i(mrb_state *mrb, mrb_value self)
tm = time_get_ptr(mrb, self);
#ifndef MRB_WITHOUT_FLOAT
- if (tm->sec > MRB_INT_MAX || tm->sec < MRB_INT_MIN) {
+ if (!fixable_time_t_p(tm->sec)) {
return mrb_float_value(mrb, (mrb_float)tm->sec);
}
#endif
@@ -884,7 +886,7 @@ mrb_time_usec(mrb_state *mrb, mrb_value self)
tm = time_get_ptr(mrb, self);
#ifndef MRB_WITHOUT_FLOAT
- if (tm->usec > MRB_INT_MAX || tm->usec < MRB_INT_MIN) {
+ if (!fixable_time_t_p(tm->usec)) {
return mrb_float_value(mrb, (mrb_float)tm->usec);
}
#endif
diff --git a/mrblib/hash.rb b/mrblib/hash.rb
index b49e987c7..7d64addd7 100644
--- a/mrblib/hash.rb
+++ b/mrblib/hash.rb
@@ -140,7 +140,7 @@ class Hash
def each_value(&block)
return to_enum :each_value unless block
- self.keys.each{|k| block.call(self[k])}
+ self.values.each{|v| block.call(v)}
self
end
@@ -192,11 +192,11 @@ class Hash
recur_list[self.object_id] = true
ary=[]
keys=self.keys
+ vals=self.values
size=keys.size
i=0
while i<size
- k=keys[i]
- ary<<(k._inspect(recur_list) + "=>" + self[k]._inspect(recur_list))
+ ary<<(keys[i]._inspect(recur_list) + "=>" + vals[i]._inspect(recur_list))
i+=1
end
"{"+ary.join(", ")+"}"
diff --git a/mrblib/mrblib.rake b/mrblib/mrblib.rake
index e96decb27..6fba0adc1 100644
--- a/mrblib/mrblib.rake
+++ b/mrblib/mrblib.rake
@@ -8,7 +8,7 @@ MRuby.each_target do
file objfile("#{current_build_dir}/mrblib") => "#{current_build_dir}/mrblib.c"
file "#{current_build_dir}/mrblib.c" => [mrbcfile, __FILE__] + Dir.glob("#{current_dir}/*.rb").sort do |t|
_, _, *rbfiles = t.prerequisites
- FileUtils.mkdir_p File.dirname(t.name)
+ mkdir_p File.dirname(t.name)
open(t.name, 'w') do |f|
_pp "GEN", "*.rb", "#{t.name.relative_path}"
f.puts File.read("#{current_dir}/init_mrblib.c")
diff --git a/mruby-source.gemspec b/mruby-source.gemspec
index 62d4c0d12..b87dda3a4 100644
--- a/mruby-source.gemspec
+++ b/mruby-source.gemspec
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
spec.summary = %q{MRuby source code wrapper.}
spec.description = %q{MRuby source code wrapper for use with Ruby libs.}
- spec.homepage = "http://www.mruby.org/"
+ spec.homepage = "https://mruby.org"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0")
diff --git a/src/array.c b/src/array.c
index 85481fe9e..ad0d5b8db 100644
--- a/src/array.c
+++ b/src/array.c
@@ -631,11 +631,13 @@ mrb_ary_unshift_m(mrb_state *mrb, mrb_value self)
ptr = a->as.heap.ptr;
}
else {
+ mrb_bool same = vals == ARY_PTR(a);
ary_modify(mrb, a);
if (ARY_CAPA(a) < len + alen)
ary_expand_capa(mrb, a, len + alen);
ptr = ARY_PTR(a);
value_move(ptr + alen, ptr, len);
+ if (same) vals = ptr;
}
array_copy(ptr, vals, alen);
ARY_SET_LEN(a, len+alen);
@@ -730,6 +732,10 @@ mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_val
argv = ARY_PTR(r);
}
}
+ else if (mrb_undef_p(rpl)) {
+ argc = 0;
+ argv = NULL;
+ }
else {
argc = 1;
argv = &rpl;
@@ -802,6 +808,13 @@ ary_subseq(mrb_state *mrb, struct RArray *a, mrb_int beg, mrb_int len)
return mrb_obj_value(b);
}
+mrb_value
+mrb_ary_subseq(mrb_state *mrb, mrb_value ary, mrb_int beg, mrb_int len)
+{
+ struct RArray *a = mrb_ary_ptr(ary);
+ return ary_subseq(mrb, a, beg, len);
+}
+
static mrb_int
aget_index(mrb_state *mrb, mrb_value index)
{
@@ -1302,6 +1315,7 @@ init_ary_each(mrb_state *mrb, struct RClass *ary)
each_irep->nregs = 7;
each_irep->nlocals = 3;
p = mrb_proc_new(mrb, each_irep);
+ p->flags |= MRB_PROC_SCOPE | MRB_PROC_STRICT;
MRB_METHOD_FROM_PROC(m, p);
mrb_define_method_raw(mrb, ary, mrb_intern_lit(mrb, "each"), m);
}
diff --git a/src/backtrace.c b/src/backtrace.c
index 803c5e285..591f4ea4b 100644
--- a/src/backtrace.c
+++ b/src/backtrace.c
@@ -25,6 +25,9 @@ typedef void (*each_backtrace_func)(mrb_state*, const struct backtrace_location*
static const mrb_data_type bt_type = { "Backtrace", mrb_free };
+mrb_value mrb_exc_inspect(mrb_state *mrb, mrb_value exc);
+mrb_value mrb_unpack_backtrace(mrb_state *mrb, mrb_value backtrace);
+
static void
each_backtrace(mrb_state *mrb, ptrdiff_t ciidx, const mrb_code *pc0, each_backtrace_func func, void *data)
{
@@ -74,66 +77,27 @@ each_backtrace(mrb_state *mrb, ptrdiff_t ciidx, const mrb_code *pc0, each_backtr
#ifndef MRB_DISABLE_STDIO
static void
-print_backtrace(mrb_state *mrb, mrb_value backtrace)
+print_backtrace(mrb_state *mrb, struct RObject *exc, mrb_value backtrace)
{
- int i;
- mrb_int n;
+ mrb_int i;
+ mrb_int n = RARRAY_LEN(backtrace);
+ mrb_value *loc, mesg;
FILE *stream = stderr;
- n = RARRAY_LEN(backtrace) - 1;
- if (n == 0) return;
-
- fprintf(stream, "trace (most recent call last):\n");
- for (i=0; i<n; i++) {
- mrb_value entry = RARRAY_PTR(backtrace)[n-i-1];
-
- if (mrb_string_p(entry)) {
- fprintf(stream, "\t[%d] %.*s\n", i, (int)RSTRING_LEN(entry), RSTRING_PTR(entry));
+ if (n != 0) {
+ fprintf(stream, "trace (most recent call last):\n");
+ for (i=n-1,loc=&RARRAY_PTR(backtrace)[i]; i>0; i--,loc--) {
+ if (mrb_string_p(*loc)) {
+ fprintf(stream, "\t[%d] %.*s\n",
+ (int)i, (int)RSTRING_LEN(*loc), RSTRING_PTR(*loc));
+ }
}
- }
-}
-
-static int
-packed_bt_len(const struct backtrace_location *bt, int n)
-{
- int len = 0;
- int i;
-
- for (i=0; i<n; i++) {
- if (!bt[i].filename && !bt[i].lineno && !bt[i].method_id)
- continue;
- len++;
- }
- return len;
-}
-
-static void
-print_packed_backtrace(mrb_state *mrb, mrb_value packed)
-{
- FILE *stream = stderr;
- const struct backtrace_location *bt;
- int n, i;
- int ai = mrb_gc_arena_save(mrb);
-
- bt = (struct backtrace_location*)mrb_data_check_get_ptr(mrb, packed, &bt_type);
- if (bt == NULL) return;
- n = (mrb_int)RDATA(packed)->flags;
-
- if (packed_bt_len(bt, n) == 0) return;
- fprintf(stream, "trace (most recent call last):\n");
- for (i = 0; i<n; i++) {
- const struct backtrace_location *entry = &bt[n-i-1];
- if (entry->filename == NULL) continue;
- fprintf(stream, "\t[%d] %s:%d", i, entry->filename, entry->lineno);
- if (entry->method_id != 0) {
- const char *method_name;
-
- method_name = mrb_sym_name(mrb, entry->method_id);
- fprintf(stream, ":in %s", method_name);
- mrb_gc_arena_restore(mrb, ai);
+ if (mrb_string_p(*loc)) {
+ fprintf(stream, "%.*s: ", (int)RSTRING_LEN(*loc), RSTRING_PTR(*loc));
}
- fprintf(stream, "\n");
}
+ mesg = mrb_exc_inspect(mrb, mrb_obj_value(exc));
+ fprintf(stream, "%.*s\n", (int)RSTRING_LEN(mesg), RSTRING_PTR(mesg));
}
/* mrb_print_backtrace
@@ -152,12 +116,8 @@ mrb_print_backtrace(mrb_state *mrb)
backtrace = mrb_obj_iv_get(mrb, mrb->exc, mrb_intern_lit(mrb, "backtrace"));
if (mrb_nil_p(backtrace)) return;
- if (mrb_array_p(backtrace)) {
- print_backtrace(mrb, backtrace);
- }
- else {
- print_packed_backtrace(mrb, backtrace);
- }
+ if (!mrb_array_p(backtrace)) backtrace = mrb_unpack_backtrace(mrb, backtrace);
+ print_backtrace(mrb, mrb->exc, backtrace);
}
#else
@@ -175,7 +135,6 @@ count_backtrace_i(mrb_state *mrb,
{
int *lenp = (int*)data;
- if (loc->filename == NULL) return;
(*lenp)++;
}
@@ -187,7 +146,6 @@ pack_backtrace_i(mrb_state *mrb,
struct backtrace_location **pptr = (struct backtrace_location**)data;
struct backtrace_location *ptr = *pptr;
- if (loc->filename == NULL) return;
*ptr = *loc;
*pptr = ptr+1;
}
@@ -205,7 +163,7 @@ packed_backtrace(mrb_state *mrb)
size = len * sizeof(struct backtrace_location);
ptr = mrb_malloc(mrb, size);
backtrace = mrb_data_object_alloc(mrb, NULL, ptr, &bt_type);
- backtrace->flags = (unsigned int)len;
+ backtrace->flags = (uint32_t)len;
each_backtrace(mrb, ciidx, mrb->c->ci->pc, pack_backtrace_i, &ptr);
return mrb_obj_value(backtrace);
}
@@ -245,8 +203,7 @@ mrb_unpack_backtrace(mrb_state *mrb, mrb_value backtrace)
const struct backtrace_location *entry = &bt[i];
mrb_value btline;
- if (entry->filename == NULL) continue;
- btline = mrb_format(mrb, "%s:%d", entry->filename, entry->lineno);
+ btline = mrb_format(mrb, "%s:%d", entry->filename, (int)entry->lineno);
if (entry->method_id != 0) {
mrb_str_cat_lit(mrb, btline, ":in ");
mrb_str_cat_cstr(mrb, btline, mrb_sym_name(mrb, entry->method_id));
diff --git a/src/class.c b/src/class.c
index 2656806d2..d30edd41e 100644
--- a/src/class.c
+++ b/src/class.c
@@ -65,23 +65,21 @@ mrb_class_name_class(mrb_state *mrb, struct RClass *outer, struct RClass *c, mrb
name = mrb_symbol_value(id);
}
else {
- const char *n;
- mrb_int len;
- mrb_value outer_name = mrb_class_path(mrb, outer);
-
- if (mrb_nil_p(outer_name)) { /* unnamed outer class */
+ name = mrb_class_path(mrb, outer);
+ if (mrb_nil_p(name)) { /* unnamed outer class */
if (outer != mrb->object_class && outer != c) {
mrb_obj_iv_set_force(mrb, (struct RObject*)c, mrb_intern_lit(mrb, "__outer__"),
mrb_obj_value(outer));
}
return;
}
- n = mrb_sym_name_len(mrb, id, &len);
- name = mrb_str_new_capa(mrb, RSTRING_LEN(outer_name) + 2 + len);
- mrb_str_cat_str(mrb, name, outer_name);
- mrb_str_cat_lit(mrb, name, "::");
- mrb_str_cat(mrb, name, n, len);
- MRB_SET_FROZEN_FLAG(mrb_obj_ptr(name));
+ else {
+ mrb_int len;
+ const char *n = mrb_sym_name_len(mrb, id, &len);
+
+ mrb_str_cat_lit(mrb, name, "::");
+ mrb_str_cat(mrb, name, n, len);
+ }
}
mrb_obj_iv_set_force(mrb, (struct RObject*)c, nsym, name);
}
@@ -287,11 +285,9 @@ mrb_define_class(mrb_state *mrb, const char *name, struct RClass *super)
static mrb_value mrb_bob_init(mrb_state *mrb, mrb_value);
#ifdef MRB_METHOD_CACHE
static void mc_clear_all(mrb_state *mrb);
-static void mc_clear_by_class(mrb_state *mrb, struct RClass*);
static void mc_clear_by_id(mrb_state *mrb, struct RClass*, mrb_sym);
#else
#define mc_clear_all(mrb)
-#define mc_clear_by_class(mrb,c)
#define mc_clear_by_id(mrb,c,s)
#endif
@@ -305,7 +301,7 @@ mrb_class_inherited(mrb_state *mrb, struct RClass *super, struct RClass *klass)
super = mrb->object_class;
super->flags |= MRB_FL_CLASS_IS_INHERITED;
s = mrb_obj_value(super);
- mc_clear_by_class(mrb, klass);
+ mrb_mc_clear_by_class(mrb, klass);
mid = mrb_intern_lit(mrb, "inherited");
if (!mrb_func_basic_p(mrb, s, mid, mrb_bob_init)) {
mrb_value c = mrb_obj_value(klass);
@@ -544,15 +540,12 @@ MRB_API mrb_value*
mrb_get_argv(mrb_state *mrb)
{
mrb_int argc = mrb->c->ci->argc;
- mrb_value *array_argv;
+ mrb_value *array_argv = mrb->c->stack + 1;
if (argc < 0) {
- struct RArray *a = mrb_ary_ptr(mrb->c->stack[1]);
+ struct RArray *a = mrb_ary_ptr(*array_argv);
array_argv = ARY_PTR(a);
}
- else {
- array_argv = NULL;
- }
return array_argv;
}
@@ -596,9 +589,9 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
char c;
mrb_int i = 0;
va_list ap;
- mrb_int argc = mrb_get_argc(mrb);
- mrb_int arg_i = 0;
- mrb_value *array_argv = mrb_get_argv(mrb);
+ mrb_int argc = mrb->c->ci->argc;
+ mrb_value *array_argv = mrb->c->stack+1;
+ mrb_bool argv_on_stack = argc >= 0;
mrb_bool opt = FALSE;
mrb_bool opt_skip = TRUE;
mrb_bool given = TRUE;
@@ -606,10 +599,14 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
mrb_bool reqkarg = FALSE;
mrb_int needargc = 0;
+ if (!argv_on_stack) {
+ struct RArray *a = mrb_ary_ptr(*array_argv);
+ array_argv = ARY_PTR(a);
+ argc = ARY_LEN(a);
+ }
va_start(ap, format);
-#define ARGV \
- (array_argv ? array_argv : (mrb->c->stack + 1))
+#define ARGV array_argv
while ((c = *fmt++)) {
switch (c) {
@@ -622,11 +619,11 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
goto check_exit;
case '!':
break;
- case '&': case '?':
- if (opt) opt_skip = FALSE;
- break;
case ':':
reqkarg = TRUE;
+ /* fall through */
+ case '&': case '?':
+ if (opt) opt_skip = FALSE;
break;
default:
if (!opt) needargc ++;
@@ -679,8 +676,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
p = va_arg(ap, mrb_value*);
if (i < argc) {
- *p = argv[arg_i++];
- i++;
+ *p = argv[i++];
}
}
break;
@@ -692,12 +688,11 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
if (i < argc) {
mrb_value ss;
- ss = argv[arg_i++];
+ ss = argv[i++];
if (!class_ptr_p(ss)) {
mrb_raisef(mrb, E_TYPE_ERROR, "%v is not class/module", ss);
}
*p = ss;
- i++;
}
}
break;
@@ -707,8 +702,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
p = va_arg(ap, mrb_value*);
if (i < argc) {
- *p = argv[arg_i++];
- i++;
+ *p = argv[i++];
if (!(altmode && mrb_nil_p(*p))) {
mrb_to_str(mrb, *p);
}
@@ -721,8 +715,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
p = va_arg(ap, mrb_value*);
if (i < argc) {
- *p = argv[arg_i++];
- i++;
+ *p = argv[i++];
if (!(altmode && mrb_nil_p(*p))) {
*p = to_ary(mrb, *p);
}
@@ -735,8 +728,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
p = va_arg(ap, mrb_value*);
if (i < argc) {
- *p = argv[arg_i++];
- i++;
+ *p = argv[i++];
if (!(altmode && mrb_nil_p(*p))) {
*p = to_hash(mrb, *p);
}
@@ -752,8 +744,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
ps = va_arg(ap, char**);
pl = va_arg(ap, mrb_int*);
if (i < argc) {
- ss = argv[arg_i++];
- i++;
+ ss = argv[i++];
if (altmode && mrb_nil_p(ss)) {
*ps = NULL;
*pl = 0;
@@ -773,8 +764,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
ps = va_arg(ap, const char**);
if (i < argc) {
- ss = argv[arg_i++];
- i++;
+ ss = argv[i++];
if (altmode && mrb_nil_p(ss)) {
*ps = NULL;
}
@@ -795,8 +785,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
pb = va_arg(ap, mrb_value**);
pl = va_arg(ap, mrb_int*);
if (i < argc) {
- aa = argv[arg_i++];
- i++;
+ aa = argv[i++];
if (altmode && mrb_nil_p(aa)) {
*pb = 0;
*pl = 0;
@@ -817,14 +806,12 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
p = va_arg(ap, void**);
if (i < argc) {
- ss = argv[arg_i];
+ ss = argv[i++];
if (!mrb_istruct_p(ss))
{
mrb_raisef(mrb, E_TYPE_ERROR, "%v is not inline struct", ss);
}
*p = mrb_istruct_ptr(ss);
- arg_i++;
- i++;
}
}
break;
@@ -835,9 +822,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
p = va_arg(ap, mrb_float*);
if (i < argc) {
- *p = mrb_to_flo(mrb, argv[arg_i]);
- arg_i++;
- i++;
+ *p = mrb_to_flo(mrb, argv[i++]);
}
}
break;
@@ -848,9 +833,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
p = va_arg(ap, mrb_int*);
if (i < argc) {
- *p = mrb_fixnum(mrb_to_int(mrb, argv[arg_i]));
- arg_i++;
- i++;
+ *p = mrb_fixnum(mrb_to_int(mrb, argv[i++]));
}
}
break;
@@ -859,9 +842,8 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
mrb_bool *boolp = va_arg(ap, mrb_bool*);
if (i < argc) {
- mrb_value b = argv[arg_i++];
+ mrb_value b = argv[i++];
*boolp = mrb_test(b);
- i++;
}
}
break;
@@ -873,9 +855,8 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
if (i < argc) {
mrb_value ss;
- ss = argv[arg_i++];
+ ss = argv[i++];
*symp = to_sym(mrb, ss);
- i++;
}
}
break;
@@ -887,8 +868,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
datap = va_arg(ap, void**);
type = va_arg(ap, struct mrb_data_type const*);
if (i < argc) {
- mrb_value dd = argv[arg_i++];
- i++;
+ mrb_value dd = argv[i++];
if (altmode && mrb_nil_p(dd)) {
*datap = 0;
}
@@ -917,7 +897,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
}
break;
case '|':
- if (opt_skip && i == argc) return argc;
+ if (opt_skip && i == argc) goto finish;
opt = TRUE;
break;
case '?':
@@ -933,7 +913,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
{
mrb_value **var;
mrb_int *pl;
- mrb_bool nocopy = altmode || array_argv ? TRUE : FALSE;
+ mrb_bool nocopy = (altmode || !argv_on_stack) ? TRUE : FALSE;
var = va_arg(ap, mrb_value**);
pl = va_arg(ap, mrb_int*);
@@ -941,16 +921,15 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
*pl = argc-i;
if (*pl > 0) {
if (nocopy) {
- *var = argv+arg_i;
+ *var = argv+i;
}
else {
- mrb_value args = mrb_ary_new_from_values(mrb, *pl, argv+arg_i);
+ mrb_value args = mrb_ary_new_from_values(mrb, *pl, argv+i);
RARRAY(args)->c = NULL;
*var = RARRAY_PTR(args);
}
}
i = argc;
- arg_i += *pl;
}
else {
*pl = 0;
@@ -1025,6 +1004,8 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
if (!c && argc > i) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments");
}
+
+finish:
va_end(ap);
return i;
}
@@ -1109,7 +1090,7 @@ include_module_at(mrb_state *mrb, struct RClass *c, struct RClass *ins_pos, stru
m->flags |= MRB_FL_CLASS_IS_INHERITED;
ins_pos->super = ic;
mrb_field_write_barrier(mrb, (struct RBasic*)ins_pos, (struct RBasic*)ic);
- mc_clear_by_class(mrb, ins_pos);
+ mrb_mc_clear_by_class(mrb, ins_pos);
ins_pos = ic;
skip:
m = m->super;
@@ -1261,33 +1242,45 @@ mrb_mod_dummy_visibility(mrb_state *mrb, mrb_value mod)
return mod;
}
-MRB_API mrb_value
-mrb_singleton_class(mrb_state *mrb, mrb_value v)
+/* returns mrb_class_ptr(mrb_singleton_class()) */
+/* except that it return NULL for immediate values */
+MRB_API struct RClass*
+mrb_singleton_class_ptr(mrb_state *mrb, mrb_value v)
{
struct RBasic *obj;
switch (mrb_type(v)) {
case MRB_TT_FALSE:
if (mrb_nil_p(v))
- return mrb_obj_value(mrb->nil_class);
- return mrb_obj_value(mrb->false_class);
+ return mrb->nil_class;
+ return mrb->false_class;
case MRB_TT_TRUE:
- return mrb_obj_value(mrb->true_class);
+ return mrb->true_class;
case MRB_TT_CPTR:
- return mrb_obj_value(mrb->object_class);
+ return mrb->object_class;
case MRB_TT_SYMBOL:
case MRB_TT_FIXNUM:
#ifndef MRB_WITHOUT_FLOAT
case MRB_TT_FLOAT:
#endif
- mrb_raise(mrb, E_TYPE_ERROR, "can't define singleton");
- return mrb_nil_value(); /* not reached */
+ return NULL;
default:
break;
}
obj = mrb_basic_ptr(v);
prepare_singleton_class(mrb, obj);
- return mrb_obj_value(obj->c);
+ return obj->c;
+}
+
+MRB_API mrb_value
+mrb_singleton_class(mrb_state *mrb, mrb_value v)
+{
+ struct RClass *c = mrb_singleton_class_ptr(mrb, v);
+
+ if (c == NULL) {
+ mrb_raise(mrb, E_TYPE_ERROR, "can't define singleton");
+ }
+ return mrb_obj_value(c);
}
MRB_API void
@@ -1322,8 +1315,8 @@ mc_clear_all(mrb_state *mrb)
}
}
-static void
-mc_clear_by_class(mrb_state *mrb, struct RClass *c)
+void
+mrb_mc_clear_by_class(mrb_state *mrb, struct RClass *c)
{
struct mrb_cache_entry *mc = mrb->cache;
int i;
@@ -1718,7 +1711,7 @@ mrb_class_path(mrb_state *mrb, struct RClass *c)
/* toplevel class/module */
return mrb_sym_str(mrb, mrb_symbol(path));
}
- return path;
+ return mrb_str_dup(mrb, path);
}
MRB_API struct RClass*
@@ -1735,7 +1728,10 @@ mrb_class_real(struct RClass* cl)
MRB_API const char*
mrb_class_name(mrb_state *mrb, struct RClass* c)
{
- mrb_value name = class_name_str(mrb, c);
+ mrb_value name;
+
+ if (c == NULL) return NULL;
+ name = class_name_str(mrb, c);
return RSTRING_PTR(name);
}
@@ -1885,8 +1881,7 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
return mrb_str_cat_lit(mrb, str, ">");
}
else {
- mrb_value str = class_name_str(mrb, mrb_class_ptr(klass));
- return mrb_frozen_p(mrb_basic_ptr(str)) ? mrb_str_dup(mrb, str) : str;
+ return class_name_str(mrb, mrb_class_ptr(klass));
}
}
@@ -2324,7 +2319,9 @@ mrb_init_class(mrb_state *mrb)
mrb_define_method(mrb, mod, "dup", mrb_mod_dup, MRB_ARGS_NONE());
mrb_undef_method(mrb, cls, "append_features");
+ mrb_undef_method(mrb, cls, "prepend_features");
mrb_undef_method(mrb, cls, "extend_object");
+ mrb_undef_method(mrb, cls, "module_function");
mrb->top_self = (struct RObject*)mrb_obj_alloc(mrb, MRB_TT_OBJECT, mrb->object_class);
mrb_define_singleton_method(mrb, mrb->top_self, "inspect", inspect_main, MRB_ARGS_NONE());
diff --git a/src/codedump.c b/src/codedump.c
index 7faa39360..649be176b 100644
--- a/src/codedump.c
+++ b/src/codedump.c
@@ -130,6 +130,10 @@ codedump(mrb_state *mrb, mrb_irep *irep)
printf("OP_LOADI\tR%d\t-%d\t", a, b);
print_lv_a(mrb, irep, a);
break;
+ CASE(OP_LOADI16, BS):
+ printf("OP_LOADI16\tR%d\t%d\t", a, (int)(int16_t)b);
+ print_lv_a(mrb, irep, a);
+ break;
CASE(OP_LOADI__1, B):
printf("OP_LOADI__1\tR%d\t\t", a);
print_lv_a(mrb, irep, a);
diff --git a/src/dump.c b/src/dump.c
index 183f3b67d..a6bbe68f3 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -13,9 +13,6 @@
#include <mruby/numeric.h>
#include <mruby/debug.h>
-#define FLAG_BYTEORDER_NATIVE 2
-#define FLAG_BYTEORDER_NONATIVE 0
-
#ifndef MRB_WITHOUT_FLOAT
#ifdef MRB_USE_FLOAT
#define MRB_FLOAT_FMT "%.9g"
@@ -709,22 +706,7 @@ write_rite_binary_header(mrb_state *mrb, size_t binary_size, uint8_t *bin, uint8
uint16_t crc;
uint32_t offset;
- switch (flags & DUMP_ENDIAN_NAT) {
- endian_big:
- case DUMP_ENDIAN_BIG:
- memcpy(header->binary_ident, RITE_BINARY_IDENT, sizeof(header->binary_ident));
- break;
- endian_little:
- case DUMP_ENDIAN_LIL:
- memcpy(header->binary_ident, RITE_BINARY_IDENT_LIL, sizeof(header->binary_ident));
- break;
-
- case DUMP_ENDIAN_NAT:
- if (bigendian_p()) goto endian_big;
- goto endian_little;
- break;
- }
-
+ memcpy(header->binary_ident, RITE_BINARY_IDENT, sizeof(header->binary_ident));
memcpy(header->binary_version, RITE_BINARY_FORMAT_VER, sizeof(header->binary_version));
memcpy(header->compiler_name, RITE_COMPILER_NAME, sizeof(header->compiler_name));
memcpy(header->compiler_version, RITE_COMPILER_VERSION, sizeof(header->compiler_version));
@@ -764,21 +746,6 @@ lv_defined_p(mrb_irep *irep)
return FALSE;
}
-static uint8_t
-dump_flags(uint8_t flags, uint8_t native)
-{
- if (native == FLAG_BYTEORDER_NATIVE) {
- if ((flags & DUMP_ENDIAN_NAT) == 0) {
- return (flags & DUMP_DEBUG_INFO) | DUMP_ENDIAN_NAT;
- }
- return flags;
- }
- if ((flags & DUMP_ENDIAN_NAT) == 0) {
- return (flags & DUMP_DEBUG_INFO) | DUMP_ENDIAN_BIG;
- }
- return flags;
-}
-
static int
dump_irep(mrb_state *mrb, mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size)
{
@@ -870,7 +837,7 @@ error_exit:
int
mrb_dump_irep(mrb_state *mrb, mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size)
{
- return dump_irep(mrb, irep, dump_flags(flags, FLAG_BYTEORDER_NONATIVE), bin, bin_size);
+ return dump_irep(mrb, irep, flags, bin, bin_size);
}
#ifndef MRB_DISABLE_STDIO
@@ -886,7 +853,7 @@ mrb_dump_irep_binary(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE* fp)
return MRB_DUMP_INVALID_ARGUMENT;
}
- result = dump_irep(mrb, irep, dump_flags(flags, FLAG_BYTEORDER_NONATIVE), &bin, &bin_size);
+ result = dump_irep(mrb, irep, flags, &bin, &bin_size);
if (result == MRB_DUMP_OK) {
if (fwrite(bin, sizeof(bin[0]), bin_size, fp) != bin_size) {
result = MRB_DUMP_WRITE_FAULT;
@@ -897,20 +864,6 @@ mrb_dump_irep_binary(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE* fp)
return result;
}
-static mrb_bool
-dump_bigendian_p(uint8_t flags)
-{
- switch (flags & DUMP_ENDIAN_NAT) {
- case DUMP_ENDIAN_BIG:
- return TRUE;
- case DUMP_ENDIAN_LIL:
- return FALSE;
- default:
- case DUMP_ENDIAN_NAT:
- return bigendian_p();
- }
-}
-
int
mrb_dump_irep_cfunc(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE *fp, const char *initname)
{
@@ -921,23 +874,8 @@ mrb_dump_irep_cfunc(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE *fp, con
if (fp == NULL || initname == NULL || initname[0] == '\0') {
return MRB_DUMP_INVALID_ARGUMENT;
}
- flags = dump_flags(flags, FLAG_BYTEORDER_NATIVE);
result = dump_irep(mrb, irep, flags, &bin, &bin_size);
if (result == MRB_DUMP_OK) {
- if (!dump_bigendian_p(flags)) {
- if (fprintf(fp, "/* dumped in little endian order.\n"
- " use `mrbc -E` option for big endian CPU. */\n") < 0) {
- mrb_free(mrb, bin);
- return MRB_DUMP_WRITE_FAULT;
- }
- }
- else {
- if (fprintf(fp, "/* dumped in big endian order.\n"
- " use `mrbc -e` option for better performance on little endian CPU. */\n") < 0) {
- mrb_free(mrb, bin);
- return MRB_DUMP_WRITE_FAULT;
- }
- }
if (fprintf(fp, "#include <stdint.h>\n") < 0) { /* for uint8_t under at least Darwin */
mrb_free(mrb, bin);
return MRB_DUMP_WRITE_FAULT;
diff --git a/src/error.c b/src/error.c
index 43b09ec66..260ca7a3d 100644
--- a/src/error.c
+++ b/src/error.c
@@ -13,7 +13,6 @@
#include <mruby/proc.h>
#include <mruby/string.h>
#include <mruby/variable.h>
-#include <mruby/debug.h>
#include <mruby/error.h>
#include <mruby/class.h>
#include <mruby/throw.h>
@@ -88,7 +87,7 @@ exc_exception(mrb_state *mrb, mrb_value self)
* no message is set).
*/
-static mrb_value
+mrb_value
exc_to_s(mrb_state *mrb, mrb_value exc)
{
mrb_value mesg = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "mesg"));
@@ -128,37 +127,13 @@ exc_message(mrb_state *mrb, mrb_value exc)
* returns message and class name.
*/
-static mrb_value
-exc_inspect(mrb_state *mrb, mrb_value exc)
+mrb_value
+mrb_exc_inspect(mrb_state *mrb, mrb_value exc)
{
- mrb_value str, mesg, file, line;
- mrb_bool append_mesg;
- const char *cname;
-
- mesg = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "mesg"));
- file = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "file"));
- line = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "line"));
-
- append_mesg = !mrb_nil_p(mesg);
- if (append_mesg) {
- mesg = mrb_obj_as_string(mrb, mesg);
- append_mesg = RSTRING_LEN(mesg) > 0;
- }
-
- cname = mrb_obj_classname(mrb, exc);
- str = mrb_str_new_cstr(mrb, cname);
- if (mrb_string_p(file) && mrb_fixnum_p(line)) {
- if (append_mesg) {
- str = mrb_format(mrb, "%v:%v: %v (%v)", file, line, mesg, str);
- }
- else {
- str = mrb_format(mrb, "%v:%v: %v", file, line, str);
- }
- }
- else if (append_mesg) {
- str = mrb_format(mrb, "%v: %v", str, mesg);
- }
- return str;
+ mrb_value mesg = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "mesg"));
+ mrb_value cname = mrb_mod_to_s(mrb, mrb_obj_value(mrb_obj_class(mrb, exc)));
+ mesg = mrb_obj_as_string(mrb, mesg);
+ return RSTRING_LEN(mesg) == 0 ? cname : mrb_format(mrb, "%v (%v)", mesg, cname);
}
void mrb_keep_backtrace(mrb_state *mrb, mrb_value exc);
@@ -192,33 +167,6 @@ exc_set_backtrace(mrb_state *mrb, mrb_value exc)
return backtrace;
}
-static void
-exc_debug_info(mrb_state *mrb, struct RObject *exc)
-{
- mrb_callinfo *ci = mrb->c->ci;
- const mrb_code *pc = ci->pc;
-
- if (mrb_obj_iv_defined(mrb, exc, mrb_intern_lit(mrb, "file"))) return;
- while (ci >= mrb->c->cibase) {
- const mrb_code *err = ci->err;
-
- if (!err && pc) err = pc - 1;
- if (err && ci->proc && !MRB_PROC_CFUNC_P(ci->proc)) {
- mrb_irep *irep = ci->proc->body.irep;
-
- int32_t const line = mrb_debug_get_line(mrb, irep, err - irep->iseq);
- char const* file = mrb_debug_get_filename(mrb, irep, err - irep->iseq);
- if (line != -1 && file) {
- mrb_obj_iv_set(mrb, exc, mrb_intern_lit(mrb, "file"), mrb_str_new_cstr(mrb, file));
- mrb_obj_iv_set(mrb, exc, mrb_intern_lit(mrb, "line"), mrb_fixnum_value(line));
- return;
- }
- }
- pc = ci->pc;
- ci--;
- }
-}
-
void
mrb_exc_set(mrb_state *mrb, mrb_value exc)
{
@@ -232,7 +180,6 @@ mrb_exc_set(mrb_state *mrb, mrb_value exc)
mrb->gc.arena_idx--;
}
if (!mrb->gc.out_of_memory && !mrb_frozen_p(mrb->exc)) {
- exc_debug_info(mrb, mrb->exc);
mrb_keep_backtrace(mrb, exc);
}
}
@@ -355,7 +302,11 @@ mrb_vformat(mrb_state *mrb, const char *format, va_list ap)
mrb_gc_arena_restore(mrb, ai);
break;
case 'n':
+#if UINT32_MAX < INT_MAX
+ obj = mrb_symbol_value((mrb_sym)va_arg(ap, int));
+#else
obj = mrb_symbol_value(va_arg(ap, mrb_sym));
+#endif
goto L_cat_obj;
case 's':
chars = va_arg(ap, char*);
@@ -530,7 +481,7 @@ exception_call:
break;
default:
- mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%i for 0..3)", argc);
+ mrb_argnum_error(mrb, argc, 0, 3);
break;
}
if (argc > 0) {
@@ -586,6 +537,19 @@ mrb_frozen_error(mrb_state *mrb, void *frozen_obj)
mrb_raisef(mrb, E_FROZEN_ERROR, "can't modify frozen %t", mrb_obj_value(frozen_obj));
}
+MRB_API mrb_noreturn void
+mrb_argnum_error(mrb_state *mrb, mrb_int argc, int min, int max)
+{
+#define FMT(exp) "wrong number of arguments (given %i, expected " exp ")"
+ if (min == max)
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, FMT("%d"), argc, min);
+ else if (max < 0)
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, FMT("%d+"), argc, min);
+ else
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, FMT("%d..%d"), argc, min, max);
+#undef FMT
+}
+
void
mrb_init_exception(mrb_state *mrb)
{
@@ -598,7 +562,7 @@ mrb_init_exception(mrb_state *mrb)
mrb_define_method(mrb, exception, "initialize", exc_initialize, MRB_ARGS_OPT(1));
mrb_define_method(mrb, exception, "to_s", exc_to_s, MRB_ARGS_NONE());
mrb_define_method(mrb, exception, "message", exc_message, MRB_ARGS_NONE());
- mrb_define_method(mrb, exception, "inspect", exc_inspect, MRB_ARGS_NONE());
+ mrb_define_method(mrb, exception, "inspect", mrb_exc_inspect, MRB_ARGS_NONE());
mrb_define_method(mrb, exception, "backtrace", mrb_exc_backtrace, MRB_ARGS_NONE());
mrb_define_method(mrb, exception, "set_backtrace", exc_set_backtrace, MRB_ARGS_REQ(1));
diff --git a/src/etc.c b/src/etc.c
index 607e82ca1..6e1533e3d 100644
--- a/src/etc.c
+++ b/src/etc.c
@@ -140,7 +140,13 @@ mrb_obj_id(mrb_value obj)
}
}
+#if defined(MRB_NAN_BOXING) && defined(MRB_64BIT)
+#define mrb_xxx_boxing_cptr_value mrb_nan_boxing_cptr_value
+#endif
+
#ifdef MRB_WORD_BOXING
+#define mrb_xxx_boxing_cptr_value mrb_word_boxing_cptr_value
+
#ifndef MRB_WITHOUT_FLOAT
MRB_API mrb_value
mrb_word_boxing_float_value(mrb_state *mrb, mrb_float f)
@@ -164,17 +170,20 @@ mrb_word_boxing_float_pool(mrb_state *mrb, mrb_float f)
return mrb_obj_value(nf);
}
#endif /* MRB_WITHOUT_FLOAT */
+#endif /* MRB_WORD_BOXING */
+#if defined(MRB_WORD_BOXING) || (defined(MRB_NAN_BOXING) && defined(MRB_64BIT))
MRB_API mrb_value
-mrb_word_boxing_cptr_value(mrb_state *mrb, void *p)
+mrb_xxx_boxing_cptr_value(mrb_state *mrb, void *p)
{
mrb_value v;
+ struct RCptr *cptr = (struct RCptr*)mrb_obj_alloc(mrb, MRB_TT_CPTR, mrb->object_class);
- v.value.p = mrb_obj_alloc(mrb, MRB_TT_CPTR, mrb->object_class);
- v.value.vp->p = p;
+ SET_OBJ_VALUE(v, cptr);
+ cptr->p = p;
return v;
}
-#endif /* MRB_WORD_BOXING */
+#endif
#if defined _MSC_VER && _MSC_VER < 1900
diff --git a/src/fmt_fp.c b/src/fmt_fp.c
index 1f1af6764..9ae5dd177 100644
--- a/src/fmt_fp.c
+++ b/src/fmt_fp.c
@@ -30,7 +30,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <limits.h>
#include <string.h>
-#include <stdint.h>
#include <math.h>
#include <float.h>
#include <ctype.h>
@@ -38,9 +37,19 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <mruby.h>
#include <mruby/string.h>
+struct fmt_args;
+
+typedef void output_func(struct fmt_args *f, const char *s, size_t l);
+
struct fmt_args {
mrb_state *mrb;
- mrb_value str;
+ output_func *output;
+ void *opaque;
+};
+
+struct mrb_cstr {
+ char *buf;
+ size_t len;
};
#define MAX(a,b) ((a)>(b) ? (a) : (b))
@@ -55,15 +64,44 @@ struct fmt_args {
#define PAD_POS (1U<<(' '-' '))
#define MARK_POS (1U<<('+'-' '))
+#define FLAGMASK (ALT_FORM|ZERO_PAD|LEFT_ADJ|PAD_POS|MARK_POS)
+
+static output_func strcat_value;
+static output_func strcat_cstr;
+
+static void
+strcat_value(struct fmt_args *f, const char *s, size_t l)
+{
+ mrb_value str = *(mrb_value*)f->opaque;
+ mrb_str_cat(f->mrb, str, s, l);
+}
+
+static void
+strcat_cstr(struct fmt_args *f, const char *s, size_t l)
+{
+ struct mrb_cstr *cstr = (struct mrb_cstr*)f->opaque;
+
+ if (l > cstr->len) {
+ mrb_state *mrb = f->mrb;
+
+ mrb_raise(mrb, E_ARGUMENT_ERROR, "string buffer too small");
+ }
+
+ memcpy(cstr->buf, s, l);
+
+ cstr->buf += l;
+ cstr->len -= l;
+}
+
static void
out(struct fmt_args *f, const char *s, size_t l)
{
- mrb_str_cat(f->mrb, f->str, s, l);
+ f->output(f, s, l);
}
#define PAD_SIZE 256
static void
-pad(struct fmt_args *f, char c, ptrdiff_t w, ptrdiff_t l, uint8_t fl)
+pad(struct fmt_args *f, char c, ptrdiff_t w, ptrdiff_t l, uint32_t fl)
{
char pad[PAD_SIZE];
if (fl & (LEFT_ADJ | ZERO_PAD) || l >= w) return;
@@ -93,7 +131,7 @@ typedef char compiler_defines_long_double_incorrectly[9-(int)sizeof(long double)
#endif
static int
-fmt_fp(struct fmt_args *f, long double y, ptrdiff_t p, uint8_t fl, int t)
+fmt_fp(struct fmt_args *f, long double y, ptrdiff_t w, ptrdiff_t p, uint32_t fl, int t)
{
uint32_t big[(LDBL_MANT_DIG+28)/29 + 1 // mantissa expansion
+ (LDBL_MAX_EXP+LDBL_MANT_DIG+28+8)/9]; // exponent expansion
@@ -118,11 +156,11 @@ fmt_fp(struct fmt_args *f, long double y, ptrdiff_t p, uint8_t fl, int t)
if (!isfinite(y)) {
const char *ss = (t&32)?"inf":"INF";
if (y!=y) ss=(t&32)?"nan":"NAN";
- pad(f, ' ', 0, 3+pl, fl&~ZERO_PAD);
+ pad(f, ' ', w, 3+pl, fl&~ZERO_PAD);
out(f, prefix, pl);
out(f, ss, 3);
- pad(f, ' ', 0, 3+pl, fl^LEFT_ADJ);
- return 3+(int)pl;
+ pad(f, ' ', w, 3+pl, fl^LEFT_ADJ);
+ return MAX(w, 3+(int)pl);
}
y = frexp((double)y, &e2) * 2;
@@ -170,14 +208,14 @@ fmt_fp(struct fmt_args *f, long double y, ptrdiff_t p, uint8_t fl, int t)
else
l = (s-buf) + (ebuf-estr);
- pad(f, ' ', 0, pl+l, fl);
+ pad(f, ' ', w, pl+l, fl);
out(f, prefix, pl);
- pad(f, '0', 0, pl+l, fl^ZERO_PAD);
+ pad(f, '0', w, pl+l, fl^ZERO_PAD);
out(f, buf, s-buf);
pad(f, '0', l-(ebuf-estr)-(s-buf), 0, 0);
out(f, estr, ebuf-estr);
- pad(f, ' ', 0, pl+l, fl^LEFT_ADJ);
- return (int)pl+(int)l;
+ pad(f, ' ', w, pl+l, fl^LEFT_ADJ);
+ return MAX(w, (int)pl+(int)l);
}
if (p<0) p=6;
@@ -289,9 +327,9 @@ fmt_fp(struct fmt_args *f, long double y, ptrdiff_t p, uint8_t fl, int t)
l += ebuf-estr;
}
- pad(f, ' ', 0, pl+l, fl);
+ pad(f, ' ', w, pl+l, fl);
out(f, prefix, pl);
- pad(f, '0', 0, pl+l, fl^ZERO_PAD);
+ pad(f, '0', w, pl+l, fl^ZERO_PAD);
if ((t|32)=='f') {
if (a>r) a=r;
@@ -326,21 +364,33 @@ fmt_fp(struct fmt_args *f, long double y, ptrdiff_t p, uint8_t fl, int t)
out(f, estr, ebuf-estr);
}
- pad(f, ' ', 0, pl+l, fl^LEFT_ADJ);
+ pad(f, ' ', w, pl+l, fl^LEFT_ADJ);
- return (int)pl+(int)l;
+ return MAX(w, (int)pl+(int)l);
}
static int
fmt_core(struct fmt_args *f, const char *fmt, mrb_float flo)
{
- ptrdiff_t p;
+ ptrdiff_t w, p;
+ uint32_t fl;
if (*fmt != '%') {
return -1;
}
++fmt;
+ /* Read modifier flags */
+ for (fl=0; (unsigned)*fmt-' '<32 && (FLAGMASK&(1U<<(*fmt-' '))); fmt++)
+ fl |= 1U<<(*fmt-' ');
+
+ /* - and 0 flags are mutually exclusive */
+ if (fl & LEFT_ADJ) fl &= ~ZERO_PAD;
+
+ for (w = 0; ISDIGIT(*fmt); ++fmt) {
+ w = 10 * w + (*fmt - '0');
+ }
+
if (*fmt == '.') {
++fmt;
for (p = 0; ISDIGIT(*fmt); ++fmt) {
@@ -354,29 +404,49 @@ fmt_core(struct fmt_args *f, const char *fmt, mrb_float flo)
switch (*fmt) {
case 'e': case 'f': case 'g': case 'a':
case 'E': case 'F': case 'G': case 'A':
- return fmt_fp(f, flo, p, 0, *fmt);
+ return fmt_fp(f, flo, w, p, fl, *fmt);
default:
return -1;
}
}
-mrb_value
+MRB_API mrb_value
mrb_float_to_str(mrb_state *mrb, mrb_value flo, const char *fmt)
{
struct fmt_args f;
+ mrb_value str = mrb_str_new_capa(mrb, 24);
f.mrb = mrb;
- f.str = mrb_str_new_capa(mrb, 24);
+ f.output = strcat_value;
+ f.opaque = (void*)&str;
if (fmt_core(&f, fmt, mrb_float(flo)) < 0) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "invalid format string");
}
- return f.str;
+ return str;
+}
+
+MRB_API int
+mrb_float_to_cstr(mrb_state *mrb, char *buf, size_t len, const char *fmt, mrb_float fval)
+{
+ struct fmt_args f;
+ struct mrb_cstr cstr;
+
+ cstr.buf = buf;
+ cstr.len = len - 1; /* reserve NUL terminator */
+ f.mrb = mrb;
+ f.output = strcat_cstr;
+ f.opaque = (void*)&cstr;
+ if (fmt_core(&f, fmt, fval) < 0) {
+ mrb_raise(mrb, E_ARGUMENT_ERROR, "invalid format string");
+ }
+ *cstr.buf = '\0';
+ return cstr.buf - buf;
}
#else /* MRB_DISABLE_STDIO || _WIN32 || _WIN64 */
#include <mruby.h>
#include <stdio.h>
-mrb_value
+MRB_API mrb_value
mrb_float_to_str(mrb_state *mrb, mrb_value flo, const char *fmt)
{
char buf[25];
@@ -384,5 +454,11 @@ mrb_float_to_str(mrb_state *mrb, mrb_value flo, const char *fmt)
snprintf(buf, sizeof(buf), fmt, mrb_float(flo));
return mrb_str_new_cstr(mrb, buf);
}
+
+MRB_API int
+mrb_float_to_cstr(mrb_state *mrb, char *buf, size_t len, const char *fmt, mrb_float fval)
+{
+ return snprintf(buf, len, fmt, fval);
+}
#endif /* MRB_DISABLE_STDIO || _WIN32 || _WIN64 */
#endif
diff --git a/src/gc.c b/src/gc.c
index 835d1c61d..8d9a1806c 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -280,8 +280,9 @@ mrb_free(mrb_state *mrb, void *p)
MRB_API void*
mrb_alloca(mrb_state *mrb, size_t size)
{
- mrb_value str = mrb_str_new(mrb, NULL, size);
- return RSTRING_PTR(str);
+ struct RString *s;
+ s = (struct RString*)mrb_obj_alloc(mrb, MRB_TT_STRING, mrb->string_class);
+ return s->as.heap.ptr = (char*)mrb_malloc(mrb, size);
}
static mrb_bool
@@ -806,10 +807,12 @@ obj_free(mrb_state *mrb, struct RBasic *obj, int end)
case MRB_TT_SCLASS:
mrb_gc_free_mt(mrb, (struct RClass*)obj);
mrb_gc_free_iv(mrb, (struct RObject*)obj);
+ mrb_mc_clear_by_class(mrb, (struct RClass*)obj);
break;
case MRB_TT_ICLASS:
if (MRB_FLAG_TEST(obj, MRB_FL_CLASS_IS_ORIGIN))
mrb_gc_free_mt(mrb, (struct RClass*)obj);
+ mrb_mc_clear_by_class(mrb, (struct RClass*)obj);
break;
case MRB_TT_ENV:
{
@@ -1609,6 +1612,9 @@ mrb_init_gc(mrb_state *mrb)
{
struct RClass *gc;
+ mrb_static_assert(sizeof(RVALUE) <= sizeof(void*) * 6,
+ "RVALUE size must be within 6 words");
+
gc = mrb_define_module(mrb, "GC");
mrb_define_class_method(mrb, gc, "start", gc_start, MRB_ARGS_NONE());
diff --git a/src/hash.c b/src/hash.c
index 21e34a5ea..ec79a3def 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -222,9 +222,8 @@ static void
ht_compact(mrb_state *mrb, htable *t)
{
segment *seg;
- mrb_int i;
+ uint16_t i, i2;
segment *seg2 = NULL;
- mrb_int i2;
mrb_int size = 0;
if (t == NULL) return;
@@ -374,7 +373,7 @@ ht_put(mrb_state *mrb, htable *t, mrb_value key, mrb_value val)
deleted++;
continue;
}
- if (ht_hash_equal(mrb, t, k, key)) {
+ if (ht_hash_equal(mrb, t, key, k)) {
seg->e[i].val = val;
return;
}
@@ -455,7 +454,7 @@ ht_get(mrb_state *mrb, htable *t, mrb_value key, mrb_value *vp)
return FALSE;
}
if (mrb_undef_p(k)) continue;
- if (ht_hash_equal(mrb, t, k, key)) {
+ if (ht_hash_equal(mrb, t, key, k)) {
if (vp) *vp = seg->e[i].val;
return TRUE;
}
@@ -800,7 +799,7 @@ mrb_hash_init(mrb_state *mrb, mrb_value hash)
mrb_hash_modify(mrb, hash);
if (!mrb_nil_p(block)) {
if (ifnone_p) {
- mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments");
+ mrb_argnum_error(mrb, 1, 0, 0);
}
RHASH(hash)->flags |= MRB_HASH_PROC_DEFAULT;
ifnone = block;
@@ -1414,7 +1413,7 @@ mrb_init_hash(mrb_state *mrb)
mrb_define_method(mrb, h, "[]", mrb_hash_aget, MRB_ARGS_REQ(1)); /* 15.2.13.4.2 */
mrb_define_method(mrb, h, "[]=", mrb_hash_aset, MRB_ARGS_REQ(2)); /* 15.2.13.4.3 */
mrb_define_method(mrb, h, "clear", mrb_hash_clear, MRB_ARGS_NONE()); /* 15.2.13.4.4 */
- mrb_define_method(mrb, h, "default", mrb_hash_default, MRB_ARGS_ANY()); /* 15.2.13.4.5 */
+ mrb_define_method(mrb, h, "default", mrb_hash_default, MRB_ARGS_OPT(1)); /* 15.2.13.4.5 */
mrb_define_method(mrb, h, "default=", mrb_hash_set_default, MRB_ARGS_REQ(1)); /* 15.2.13.4.6 */
mrb_define_method(mrb, h, "default_proc", mrb_hash_default_proc,MRB_ARGS_NONE()); /* 15.2.13.4.7 */
mrb_define_method(mrb, h, "default_proc=", mrb_hash_set_default_proc,MRB_ARGS_REQ(1)); /* 15.2.13.4.7 */
@@ -1423,7 +1422,7 @@ mrb_init_hash(mrb_state *mrb)
mrb_define_method(mrb, h, "has_key?", mrb_hash_has_key, MRB_ARGS_REQ(1)); /* 15.2.13.4.13 */
mrb_define_method(mrb, h, "has_value?", mrb_hash_has_value, MRB_ARGS_REQ(1)); /* 15.2.13.4.14 */
mrb_define_method(mrb, h, "include?", mrb_hash_has_key, MRB_ARGS_REQ(1)); /* 15.2.13.4.15 */
- mrb_define_method(mrb, h, "initialize", mrb_hash_init, MRB_ARGS_OPT(1)); /* 15.2.13.4.16 */
+ mrb_define_method(mrb, h, "initialize", mrb_hash_init, MRB_ARGS_OPT(1)|MRB_ARGS_BLOCK()); /* 15.2.13.4.16 */
mrb_define_method(mrb, h, "key?", mrb_hash_has_key, MRB_ARGS_REQ(1)); /* 15.2.13.4.18 */
mrb_define_method(mrb, h, "keys", mrb_hash_keys, MRB_ARGS_NONE()); /* 15.2.13.4.19 */
mrb_define_method(mrb, h, "length", mrb_hash_size_m, MRB_ARGS_NONE()); /* 15.2.13.4.20 */
diff --git a/src/kernel.c b/src/kernel.c
index c88a457f0..ae9617686 100644
--- a/src/kernel.c
+++ b/src/kernel.c
@@ -325,7 +325,7 @@ mrb_obj_clone(mrb_state *mrb, mrb_value self)
mrb_value clone;
if (mrb_immediate_p(self)) {
- mrb_raisef(mrb, E_TYPE_ERROR, "can't clone %v", self);
+ return self;
}
if (mrb_sclass_p(self)) {
mrb_raise(mrb, E_TYPE_ERROR, "can't clone singleton class");
@@ -366,7 +366,7 @@ mrb_obj_dup(mrb_state *mrb, mrb_value obj)
mrb_value dup;
if (mrb_immediate_p(obj)) {
- mrb_raisef(mrb, E_TYPE_ERROR, "can't dup %v", obj);
+ return obj;
}
if (mrb_sclass_p(obj)) {
mrb_raise(mrb, E_TYPE_ERROR, "can't dup singleton class");
@@ -384,7 +384,7 @@ mrb_obj_extend(mrb_state *mrb, mrb_int argc, mrb_value *argv, mrb_value obj)
mrb_int i;
if (argc == 0) {
- mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (at least 1)");
+ mrb_argnum_error(mrb, argc, 1, -1);
}
for (i = 0; i < argc; i++) {
mrb_check_type(mrb, argv[i], MRB_TT_MODULE);
@@ -685,7 +685,6 @@ mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value args)
* r.xxiii #=> 23
* r.mm #=> 2000
*/
-#ifdef MRB_DEFAULT_METHOD_MISSING
static mrb_value
mrb_obj_missing(mrb_state *mrb, mrb_value mod)
{
@@ -698,7 +697,6 @@ mrb_obj_missing(mrb_state *mrb, mrb_value mod)
/* not reached */
return mrb_nil_value();
}
-#endif
static inline mrb_bool
basic_obj_respond_to(mrb_state *mrb, mrb_value obj, mrb_sym id, int pub)
@@ -791,14 +789,12 @@ mrb_init_kernel(mrb_state *mrb)
mrb_define_method(mrb, krn, "is_a?", mrb_obj_is_kind_of_m, MRB_ARGS_REQ(1)); /* 15.3.1.3.24 */
mrb_define_method(mrb, krn, "iterator?", mrb_f_block_given_p_m, MRB_ARGS_NONE()); /* 15.3.1.3.25 */
mrb_define_method(mrb, krn, "kind_of?", mrb_obj_is_kind_of_m, MRB_ARGS_REQ(1)); /* 15.3.1.3.26 */
-#ifdef MRB_DEFAULT_METHOD_MISSING
mrb_define_method(mrb, krn, "method_missing", mrb_obj_missing, MRB_ARGS_ANY()); /* 15.3.1.3.30 */
-#endif
mrb_define_method(mrb, krn, "nil?", mrb_false, MRB_ARGS_NONE()); /* 15.3.1.3.32 */
mrb_define_method(mrb, krn, "object_id", mrb_obj_id_m, MRB_ARGS_NONE()); /* 15.3.1.3.33 */
mrb_define_method(mrb, krn, "raise", mrb_f_raise, MRB_ARGS_ANY()); /* 15.3.1.3.40 */
mrb_define_method(mrb, krn, "remove_instance_variable", mrb_obj_remove_instance_variable,MRB_ARGS_REQ(1)); /* 15.3.1.3.41 */
- mrb_define_method(mrb, krn, "respond_to?", obj_respond_to, MRB_ARGS_ANY()); /* 15.3.1.3.43 */
+ mrb_define_method(mrb, krn, "respond_to?", obj_respond_to, MRB_ARGS_ARG(1,1)); /* 15.3.1.3.43 */
mrb_define_method(mrb, krn, "to_s", mrb_any_to_s, MRB_ARGS_NONE()); /* 15.3.1.3.46 */
mrb_define_method(mrb, krn, "__case_eqq", mrb_obj_ceqq, MRB_ARGS_REQ(1)); /* internal */
mrb_define_method(mrb, krn, "__to_int", mrb_to_int, MRB_ARGS_NONE()); /* internal */
diff --git a/src/load.c b/src/load.c
index 471ff3841..2a118c922 100644
--- a/src/load.c
+++ b/src/load.c
@@ -19,9 +19,6 @@
# error size_t must be at least 32 bits wide
#endif
-#define FLAG_BYTEORDER_BIG 2
-#define FLAG_BYTEORDER_LIL 4
-#define FLAG_BYTEORDER_NATIVE 8
#define FLAG_SRC_MALLOC 1
#define FLAG_SRC_STATIC 0
@@ -42,22 +39,22 @@ offset_crc_body(void)
}
#ifndef MRB_WITHOUT_FLOAT
+double mrb_str_len_to_dbl(mrb_state *mrb, const char *s, size_t len, mrb_bool badcheck);
+
static double
-str_to_double(mrb_state *mrb, mrb_value str)
+str_to_double(mrb_state *mrb, const char *p, size_t len)
{
- const char *p = RSTRING_PTR(str);
- mrb_int len = RSTRING_LEN(str);
-
/* `i`, `inf`, `infinity` */
if (len > 0 && p[0] == 'i') return INFINITY;
/* `I`, `-inf`, `-infinity` */
if (p[0] == 'I' || (len > 1 && p[0] == '-' && p[1] == 'i')) return -INFINITY;
-
- return mrb_str_to_dbl(mrb, str, TRUE);
+ return mrb_str_len_to_dbl(mrb, p, len, TRUE);
}
#endif
+mrb_value mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base, int badcheck);
+
static mrb_irep*
read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flags)
{
@@ -94,8 +91,7 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
if (SIZE_ERROR_MUL(irep->ilen, sizeof(mrb_code))) {
return NULL;
}
- if ((flags & FLAG_SRC_MALLOC) == 0 &&
- (flags & FLAG_BYTEORDER_NATIVE)) {
+ if ((flags & FLAG_SRC_MALLOC) == 0) {
irep->iseq = (mrb_code*)src;
src += sizeof(mrb_code) * irep->ilen;
irep->flags |= MRB_ISEQ_NO_FREE;
@@ -119,21 +115,17 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
irep->pool = (mrb_value*)mrb_malloc(mrb, sizeof(mrb_value) * plen);
for (i = 0; i < plen; i++) {
- mrb_value s;
+ const char *s;
+ mrb_bool st = (flags & FLAG_SRC_MALLOC)==0;
tt = *src++; /* pool TT */
pool_data_len = bin_to_uint16(src); /* pool data length */
src += sizeof(uint16_t);
- if (flags & FLAG_SRC_MALLOC) {
- s = mrb_str_new(mrb, (char *)src, pool_data_len);
- }
- else {
- s = mrb_str_new_static(mrb, (char *)src, pool_data_len);
- }
+ s = (const char*)src;
src += pool_data_len;
switch (tt) { /* pool data */
case IREP_TT_FIXNUM: {
- mrb_value num = mrb_str_to_inum(mrb, s, 10, FALSE);
+ mrb_value num = mrb_str_len_to_inum(mrb, s, pool_data_len, 10, FALSE);
#ifdef MRB_WITHOUT_FLOAT
irep->pool[i] = num;
#else
@@ -144,12 +136,12 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
#ifndef MRB_WITHOUT_FLOAT
case IREP_TT_FLOAT:
- irep->pool[i] = mrb_float_pool(mrb, str_to_double(mrb, s));
+ irep->pool[i] = mrb_float_pool(mrb, str_to_double(mrb, s, pool_data_len));
break;
#endif
case IREP_TT_STRING:
- irep->pool[i] = mrb_str_pool(mrb, s);
+ irep->pool[i] = mrb_str_pool(mrb, s, pool_data_len, st);
break;
default:
@@ -468,19 +460,7 @@ read_binary_header(const uint8_t *bin, size_t bufsize, size_t *bin_size, uint16_
return MRB_DUMP_READ_FAULT;
}
- if (memcmp(header->binary_ident, RITE_BINARY_IDENT, sizeof(header->binary_ident)) == 0) {
- if (bigendian_p())
- *flags |= FLAG_BYTEORDER_NATIVE;
- else
- *flags |= FLAG_BYTEORDER_BIG;
- }
- else if (memcmp(header->binary_ident, RITE_BINARY_IDENT_LIL, sizeof(header->binary_ident)) == 0) {
- if (bigendian_p())
- *flags |= FLAG_BYTEORDER_LIL;
- else
- *flags |= FLAG_BYTEORDER_NATIVE;
- }
- else {
+ if (memcmp(header->binary_ident, RITE_BINARY_IDENT, sizeof(header->binary_ident)) != 0) {
return MRB_DUMP_INVALID_FILE_HEADER;
}
diff --git a/src/numeric.c b/src/numeric.c
index 306b6ef4d..07a2d20a8 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -1485,13 +1485,14 @@ cmpnum(mrb_state *mrb, mrb_value v1, mrb_value v2)
/* 15.2.9.3.6 */
/*
* call-seq:
- * self.f <=> other.f => -1, 0, +1
+ * self.f <=> other.f => -1, 0, +1, or nil
* < => -1
* = => 0
* > => +1
* Comparison---Returns -1, 0, or +1 depending on whether <i>fix</i> is
* less than, equal to, or greater than <i>numeric</i>. This is the
- * basis for the tests in <code>Comparable</code>.
+ * basis for the tests in <code>Comparable</code>. When the operands are
+ * not comparable, it returns nil instead of raising an exception.
*/
static mrb_value
integral_cmp(mrb_state *mrb, mrb_value self)
@@ -1648,10 +1649,10 @@ mrb_init_numeric(mrb_state *mrb)
mrb_define_method(mrb, integer, "to_i", int_to_i, MRB_ARGS_NONE()); /* 15.2.8.3.24 */
mrb_define_method(mrb, integer, "to_int", int_to_i, MRB_ARGS_NONE());
#ifndef MRB_WITHOUT_FLOAT
- mrb_define_method(mrb, integer, "ceil", int_to_i, MRB_ARGS_REQ(1)); /* 15.2.8.3.8 (x) */
- mrb_define_method(mrb, integer, "floor", int_to_i, MRB_ARGS_REQ(1)); /* 15.2.8.3.10 (x) */
- mrb_define_method(mrb, integer, "round", int_to_i, MRB_ARGS_REQ(1)); /* 15.2.8.3.12 (x) */
- mrb_define_method(mrb, integer, "truncate", int_to_i, MRB_ARGS_REQ(1)); /* 15.2.8.3.15 (x) */
+ mrb_define_method(mrb, integer, "ceil", int_to_i, MRB_ARGS_NONE()); /* 15.2.8.3.8 (x) */
+ mrb_define_method(mrb, integer, "floor", int_to_i, MRB_ARGS_NONE()); /* 15.2.8.3.10 (x) */
+ mrb_define_method(mrb, integer, "round", int_to_i, MRB_ARGS_NONE()); /* 15.2.8.3.12 (x) */
+ mrb_define_method(mrb, integer, "truncate", int_to_i, MRB_ARGS_NONE()); /* 15.2.8.3.15 (x) */
#endif
/* Fixnum Class */
diff --git a/src/print.c b/src/print.c
index 03b5eadfa..7d2d16086 100644
--- a/src/print.c
+++ b/src/print.c
@@ -31,7 +31,6 @@ MRB_API void
mrb_print_error(mrb_state *mrb)
{
mrb_print_backtrace(mrb);
- printstr(mrb_funcall(mrb, mrb_obj_value(mrb->exc), "inspect", 0), stderr);
}
MRB_API void
diff --git a/src/string.c b/src/string.c
index b7eef5888..44e3c9069 100644
--- a/src/string.c
+++ b/src/string.c
@@ -10,6 +10,7 @@
#ifndef MRB_WITHOUT_FLOAT
#include <float.h>
+#include <math.h>
#endif
#include <limits.h>
#include <stddef.h>
@@ -24,7 +25,7 @@
typedef struct mrb_shared_string {
int refcnt;
- mrb_int capa;
+ mrb_ssize capa;
char *ptr;
} mrb_shared_string;
@@ -40,8 +41,8 @@ str_init_normal_capa(mrb_state *mrb, struct RString *s,
if (p) memcpy(dst, p, len);
dst[len] = '\0';
s->as.heap.ptr = dst;
- s->as.heap.len = (mrb_int)len;
- s->as.heap.aux.capa = (mrb_int)capa;
+ s->as.heap.len = (mrb_ssize)len;
+ s->as.heap.aux.capa = (mrb_ssize)capa;
RSTR_UNSET_TYPE_FLAG(s);
return s;
}
@@ -66,7 +67,7 @@ static struct RString*
str_init_nofree(struct RString *s, const char *p, size_t len)
{
s->as.heap.ptr = (char *)p;
- s->as.heap.len = (mrb_int)len;
+ s->as.heap.len = (mrb_ssize)len;
s->as.heap.aux.capa = 0; /* nofree */
RSTR_SET_TYPE_FLAG(s, NOFREE);
return s;
@@ -118,7 +119,7 @@ str_new_static(mrb_state *mrb, const char *p, size_t len)
if (RSTR_EMBEDDABLE_P(len)) {
return str_init_embed(mrb_obj_alloc_string(mrb), p, len);
}
- if (len >= MRB_INT_MAX) {
+ if (len >= MRB_SSIZE_MAX) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
}
return str_init_nofree(mrb_obj_alloc_string(mrb), p, len);
@@ -130,7 +131,7 @@ str_new(mrb_state *mrb, const char *p, size_t len)
if (RSTR_EMBEDDABLE_P(len)) {
return str_init_embed(mrb_obj_alloc_string(mrb), p, len);
}
- if (len >= MRB_INT_MAX) {
+ if (len >= MRB_SSIZE_MAX) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
}
if (p && mrb_ro_data_p(p)) {
@@ -162,7 +163,7 @@ mrb_str_new_capa(mrb_state *mrb, size_t capa)
if (RSTR_EMBEDDABLE_P(capa)) {
s = str_init_embed(mrb_obj_alloc_string(mrb), NULL, 0);
}
- else if (capa >= MRB_INT_MAX) {
+ else if (capa >= MRB_SSIZE_MAX) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "string capacity size too big");
/* not reached */
s = NULL;
@@ -190,8 +191,8 @@ mrb_str_buf_new(mrb_state *mrb, size_t capa)
static void
resize_capa(mrb_state *mrb, struct RString *s, size_t capacity)
{
-#if SIZE_MAX > MRB_INT_MAX
- mrb_assert(capacity < MRB_INT_MAX);
+#if SIZE_MAX > MRB_SSIZE_MAX
+ mrb_assert(capacity < MRB_SSIZE_MAX);
#endif
if (RSTR_EMBED_P(s)) {
if (!RSTR_EMBEDDABLE_P(capacity)) {
@@ -200,7 +201,7 @@ resize_capa(mrb_state *mrb, struct RString *s, size_t capacity)
}
else {
s->as.heap.ptr = (char*)mrb_realloc(mrb, RSTR_PTR(s), capacity+1);
- s->as.heap.aux.capa = (mrb_int)capacity;
+ s->as.heap.aux.capa = (mrb_ssize)capacity;
}
}
@@ -246,6 +247,28 @@ str_decref(mrb_state *mrb, mrb_shared_string *shared)
}
static void
+str_modify_keep_ascii(mrb_state *mrb, struct RString *s)
+{
+ if (RSTR_SHARED_P(s)) {
+ mrb_shared_string *shared = s->as.heap.aux.shared;
+
+ if (shared->refcnt == 1 && s->as.heap.ptr == shared->ptr) {
+ s->as.heap.aux.capa = shared->capa;
+ s->as.heap.ptr[s->as.heap.len] = '\0';
+ RSTR_UNSET_SHARED_FLAG(s);
+ mrb_free(mrb, shared);
+ }
+ else {
+ str_init_modifiable(mrb, s, s->as.heap.ptr, (size_t)s->as.heap.len);
+ str_decref(mrb, shared);
+ }
+ }
+ else if (RSTR_NOFREE_P(s) || RSTR_FSHARED_P(s)) {
+ str_init_modifiable(mrb, s, s->as.heap.ptr, (size_t)s->as.heap.len);
+ }
+}
+
+static void
check_null_byte(mrb_state *mrb, mrb_value str)
{
mrb_to_str(mrb, str);
@@ -278,8 +301,8 @@ static const char utf8len_codepage[256] =
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1,
};
-static mrb_int
-utf8len(const char* p, const char* e)
+mrb_int
+mrb_utf8len(const char* p, const char* e)
{
mrb_int len;
mrb_int i;
@@ -295,14 +318,14 @@ utf8len(const char* p, const char* e)
}
mrb_int
-mrb_utf8_len(const char *str, mrb_int byte_len)
+mrb_utf8_strlen(const char *str, mrb_int byte_len)
{
mrb_int total = 0;
const char *p = str;
const char *e = p + byte_len;
while (p < e) {
- p += utf8len(p, e);
+ p += mrb_utf8len(p, e);
total++;
}
return total;
@@ -318,7 +341,7 @@ utf8_strlen(mrb_value str)
return byte_len;
}
else {
- mrb_int utf8_len = mrb_utf8_len(RSTR_PTR(s), byte_len);
+ mrb_int utf8_len = mrb_utf8_strlen(RSTR_PTR(s), byte_len);
if (byte_len == utf8_len) RSTR_SET_ASCII_FLAG(s);
return utf8_len;
}
@@ -339,7 +362,7 @@ chars2bytes(mrb_value s, mrb_int off, mrb_int idx)
const char *e = RSTRING_END(s);
for (b=i=0; p<e && i<idx; i++) {
- n = utf8len(p, e);
+ n = mrb_utf8len(p, e);
b += n;
p += n;
}
@@ -356,7 +379,7 @@ bytes2chars(char *p, mrb_int len, mrb_int bi)
mrb_int i;
for (i = 0; p < pivot; i ++) {
- p += utf8len(p, e);
+ p += mrb_utf8len(p, e);
}
if (p != pivot) return -1;
return i;
@@ -377,7 +400,7 @@ char_adjust(const char *beg, const char *end, const char *ptr)
while (p > beg) {
p --;
if ((*p & 0xc0) != 0x80) {
- int clen = utf8len(p, end);
+ int clen = mrb_utf8len(p, end);
if (clen > ptr - p) return p;
break;
}
@@ -440,10 +463,10 @@ str_index_str_by_char_search(mrb_state *mrb, const char *p, const char *pend, co
}
pivot = p + qstable[(unsigned char)p[slen - 1]];
- if (pivot > pend || pivot < p /* overflowed */) { return -1; }
+ if (pivot >= pend || pivot < p /* overflowed */) { return -1; }
do {
- p += utf8len(p, pend);
+ p += mrb_utf8len(p, pend);
off ++;
} while (p < pivot);
}
@@ -462,7 +485,7 @@ str_index_str_by_char(mrb_state *mrb, mrb_value str, mrb_value sub, mrb_int pos)
for (; pos > 0; pos --) {
if (pend - p < 1) { return -1; }
- p += utf8len(p, pend);
+ p += mrb_utf8len(p, pend);
}
if (slen < 1) { return off; }
@@ -481,25 +504,45 @@ str_index_str_by_char(mrb_state *mrb, mrb_value str, mrb_value sub, mrb_int pos)
#define str_index_str_by_char(mrb, str, sub, pos) str_index_str(mrb, str, sub, pos)
#endif
+#ifndef MRB_QS_SHORT_STRING_LENGTH
+#define MRB_QS_SHORT_STRING_LENGTH 2048
+#endif
+
static inline mrb_int
mrb_memsearch_qs(const unsigned char *xs, mrb_int m, const unsigned char *ys, mrb_int n)
{
- const unsigned char *x = xs, *xe = xs + m;
- const unsigned char *y = ys;
- int i;
- ptrdiff_t qstable[256];
+ if (n + m < MRB_QS_SHORT_STRING_LENGTH) {
+ const unsigned char *y = ys;
+ const unsigned char *ye = ys+n-m+1;
- /* Preprocessing */
- for (i = 0; i < 256; ++i)
- qstable[i] = m + 1;
- for (; x < xe; ++x)
- qstable[*x] = xe - x;
- /* Searching */
- for (; y + m <= ys + n; y += *(qstable + y[m])) {
- if (*xs == *y && memcmp(xs, y, m) == 0)
- return (mrb_int)(y - ys);
+ for (;;) {
+ y = (const unsigned char*)memchr(y, xs[0], (size_t)(ye-y));
+ if (y == NULL) return -1;
+ if (memcmp(xs, y, m) == 0) {
+ return (mrb_int)(y - ys);
+ }
+ y++;
+ }
+ return -1;
+ }
+ else {
+ const unsigned char *x = xs, *xe = xs + m;
+ const unsigned char *y = ys;
+ int i;
+ ptrdiff_t qstable[256];
+
+ /* Preprocessing */
+ for (i = 0; i < 256; ++i)
+ qstable[i] = m + 1;
+ for (; x < xe; ++x)
+ qstable[*x] = xe - x;
+ /* Searching */
+ for (; y + m <= ys + n; y += *(qstable + y[m])) {
+ if (*xs == *y && memcmp(xs, y, m) == 0)
+ return (mrb_int)(y - ys);
+ }
+ return -1;
}
- return -1;
}
static mrb_int
@@ -531,7 +574,7 @@ str_share(mrb_state *mrb, struct RString *orig, struct RString *s)
size_t len = (size_t)orig->as.heap.len;
mrb_assert(!RSTR_EMBED_P(orig));
- if (RSTR_NOFREE_P(orig) || RSTR_POOL_P(orig)) {
+ if (RSTR_NOFREE_P(orig)) {
str_init_nofree(s, orig->as.heap.ptr, len);
}
else if (RSTR_SHARED_P(orig)) {
@@ -540,13 +583,13 @@ str_share(mrb_state *mrb, struct RString *orig, struct RString *s)
else if (RSTR_FSHARED_P(orig)) {
str_init_fshared(orig, s, orig->as.heap.aux.fshared);
}
- else if (mrb_frozen_p(orig)) {
+ else if (mrb_frozen_p(orig) && !RSTR_POOL_P(orig)) {
str_init_fshared(orig, s, orig);
}
else {
if (orig->as.heap.aux.capa > orig->as.heap.len) {
orig->as.heap.ptr = (char *)mrb_realloc(mrb, orig->as.heap.ptr, len+1);
- orig->as.heap.aux.capa = len;
+ orig->as.heap.aux.capa = (mrb_ssize)len;
}
str_init_shared(mrb, orig, s, NULL);
str_init_shared(mrb, orig, orig, s->as.heap.aux.shared);
@@ -554,12 +597,9 @@ str_share(mrb_state *mrb, struct RString *orig, struct RString *s)
}
mrb_value
-mrb_str_pool(mrb_state *mrb, mrb_value str)
+mrb_str_pool(mrb_state *mrb, const char *p, mrb_int len, mrb_bool nofree)
{
struct RString *s = (struct RString *)mrb_malloc(mrb, sizeof(struct RString));
- struct RString *orig = mrb_str_ptr(str);
- const char *p = RSTR_PTR(orig);
- size_t len = (size_t)RSTR_LEN(orig);
s->tt = MRB_TT_STRING;
s->c = mrb->string_class;
@@ -568,7 +608,7 @@ mrb_str_pool(mrb_state *mrb, mrb_value str)
if (RSTR_EMBEDDABLE_P(len)) {
str_init_embed(s, p, len);
}
- else if (RSTR_NOFREE_P(orig)) {
+ else if (nofree) {
str_init_nofree(s, p, len);
}
else {
@@ -591,8 +631,8 @@ mrb_str_byte_subseq(mrb_state *mrb, mrb_value str, mrb_int beg, mrb_int len)
}
else {
str_share(mrb, orig, s);
- s->as.heap.ptr += beg;
- s->as.heap.len = len;
+ s->as.heap.ptr += (mrb_ssize)beg;
+ s->as.heap.len = (mrb_ssize)len;
}
RSTR_COPY_ASCII_FLAG(s, orig);
return mrb_obj_value(s);
@@ -814,22 +854,7 @@ MRB_API void
mrb_str_modify_keep_ascii(mrb_state *mrb, struct RString *s)
{
mrb_check_frozen(mrb, s);
- if (RSTR_SHARED_P(s)) {
- mrb_shared_string *shared = s->as.heap.aux.shared;
-
- if (shared->refcnt == 1 && s->as.heap.ptr == shared->ptr) {
- s->as.heap.aux.capa = shared->capa;
- s->as.heap.ptr[s->as.heap.len] = '\0';
- mrb_free(mrb, shared);
- }
- else {
- str_init_modifiable(mrb, s, s->as.heap.ptr, (size_t)s->as.heap.len);
- str_decref(mrb, shared);
- }
- }
- else if (RSTR_NOFREE_P(s) || RSTR_FSHARED_P(s)) {
- str_init_modifiable(mrb, s, s->as.heap.ptr, (size_t)s->as.heap.len);
- }
+ str_modify_keep_ascii(mrb, s);
}
MRB_API void
@@ -954,7 +979,7 @@ mrb_str_times(mrb_state *mrb, mrb_value self)
if (times < 0) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "negative argument");
}
- if (times && MRB_INT_MAX / times < RSTRING_LEN(self)) {
+ if (times && MRB_SSIZE_MAX / times < RSTRING_LEN(self)) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "argument too big");
}
@@ -1088,7 +1113,6 @@ mrb_str_equal_m(mrb_state *mrb, mrb_value str1)
return mrb_bool_value(mrb_str_equal(mrb, str1, str2));
}
/* ---------------------------------- */
-mrb_value mrb_mod_to_s(mrb_state *mrb, mrb_value klass);
MRB_API mrb_value
mrb_str_to_str(mrb_state *mrb, mrb_value str)
@@ -1295,7 +1319,7 @@ str_replace_partial(mrb_state *mrb, mrb_value src, mrb_int pos, mrb_int end, mrb
replen = (mrb_nil_p(rep) ? 0 : RSTRING_LEN(rep));
newlen = replen + len - (end - pos);
- if (newlen >= MRB_INT_MAX || newlen < replen /* overflowed */) {
+ if (newlen >= MRB_SSIZE_MAX || newlen < replen /* overflowed */) {
mrb_raise(mrb, E_RUNTIME_ERROR, "string size too big");
}
@@ -1338,7 +1362,7 @@ str_escape(mrb_state *mrb, mrb_value str, mrb_bool inspect)
unsigned char c, cc;
#ifdef MRB_UTF8_STRING
if (inspect) {
- mrb_int clen = utf8len(p, pend);
+ mrb_int clen = mrb_utf8len(p, pend);
if (clen > 1) {
mrb_int i;
@@ -1641,7 +1665,7 @@ mrb_str_chop_bang(mrb_state *mrb, mrb_value str)
const char* t = RSTR_PTR(s), *p = t;
const char* e = p + RSTR_LEN(s);
while (p<e) {
- mrb_int clen = utf8len(p, e);
+ mrb_int clen = mrb_utf8len(p, e);
if (p + clen>=e) break;
p += clen;
}
@@ -1942,15 +1966,10 @@ mrb_str_intern(mrb_state *mrb, mrb_value self)
MRB_API mrb_value
mrb_obj_as_string(mrb_state *mrb, mrb_value obj)
{
- mrb_value str;
-
if (mrb_string_p(obj)) {
return obj;
}
- str = mrb_funcall(mrb, obj, "to_s", 0);
- if (!mrb_string_p(str))
- return mrb_any_to_s(mrb, obj);
- return str;
+ return mrb_str_to_str(mrb, obj);
}
MRB_API mrb_value
@@ -2018,7 +2037,7 @@ mrb_str_reverse_bang(mrb_state *mrb, mrb_value str)
p = RSTR_PTR(s);
e = p + RSTR_LEN(s);
while (p<e) {
- mrb_int clen = utf8len(p, e);
+ mrb_int clen = mrb_utf8len(p, e);
str_reverse(p, p + clen - 1);
p += clen;
}
@@ -2241,7 +2260,7 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str)
return result;
}
-static mrb_value
+mrb_value
mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base, int badcheck)
{
const char *p = str;
@@ -2352,7 +2371,7 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base,
if (*(p - 1) == '0')
p--;
}
- if (p == pend) {
+ if (p == pend || *p == '_') {
if (badcheck) goto bad;
return mrb_fixnum_value(0);
}
@@ -2391,9 +2410,10 @@ mrb_str_len_to_inum(mrb_state *mrb, const char *str, mrb_int len, mrb_int base,
}
val = (mrb_int)n;
if (badcheck) {
- if (p == str) goto bad; /* no number */
+ if (p == str) goto bad; /* no number */
+ if (*(p - 1) == '_') goto bad; /* trailing '_' */
while (p<pend && ISSPACE(*p)) p++;
- if (p<pend) goto bad; /* trailing garbage */
+ if (p<pend) goto bad; /* trailing garbage */
}
return mrb_fixnum_value(sign ? val : -val);
@@ -2427,15 +2447,12 @@ mrb_string_value_cstr(mrb_state *mrb, mrb_value *ptr)
if (p[len] == '\0') {
return p;
}
- if (mrb_frozen_p(ps) || RSTR_CAPA(ps) == len) {
- ps = str_new(mrb, NULL, len+1);
- memcpy(RSTR_PTR(ps), p, len);
- RSTR_SET_LEN(ps, len);
- *ptr = mrb_obj_value(ps);
- }
- else {
- mrb_str_modify(mrb, ps);
- }
+
+ /*
+ * Even after str_modify_keep_ascii(), NULL termination is not ensured if
+ * RSTR_SET_LEN() is used explicitly (e.g. String#delete_suffix!).
+ */
+ str_modify_keep_ascii(mrb, ps);
RSTR_PTR(ps)[len] = '\0';
return RSTR_PTR(ps);
}
@@ -2492,73 +2509,105 @@ mrb_str_to_i(mrb_state *mrb, mrb_value self)
}
#ifndef MRB_WITHOUT_FLOAT
-MRB_API double
-mrb_cstr_to_dbl(mrb_state *mrb, const char * p, mrb_bool badcheck)
+double
+mrb_str_len_to_dbl(mrb_state *mrb, const char *s, size_t len, mrb_bool badcheck)
{
+ char buf[DBL_DIG * 4 + 20];
+ const char *p = s, *p2;
+ const char *pend = p + len;
char *end;
- char buf[DBL_DIG * 4 + 10];
+ char *n;
+ char prev = 0;
double d;
-
- enum {max_width = 20};
+ mrb_bool dot = FALSE;
if (!p) return 0.0;
- while (ISSPACE(*p)) p++;
-
- if (!badcheck && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
- return 0.0;
+ while (p<pend && ISSPACE(*p)) p++;
+ p2 = p;
+
+ if (pend - p > 2 && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
+ mrb_value x;
+
+ if (!badcheck) return 0.0;
+ x = mrb_str_len_to_inum(mrb, p, pend-p, 0, badcheck);
+ if (mrb_fixnum_p(x))
+ d = (double)mrb_fixnum(x);
+ else /* if (mrb_float_p(x)) */
+ d = mrb_float(x);
+ return d;
+ }
+ while (p < pend) {
+ if (!*p) {
+ if (badcheck) {
+ mrb_raise(mrb, E_ARGUMENT_ERROR, "string for Float contains null byte");
+ /* not reached */
+ }
+ pend = p;
+ p = p2;
+ goto nocopy;
+ }
+ if (!badcheck && *p == ' ') {
+ pend = p;
+ p = p2;
+ goto nocopy;
+ }
+ if (*p == '_') break;
+ p++;
}
+ p = p2;
+ n = buf;
+ while (p < pend) {
+ char c = *p++;
+ if (c == '.') dot = TRUE;
+ if (c == '_') {
+ /* remove an underscore between digits */
+ if (n == buf || !ISDIGIT(prev) || p == pend) {
+ if (badcheck) goto bad;
+ break;
+ }
+ }
+ else if (badcheck && prev == '_' && !ISDIGIT(c)) goto bad;
+ else {
+ const char *bend = buf+sizeof(buf)-1;
+ if (n==bend) { /* buffer overflow */
+ if (dot) break; /* cut off remaining fractions */
+ return INFINITY;
+ }
+ *n++ = c;
+ }
+ prev = c;
+ }
+ *n = '\0';
+ p = buf;
+ pend = n;
+nocopy:
d = mrb_float_read(p, &end);
if (p == end) {
if (badcheck) {
bad:
- mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid string for float(%s)", p);
+ mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid string for float(%!s)", s);
/* not reached */
}
return d;
}
- if (*end) {
- char *n = buf;
- char *e = buf + sizeof(buf) - 1;
- char prev = 0;
-
- while (p < end && n < e) prev = *n++ = *p++;
- while (*p) {
- if (*p == '_') {
- /* remove underscores between digits */
- if (badcheck) {
- if (n == buf || !ISDIGIT(prev)) goto bad;
- ++p;
- if (!ISDIGIT(*p)) goto bad;
- }
- else {
- while (*++p == '_');
- continue;
- }
- }
- prev = *p++;
- if (n < e) *n++ = prev;
- }
- *n = '\0';
- p = buf;
-
- if (!badcheck && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
- return 0.0;
- }
-
- d = mrb_float_read(p, &end);
- if (badcheck) {
- if (!end || p == end) goto bad;
- while (*end && ISSPACE(*end)) end++;
- if (*end) goto bad;
- }
+ if (badcheck) {
+ if (!end || p == end) goto bad;
+ while (end<pend && ISSPACE(*end)) end++;
+ if (end<pend) goto bad;
}
return d;
}
MRB_API double
+mrb_cstr_to_dbl(mrb_state *mrb, const char *s, mrb_bool badcheck)
+{
+ return mrb_str_len_to_dbl(mrb, s, strlen(s), badcheck);
+}
+
+MRB_API double
mrb_str_to_dbl(mrb_state *mrb, mrb_value str, mrb_bool badcheck)
{
- return mrb_cstr_to_dbl(mrb, RSTRING_CSTR(mrb, str), badcheck);
+ return mrb_str_len_to_dbl(mrb, RSTRING_PTR(str), RSTRING_LEN(str), badcheck);
}
/* 15.2.10.5.39 */
@@ -2678,21 +2727,21 @@ mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len)
capa = RSTR_CAPA(s);
total = RSTR_LEN(s)+len;
- if (total >= MRB_INT_MAX) {
+ if (total >= MRB_SSIZE_MAX) {
size_error:
mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
}
if (capa <= total) {
if (capa == 0) capa = 1;
while (capa <= total) {
- if (capa <= MRB_INT_MAX / 2) {
+ if (capa <= MRB_SSIZE_MAX / 2) {
capa *= 2;
}
else {
capa = total+1;
}
}
- if (capa <= total || capa > MRB_INT_MAX) {
+ if (capa <= total || capa > MRB_SSIZE_MAX) {
goto size_error;
}
resize_capa(mrb, s, capa);
@@ -2701,7 +2750,7 @@ mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len)
ptr = RSTR_PTR(s) + off;
}
memcpy(RSTR_PTR(s) + RSTR_LEN(s), ptr, len);
- mrb_assert_int_fit(size_t, total, mrb_int, MRB_INT_MAX);
+ mrb_assert_int_fit(size_t, total, mrb_ssize, MRB_SSIZE_MAX);
RSTR_SET_LEN(s, total);
RSTR_PTR(s)[total] = '\0'; /* sentinel */
return str;
@@ -2710,7 +2759,7 @@ mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len)
MRB_API mrb_value
mrb_str_cat_cstr(mrb_state *mrb, mrb_value str, const char *ptr)
{
- return mrb_str_cat(mrb, str, ptr, strlen(ptr));
+ return mrb_str_cat(mrb, str, ptr, ptr ? strlen(ptr) : 0);
}
MRB_API mrb_value
@@ -2873,7 +2922,7 @@ mrb_init_string(mrb_state *mrb)
{
struct RClass *s;
- mrb_static_assert(RSTRING_EMBED_LEN_MAX < (1 << MRB_STR_EMBED_LEN_BITSIZE),
+ mrb_static_assert(RSTRING_EMBED_LEN_MAX < (1 << MRB_STR_EMBED_LEN_BIT),
"pointer size too big for embedded string");
mrb->string_class = s = mrb_define_class(mrb, "String", mrb->object_class); /* 15.2.10 */
diff --git a/src/symbol.c b/src/symbol.c
index 2696b5210..ad186dce3 100644
--- a/src/symbol.c
+++ b/src/symbol.c
@@ -20,12 +20,12 @@ typedef struct symbol_name {
const char *name;
} symbol_name;
-#define SYMBOL_INLINE_BIT 1
-#define SYMBOL_INLINE_LOWER_BIT 2
-#define SYMBOL_INLINE (1 << (SYMBOL_INLINE_BIT - 1))
-#define SYMBOL_INLINE_LOWER (1 << (SYMBOL_INLINE_LOWER_BIT - 1))
-#define SYMBOL_NORMAL_SHIFT SYMBOL_INLINE_BIT
-#define SYMBOL_INLINE_SHIFT SYMBOL_INLINE_LOWER_BIT
+#define SYMBOL_INLINE_BIT_POS 1
+#define SYMBOL_INLINE_LOWER_BIT_POS 2
+#define SYMBOL_INLINE (1 << (SYMBOL_INLINE_BIT_POS - 1))
+#define SYMBOL_INLINE_LOWER (1 << (SYMBOL_INLINE_LOWER_BIT_POS - 1))
+#define SYMBOL_NORMAL_SHIFT SYMBOL_INLINE_BIT_POS
+#define SYMBOL_INLINE_SHIFT SYMBOL_INLINE_LOWER_BIT_POS
#ifdef MRB_ENABLE_ALL_SYMBOLS
# define SYMBOL_INLINE_P(sym) FALSE
# define SYMBOL_INLINE_LOWER_P(sym) FALSE
@@ -48,14 +48,14 @@ sym_validate_len(mrb_state *mrb, size_t len)
static const char pack_table[] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
static mrb_sym
-sym_inline_pack(const char *name, uint16_t len)
+sym_inline_pack(const char *name, size_t len)
{
- const int lower_length_max = (MRB_SYMBOL_BITSIZE - 2) / 5;
- const int mix_length_max = (MRB_SYMBOL_BITSIZE - 2) / 6;
+ const size_t lower_length_max = (MRB_SYMBOL_BIT - 2) / 5;
+ const size_t mix_length_max = (MRB_SYMBOL_BIT - 2) / 6;
char c;
const char *p;
- int i;
+ size_t i;
mrb_sym sym = 0;
mrb_bool lower = TRUE;
@@ -124,7 +124,7 @@ symhash(const char *key, size_t len)
}
static mrb_sym
-find_symbol(mrb_state *mrb, const char *name, uint16_t len, uint8_t *hashp)
+find_symbol(mrb_state *mrb, const char *name, size_t len, uint8_t *hashp)
{
mrb_sym i;
symbol_name *sname;
@@ -517,18 +517,14 @@ mrb_sym_str(mrb_state *mrb, mrb_sym sym)
{
mrb_int len;
const char *name = mrb_sym_name_len(mrb, sym, &len);
- mrb_value str;
if (!name) return mrb_undef_value(); /* can't happen */
if (SYMBOL_INLINE_P(sym)) {
- str = mrb_str_new(mrb, name, len);
+ mrb_value str = mrb_str_new(mrb, name, len);
RSTR_SET_ASCII_FLAG(mrb_str_ptr(str));
+ return str;
}
- else {
- str = mrb_str_new_static(mrb, name, len);
- }
- MRB_SET_FROZEN_FLAG(mrb_str_ptr(str));
- return str;
+ return mrb_str_new_static(mrb, name, len);
}
static const char*
diff --git a/src/variable.c b/src/variable.c
index 8fc01fe2d..030aa7b00 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -1123,7 +1123,7 @@ mrb_class_find_path(mrb_state *mrb, struct RClass *c)
iv_del(mrb, c->iv, mrb_intern_lit(mrb, "__outer__"), NULL);
iv_put(mrb, c->iv, mrb_intern_lit(mrb, "__classname__"), path);
mrb_field_write_barrier_value(mrb, (struct RBasic*)c, path);
- MRB_SET_FROZEN_FLAG(mrb_obj_ptr(path));
+ path = mrb_str_dup(mrb, path);
}
return path;
}
diff --git a/src/vm.c b/src/vm.c
index 54f74907e..a280026f8 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -6,7 +6,9 @@
#include <stddef.h>
#include <stdarg.h>
+#ifndef MRB_WITHOUT_FLOAT
#include <math.h>
+#endif
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/class.h>
@@ -322,6 +324,7 @@ cipop(mrb_state *mrb)
}
void mrb_exc_set(mrb_state *mrb, mrb_value exc);
+static mrb_value mrb_run(mrb_state *mrb, struct RProc* proc, mrb_value self);
static void
ecall(mrb_state *mrb)
@@ -333,10 +336,12 @@ ecall(mrb_state *mrb)
struct REnv *env;
ptrdiff_t cioff;
int ai = mrb_gc_arena_save(mrb);
- uint16_t i = --c->eidx;
+ uint16_t i;
int nregs;
- if (i<0) return;
+ if (c->eidx == 0) return;
+ i = --c->eidx;
+
/* restrict total call depth of ecall() */
if (++mrb->ecall_nest > MRB_ECALL_DEPTH_MAX) {
mrb_exc_raise(mrb, mrb_obj_value(mrb->stack_err));
@@ -428,6 +433,7 @@ MRB_API mrb_value
mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc, const mrb_value *argv, mrb_value blk)
{
mrb_value val;
+ int ai = mrb_gc_arena_save(mrb);
if (!mrb->jmp) {
struct mrb_jmpbuf c_jmp;
@@ -516,19 +522,17 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc
mrb->c->stack[argc+1] = blk;
if (MRB_METHOD_CFUNC_P(m)) {
- int ai = mrb_gc_arena_save(mrb);
-
ci->acc = CI_ACC_DIRECT;
val = MRB_METHOD_CFUNC(m)(mrb, self);
mrb->c->stack = mrb->c->ci->stackent;
cipop(mrb);
- mrb_gc_arena_restore(mrb, ai);
}
else {
ci->acc = CI_ACC_SKIP;
val = mrb_run(mrb, MRB_METHOD_PROC(m), self);
}
}
+ mrb_gc_arena_restore(mrb, ai);
mrb_gc_protect(mrb, val);
return val;
}
@@ -623,7 +627,7 @@ mrb_f_send(mrb_state *mrb, mrb_value self)
ci->argc--;
}
else { /* variable length arguments */
- mrb_ary_shift(mrb, regs[0]);
+ regs[0] = mrb_ary_subseq(mrb, regs[0], 1, RARRAY_LEN(regs[0]) - 1);
}
if (MRB_METHOD_CFUNC_P(m)) {
@@ -647,8 +651,7 @@ eval_under(mrb_state *mrb, mrb_value self, mrb_value blk, struct RClass *c)
}
ci = mrb->c->ci;
if (ci->acc == CI_ACC_DIRECT) {
- ci->target_class = c;
- return mrb_yield_cont(mrb, blk, self, 1, &self);
+ return mrb_yield_with_class(mrb, blk, 1, &self, self, c);
}
ci->target_class = c;
p = mrb_proc_ptr(blk);
@@ -723,26 +726,11 @@ mrb_value
mrb_obj_instance_eval(mrb_state *mrb, mrb_value self)
{
mrb_value a, b;
- mrb_value cv;
- struct RClass *c;
if (mrb_get_args(mrb, "|S&", &a, &b) == 1) {
mrb_raise(mrb, E_NOTIMP_ERROR, "instance_eval with string not implemented");
}
- switch (mrb_type(self)) {
- case MRB_TT_SYMBOL:
- case MRB_TT_FIXNUM:
-#ifndef MRB_WITHOUT_FLOAT
- case MRB_TT_FLOAT:
-#endif
- c = 0;
- break;
- default:
- cv = mrb_singleton_class(mrb, self);
- c = mrb_class_ptr(cv);
- break;
- }
- return eval_under(mrb, self, b, c);
+ return eval_under(mrb, self, b, mrb_singleton_class_ptr(mrb, self));
}
MRB_API mrb_value
@@ -1061,6 +1049,11 @@ RETRY_TRY_BLOCK:
NEXT;
}
+ CASE(OP_LOADI16, BS) {
+ SET_INT_VALUE(regs[a], (mrb_int)(int16_t)b);
+ NEXT;
+ }
+
CASE(OP_LOADSYM, BB) {
SET_SYM_VALUE(regs[a], syms[b]);
NEXT;
@@ -1098,13 +1091,13 @@ RETRY_TRY_BLOCK:
}
CASE(OP_GETSV, BB) {
- mrb_value val = mrb_vm_special_get(mrb, b);
+ mrb_value val = mrb_vm_special_get(mrb, syms[b]);
regs[a] = val;
NEXT;
}
CASE(OP_SETSV, BB) {
- mrb_vm_special_set(mrb, b, regs[a]);
+ mrb_vm_special_set(mrb, syms[b], regs[a]);
NEXT;
}
@@ -1495,11 +1488,9 @@ RETRY_TRY_BLOCK:
ci->target_class = MRB_PROC_TARGET_CLASS(m);
ci->proc = m;
if (MRB_PROC_ENV_P(m)) {
- mrb_sym mid;
struct REnv *e = MRB_PROC_ENV(m);
- mid = e->mid;
- if (mid) ci->mid = mid;
+ ci->mid = e->mid;
if (!e->stack) {
e->stack = mrb->c->stack;
}
@@ -2825,7 +2816,7 @@ RETRY_TRY_BLOCK:
MRB_END_EXC(&c_jmp);
}
-MRB_API mrb_value
+static mrb_value
mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
{
if (mrb->c->ci->argc < 0) {
diff --git a/tasks/doc.rake b/tasks/doc.rake
index 4aec2d0a1..11b76bb3f 100644
--- a/tasks/doc.rake
+++ b/tasks/doc.rake
@@ -25,12 +25,12 @@ end
desc 'clean all built docs'
task :clean_api_doc do
- FileUtils.rm_rf 'doc/api'
+ rm_rf 'doc/api'
end
desc 'clean all built docs'
task :clean_capi_doc do
- FileUtils.rm_rf 'doc/capi'
+ rm_rf 'doc/capi'
end
desc 'clean all built docs'
diff --git a/tasks/gitlab.rake b/tasks/gitlab.rake
index 471172377..377b1cc9d 100644
--- a/tasks/gitlab.rake
+++ b/tasks/gitlab.rake
@@ -63,28 +63,25 @@ task :gitlab_config do
configs = []
[true, false].each do |mode_32|
['', 'MRB_USE_FLOAT'].each do |float_conf|
- ['', 'MRB_INT16', 'MRB_INT64'].each do |int_conf|
- ['', 'MRB_NAN_BOXING', 'MRB_WORD_BOXING'].each do |boxing_conf|
- ['', 'MRB_UTF8_STRING'].each do |utf8_conf|
- next if (float_conf == 'MRB_USE_FLOAT') && (boxing_conf == 'MRB_NAN_BOXING')
- next if (int_conf == 'MRB_INT64') && (boxing_conf == 'MRB_NAN_BOXING')
- next if (int_conf == 'MRB_INT16') && (boxing_conf == 'MRB_WORD_BOXING')
- next if (int_conf == 'MRB_INT64') && (boxing_conf == 'MRB_WORD_BOXING') && mode_32
- env = [float_conf, int_conf, boxing_conf, utf8_conf].map do |conf|
- conf == '' ? nil : "-D#{conf}=1"
- end.compact.join(' ')
- bit = mode_32 ? '-m32 ' : ''
- _info = ''
- _info += mode_32 ? '32bit ' : '64bit '
- _info += float_conf['USE'] ? 'float ' : ''
- _info += int_conf['16'] ? 'int16 ' : ''
- _info += int_conf['64'] ? 'int64 ' : ''
- _info += boxing_conf['NAN'] ? 'nan ' : ''
- _info += boxing_conf['word'] ? 'word ' : ''
- _info += utf8_conf['UTF8'] ? 'utf8 ' : ''
- _info = _info.gsub(/ +/, ' ').strip.tr(' ', '_')
- configs << { '_info' => _info, 'CFLAGS' => "#{bit}#{env}", 'LDFLAGS' => bit.strip.to_s }
- end
+ ['', 'MRB_NAN_BOXING', 'MRB_WORD_BOXING'].each do |boxing_conf|
+ ['', 'MRB_UTF8_STRING'].each do |utf8_conf|
+ next if (float_conf == 'MRB_USE_FLOAT') && (boxing_conf == 'MRB_NAN_BOXING')
+ next if (int_conf == 'MRB_INT64') && (boxing_conf == 'MRB_NAN_BOXING')
+ next if (int_conf == 'MRB_INT64') && (boxing_conf == 'MRB_WORD_BOXING') && mode_32
+ env = [float_conf, int_conf, boxing_conf, utf8_conf].map do |conf|
+ conf == '' ? nil : "-D#{conf}=1"
+ end.compact.join(' ')
+ bit = mode_32 ? '-m32 ' : ''
+ _info = ''
+ _info += mode_32 ? '32bit ' : '64bit '
+ _info += float_conf['USE'] ? 'float ' : ''
+ _info += int_conf['16'] ? 'int16 ' : ''
+ _info += int_conf['64'] ? 'int64 ' : ''
+ _info += boxing_conf['NAN'] ? 'nan ' : ''
+ _info += boxing_conf['WORD'] ? 'word ' : ''
+ _info += utf8_conf['UTF8'] ? 'utf8 ' : ''
+ _info = _info.gsub(/ +/, ' ').strip.tr(' ', '_')
+ configs << { '_info' => _info, 'CFLAGS' => "#{bit}#{env}", 'LDFLAGS' => bit.strip.to_s }
end
end
end
@@ -110,7 +107,7 @@ task :gitlab_config do
'stage' => 'test',
'image' => ci_docker_tag(compiler),
'variables' => hash,
- 'script' => 'env; ./minirake --verbose all test'
+ 'script' => 'env; rake --verbose all test'
}
end
end
diff --git a/tasks/libmruby.rake b/tasks/libmruby.rake
index ab5a15b4a..17f8534e2 100644
--- a/tasks/libmruby.rake
+++ b/tasks/libmruby.rake
@@ -4,7 +4,7 @@ MRuby.each_target do
end
file "#{build_dir}/lib/libmruby.flags.mak" => [__FILE__, libmruby_static] do |t|
- FileUtils.mkdir_p File.dirname t.name
+ mkdir_p File.dirname t.name
open(t.name, 'w') do |f|
f.puts "MRUBY_CFLAGS = #{cc.all_flags}"
diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake
index fb76856e5..c814a16db 100644
--- a/tasks/mrbgems.rake
+++ b/tasks/mrbgems.rake
@@ -7,8 +7,8 @@ MRuby.each_target do
# loader all gems
self.libmruby_objs << objfile("#{build_dir}/mrbgems/gem_init")
file objfile("#{build_dir}/mrbgems/gem_init") => ["#{build_dir}/mrbgems/gem_init.c", "#{build_dir}/LEGAL"]
- file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG, __FILE__] do |t|
- FileUtils.mkdir_p "#{build_dir}/mrbgems"
+ file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG, __FILE__, *Dir.glob("#{build_dir}/mrbgems/mruby-*/*.c")] do |t|
+ mkdir_p "#{build_dir}/mrbgems"
open(t.name, 'w') do |f|
gem_func_gems = gems.select { |g| g.generate_functions }
gem_func_decls = gem_func_gems.each_with_object('') do |g, s|
@@ -53,7 +53,7 @@ MRuby.each_target do
# legal documents
file "#{build_dir}/LEGAL" => [MRUBY_CONFIG, __FILE__] do |t|
- FileUtils.mkdir_p File.dirname t.name
+ mkdir_p File.dirname t.name
open(t.name, 'w+') do |f|
f.puts <<LEGAL
Copyright (c) #{Time.now.year} mruby developers
diff --git a/tasks/toolchains/android.rake b/tasks/toolchains/android.rake
index c7df9ef80..2368b93b5 100644
--- a/tasks/toolchains/android.rake
+++ b/tasks/toolchains/android.rake
@@ -10,6 +10,7 @@ class MRuby::Toolchain::Android
~/Android/Sdk/ndk-bundle
%LOCALAPPDATA%/Android/android-sdk/ndk-bundle
%LOCALAPPDATA%/Android/android-ndk
+ %LOCALAPPDATA%/Android/Sdk/ndk/*
~/Library/Android/sdk/ndk-bundle
~/Library/Android/ndk
}
@@ -40,6 +41,19 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
end
end
+ class SysrootNotReady < StandardError
+ def message
+ <<-EOM
+Couldn't find standard header files
+Please Move/Copy important file inside
+ <NDK_HOME>/sysroot/usr/include/
+to
+ <NDK_HOME>/platforms/<ANDROID_VERSION>/<ARCH>/usr/include/
+Higher NDK version will be use.
+ EOM
+ end
+ end
+
attr_reader :params
def initialize(params)
@@ -67,13 +81,32 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
end
def home_path
- @home_path ||= Pathname(
+ @home_path ||= Pathname.new(
params[:ndk_home] ||
ENV['ANDROID_NDK_HOME'] ||
DEFAULT_NDK_HOMES.find { |path|
path.gsub! '%LOCALAPPDATA%', ENV['LOCALAPPDATA'] || '%LOCALAPPDATA%'
path.gsub! '\\', '/'
path.gsub! '~', Dir.home || '~'
+ path.gsub!('*') do
+ next nil unless path[-1] == "*"
+ dirs = Dir.glob(path).collect do |d|
+ m = d.match(/(\d+)\.(\d+)\.(\d+)$/)
+ m ? [m[1], m[2], m[3]].collect { |v| v.to_i } : nil
+ end
+ dirs.compact!
+ dirs.sort! do |before, after|
+ f = 0
+ if (f = (after.first <=> before.first)) != 0
+ next f
+ elsif (f = (after[1] <=> before[1])) != 0
+ next f
+ else
+ next after.last <=> before.last
+ end
+ end
+ dirs.empty? ? nil.to_s : dirs.first.join(".")
+ end
File.directory?(path)
} || raise(AndroidNDKHomeNotFound)
)
@@ -124,7 +157,7 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
path = home_path.join('toolchains', 'llvm' , 'prebuilt', 'windows*')
Dir.glob(path.to_s){ |item|
next if File.file?(item)
- path = Pathname(item)
+ path = Pathname.new(item)
break
}
path.basename
@@ -146,7 +179,8 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
end
def sysroot
- @sysroot ||= home_path.join('platforms', platform,
+ return @sysroot if @sysroot
+ sysroot_path = home_path.join('platforms', platform,
case arch
when /armeabi/ then 'arch-arm'
when /arm64-v8a/ then 'arch-arm64'
@@ -156,6 +190,11 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
when /mips/ then 'arch-mips'
end
).to_s
+ if Dir.exist?(File.join(sysroot_path, "usr", "include"))
+ return @sysroot = sysroot_path
+ else
+ raise(SysrootNotReady)
+ end
end
def platform
@@ -259,6 +298,12 @@ Set ANDROID_PLATFORM environment variable or set :platform parameter
def cflags
flags = []
+ case RUBY_PLATFORM
+ when /mswin|mingw|win32/
+ # Build for Android dont need window flag
+ flags += %W(-U_WIN32 -U_WIN64)
+ end
+
flags += %W(-MMD -MP -D__android__ -DANDROID --sysroot="#{sysroot}")
flags += ctarget
case toolchain
diff --git a/tasks/toolchains/gcc.rake b/tasks/toolchains/gcc.rake
index 1a28026bf..810f23b7a 100644
--- a/tasks/toolchains/gcc.rake
+++ b/tasks/toolchains/gcc.rake
@@ -12,10 +12,10 @@ MRuby::Toolchain.new(:gcc) do |conf, params|
compiler.command = ENV['CC'] || default_command
compiler.flags = [c_mandatory_flags, ENV['CFLAGS'] || [compiler_flags, cxx_invalid_flags, %w(-Wwrite-strings)]]
end
- compiler.option_include_path = '-I%s'
+ compiler.option_include_path = %q[-I"%s"]
compiler.option_define = '-D%s'
- compiler.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
- compiler.cxx_compile_flag = '-x c++ -std=c++03'
+ compiler.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
+ compiler.cxx_compile_flag = '-x c++ -std=gnu++03'
compiler.cxx_exception_flag = '-fexceptions'
compiler.cxx_invalid_flags = c_mandatory_flags + cxx_invalid_flags
end
@@ -27,7 +27,7 @@ MRuby::Toolchain.new(:gcc) do |conf, params|
linker.library_paths = []
linker.option_library = '-l%s'
linker.option_library_path = '-L%s'
- linker.link_options = '%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
+ linker.link_options = '%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
end
[[conf.cc, 'c'], [conf.cxx, 'c++']].each do |cc, lang|
diff --git a/tasks/toolchains/openwrt.rake b/tasks/toolchains/openwrt.rake
index aeb6dbcbc..c376d96ec 100644
--- a/tasks/toolchains/openwrt.rake
+++ b/tasks/toolchains/openwrt.rake
@@ -5,18 +5,18 @@ MRuby::Toolchain.new(:openwrt) do |conf|
cc.command = ENV['TARGET_CC']
cc.flags = ENV['TARGET_CFLAGS']
cc.include_paths = ["#{MRUBY_ROOT}/include"]
- cc.option_include_path = '-I%s'
+ cc.option_include_path = %q[-I"%s"]
cc.option_define = '-D%s'
- cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
+ cc.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
end
[conf.cxx].each do |cxx|
cxx.command = ENV['TARGET_CXX']
cxx.flags = ENV['TARGET_CXXFLAGS']
cxx.include_paths = ["#{MRUBY_ROOT}/include"]
- cxx.option_include_path = '-I%s'
+ cxx.option_include_path = %q[-I"%s"]
cxx.option_define = '-D%s'
- cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
+ cxx.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
end
conf.linker do |linker|
@@ -26,11 +26,11 @@ MRuby::Toolchain.new(:openwrt) do |conf|
linker.library_paths = []
linker.option_library = '-l%s'
linker.option_library_path = '-L%s'
- linker.link_options = '%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
+ linker.link_options = '%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
end
conf.archiver do |archiver|
archiver.command = ENV['TARGET_AR']
- archiver.archive_options = 'rs %{outfile} %{objs}'
+ archiver.archive_options = 'rs "%{outfile}" %{objs}'
end
end
diff --git a/tasks/toolchains/visualcpp.rake b/tasks/toolchains/visualcpp.rake
index c5f295130..5094495e3 100644
--- a/tasks/toolchains/visualcpp.rake
+++ b/tasks/toolchains/visualcpp.rake
@@ -4,9 +4,9 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params|
# C4013: implicit function declaration
cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /we4013 /Zi /MD /O2 /D_CRT_SECURE_NO_WARNINGS)]
cc.defines = %w(MRB_STACK_EXTEND_DOUBLING)
- cc.option_include_path = '/I%s'
+ cc.option_include_path = %q[/I"%s"]
cc.option_define = '/D%s'
- cc.compile_options = "%{flags} /Fo%{outfile} %{infile}"
+ cc.compile_options = %Q[%{flags} /Fo"%{outfile}" "%{infile}"]
cc.cxx_compile_flag = '/TP'
cc.cxx_exception_flag = '/EHs'
end
@@ -15,9 +15,9 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params|
cxx.command = ENV['CXX'] || 'cl.exe'
cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /nologo /W3 /Zi /MD /O2 /EHs /D_CRT_SECURE_NO_WARNINGS)]
cxx.defines = %w(MRB_STACK_EXTEND_DOUBLING)
- cxx.option_include_path = '/I%s'
+ cxx.option_include_path = %q[/I"%s"]
cxx.option_define = '/D%s'
- cxx.compile_options = "%{flags} /Fo%{outfile} %{infile}"
+ cxx.compile_options = %Q[%{flags} /Fo"%{outfile}" "%{infile}"]
cxx.cxx_compile_flag = '/TP'
cxx.cxx_exception_flag = '/EHs'
end
@@ -29,22 +29,22 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params|
linker.library_paths = %w()
linker.option_library = '%s.lib'
linker.option_library_path = '/LIBPATH:%s'
- linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}"
+ linker.link_options = %Q[%{flags} /OUT:"%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}]
end
conf.archiver do |archiver|
archiver.command = ENV['AR'] || 'lib.exe'
- archiver.archive_options = '/nologo /OUT:%{outfile} %{objs}'
+ archiver.archive_options = '/nologo /OUT:"%{outfile}" %{objs}'
end
conf.yacc do |yacc|
yacc.command = ENV['YACC'] || 'bison.exe'
- yacc.compile_options = '-o %{outfile} %{infile}'
+ yacc.compile_options = %q[-o "%{outfile}" "%{infile}"]
end
conf.gperf do |gperf|
gperf.command = 'gperf.exe'
- gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
+ gperf.compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"]
end
conf.exts do |exts|
diff --git a/test/t/ensure.rb b/test/t/ensure.rb
index bef397059..bdb5bffc4 100644
--- a/test/t/ensure.rb
+++ b/test/t/ensure.rb
@@ -1,16 +1,16 @@
##
# ensure Test
-assert('ensure - context - yield') do
- class EnsureYieldBreak
- attr_reader :ensure_context
- def try
- yield
- ensure
- @ensure_context = self
- end
+class EnsureYieldBreak
+ attr_reader :ensure_context
+ def try
+ yield
+ ensure
+ @ensure_context = self
end
+end
+assert('ensure - context - yield') do
yielder = EnsureYieldBreak.new
yielder.try do
end
@@ -18,15 +18,6 @@ assert('ensure - context - yield') do
end
assert('ensure - context - yield and break') do
- class EnsureYieldBreak
- attr_reader :ensure_context
- def try
- yield
- ensure
- @ensure_context = self
- end
- end
-
yielder = EnsureYieldBreak.new
yielder.try do
break
@@ -35,15 +26,6 @@ assert('ensure - context - yield and break') do
end
assert('ensure - context - yield and return') do
- class EnsureYieldBreak
- attr_reader :ensure_context
- def try
- yield
- ensure
- @ensure_context = self
- end
- end
-
yielder = EnsureYieldBreak.new
lambda do
yielder.try do
diff --git a/test/t/exception.rb b/test/t/exception.rb
index bdf277c1e..c9afeb61a 100644
--- a/test/t/exception.rb
+++ b/test/t/exception.rb
@@ -352,8 +352,10 @@ assert('Exception 19') do
assert_equal [true, true], Class4Exception19.new.a
end
-assert('Exception#inspect without message') do
+assert('Exception#inspect') do
assert_equal "Exception", Exception.new.inspect
+ assert_equal "Exception", Exception.new("").inspect
+ assert_equal "error! (Exception)", Exception.new("error!").inspect
end
assert('Exception#backtrace') do
@@ -398,7 +400,7 @@ assert('GC in rescue') do
end
rescue => exception
GC.start
- assert_equal("#{__FILE__}:#{line}:in call",
+ assert_equal("#{__FILE__}:#{line}",
exception.backtrace.first)
end
end
@@ -416,7 +418,7 @@ assert('Method call in rescue') do
rescue => exception
[3].each do
end
- assert_equal("#{__FILE__}:#{line}:in call",
+ assert_equal("#{__FILE__}:#{line}",
exception.backtrace.first)
end
end
diff --git a/test/t/kernel.rb b/test/t/kernel.rb
index c2eeee1a5..e3b9fe8ab 100644
--- a/test/t/kernel.rb
+++ b/test/t/kernel.rb
@@ -100,6 +100,10 @@ assert('Kernel#__send__', '15.3.1.3.4') do
assert_true __send__(:respond_to?, :nil?)
# test without argument and without block
assert_equal String, __send__(:to_s).class
+
+ args = [:respond_to?, :nil?]
+ assert_true __send__(*args)
+ assert_equal [:respond_to?, :nil?], args
end
assert('Kernel#block_given?', '15.3.1.3.6') do
@@ -197,17 +201,6 @@ assert('Kernel#dup', '15.3.1.3.9') do
a.set(2)
c = a.dup
- immutables = [ 1, :foo, true, false, nil ]
- error_count = 0
- immutables.each do |i|
- begin
- i.dup
- rescue TypeError
- error_count += 1
- end
- end
-
- assert_equal immutables.size, error_count
assert_equal 2, a.get
assert_equal 1, b.get
assert_equal 2, c.get
diff --git a/test/t/string.rb b/test/t/string.rb
index 65ad13103..2bb988810 100644
--- a/test/t/string.rb
+++ b/test/t/string.rb
@@ -687,31 +687,45 @@ assert('String#sub!', '15.2.10.5.37') do
end
assert('String#to_f', '15.2.10.5.38') do
- a = ''.to_f
- b = '123456789'.to_f
- c = '12345.6789'.to_f
- d = '1e-2147483648'.to_f
- e = '1e2147483648'.to_f
-
- assert_float(0.0, a)
- assert_float(123456789.0, b)
- assert_float(12345.6789, c)
- assert_float(0, d)
- assert_float(Float::INFINITY, e)
+ assert_operator(0.0, :eql?, ''.to_f)
+ assert_operator(123456789.0, :eql?, '123456789'.to_f)
+ assert_operator(12345.6789, :eql?, '12345.6789'.to_f)
+ assert_operator(0.0, :eql?, '1e-2147483648'.to_f)
+ assert_operator(Float::INFINITY, :eql?, '1e2147483648'.to_f)
+ assert_operator(0.0, :eql?, 'a'.to_f)
+ assert_operator(4.0, :eql?, '4a5'.to_f)
+ assert_operator(12.0, :eql?, '1_2__3'.to_f)
+ assert_operator(123.0, :eql?, '1_2_3'.to_f)
+ assert_operator(68.0, :eql?, '68_'.to_f)
+ assert_operator(68.0, :eql?, '68._7'.to_f)
+ assert_operator(68.7, :eql?, '68.7_'.to_f)
+ assert_operator(68.7, :eql?, '68.7_ '.to_f)
+ assert_operator(6.0, :eql?, '6 8.7'.to_f)
+ assert_operator(68.0, :eql?, '68. 7'.to_f)
+ assert_operator(0.0, :eql?, '_68'.to_f)
+ assert_operator(0.0, :eql?, ' _68'.to_f)
+ assert_operator(12.34, :eql?, '1_2.3_4'.to_f)
+ assert_operator(12.3, :eql?, '1_2.3__4'.to_f)
+ assert_operator(0.9, :eql?, '.9'.to_f)
+ assert_operator(0.9, :eql?, "\t\r\n\f\v .9 \t\r\n\f\v".to_f)
end if Object.const_defined?(:Float)
assert('String#to_i', '15.2.10.5.39') do
- a = ''.to_i
- b = '32143'.to_i
- c = 'a'.to_i(16)
- d = '100'.to_i(2)
- e = '1_000'.to_i
-
- assert_equal 0, a
- assert_equal 32143, b
- assert_equal 10, c
- assert_equal 4, d
- assert_equal 1_000, e
+ assert_operator 0, :eql?, ''.to_i
+ assert_operator 32143, :eql?, '32143'.to_i
+ assert_operator 10, :eql?, 'a'.to_i(16)
+ assert_operator 4, :eql?, '100'.to_i(2)
+ assert_operator 1_000, :eql?, '1_000'.to_i
+ assert_operator 0, :eql?, 'a'.to_i
+ assert_operator 4, :eql?, '4a5'.to_i
+ assert_operator 12, :eql?, '1_2__3'.to_i
+ assert_operator 123, :eql?, '1_2_3'.to_i
+ assert_operator 68, :eql?, '68_'.to_i
+ assert_operator 68, :eql?, '68_ '.to_i
+ assert_operator 0, :eql?, '_68'.to_i
+ assert_operator 0, :eql?, ' _68'.to_i
+ assert_operator 68, :eql?, "\t\r\n\f\v 68 \t\r\n\f\v".to_i
+ assert_operator 6, :eql?, ' 6 8 '.to_i
end
assert('String#to_s', '15.2.10.5.40') do
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
index 2740789ae..436c06601 100644
--- a/test/t/syntax.rb
+++ b/test/t/syntax.rb
@@ -671,3 +671,13 @@ assert 'keyword arguments' do
assert_equal([1, 1, :c], m(c: :c))
assert_equal([:a, nil, :c], m(a: :a, c: :c))
end
+
+assert('numbered parameters') do
+ assert_equal(15, [1,2,3,4,5].reduce {_1+_2})
+ assert_equal(45, Proc.new do _1 + _2 + _3 + _4 + _5 + _6 + _7 + _8 + _9 end.call(*[1, 2, 3, 4, 5, 6, 7, 8, 9]))
+end
+
+assert('_0 is not numbered parameter') do
+ _0 = :l
+ assert_equal(:l, ->{_0}.call)
+end
diff --git a/test/t/vformat.rb b/test/t/vformat.rb
index 679f30407..df6950ee6 100644
--- a/test/t/vformat.rb
+++ b/test/t/vformat.rb
@@ -1,25 +1,4 @@
-def assert_format(exp, args)
- assert_equal(exp, TestVFormat.format(*args))
-end
-
-def assert_format_pattern(exp_pattern, args)
- assert_match(exp_pattern, TestVFormat.format(*args))
-end
-
-# Pass if ArgumentError is raised or return value is +exp+.
-def assert_implementation_dependent(exp, args)
- begin
- ret = TestVFormat.format(*args)
- rescue ArgumentError
- return pass
- end
- if ret == exp
- pass
- else
- flunk "", "Expected ArgumentError is raised or #{ret.inspect} to be #{exp}."
- end
-end
-
+# coding: utf-8-emacs
def sclass(v)
class << v
self
@@ -27,66 +6,53 @@ def sclass(v)
end
assert('mrb_vformat') do
- n = TestVFormat::Native
- assert_format '', ['']
- assert_format 'No specifier!', ['No specifier!']
- assert_format '`c`: C', ['`c`: %c', n.c(?C)]
- assert_format '`d`: 123', ['`d`: %d', n.d(123)]
- assert_format '`d`: -79', ['`d`: %d', n.d(-79)]
- assert_format '`i`: 514', ['`i`: %i', n.i(514)]
- assert_format '`i`: -83', ['`i`: %i', n.i(-83)]
- assert_format '`t`: NilClass', ['`t`: %t', nil]
- assert_format '`t`: FalseClass', ['`t`: %t', false]
- assert_format '`t`: TrueClass', ['`t`: %t', true]
- assert_format '`t`: Fixnum', ['`t`: %t', 0]
- assert_format '`t`: Hash', ['`t`: %t', k: "value"]
- assert_format_pattern '#<Class:#<Class:#<Hash:0x*>>>', ['%t', sclass({})]
-# assert_format 'string and length', ['string %l length', n.s('andante'), n.l(3)]
- assert_format '`n`: sym', ['`n`: %n', n.n(:sym)]
- assert_format '%C文字列%', ['%s', n.s('%C文字列%')]
- assert_format '`C`: Kernel module', ['`C`: %C module', n.C(Kernel)]
- assert_format '`C`: NilClass', ['`C`: %C', n.C(nil.class)]
- assert_format_pattern '#<Class:#<String:0x*>>', ['%C', n.C(sclass(""))]
- assert_format '`T`: NilClass', ['`T`: %T', nil]
- assert_format '`T`: FalseClass', ['`T`: %T', false]
- assert_format '`T`: TrueClass', ['`T`: %T', true]
- assert_format '`T`: Fixnum', ['`T`: %T', 0]
- assert_format '`T`: Hash', ['`T`: %T', k: "value"]
- assert_format_pattern 'Class', ['%T', sclass({})]
- assert_format '`Y`: nil', ['`Y`: %Y', nil]
- assert_format '`Y`: false', ['`Y`: %Y', false]
- assert_format '`Y`: true', ['`Y`: %Y', true]
- assert_format '`Y`: Fixnum', ['`Y`: %Y', 0]
- assert_format '`Y`: Hash', ['`Y`: %Y', k: "value"]
- assert_format 'Class', ['%Y', sclass({})]
- assert_format_pattern '#<Class:#<String:0x*>>', ['%v', sclass("")]
- assert_format '`v`: 1...3', ['`v`: %v', 1...3]
- assert_format '`S`: {:a=>1, "b"=>"c"}', ['`S`: %S', a: 1, "b" => ?c]
- assert_format 'percent: %', ['percent: %%']
- assert_format '"I": inspect char', ['%!c: inspect char', n.c(?I)]
- assert_format '709: inspect mrb_int', ['%!d: inspect mrb_int', n.i(709)]
-# assert_format '"a\x00b\xff"', ['%!l', n.s("a\000b\xFFc\000d"), n.l(4)]
- assert_format ':"&.": inspect symbol', ['%!n: inspect symbol', n.n(:'&.')]
- assert_format 'inspect "String"', ['inspect %!v', 'String']
- assert_format 'inspect Array: [1, :x, {}]', ['inspect Array: %!v', [1,:x,{}]]
- assert_format_pattern '`!C`: #<Class:0x*>', ['`!C`: %!C', n.C(Class.new)]
- assert_format 'to_s -> to_s: ab,cd', ['to_s -> to_s: %n,%v', n.n(:ab), 'cd']
- assert_format 'to_s -> inspect: x:y', ['to_s -> inspect: %v%!v', 'x', :y]
- assert_format 'inspect -> to_s: "a"b', ['inspect -> to_s: %!v%n', 'a', n.n(:b)]
- assert_format 'Y -> to_s: nile', ['Y -> to_s: %Y%v', nil, "e"]
- assert_format '"abc":Z', ['%!s%!n', n.s('abc'), n.n('Z'.to_sym)]
- assert_format 'escape: \\%a,b,c,d', ['escape: \\\\\%a,b,\c%v', ',d']
-
- assert_implementation_dependent 'unknown specifier: %^',
- ['unknown specifier: %^']
- assert_implementation_dependent 'unknown specifier with modifier: %!^',
- ['unknown specifier with modifier: %!^']
- assert_implementation_dependent 'termination is \\', ['termination is \\']
- assert_implementation_dependent 'termination is %', ['termination is %']
- assert_implementation_dependent 'termination is %!', ['termination is %!']
+ vf = TestVFormat
+ assert_equal '', vf.z('')
+ assert_equal 'No specifier!', vf.z('No specifier!')
+ assert_equal '`c`: C', vf.c('`c`: %c', ?C)
+ assert_equal '`d`: 123', vf.d('`d`: %d', 123)
+ assert_equal '`d`: -79', vf.d('`d`: %d', -79)
+ assert_equal '`i`: 514', vf.i('`i`: %i', 514)
+ assert_equal '`i`: -83', vf.i('`i`: %i', -83)
+ assert_equal '`t`: NilClass', vf.v('`t`: %t', nil)
+ assert_equal '`t`: FalseClass', vf.v('`t`: %t', false)
+ assert_equal '`t`: TrueClass', vf.v('`t`: %t', true)
+ assert_equal '`t`: Fixnum', vf.v('`t`: %t', 0)
+ assert_equal '`t`: Hash', vf.v('`t`: %t', {k: "value"})
+ assert_match '#<Class:#<Class:#<Hash:0x*>>>', vf.v('%t', sclass({}))
+ assert_equal 'string and length', vf.l('string %l length', 'andante', 3)
+ assert_equal '`n`: sym', vf.n('`n`: %n', :sym)
+ assert_equal '%C文字列����%', vf.s('%s', '%C文字列����%')
+ assert_equal '`C`: Kernel module', vf.C('`C`: %C module', Kernel)
+ assert_equal '`C`: NilClass', vf.C('`C`: %C', nil.class)
+ assert_match '#<Class:#<String:0x*>>', vf.C('%C', sclass(""))
+ assert_equal '`T`: NilClass', vf.v('`T`: %T', nil)
+ assert_equal '`T`: FalseClass', vf.v('`T`: %T', false)
+ assert_equal '`T`: TrueClass', vf.v('`T`: %T', true)
+ assert_equal '`T`: Fixnum', vf.v('`T`: %T', 0)
+ assert_equal '`T`: Hash', vf.v('`T`: %T', {k: "value"})
+ assert_match 'Class', vf.v('%T', sclass({}))
+ assert_equal '`Y`: nil', vf.v('`Y`: %Y', nil)
+ assert_equal '`Y`: false', vf.v('`Y`: %Y', false)
+ assert_equal '`Y`: true', vf.v('`Y`: %Y', true)
+ assert_equal '`Y`: Fixnum', vf.v('`Y`: %Y', 0)
+ assert_equal '`Y`: Hash', vf.v('`Y`: %Y', {k: "value"})
+ assert_equal 'Class', vf.v('%Y', sclass({}))
+ assert_match '#<Class:#<String:0x*>>', vf.v('%v', sclass(""))
+ assert_equal '`v`: 1...3', vf.v('`v`: %v', 1...3)
+ assert_equal '`S`: {:a=>1, "b"=>"c"}', vf.v('`S`: %S', {a: 1, "b" => ?c})
+ assert_equal 'percent: %', vf.z('percent: %%')
+ assert_equal '"I": inspect char', vf.c('%!c: inspect char', ?I)
+ assert_equal '709: inspect mrb_int', vf.i('%!d: inspect mrb_int', 709)
+ assert_equal '"a\x00b\xff"', vf.l('%!l', "a\000b\xFFc\000d", 4)
+ assert_equal ':"&.": inspect symbol', vf.n('%!n: inspect symbol', :'&.')
+ assert_equal 'inspect "String"', vf.v('inspect %!v', 'String')
+ assert_equal 'inspect Array: [1, :x, {}]', vf.v('inspect Array: %!v', [1,:x,{}])
+ assert_match '`!C`: #<Class:0x*>', vf.C('`!C`: %!C', Class.new)
+ assert_equal 'escape: \\%a,b,c,d', vf.v('escape: \\\\\%a,b,\c%v', ',d')
skip unless Object.const_defined?(:Float)
- assert_format '`f`: 0.0125', ['`f`: %f', n.f(0.0125)]
- assert_format '-Infinity', ['%f', n.f(-Float::INFINITY)]
- assert_format 'NaN: Not a Number', ['%f: Not a Number', n.f(Float::NAN)]
+ assert_equal '`f`: 0.0125', vf.f('`f`: %f', 0.0125)
+ assert_equal '-Infinity', vf.f('%f', -Float::INFINITY)
+ assert_equal 'NaN: Not a Number', vf.f('%f: Not a Number', Float::NAN)
end
diff --git a/travis_config.rb b/travis_config.rb
index 94cd4aadc..f4bef0a52 100644
--- a/travis_config.rb
+++ b/travis_config.rb
@@ -1,24 +1,11 @@
-MRuby::Build.new('debug') do |conf|
- toolchain :gcc
- enable_debug
-
- # include all core GEMs
- conf.gembox 'full-core'
- conf.cc.flags += %w(-Werror=declaration-after-statement)
- conf.compilers.each do |c|
- c.defines += %w(MRB_GC_STRESS MRB_GC_FIXED_ARENA MRB_METHOD_CACHE)
- end
-
- build_mrbc_exec
-end
-
MRuby::Build.new('full-debug') do |conf|
toolchain :gcc
enable_debug
# include all core GEMs
conf.gembox 'full-core'
- conf.cc.defines += %w(MRB_ENABLE_DEBUG_HOOK)
+ conf.cc.flags += %w(-Werror=declaration-after-statement)
+ conf.cc.defines += %w(MRB_GC_STRESS MRB_METHOD_CACHE MRB_ENABLE_DEBUG_HOOK)
conf.enable_test
end