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