script_core 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/ext/enterprise_script_service/libseccomp/.travis.yml +3 -5
- data/ext/enterprise_script_service/libseccomp/CHANGELOG +10 -0
- data/ext/enterprise_script_service/libseccomp/CREDITS +3 -0
- data/ext/enterprise_script_service/libseccomp/README.md +18 -0
- data/ext/enterprise_script_service/libseccomp/configure.ac +1 -1
- data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +7 -0
- data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +16 -0
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +16 -0
- data/ext/enterprise_script_service/libseccomp/tests/.gitignore +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/15-basic-resolver.c +3 -3
- data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.c +48 -0
- data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.py +38 -0
- data/ext/enterprise_script_service/libseccomp/tests/52-basic-load.tests +11 -0
- data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +6 -3
- data/ext/enterprise_script_service/libseccomp/tests/regression +4 -0
- data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -3
- data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +2 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/build.yml +106 -0
- data/ext/enterprise_script_service/mruby/.github/workflows/main.yml +24 -0
- data/ext/enterprise_script_service/mruby/.gitignore +3 -0
- data/ext/enterprise_script_service/mruby/.travis.yml +6 -9
- data/ext/enterprise_script_service/mruby/AUTHORS +1 -0
- data/ext/enterprise_script_service/mruby/Doxyfile +1 -1
- data/ext/enterprise_script_service/mruby/LICENSE +1 -1
- data/ext/enterprise_script_service/mruby/README.md +6 -2
- data/ext/enterprise_script_service/mruby/appveyor.yml +9 -12
- data/ext/enterprise_script_service/mruby/appveyor_config.rb +9 -0
- data/ext/enterprise_script_service/mruby/build_config.rb +6 -6
- data/ext/enterprise_script_service/mruby/doc/guides/compile.md +6 -2
- data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
- data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +4 -8
- data/ext/enterprise_script_service/mruby/doc/limitations.md +10 -10
- data/ext/enterprise_script_service/mruby/doc/opcode.md +108 -95
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_ArduinoDue.rb +2 -2
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_IntelEdison.rb +2 -2
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_IntelGalileo.rb +2 -2
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_RX630.rb +2 -2
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_chipKITMax32.rb +2 -2
- data/ext/enterprise_script_service/mruby/examples/targets/build_config_dreamcast_shelf.rb +108 -0
- data/ext/enterprise_script_service/mruby/include/mrbconf.h +10 -7
- data/ext/enterprise_script_service/mruby/include/mruby.h +11 -9
- data/ext/enterprise_script_service/mruby/include/mruby/array.h +4 -0
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +11 -2
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +0 -9
- data/ext/enterprise_script_service/mruby/include/mruby/common.h +10 -0
- data/ext/enterprise_script_service/mruby/include/mruby/compile.h +11 -3
- data/ext/enterprise_script_service/mruby/include/mruby/dump.h +1 -17
- data/ext/enterprise_script_service/mruby/include/mruby/irep.h +10 -0
- data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -1
- data/ext/enterprise_script_service/mruby/include/mruby/khash.h +23 -5
- data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +1 -0
- data/ext/enterprise_script_service/mruby/include/mruby/ops.h +3 -2
- data/ext/enterprise_script_service/mruby/include/mruby/string.h +2 -1
- data/ext/enterprise_script_service/mruby/include/mruby/value.h +7 -12
- data/ext/enterprise_script_service/mruby/include/mruby/version.h +4 -4
- data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +2 -30
- data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +21 -46
- data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +9 -0
- data/ext/enterprise_script_service/mruby/lib/mruby/source.rb +3 -1
- data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +7 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +0 -31
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +0 -13
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-config/mrbgem.rake +5 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +5 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +5 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +7 -11
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +6 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c +6 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +6 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +76 -48
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +107 -32
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/y.tab.c +13153 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/mrbgem.rake +13 -15
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +2 -213
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +21 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +1 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/include/mruby/ext/io.h +39 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +2 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file_constants.rb +0 -16
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +7 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +76 -30
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +9 -10
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +323 -120
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +18 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +32 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +57 -49
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +15 -17
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +9 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +3 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +113 -10
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/src/print.c +5 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +9 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/src/mrb_sleep.c +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/test/sockettest.c +3 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +61 -24
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +5 -23
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +1 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +6 -5
- data/ext/enterprise_script_service/mruby/mrblib/hash.rb +3 -3
- data/ext/enterprise_script_service/mruby/src/array.c +11 -0
- data/ext/enterprise_script_service/mruby/src/backtrace.c +2 -2
- data/ext/enterprise_script_service/mruby/src/class.c +26 -11
- data/ext/enterprise_script_service/mruby/src/codedump.c +4 -0
- data/ext/enterprise_script_service/mruby/src/debug.c +8 -5
- data/ext/enterprise_script_service/mruby/src/dump.c +3 -65
- data/ext/enterprise_script_service/mruby/src/error.c +57 -5
- data/ext/enterprise_script_service/mruby/src/etc.c +13 -4
- data/ext/enterprise_script_service/mruby/src/fmt_fp.c +98 -21
- data/ext/enterprise_script_service/mruby/src/gc.c +10 -275
- data/ext/enterprise_script_service/mruby/src/hash.c +5 -6
- data/ext/enterprise_script_service/mruby/src/kernel.c +2 -2
- data/ext/enterprise_script_service/mruby/src/load.c +56 -30
- data/ext/enterprise_script_service/mruby/src/numeric.c +22 -10
- data/ext/enterprise_script_service/mruby/src/object.c +12 -4
- data/ext/enterprise_script_service/mruby/src/print.c +27 -3
- data/ext/enterprise_script_service/mruby/src/proc.c +21 -1
- data/ext/enterprise_script_service/mruby/src/state.c +34 -11
- data/ext/enterprise_script_service/mruby/src/string.c +69 -35
- data/ext/enterprise_script_service/mruby/src/symbol.c +12 -10
- data/ext/enterprise_script_service/mruby/src/vm.c +21 -30
- data/ext/enterprise_script_service/mruby/tasks/gitlab.rake +19 -22
- data/ext/enterprise_script_service/mruby/tasks/mrbgems.rake +1 -1
- data/ext/enterprise_script_service/mruby/tasks/toolchains/android.rake +46 -1
- data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +3 -3
- data/ext/enterprise_script_service/mruby/tasks/toolchains/openwrt.rake +6 -6
- data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +8 -8
- data/ext/enterprise_script_service/mruby/test/assert.rb +5 -4
- data/ext/enterprise_script_service/mruby/test/t/ensure.rb +8 -26
- data/ext/enterprise_script_service/mruby/test/t/exception.rb +2 -2
- data/ext/enterprise_script_service/mruby/test/t/kernel.rb +8 -24
- data/ext/enterprise_script_service/mruby/travis_config.rb +0 -14
- data/ext/enterprise_script_service/msgpack/.github/depends/boost.sh +56 -0
- data/ext/enterprise_script_service/msgpack/.github/workflows/coverage.yml +62 -0
- data/ext/enterprise_script_service/msgpack/.github/workflows/gha.yml +304 -0
- data/ext/enterprise_script_service/msgpack/CHANGELOG.md +11 -0
- data/ext/enterprise_script_service/msgpack/CMakeLists.txt +82 -39
- data/ext/enterprise_script_service/msgpack/Files.cmake +22 -12
- data/ext/enterprise_script_service/msgpack/QUICKSTART-C.md +26 -29
- data/ext/enterprise_script_service/msgpack/README.md +3 -2
- data/ext/enterprise_script_service/msgpack/appveyor.yml +6 -2
- data/ext/enterprise_script_service/msgpack/ci/build_cmake.sh +3 -1
- data/ext/enterprise_script_service/msgpack/cmake/CodeCoverage.cmake +55 -0
- data/ext/enterprise_script_service/msgpack/codecov.yml +36 -0
- data/ext/enterprise_script_service/msgpack/example/CMakeLists.txt +9 -5
- data/ext/enterprise_script_service/msgpack/example/boost/CMakeLists.txt +1 -1
- data/ext/enterprise_script_service/msgpack/example/c/CMakeLists.txt +17 -6
- data/ext/enterprise_script_service/msgpack/example/c/boundary.c +296 -0
- data/ext/enterprise_script_service/msgpack/example/c/jsonconv.c +419 -0
- data/ext/enterprise_script_service/msgpack/example/c/simple_c.c +1 -1
- data/ext/enterprise_script_service/msgpack/example/cpp03/CMakeLists.txt +3 -3
- data/ext/enterprise_script_service/msgpack/example/cpp11/CMakeLists.txt +2 -2
- data/ext/enterprise_script_service/msgpack/example/x3/CMakeLists.txt +2 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/pack.h +24 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +5 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/boost/optional.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp17/vector_byte.hpp +8 -8
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/map.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector_char.hpp +8 -8
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/vector_unsigned_char.hpp +8 -8
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +4 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v3/unpack.hpp +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +4 -4
- data/ext/enterprise_script_service/msgpack/make_file_list.sh +38 -11
- data/ext/enterprise_script_service/msgpack/src/vrefbuffer.c +6 -0
- data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +86 -64
- data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +4 -1
- data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/buffer.cpp +4 -47
- data/ext/enterprise_script_service/msgpack/test/buffer_c.cpp +148 -0
- data/ext/enterprise_script_service/msgpack/test/carray.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/cases.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/convert.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/fixint.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/json.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/limit.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +159 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +32 -27
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +4 -1
- data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/object.cpp +4 -1
- data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +12 -8
- data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +30 -26
- data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/raw.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/reference.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/streaming.cpp +8 -4
- data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/user_class.cpp +16 -12
- data/ext/enterprise_script_service/msgpack/test/version.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/visitor.cpp +4 -0
- data/ext/enterprise_script_service/msgpack/test/zone.cpp +4 -0
- data/lib/script_core/version.rb +1 -1
- data/script_core.gemspec +1 -1
- metadata +23 -9
- data/ext/enterprise_script_service/msgpack/.travis.yml +0 -258
@@ -686,37 +686,6 @@ def bsearch_index(&block)
|
|
686
686
|
satisfied ? low : nil
|
687
687
|
end
|
688
688
|
|
689
|
-
##
|
690
|
-
# call-seq:
|
691
|
-
# ary.delete_if { |item| block } -> ary
|
692
|
-
# ary.delete_if -> Enumerator
|
693
|
-
#
|
694
|
-
# Deletes every element of +self+ for which block evaluates to +true+.
|
695
|
-
#
|
696
|
-
# The array is changed instantly every time the block is called, not after
|
697
|
-
# the iteration is over.
|
698
|
-
#
|
699
|
-
# See also Array#reject!
|
700
|
-
#
|
701
|
-
# If no block is given, an Enumerator is returned instead.
|
702
|
-
#
|
703
|
-
# scores = [ 97, 42, 75 ]
|
704
|
-
# scores.delete_if {|score| score < 80 } #=> [97]
|
705
|
-
|
706
|
-
def delete_if(&block)
|
707
|
-
return to_enum :delete_if unless block
|
708
|
-
|
709
|
-
idx = 0
|
710
|
-
while idx < self.size do
|
711
|
-
if block.call(self[idx])
|
712
|
-
self.delete_at(idx)
|
713
|
-
else
|
714
|
-
idx += 1
|
715
|
-
end
|
716
|
-
end
|
717
|
-
self
|
718
|
-
end
|
719
|
-
|
720
689
|
##
|
721
690
|
# call-seq:
|
722
691
|
# ary.keep_if { |item| block } -> ary
|
@@ -299,19 +299,6 @@ def between(lo, x, hi)
|
|
299
299
|
#assert("Array#bsearch_index") do
|
300
300
|
#end
|
301
301
|
|
302
|
-
assert("Array#delete_if") do
|
303
|
-
a = [1, 2, 3, 4, 5]
|
304
|
-
assert_equal [1, 2, 3, 4, 5], a.delete_if { false }
|
305
|
-
assert_equal [1, 2, 3, 4, 5], a
|
306
|
-
|
307
|
-
a = [1, 2, 3, 4, 5]
|
308
|
-
assert_equal [], a.delete_if { true }
|
309
|
-
assert_equal [], a
|
310
|
-
|
311
|
-
a = [ 1, 2, 3, 4, 5 ]
|
312
|
-
assert_equal [1, 2, 3], a.delete_if { |val| val > 3 }
|
313
|
-
end
|
314
|
-
|
315
302
|
assert("Array#keep_if") do
|
316
303
|
a = [1, 2, 3, 4, 5]
|
317
304
|
assert_equal [1, 2, 3, 4, 5], a.keep_if { true }
|
@@ -5,13 +5,16 @@
|
|
5
5
|
spec.author = 'mruby developers'
|
6
6
|
spec.summary = "#{name} command"
|
7
7
|
|
8
|
+
mruby_config_dir = "#{build.build_dir}/bin"
|
8
9
|
mruby_config = name + (ENV['OS'] == 'Windows_NT' ? '.bat' : '')
|
9
|
-
mruby_config_path = "#{
|
10
|
+
mruby_config_path = "#{mruby_config_dir}/#{mruby_config}"
|
10
11
|
make_cfg = "#{build.build_dir}/lib/libmruby.flags.mak"
|
11
12
|
tmplt_path = "#{__dir__}/#{mruby_config}"
|
12
13
|
build.bins << mruby_config
|
13
14
|
|
14
|
-
|
15
|
+
directory mruby_config_dir
|
16
|
+
|
17
|
+
file mruby_config_path => [mruby_config_dir, make_cfg, tmplt_path] do |t|
|
15
18
|
config = Hash[File.readlines(make_cfg).map!(&:chomp).map! {|l|
|
16
19
|
l.gsub('\\"', '"').split(' = ', 2).map! {|s| s.sub(/^(?=.)/, 'echo ')}
|
17
20
|
}]
|
@@ -7,7 +7,11 @@
|
|
7
7
|
#define MRDBCONF_H
|
8
8
|
|
9
9
|
#ifndef MRB_ENABLE_DEBUG_HOOK
|
10
|
-
# error
|
10
|
+
# error mruby-bin-debugger need 'MRB_ENABLE_DEBUG_HOOK' configuration in your 'build_config.rb'
|
11
|
+
#endif
|
12
|
+
|
13
|
+
#ifdef MRB_DISABLE_STDIO
|
14
|
+
# error mruby-bin-debugger conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
|
11
15
|
#endif
|
12
16
|
|
13
17
|
/* configuration options: */
|
@@ -7,6 +7,11 @@
|
|
7
7
|
*/
|
8
8
|
|
9
9
|
#include <mruby.h>
|
10
|
+
|
11
|
+
#ifdef MRB_DISABLE_STDIO
|
12
|
+
# error mruby-bin-mirb conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
|
13
|
+
#endif
|
14
|
+
|
10
15
|
#include <mruby/array.h>
|
11
16
|
#include <mruby/proc.h>
|
12
17
|
#include <mruby/compile.h>
|
@@ -17,7 +22,6 @@
|
|
17
22
|
|
18
23
|
#include <stdlib.h>
|
19
24
|
#include <string.h>
|
20
|
-
#include <stdio.h>
|
21
25
|
#include <ctype.h>
|
22
26
|
|
23
27
|
#include <signal.h>
|
@@ -1,7 +1,11 @@
|
|
1
|
-
#include <
|
1
|
+
#include <mruby.h>
|
2
|
+
|
3
|
+
#ifdef MRB_DISABLE_STDIO
|
4
|
+
# error mruby-bin-mrbc conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
|
5
|
+
#endif
|
6
|
+
|
2
7
|
#include <stdlib.h>
|
3
8
|
#include <string.h>
|
4
|
-
#include <mruby.h>
|
5
9
|
#include <mruby/compile.h>
|
6
10
|
#include <mruby/dump.h>
|
7
11
|
#include <mruby/proc.h>
|
@@ -32,8 +36,6 @@ usage(const char *name)
|
|
32
36
|
"-v print version number, then turn on verbose mode",
|
33
37
|
"-g produce debugging information",
|
34
38
|
"-B<symbol> binary <symbol> output in C language format",
|
35
|
-
"-e generate little endian iseq data",
|
36
|
-
"-E generate big endian iseq data",
|
37
39
|
"--remove-lv remove local variables",
|
38
40
|
"--verbose run at verbose mode",
|
39
41
|
"--version print the version",
|
@@ -120,10 +122,8 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
|
|
120
122
|
args->flags |= DUMP_DEBUG_INFO;
|
121
123
|
break;
|
122
124
|
case 'E':
|
123
|
-
args->flags = DUMP_ENDIAN_BIG | (args->flags & ~DUMP_ENDIAN_MASK);
|
124
|
-
break;
|
125
125
|
case 'e':
|
126
|
-
|
126
|
+
fprintf(stderr, "%s: -e/-E option no longer needed.\n", args->prog);
|
127
127
|
break;
|
128
128
|
case 'h':
|
129
129
|
return -1;
|
@@ -156,10 +156,6 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args)
|
|
156
156
|
break;
|
157
157
|
}
|
158
158
|
}
|
159
|
-
if (args->verbose && args->initname && (args->flags & DUMP_ENDIAN_MASK) == 0) {
|
160
|
-
fprintf(stderr, "%s: generating %s endian C file. specify -e/-E for cross compiling.\n",
|
161
|
-
args->prog, bigendian_p() ? "big" : "little");
|
162
|
-
}
|
163
159
|
return i;
|
164
160
|
}
|
165
161
|
|
@@ -4,7 +4,6 @@
|
|
4
4
|
spec.summary = 'mruby command'
|
5
5
|
spec.bins = %w(mruby)
|
6
6
|
spec.add_dependency('mruby-compiler', :core => 'mruby-compiler')
|
7
|
-
spec.add_dependency('mruby-error', :core => 'mruby-error')
|
8
7
|
spec.add_test_dependency('mruby-print', :core => 'mruby-print')
|
9
8
|
|
10
9
|
if build.cxx_exception_enabled?
|
@@ -1,7 +1,11 @@
|
|
1
|
-
#include <
|
1
|
+
#include <mruby.h>
|
2
|
+
|
3
|
+
#ifdef MRB_DISABLE_STDIO
|
4
|
+
# error mruby-bin-mruby conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
|
5
|
+
#endif
|
6
|
+
|
2
7
|
#include <stdlib.h>
|
3
8
|
#include <string.h>
|
4
|
-
#include <mruby.h>
|
5
9
|
#include <mruby/array.h>
|
6
10
|
#include <mruby/compile.h>
|
7
11
|
#include <mruby/dump.h>
|
data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-strip/tools/mruby-strip/mruby-strip.c
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
#include <
|
1
|
+
#include <mruby.h>
|
2
|
+
|
3
|
+
#ifdef MRB_DISABLE_STDIO
|
4
|
+
# error mruby-bin-strip conflicts 'MRB_DISABLE_STDIO' configuration in your 'build_config.rb'
|
5
|
+
#endif
|
6
|
+
|
2
7
|
#include <stdlib.h>
|
3
8
|
#include <string.h>
|
4
|
-
#include <mruby.h>
|
5
9
|
#include <mruby/irep.h>
|
6
10
|
#include <mruby/dump.h>
|
7
11
|
|
@@ -43,10 +43,15 @@ mrb_mod_module_exec(mrb_state *mrb, mrb_value self)
|
|
43
43
|
const mrb_value *argv;
|
44
44
|
mrb_int argc;
|
45
45
|
mrb_value blk;
|
46
|
+
struct RClass *c;
|
46
47
|
|
47
48
|
mrb_get_args(mrb, "*&!", &argv, &argc, &blk);
|
48
49
|
|
49
|
-
|
50
|
+
c = mrb_class_ptr(self);
|
51
|
+
if (mrb->c->ci->acc < 0) {
|
52
|
+
return mrb_yield_with_class(mrb, blk, argc, argv, self, c);
|
53
|
+
}
|
54
|
+
mrb->c->ci->target_class = c;
|
50
55
|
return mrb_yield_cont(mrb, blk, self, argc, argv);
|
51
56
|
}
|
52
57
|
|
@@ -281,15 +281,6 @@ no_optimize(codegen_scope *s)
|
|
281
281
|
return FALSE;
|
282
282
|
}
|
283
283
|
|
284
|
-
static
|
285
|
-
mrb_bool
|
286
|
-
on_eval(codegen_scope *s)
|
287
|
-
{
|
288
|
-
if (s && s->parser && s->parser->on_eval)
|
289
|
-
return TRUE;
|
290
|
-
return FALSE;
|
291
|
-
}
|
292
|
-
|
293
284
|
struct mrb_insn_data
|
294
285
|
mrb_decode_insn(const mrb_code *pc)
|
295
286
|
{
|
@@ -407,9 +398,6 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep)
|
|
407
398
|
if (no_peephole(s)) {
|
408
399
|
normal:
|
409
400
|
genop_2(s, OP_MOVE, dst, src);
|
410
|
-
if (on_eval(s)) {
|
411
|
-
genop_0(s, OP_NOP);
|
412
|
-
}
|
413
401
|
return;
|
414
402
|
}
|
415
403
|
else {
|
@@ -674,6 +662,43 @@ lv_idx(codegen_scope *s, mrb_sym id)
|
|
674
662
|
return 0;
|
675
663
|
}
|
676
664
|
|
665
|
+
static int
|
666
|
+
search_upvar(codegen_scope *s, mrb_sym id, int *idx)
|
667
|
+
{
|
668
|
+
struct RProc *u;
|
669
|
+
int lv = 0;
|
670
|
+
codegen_scope *up = s->prev;
|
671
|
+
|
672
|
+
while (up) {
|
673
|
+
*idx = lv_idx(up, id);
|
674
|
+
if (*idx > 0) {
|
675
|
+
return lv;
|
676
|
+
}
|
677
|
+
lv ++;
|
678
|
+
up = up->prev;
|
679
|
+
}
|
680
|
+
|
681
|
+
if (lv < 1) lv = 1;
|
682
|
+
u = s->parser->upper;
|
683
|
+
while (u && !MRB_PROC_CFUNC_P(u)) {
|
684
|
+
struct mrb_irep *ir = u->body.irep;
|
685
|
+
uint_fast16_t n = ir->nlocals;
|
686
|
+
const struct mrb_locals *v = ir->lv;
|
687
|
+
for (; n > 1; n --, v ++) {
|
688
|
+
if (v->name == id) {
|
689
|
+
*idx = v->r;
|
690
|
+
return lv - 1;
|
691
|
+
}
|
692
|
+
}
|
693
|
+
if (MRB_PROC_SCOPE_P(u)) break;
|
694
|
+
u = u->upper;
|
695
|
+
lv ++;
|
696
|
+
}
|
697
|
+
|
698
|
+
codegen_error(s, "Can't found local variables");
|
699
|
+
return -1; /* not reached */
|
700
|
+
}
|
701
|
+
|
677
702
|
static void
|
678
703
|
for_body(codegen_scope *s, node *tree)
|
679
704
|
{
|
@@ -786,12 +811,19 @@ lambda_body(codegen_scope *s, node *tree, int blk)
|
|
786
811
|
i = 0;
|
787
812
|
while (opt) {
|
788
813
|
int idx;
|
814
|
+
mrb_sym id = nsym(opt->car->car);
|
789
815
|
|
790
816
|
dispatch(s, pos+i*3+1);
|
791
817
|
codegen(s, opt->car->cdr, VAL);
|
792
818
|
pop();
|
793
|
-
idx = lv_idx(s,
|
794
|
-
|
819
|
+
idx = lv_idx(s, id);
|
820
|
+
if (idx > 0) {
|
821
|
+
gen_move(s, idx, cursp(), 0);
|
822
|
+
}
|
823
|
+
else {
|
824
|
+
int lv = search_upvar(s, id, &idx);
|
825
|
+
genop_3(s, OP_GETUPVAR, cursp(), idx, lv);
|
826
|
+
}
|
795
827
|
i++;
|
796
828
|
opt = opt->cdr;
|
797
829
|
}
|
@@ -818,11 +850,19 @@ lambda_body(codegen_scope *s, node *tree, int blk)
|
|
818
850
|
mrb_assert(nint(kwd->car) == NODE_KW_ARG);
|
819
851
|
|
820
852
|
if (def_arg) {
|
853
|
+
int idx;
|
821
854
|
genop_2(s, OP_KEY_P, lv_idx(s, kwd_sym), new_sym(s, kwd_sym));
|
822
855
|
jmpif_key_p = genjmp2(s, OP_JMPIF, lv_idx(s, kwd_sym), 0, 0);
|
823
856
|
codegen(s, def_arg, VAL);
|
824
857
|
pop();
|
825
|
-
|
858
|
+
idx = lv_idx(s, kwd_sym);
|
859
|
+
if (idx > 0) {
|
860
|
+
gen_move(s, idx, cursp(), 0);
|
861
|
+
}
|
862
|
+
else {
|
863
|
+
int lv = search_upvar(s, kwd_sym, &idx);
|
864
|
+
genop_3(s, OP_GETUPVAR, cursp(), idx, lv);
|
865
|
+
}
|
826
866
|
jmp_def_set = genjmp(s, OP_JMP, 0);
|
827
867
|
dispatch(s, jmpif_key_p);
|
828
868
|
}
|
@@ -1103,23 +1143,12 @@ gen_assignment(codegen_scope *s, node *tree, int sp, int val)
|
|
1103
1143
|
if (idx > 0) {
|
1104
1144
|
if (idx != sp) {
|
1105
1145
|
gen_move(s, idx, sp, val);
|
1106
|
-
if (val && on_eval(s)) genop_0(s, OP_NOP);
|
1107
1146
|
}
|
1108
1147
|
break;
|
1109
1148
|
}
|
1110
1149
|
else { /* upvar */
|
1111
|
-
int lv =
|
1112
|
-
|
1113
|
-
|
1114
|
-
while (up) {
|
1115
|
-
idx = lv_idx(up, nsym(tree));
|
1116
|
-
if (idx > 0) {
|
1117
|
-
genop_3(s, OP_SETUPVAR, sp, idx, lv);
|
1118
|
-
break;
|
1119
|
-
}
|
1120
|
-
lv++;
|
1121
|
-
up = up->prev;
|
1122
|
-
}
|
1150
|
+
int lv = search_upvar(s, nsym(tree), &idx);
|
1151
|
+
genop_3(s, OP_SETUPVAR, sp, idx, lv);
|
1123
1152
|
}
|
1124
1153
|
break;
|
1125
1154
|
case NODE_NVAR:
|
@@ -1860,7 +1889,7 @@ codegen(codegen_scope *s, node *tree, int val)
|
|
1860
1889
|
len++;
|
1861
1890
|
}
|
1862
1891
|
tree = tree->cdr;
|
1863
|
-
if (val &&
|
1892
|
+
if (val && cursp() > 127) {
|
1864
1893
|
pop_n(len*2);
|
1865
1894
|
if (!update) {
|
1866
1895
|
genop_2(s, OP_HASH, cursp(), len);
|
@@ -2324,21 +2353,10 @@ codegen(codegen_scope *s, node *tree, int val)
|
|
2324
2353
|
|
2325
2354
|
if (idx > 0) {
|
2326
2355
|
gen_move(s, cursp(), idx, val);
|
2327
|
-
if (val && on_eval(s)) genop_0(s, OP_NOP);
|
2328
2356
|
}
|
2329
2357
|
else {
|
2330
|
-
int lv =
|
2331
|
-
|
2332
|
-
|
2333
|
-
while (up) {
|
2334
|
-
idx = lv_idx(up, nsym(tree));
|
2335
|
-
if (idx > 0) {
|
2336
|
-
genop_3(s, OP_GETUPVAR, cursp(), idx, lv);
|
2337
|
-
break;
|
2338
|
-
}
|
2339
|
-
lv++;
|
2340
|
-
up = up->prev;
|
2341
|
-
}
|
2358
|
+
int lv = search_upvar(s, nsym(tree), &idx);
|
2359
|
+
genop_3(s, OP_GETUPVAR, cursp(), idx, lv);
|
2342
2360
|
}
|
2343
2361
|
push();
|
2344
2362
|
}
|
@@ -2349,7 +2367,6 @@ codegen(codegen_scope *s, node *tree, int val)
|
|
2349
2367
|
int idx = nint(tree);
|
2350
2368
|
|
2351
2369
|
gen_move(s, cursp(), idx, val);
|
2352
|
-
if (val && on_eval(s)) genop_0(s, OP_NOP);
|
2353
2370
|
|
2354
2371
|
push();
|
2355
2372
|
}
|
@@ -2440,12 +2457,20 @@ codegen(codegen_scope *s, node *tree, int val)
|
|
2440
2457
|
else
|
2441
2458
|
#endif
|
2442
2459
|
{
|
2443
|
-
if (i
|
2444
|
-
|
2460
|
+
if (i < 0) {
|
2461
|
+
if (i == -1) genop_1(s, OP_LOADI__1, cursp());
|
2462
|
+
else if (i >= -0xff) genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i);
|
2463
|
+
else if (i >= -0x8000) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
|
2464
|
+
else goto lit_int;
|
2465
|
+
}
|
2445
2466
|
else if (i < 8) genop_1(s, OP_LOADI_0 + (uint8_t)i, cursp());
|
2446
|
-
else if (i <=
|
2467
|
+
else if (i <= 0xff) genop_2(s, OP_LOADI, cursp(), (uint16_t)i);
|
2468
|
+
else if (i <= 0x7fff) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
|
2447
2469
|
else {
|
2448
|
-
int off
|
2470
|
+
int off;
|
2471
|
+
|
2472
|
+
lit_int:
|
2473
|
+
off = new_lit(s, mrb_fixnum_value(i));
|
2449
2474
|
genop_2(s, OP_LOADL, cursp(), off);
|
2450
2475
|
}
|
2451
2476
|
}
|
@@ -2501,9 +2526,12 @@ codegen(codegen_scope *s, node *tree, int val)
|
|
2501
2526
|
else {
|
2502
2527
|
#endif
|
2503
2528
|
if (i == -1) genop_1(s, OP_LOADI__1, cursp());
|
2504
|
-
else if (i >= -
|
2529
|
+
else if (i >= -0xff) {
|
2505
2530
|
genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i);
|
2506
2531
|
}
|
2532
|
+
else if (i >= -0x8000) {
|
2533
|
+
genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i);
|
2534
|
+
}
|
2507
2535
|
else {
|
2508
2536
|
int off = new_lit(s, mrb_fixnum_value(i));
|
2509
2537
|
genop_2(s, OP_LOADL, cursp(), off);
|
@@ -9,7 +9,6 @@
|
|
9
9
|
#ifdef PARSER_DEBUG
|
10
10
|
# define YYDEBUG 1
|
11
11
|
#endif
|
12
|
-
#define YYERROR_VERBOSE 1
|
13
12
|
#define YYSTACK_USE_ALLOCA 1
|
14
13
|
|
15
14
|
#include <ctype.h>
|
@@ -266,6 +265,7 @@ local_unnest(parser_state *p)
|
|
266
265
|
static mrb_bool
|
267
266
|
local_var_p(parser_state *p, mrb_sym sym)
|
268
267
|
{
|
268
|
+
struct RProc *u;
|
269
269
|
node *l = p->locals;
|
270
270
|
|
271
271
|
while (l) {
|
@@ -276,6 +276,18 @@ local_var_p(parser_state *p, mrb_sym sym)
|
|
276
276
|
}
|
277
277
|
l = l->cdr;
|
278
278
|
}
|
279
|
+
|
280
|
+
u = p->upper;
|
281
|
+
while (u && !MRB_PROC_CFUNC_P(u)) {
|
282
|
+
struct mrb_irep *ir = u->body.irep;
|
283
|
+
uint_fast16_t n = ir->nlocals;
|
284
|
+
const struct mrb_locals *v = ir->lv;
|
285
|
+
for (; n > 1; n --, v ++) {
|
286
|
+
if (v->name == sym) return TRUE;
|
287
|
+
}
|
288
|
+
if (MRB_PROC_SCOPE_P(u)) break;
|
289
|
+
u = u->upper;
|
290
|
+
}
|
279
291
|
return FALSE;
|
280
292
|
}
|
281
293
|
|
@@ -827,6 +839,13 @@ new_kw_arg(parser_state *p, mrb_sym kw, node *def_arg)
|
|
827
839
|
return list3((node*)NODE_KW_ARG, nsym(kw), def_arg);
|
828
840
|
}
|
829
841
|
|
842
|
+
/* (:kw_rest_args . a) */
|
843
|
+
static node*
|
844
|
+
new_kw_rest_args(parser_state *p, node *a)
|
845
|
+
{
|
846
|
+
return cons((node*)NODE_KW_REST_ARGS, a);
|
847
|
+
}
|
848
|
+
|
830
849
|
/* (:block_arg . a) */
|
831
850
|
static node*
|
832
851
|
new_block_arg(parser_state *p, node *a)
|
@@ -845,7 +864,8 @@ setup_numparams(parser_state *p, node *a)
|
|
845
864
|
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))) {
|
846
865
|
yyerror(p, "ordinary parameter is defined");
|
847
866
|
}
|
848
|
-
else {
|
867
|
+
else if (p->locals) {
|
868
|
+
/* p->locals should not be NULL unless error happens before the point */
|
849
869
|
node* args = 0;
|
850
870
|
for (i = nvars; i > 0; i--) {
|
851
871
|
char buf[3];
|
@@ -1322,7 +1342,8 @@ heredoc_end(parser_state *p)
|
|
1322
1342
|
|
1323
1343
|
%}
|
1324
1344
|
|
1325
|
-
%
|
1345
|
+
%define parse.error verbose
|
1346
|
+
%define api.pure
|
1326
1347
|
%parse-param {parser_state *p}
|
1327
1348
|
%lex-param {parser_state *p}
|
1328
1349
|
|
@@ -2264,6 +2285,30 @@ paren_args : '(' opt_call_args ')'
|
|
2264
2285
|
{
|
2265
2286
|
$$ = $2;
|
2266
2287
|
}
|
2288
|
+
| '(' tDOT3 rparen
|
2289
|
+
{
|
2290
|
+
#if 1
|
2291
|
+
mrb_sym r = mrb_intern_lit(p->mrb, "*");
|
2292
|
+
mrb_sym b = mrb_intern_lit(p->mrb, "&");
|
2293
|
+
if (local_var_p(p, r) && local_var_p(p, b)) {
|
2294
|
+
$$ = cons(list1(new_splat(p, new_lvar(p, r))),
|
2295
|
+
new_block_arg(p, new_lvar(p, b)));
|
2296
|
+
}
|
2297
|
+
#else
|
2298
|
+
mrb_sym r = mrb_intern_lit(p->mrb, "*");
|
2299
|
+
mrb_sym k = mrb_intern_lit(p->mrb, "**");
|
2300
|
+
mrb_sym b = mrb_intern_lit(p->mrb, "&");
|
2301
|
+
if (local_var_p(p, r) && local_var_p(p, k) && local_var_p(p, b)) {
|
2302
|
+
$$ = cons(list2(new_splat(p, new_lvar(p, r)),
|
2303
|
+
new_kw_hash(p, list1(cons(new_kw_rest_args(p, 0), new_lvar(p, k))))),
|
2304
|
+
new_block_arg(p, new_lvar(p, b)));
|
2305
|
+
}
|
2306
|
+
#endif
|
2307
|
+
else {
|
2308
|
+
yyerror(p, "unexpected argument forwarding ...");
|
2309
|
+
$$ = 0;
|
2310
|
+
}
|
2311
|
+
}
|
2267
2312
|
;
|
2268
2313
|
|
2269
2314
|
opt_paren_args : none
|
@@ -3360,6 +3405,24 @@ f_arglist : '(' f_args rparen
|
|
3360
3405
|
p->lstate = EXPR_BEG;
|
3361
3406
|
p->cmd_start = TRUE;
|
3362
3407
|
}
|
3408
|
+
| '(' tDOT3 rparen
|
3409
|
+
{
|
3410
|
+
#if 1
|
3411
|
+
/* til real keyword args implemented */
|
3412
|
+
mrb_sym r = mrb_intern_lit(p->mrb, "*");
|
3413
|
+
mrb_sym b = mrb_intern_lit(p->mrb, "&");
|
3414
|
+
local_add_f(p, r);
|
3415
|
+
$$ = new_args(p, 0, 0, r, 0,
|
3416
|
+
new_args_tail(p, 0, 0, b));
|
3417
|
+
#else
|
3418
|
+
mrb_sym r = mrb_intern_lit(p->mrb, "*");
|
3419
|
+
mrb_sym k = mrb_intern_lit(p->mrb, "**");
|
3420
|
+
mrb_sym b = mrb_intern_lit(p->mrb, "&");
|
3421
|
+
local_add_f(p, r); local_add_f(p, k);
|
3422
|
+
$$ = new_args(p, 0, 0, r, 0,
|
3423
|
+
new_args_tail(p, 0, new_kw_rest_args(p, nsym(k)), b));
|
3424
|
+
#endif
|
3425
|
+
}
|
3363
3426
|
| f_args term
|
3364
3427
|
{
|
3365
3428
|
$$ = $1;
|
@@ -3423,11 +3486,11 @@ kwrest_mark : tPOW
|
|
3423
3486
|
|
3424
3487
|
f_kwrest : kwrest_mark tIDENTIFIER
|
3425
3488
|
{
|
3426
|
-
$$ =
|
3489
|
+
$$ = new_kw_rest_args(p, nsym($2));
|
3427
3490
|
}
|
3428
3491
|
| kwrest_mark
|
3429
3492
|
{
|
3430
|
-
$$ =
|
3493
|
+
$$ = new_kw_rest_args(p, 0);
|
3431
3494
|
}
|
3432
3495
|
;
|
3433
3496
|
|
@@ -3742,7 +3805,7 @@ assoc : arg tASSOC arg
|
|
3742
3805
|
| tDSTAR arg
|
3743
3806
|
{
|
3744
3807
|
void_expr_error(p, $2);
|
3745
|
-
$$ = cons(
|
3808
|
+
$$ = cons(new_kw_rest_args(p, 0), $2);
|
3746
3809
|
}
|
3747
3810
|
;
|
3748
3811
|
|
@@ -3806,7 +3869,7 @@ term : ';' {yyerrok;}
|
|
3806
3869
|
|
3807
3870
|
nl : '\n'
|
3808
3871
|
{
|
3809
|
-
p->lineno
|
3872
|
+
p->lineno += $<num>1;
|
3810
3873
|
p->column = 0;
|
3811
3874
|
}
|
3812
3875
|
;
|
@@ -3965,6 +4028,27 @@ static void pushback(parser_state *p, int c);
|
|
3965
4028
|
static mrb_bool peeks(parser_state *p, const char *s);
|
3966
4029
|
static mrb_bool skips(parser_state *p, const char *s);
|
3967
4030
|
|
4031
|
+
static inline int
|
4032
|
+
nextc0(parser_state *p)
|
4033
|
+
{
|
4034
|
+
int c;
|
4035
|
+
#ifndef MRB_DISABLE_STDIO
|
4036
|
+
if (p->f) {
|
4037
|
+
if (feof(p->f)) return -1;
|
4038
|
+
c = fgetc(p->f);
|
4039
|
+
if (c == EOF) return -1;
|
4040
|
+
}
|
4041
|
+
else
|
4042
|
+
#endif
|
4043
|
+
if (!p->s || p->s >= p->send) {
|
4044
|
+
return -1;
|
4045
|
+
}
|
4046
|
+
else {
|
4047
|
+
c = (unsigned char)*p->s++;
|
4048
|
+
}
|
4049
|
+
return c;
|
4050
|
+
}
|
4051
|
+
|
3968
4052
|
static inline int
|
3969
4053
|
nextc(parser_state *p)
|
3970
4054
|
{
|
@@ -3979,30 +4063,18 @@ nextc(parser_state *p)
|
|
3979
4063
|
cons_free(tmp);
|
3980
4064
|
}
|
3981
4065
|
else {
|
3982
|
-
|
3983
|
-
if (
|
3984
|
-
if (feof(p->f)) goto eof;
|
3985
|
-
c = fgetc(p->f);
|
3986
|
-
if (c == EOF) goto eof;
|
3987
|
-
}
|
3988
|
-
else
|
3989
|
-
#endif
|
3990
|
-
if (!p->s || p->s >= p->send) {
|
3991
|
-
goto eof;
|
3992
|
-
}
|
3993
|
-
else {
|
3994
|
-
c = (unsigned char)*p->s++;
|
3995
|
-
}
|
4066
|
+
c = nextc0(p);
|
4067
|
+
if (c < 0) goto eof;
|
3996
4068
|
}
|
3997
4069
|
if (c >= 0) {
|
3998
4070
|
p->column++;
|
3999
4071
|
}
|
4000
4072
|
if (c == '\r') {
|
4001
|
-
const int lf =
|
4073
|
+
const int lf = nextc0(p);
|
4002
4074
|
if (lf == '\n') {
|
4003
4075
|
return '\n';
|
4004
4076
|
}
|
4005
|
-
pushback(p, lf);
|
4077
|
+
if (lf > 0) pushback(p, lf);
|
4006
4078
|
}
|
4007
4079
|
return c;
|
4008
4080
|
|
@@ -4785,6 +4857,7 @@ static int
|
|
4785
4857
|
parser_yylex(parser_state *p)
|
4786
4858
|
{
|
4787
4859
|
int32_t c;
|
4860
|
+
int nlines = 1;
|
4788
4861
|
int space_seen = 0;
|
4789
4862
|
int cmd_state;
|
4790
4863
|
enum mrb_lex_state_enum last_state;
|
@@ -4842,6 +4915,7 @@ parser_yylex(parser_state *p)
|
|
4842
4915
|
break;
|
4843
4916
|
}
|
4844
4917
|
if (p->parsing_heredoc != NULL) {
|
4918
|
+
pylval.num = nlines;
|
4845
4919
|
return '\n';
|
4846
4920
|
}
|
4847
4921
|
while ((c = nextc(p))) {
|
@@ -4851,13 +4925,13 @@ parser_yylex(parser_state *p)
|
|
4851
4925
|
space_seen = 1;
|
4852
4926
|
break;
|
4853
4927
|
case '#': /* comment as a whitespace */
|
4854
|
-
|
4855
|
-
|
4856
|
-
|
4928
|
+
skip(p, '\n');
|
4929
|
+
nlines++;
|
4930
|
+
break;
|
4857
4931
|
case '.':
|
4858
4932
|
if (!peek(p, '.')) {
|
4859
4933
|
pushback(p, '.');
|
4860
|
-
p->lineno
|
4934
|
+
p->lineno+=nlines; nlines=1;
|
4861
4935
|
goto retry;
|
4862
4936
|
}
|
4863
4937
|
pushback(p, c);
|
@@ -4865,7 +4939,7 @@ parser_yylex(parser_state *p)
|
|
4865
4939
|
case '&':
|
4866
4940
|
if (peek(p, '.')) {
|
4867
4941
|
pushback(p, '&');
|
4868
|
-
p->lineno
|
4942
|
+
p->lineno+=nlines; nlines=1;
|
4869
4943
|
goto retry;
|
4870
4944
|
}
|
4871
4945
|
pushback(p, c);
|
@@ -4881,6 +4955,7 @@ parser_yylex(parser_state *p)
|
|
4881
4955
|
normal_newline:
|
4882
4956
|
p->cmd_start = TRUE;
|
4883
4957
|
p->lstate = EXPR_BEG;
|
4958
|
+
pylval.num = nlines;
|
4884
4959
|
return '\n';
|
4885
4960
|
|
4886
4961
|
case '*':
|
@@ -4963,7 +5038,7 @@ parser_yylex(parser_state *p)
|
|
4963
5038
|
c = nextc(p);
|
4964
5039
|
} while (!(c < 0 || ISSPACE(c)));
|
4965
5040
|
if (c != '\n') skip(p, '\n');
|
4966
|
-
p->lineno
|
5041
|
+
p->lineno+=nlines; nlines=1;
|
4967
5042
|
p->column = 0;
|
4968
5043
|
goto retry;
|
4969
5044
|
}
|
@@ -5685,7 +5760,7 @@ parser_yylex(parser_state *p)
|
|
5685
5760
|
case '\\':
|
5686
5761
|
c = nextc(p);
|
5687
5762
|
if (c == '\n') {
|
5688
|
-
p->lineno
|
5763
|
+
p->lineno+=nlines; nlines=1;
|
5689
5764
|
p->column = 0;
|
5690
5765
|
space_seen = 1;
|
5691
5766
|
goto retry; /* skip \\n */
|
@@ -6130,7 +6205,7 @@ parser_init_cxt(parser_state *p, mrbc_context *cxt)
|
|
6130
6205
|
}
|
6131
6206
|
p->capture_errors = cxt->capture_errors;
|
6132
6207
|
p->no_optimize = cxt->no_optimize;
|
6133
|
-
p->
|
6208
|
+
p->upper = cxt->upper;
|
6134
6209
|
if (cxt->partial_hook) {
|
6135
6210
|
p->cxt = cxt;
|
6136
6211
|
}
|
@@ -6549,7 +6624,7 @@ dump_args(mrb_state *mrb, node *n, int offset)
|
|
6549
6624
|
static const char*
|
6550
6625
|
str_dump(mrb_state *mrb, const char *str, int len)
|
6551
6626
|
{
|
6552
|
-
|
6627
|
+
int ai = mrb_gc_arena_save(mrb);
|
6553
6628
|
mrb_value s;
|
6554
6629
|
# if INT_MAX > MRB_INT_MAX / 4
|
6555
6630
|
/* check maximum length with "\xNN" charactor */
|