opal 0.10.6 → 0.11.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +19 -0
- data/.gitmodules +1 -1
- data/.jshintrc +1 -2
- data/.travis.yml +26 -18
- data/CHANGELOG.md +89 -23
- data/{CODE_OF_CONDUCT.md → CONDUCT.md} +0 -0
- data/Gemfile +19 -21
- data/HACKING.md +2 -0
- data/README.md +7 -6
- data/Rakefile +1 -1
- data/appveyor.yml +21 -4
- data/benchmark-ips/bm_case.rb +33 -0
- data/benchmark-ips/bm_constants_lookup.rb +13 -0
- data/benchmark-ips/bm_is_number.rb +29 -0
- data/benchmark-ips/bm_symbol_to_proc.rb +19 -0
- data/benchmark/bm_constant_lookup_big.rb +799 -0
- data/benchmark/bm_constant_lookup_small.rb +59 -0
- data/benchmark/bm_module_definition_big.rb +400 -0
- data/benchmark/bm_module_definition_small.rb +30 -0
- data/bin/opal-repl +23 -1
- data/docs/compiled_ruby.md +16 -14
- data/docs/faq.md +3 -3
- data/docs/rspec.md +2 -1
- data/docs/unsupported_features.md +6 -4
- data/examples/rack/Gemfile +1 -0
- data/examples/rack/app/application.rb +14 -3
- data/examples/rack/app/user.rb +2 -0
- data/examples/rack/config.ru +1 -1
- data/examples/rack/index.html.erb +1 -0
- data/lib/opal.rb +6 -1
- data/lib/opal/ast/builder.rb +17 -0
- data/lib/opal/ast/node.rb +30 -0
- data/lib/opal/builder.rb +14 -3
- data/lib/opal/builder_processors.rb +1 -0
- data/lib/opal/cli.rb +45 -59
- data/lib/opal/cli_options.rb +11 -7
- data/lib/opal/cli_runners.rb +1 -0
- data/lib/opal/cli_runners/applescript.rb +3 -3
- data/lib/opal/cli_runners/nashorn.rb +1 -0
- data/lib/opal/cli_runners/nodejs.rb +4 -1
- data/lib/opal/cli_runners/phantom.js +1 -2
- data/lib/opal/cli_runners/phantomjs.rb +3 -2
- data/lib/opal/cli_runners/server.rb +1 -0
- data/lib/opal/compiler.rb +145 -94
- data/lib/opal/config.rb +1 -0
- data/lib/opal/deprecations.rb +18 -0
- data/lib/opal/erb.rb +1 -0
- data/lib/opal/errors.rb +1 -0
- data/lib/opal/fragment.rb +1 -0
- data/lib/opal/hike_path_finder.rb +1 -0
- data/lib/opal/nodes.rb +3 -0
- data/lib/opal/nodes/arglist.rb +2 -1
- data/lib/opal/nodes/args/initialize_kwargs.rb +1 -0
- data/lib/opal/nodes/args/kwarg.rb +7 -7
- data/lib/opal/nodes/args/kwoptarg.rb +6 -7
- data/lib/opal/nodes/args/kwrestarg.rb +5 -5
- data/lib/opal/nodes/args/mlhsarg.rb +3 -2
- data/lib/opal/nodes/args/normarg.rb +6 -7
- data/lib/opal/nodes/args/optarg.rb +5 -7
- data/lib/opal/nodes/args/post_args.rb +6 -5
- data/lib/opal/nodes/args/post_kwargs.rb +1 -0
- data/lib/opal/nodes/args/restarg.rb +7 -7
- data/lib/opal/nodes/array.rb +1 -0
- data/lib/opal/nodes/base.rb +24 -3
- data/lib/opal/nodes/call.rb +167 -155
- data/lib/opal/nodes/call_special.rb +31 -217
- data/lib/opal/nodes/case.rb +36 -22
- data/lib/opal/nodes/class.rb +4 -3
- data/lib/opal/nodes/constants.rb +28 -48
- data/lib/opal/nodes/csend.rb +25 -0
- data/lib/opal/nodes/def.rb +49 -16
- data/lib/opal/nodes/defined.rb +170 -60
- data/lib/opal/nodes/definitions.rb +40 -133
- data/lib/opal/nodes/defs.rb +29 -0
- data/lib/opal/nodes/for.rb +52 -25
- data/lib/opal/nodes/hash.rb +12 -35
- data/lib/opal/nodes/helpers.rb +27 -54
- data/lib/opal/nodes/if.rb +21 -32
- data/lib/opal/nodes/inline_args.rb +12 -13
- data/lib/opal/nodes/iter.rb +61 -36
- data/lib/opal/nodes/literal.rb +189 -116
- data/lib/opal/nodes/logic.rb +20 -25
- data/lib/opal/nodes/masgn.rb +20 -18
- data/lib/opal/nodes/module.rb +10 -11
- data/lib/opal/nodes/node_with_args.rb +14 -17
- data/lib/opal/nodes/rescue.rb +37 -70
- data/lib/opal/nodes/runtime_helpers.rb +8 -3
- data/lib/opal/nodes/scope.rb +9 -5
- data/lib/opal/nodes/singleton_class.rb +4 -3
- data/lib/opal/nodes/super.rb +115 -87
- data/lib/opal/nodes/top.rb +7 -2
- data/lib/opal/nodes/variables.rb +46 -35
- data/lib/opal/nodes/while.rb +11 -1
- data/lib/opal/nodes/yield.rb +1 -17
- data/lib/opal/parser.rb +28 -770
- data/lib/opal/path_reader.rb +5 -1
- data/lib/opal/paths.rb +10 -4
- data/lib/opal/regexp_anchors.rb +1 -0
- data/lib/opal/rewriter.rb +60 -0
- data/lib/opal/rewriters/base.rb +60 -0
- data/lib/opal/rewriters/binary_operator_assignment.rb +144 -0
- data/lib/opal/rewriters/block_to_iter.rb +17 -0
- data/lib/opal/rewriters/break_finder.rb +34 -0
- data/lib/opal/rewriters/dot_js_syntax.rb +60 -0
- data/lib/opal/rewriters/explicit_writer_return.rb +58 -0
- data/lib/opal/rewriters/js_reserved_words.rb +111 -0
- data/lib/opal/rewriters/logical_operator_assignment.rb +155 -0
- data/lib/opal/rewriters/opal_engine_check.rb +42 -0
- data/lib/opal/rewriters/rubyspec/filters_rewriter.rb +67 -0
- data/lib/opal/server.rb +4 -0
- data/lib/opal/simple_server.rb +100 -0
- data/lib/opal/source_map.rb +1 -1
- data/lib/opal/util.rb +5 -5
- data/lib/opal/version.rb +2 -1
- data/lib/tilt/opal.rb +1 -0
- data/opal.gemspec +8 -7
- data/opal/README.md +1 -1
- data/opal/corelib/array.rb +137 -83
- data/opal/corelib/basic_object.rb +6 -6
- data/opal/corelib/class.rb +14 -11
- data/opal/corelib/complex.rb +5 -1
- data/opal/corelib/constants.rb +3 -3
- data/opal/corelib/enumerable.rb +129 -11
- data/opal/corelib/error.rb +35 -17
- data/opal/corelib/file.rb +65 -170
- data/opal/corelib/hash.rb +128 -13
- data/opal/corelib/helpers.rb +12 -15
- data/opal/corelib/io.rb +1 -0
- data/opal/corelib/kernel.rb +40 -21
- data/opal/corelib/marshal/read_buffer.rb +1 -1
- data/opal/corelib/method.rb +33 -13
- data/opal/corelib/module.rb +133 -81
- data/opal/corelib/number.rb +141 -25
- data/opal/corelib/numeric.rb +0 -8
- data/opal/corelib/process.rb +44 -4
- data/opal/corelib/random.rb +117 -0
- data/opal/corelib/random/seedrandom.js.rb +15 -0
- data/opal/corelib/range.rb +133 -10
- data/opal/corelib/regexp.rb +37 -9
- data/opal/corelib/runtime.js +601 -390
- data/opal/corelib/string.rb +39 -8
- data/opal/corelib/string/encoding.rb +51 -7
- data/opal/corelib/struct.rb +20 -0
- data/opal/corelib/time.rb +3 -3
- data/opal/corelib/variables.rb +1 -1
- data/opal/opal.rb +1 -0
- data/spec/filters/bugs/array.rb +5 -1
- data/spec/filters/bugs/basicobject.rb +2 -5
- data/spec/filters/bugs/bigdecimal.rb +8 -22
- data/spec/filters/bugs/class.rb +2 -1
- data/spec/filters/bugs/comparable.rb +5 -0
- data/spec/filters/bugs/date.rb +3 -3
- data/spec/filters/bugs/enumerable.rb +4 -11
- data/spec/filters/bugs/enumerator.rb +2 -4
- data/spec/filters/bugs/exception.rb +16 -2
- data/spec/filters/bugs/file.rb +8 -0
- data/spec/filters/bugs/float.rb +7 -1
- data/spec/filters/bugs/hash.rb +6 -2
- data/spec/filters/bugs/integer.rb +2 -0
- data/spec/filters/bugs/io.rb +8 -0
- data/spec/filters/bugs/kernel.rb +9 -138
- data/spec/filters/bugs/language.rb +89 -174
- data/spec/filters/bugs/marshal.rb +33 -35
- data/spec/filters/bugs/method.rb +0 -24
- data/spec/filters/bugs/module.rb +19 -55
- data/spec/filters/bugs/numeric.rb +0 -119
- data/spec/filters/bugs/pathname.rb +2 -0
- data/spec/filters/bugs/proc.rb +5 -4
- data/spec/filters/bugs/random.rb +7 -0
- data/spec/filters/bugs/range.rb +12 -120
- data/spec/filters/bugs/rational.rb +1 -1
- data/spec/filters/bugs/regexp.rb +2 -40
- data/spec/filters/bugs/set.rb +0 -1
- data/spec/filters/bugs/string.rb +5 -8
- data/spec/filters/bugs/stringscanner.rb +11 -19
- data/spec/filters/bugs/time.rb +7 -1
- data/spec/filters/bugs/unboundmethod.rb +1 -11
- data/spec/filters/unsupported/array.rb +5 -1
- data/spec/filters/unsupported/basicobject.rb +1 -1
- data/spec/filters/unsupported/bignum.rb +4 -1
- data/spec/filters/unsupported/class.rb +1 -1
- data/spec/filters/unsupported/delegator.rb +1 -1
- data/spec/filters/unsupported/enumerable.rb +1 -1
- data/spec/filters/unsupported/enumerator.rb +1 -1
- data/spec/filters/unsupported/file.rb +4 -0
- data/spec/filters/unsupported/fixnum.rb +1 -1
- data/spec/filters/unsupported/float.rb +4 -1
- data/spec/filters/unsupported/freeze.rb +27 -5
- data/spec/filters/unsupported/hash.rb +7 -15
- data/spec/filters/unsupported/integer.rb +1 -1
- data/spec/filters/unsupported/kernel.rb +2 -1
- data/spec/filters/unsupported/language.rb +6 -1
- data/spec/filters/unsupported/marshal.rb +1 -1
- data/spec/filters/unsupported/matchdata.rb +4 -1
- data/spec/filters/unsupported/math.rb +1 -1
- data/spec/filters/unsupported/pathname.rb +1 -1
- data/spec/filters/unsupported/privacy.rb +141 -9
- data/spec/filters/unsupported/proc.rb +1 -1
- data/spec/filters/unsupported/random.rb +4 -0
- data/spec/filters/unsupported/range.rb +7 -0
- data/spec/filters/unsupported/regexp.rb +25 -15
- data/spec/filters/unsupported/set.rb +1 -1
- data/spec/filters/unsupported/singleton.rb +1 -1
- data/spec/filters/unsupported/string.rb +110 -101
- data/spec/filters/unsupported/struct.rb +1 -1
- data/spec/filters/unsupported/symbol.rb +2 -1
- data/spec/filters/unsupported/taint.rb +22 -7
- data/spec/filters/unsupported/thread.rb +1 -1
- data/spec/filters/unsupported/time.rb +1 -1
- data/spec/lib/builder_spec.rb +17 -0
- data/spec/lib/cli_spec.rb +37 -8
- data/spec/lib/compiler/call_spec.rb +98 -66
- data/spec/lib/compiler_spec.rb +39 -30
- data/spec/lib/dependency_resolver_spec.rb +2 -2
- data/spec/lib/deprecations_spec.rb +16 -0
- data/spec/lib/fixtures/source_location_test.rb +7 -0
- data/spec/lib/rewriters/binary_operator_assignment_spec.rb +151 -0
- data/spec/lib/rewriters/block_to_iter_spec.rb +28 -0
- data/spec/lib/rewriters/dot_js_syntax_spec.rb +108 -0
- data/spec/lib/rewriters/explicit_writer_return_spec.rb +186 -0
- data/spec/lib/rewriters/js_reserved_words_spec.rb +116 -0
- data/spec/lib/rewriters/logical_operator_assignment_spec.rb +202 -0
- data/spec/lib/rewriters/opal_engine_check_spec.rb +82 -0
- data/spec/lib/rewriters/rubyspec/filters_rewriter_spec.rb +53 -0
- data/spec/lib/simple_server_spec.rb +54 -0
- data/spec/mspec-opal/formatters.rb +65 -17
- data/spec/mspec-opal/runner.rb +47 -67
- data/spec/opal/core/date_spec.rb +14 -0
- data/spec/opal/core/exception_spec.rb +10 -0
- data/spec/opal/core/hash/internals_spec.rb +10 -10
- data/spec/opal/core/kernel/rand_spec.rb +0 -4
- data/spec/opal/core/kernel/respond_to_spec.rb +5 -2
- data/spec/opal/core/language/constant_lookup_spec.rb +38 -0
- data/spec/opal/core/language/predefined_spec.rb +1 -1
- data/spec/opal/core/language/safe_navigator_spec.rb +7 -0
- data/spec/opal/core/language/send_spec.rb +1 -9
- data/spec/opal/core/language/string_spec.rb +8 -8
- data/spec/opal/core/language/versions/def_2_0_spec.rb +0 -4
- data/spec/opal/core/language_spec.rb +32 -0
- data/spec/opal/core/module/const_get_spec.rb +1 -1
- data/spec/opal/core/runtime/is_a_spec.rb +36 -0
- data/spec/opal/core/runtime/rescue_spec.rb +35 -0
- data/spec/opal/core/runtime_spec.rb +4 -4
- data/spec/opal/core/string_spec.rb +8 -8
- data/spec/opal/core/time_spec.rb +26 -17
- data/spec/opal/stdlib/erb/quoted.opalerb +1 -1
- data/spec/opal/stdlib/json/parse_spec.rb +4 -0
- data/spec/opal/stdlib/native/hash_spec.rb +16 -0
- data/spec/ruby_specs +2 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/rewriters_helper.rb +24 -0
- data/stdlib/base64.rb +4 -2
- data/stdlib/bigdecimal/bignumber.js.rb +1 -1
- data/stdlib/date.rb +18 -19
- data/stdlib/json.rb +16 -4
- data/stdlib/nashorn/file.rb +15 -0
- data/stdlib/native.rb +21 -12
- data/stdlib/nodejs/dir.rb +1 -1
- data/stdlib/nodejs/file.rb +49 -20
- data/stdlib/nodejs/io.rb +22 -1
- data/stdlib/nodejs/{node_modules/js-yaml/dist/js-yaml.js → js-yaml-3-6-1.js} +815 -626
- data/stdlib/nodejs/kernel.rb +3 -1
- data/stdlib/nodejs/package.json +0 -1
- data/stdlib/nodejs/stacktrace.rb +163 -0
- data/stdlib/nodejs/yaml.rb +2 -1
- data/stdlib/opal-platform.rb +15 -0
- data/stdlib/opal/platform.rb +5 -13
- data/stdlib/pathname.rb +1 -1
- data/stdlib/strscan.rb +15 -1
- data/stdlib/yaml.rb +1 -1
- data/tasks/benchmarking.rake +9 -0
- data/tasks/building.rake +24 -20
- data/tasks/linting.rake +24 -13
- data/tasks/testing.rake +322 -205
- data/tasks/testing/mspec_special_calls.rb +44 -15
- data/tasks/testing/opal_rspec_smoketest.Gemfile +13 -0
- data/test/nodejs/fixtures/hello.rb +1 -0
- data/test/nodejs/test_file.rb +57 -0
- data/test/nodejs/test_io.rb +18 -0
- data/test/nodejs/test_opal_builder.rb +12 -0
- data/test/opal/unsupported_and_bugs.rb +9 -0
- metadata +127 -240
- data/lib/opal/parser/grammar.rb +0 -6157
- data/lib/opal/parser/grammar.y +0 -2011
- data/lib/opal/parser/keywords.rb +0 -66
- data/lib/opal/parser/lexer.rb +0 -1352
- data/lib/opal/parser/parser_scope.rb +0 -28
- data/lib/opal/parser/sexp.rb +0 -90
- data/lib/opal/sprockets.rb +0 -77
- data/lib/opal/sprockets/environment.rb +0 -23
- data/lib/opal/sprockets/erb.rb +0 -28
- data/lib/opal/sprockets/path_reader.rb +0 -36
- data/lib/opal/sprockets/processor.rb +0 -173
- data/lib/opal/sprockets/server.rb +0 -133
- data/lib/opal/sprockets/source_map_header_patch.rb +0 -41
- data/lib/opal/sprockets/source_map_server.rb +0 -117
- data/spec/filters/bugs/compiler_opal.rb +0 -5
- data/spec/filters/bugs/language_opal.rb +0 -88
- data/spec/filters/unsupported/module.rb +0 -8
- data/spec/lib/compiler/pre_processed_conditionals_spec.rb +0 -87
- data/spec/lib/lexer_spec.rb +0 -110
- data/spec/lib/parser/alias_spec.rb +0 -26
- data/spec/lib/parser/and_spec.rb +0 -13
- data/spec/lib/parser/aref_spec.rb +0 -10
- data/spec/lib/parser/attrasgn_spec.rb +0 -28
- data/spec/lib/parser/begin_spec.rb +0 -42
- data/spec/lib/parser/block_spec.rb +0 -12
- data/spec/lib/parser/break_spec.rb +0 -17
- data/spec/lib/parser/call_spec.rb +0 -201
- data/spec/lib/parser/class_spec.rb +0 -35
- data/spec/lib/parser/comments_spec.rb +0 -11
- data/spec/lib/parser/def_spec.rb +0 -109
- data/spec/lib/parser/if_spec.rb +0 -26
- data/spec/lib/parser/iter_spec.rb +0 -59
- data/spec/lib/parser/lambda_spec.rb +0 -219
- data/spec/lib/parser/literal_spec.rb +0 -118
- data/spec/lib/parser/masgn_spec.rb +0 -37
- data/spec/lib/parser/module_spec.rb +0 -27
- data/spec/lib/parser/not_spec.rb +0 -21
- data/spec/lib/parser/op_asgn1_spec.rb +0 -23
- data/spec/lib/parser/op_asgn2_spec.rb +0 -23
- data/spec/lib/parser/op_asgn_spec.rb +0 -17
- data/spec/lib/parser/or_spec.rb +0 -13
- data/spec/lib/parser/return_spec.rb +0 -22
- data/spec/lib/parser/sclass_spec.rb +0 -21
- data/spec/lib/parser/string_spec.rb +0 -286
- data/spec/lib/parser/super_spec.rb +0 -20
- data/spec/lib/parser/unary_spec.rb +0 -52
- data/spec/lib/parser/undef_spec.rb +0 -19
- data/spec/lib/parser/unless_spec.rb +0 -13
- data/spec/lib/parser/variables_spec.rb +0 -112
- data/spec/lib/parser/while_spec.rb +0 -15
- data/spec/lib/parser/yield_spec.rb +0 -20
- data/spec/lib/sprockets/erb_spec.rb +0 -38
- data/spec/lib/sprockets/path_reader_spec.rb +0 -41
- data/spec/lib/sprockets/processor_spec.rb +0 -79
- data/spec/lib/sprockets/server_spec.rb +0 -102
- data/spec/lib/sprockets_spec.rb +0 -39
- data/spec/lib/tilt/opal_spec.rb +0 -37
- data/spec/opal/core/language/block_spec.rb +0 -538
- data/spec/opal/core/language/proc_spec.rb +0 -263
- data/spec/opal/core/language/variables_spec.rb +0 -1366
- data/spec/opal/core/runtime/block_send_spec.rb +0 -28
- data/spec/opal/core/runtime/send_spec.rb +0 -34
- data/spec/support/parser_helpers.rb +0 -37
- data/stdlib/nodejs/node_modules/js-yaml/HISTORY.md +0 -277
- data/stdlib/nodejs/node_modules/js-yaml/LICENSE +0 -21
- data/stdlib/nodejs/node_modules/js-yaml/README.md +0 -288
- data/stdlib/nodejs/node_modules/js-yaml/bin/js-yaml.js +0 -140
- data/stdlib/nodejs/node_modules/js-yaml/bower.json +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/dist/js-yaml.min.js +0 -3
- data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.js +0 -102
- data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.yml +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.js +0 -31
- data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.json +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.yml +0 -197
- data/stdlib/nodejs/node_modules/js-yaml/index.js +0 -7
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml.js +0 -39
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/common.js +0 -62
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/dumper.js +0 -554
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/exception.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/loader.js +0 -1581
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/mark.js +0 -78
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema.js +0 -103
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/core.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +0 -28
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +0 -17
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/json.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type.js +0 -61
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/binary.js +0 -133
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/bool.js +0 -37
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/float.js +0 -110
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/int.js +0 -183
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/function.js +0 -85
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +0 -84
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +0 -27
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/map.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/merge.js +0 -12
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/null.js +0 -36
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/omap.js +0 -56
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/pairs.js +0 -61
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/seq.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/set.js +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/str.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +0 -98
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/HISTORY.md +0 -115
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/LICENSE +0 -21
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/README.md +0 -239
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/arguments.js +0 -36
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/choice.js +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/constants.js +0 -59
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/help.js +0 -13
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/nargs.js +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/parents.js +0 -28
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js +0 -49
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sum.js +0 -35
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/testformatters.js +0 -270
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/index.js +0 -1
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action.js +0 -146
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append.js +0 -55
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js +0 -47
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/count.js +0 -40
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/help.js +0 -48
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js +0 -43
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js +0 -27
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js +0 -26
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js +0 -148
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/version.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action_container.js +0 -481
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argparse.js +0 -14
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/error.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/exclusive.js +0 -54
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/group.js +0 -75
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js +0 -1168
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/const.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/added_formatters.js +0 -88
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js +0 -798
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/namespace.js +0 -77
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.npmignore +0 -2
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.travis.yml +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/README.markdown +0 -825
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/bower.json +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/component.json +0 -11
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/foo.js +0 -10
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/gulpfile.js +0 -26
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/lib/underscore.string.js +0 -673
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/libpeerconnection.log +0 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/package.json +0 -107
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/LICENSE +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/README.md +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/package.json +0 -69
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore-min.js +0 -6
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore.js +0 -1415
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/package.json +0 -62
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/README.md +0 -73
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esparse.js +0 -117
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esvalidate.js +0 -177
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/esprima.js +0 -3908
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/package.json +0 -69
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/compat.js +0 -239
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/reflect.js +0 -422
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/run.js +0 -66
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/runner.js +0 -387
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/test.js +0 -20238
- data/stdlib/nodejs/node_modules/js-yaml/package.json +0 -83
data/lib/opal/parser/grammar.y
DELETED
@@ -1,2011 +0,0 @@
|
|
1
|
-
class Opal::Parser
|
2
|
-
|
3
|
-
token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
|
4
|
-
kTHEN kELSIF kELSE kCASE kWHEN kWHILE kUNTIL kFOR kBREAK kNEXT
|
5
|
-
kREDO kRETRY kIN kDO kDO_COND kDO_BLOCK kDO_LAMBDA kRETURN kYIELD kSUPER
|
6
|
-
kSELF kNIL kTRUE kFALSE kAND kOR kNOT kIF_MOD kUNLESS_MOD kWHILE_MOD
|
7
|
-
kUNTIL_MOD kRESCUE_MOD kALIAS kDEFINED klBEGIN klEND k__LINE__
|
8
|
-
k__FILE__ tIDENTIFIER tFID tGVAR tIVAR tCONSTANT
|
9
|
-
tLABEL tCVAR tNTH_REF tBACK_REF tSTRING_CONTENT tINTEGER tFLOAT
|
10
|
-
tREGEXP_END tUPLUS tUMINUS tPOW tCMP tEQ tEQQ tNEQ tGEQ tLEQ tANDOP
|
11
|
-
tOROP tMATCH tNMATCH tJSDOT tDOT tDOT2 tDOT3 tAREF tASET tLSHFT tRSHFT
|
12
|
-
tCOLON2 tCOLON3 tOP_ASGN tASSOC tLPAREN tLPAREN2 tRPAREN tLPAREN_ARG
|
13
|
-
tRBRACK tLBRACE tLBRACE_ARG tSTAR tSTAR2 tAMPER tAMPER2
|
14
|
-
tTILDE tPERCENT tDIVIDE tPLUS tMINUS tLT tGT tPIPE tBANG tCARET
|
15
|
-
tLCURLY tRCURLY tBACK_REF2 tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG
|
16
|
-
tWORDS_BEG tAWORDS_BEG tSTRING_DBEG tSTRING_DVAR tSTRING_END tSTRING
|
17
|
-
tSYMBOL tNL tEH tCOLON tCOMMA tSPACE tSEMI tLAMBDA tLAMBEG
|
18
|
-
tLBRACK2 tLBRACK tJSLBRACK tDSTAR tLABEL_END tEQL
|
19
|
-
|
20
|
-
prechigh
|
21
|
-
right tBANG tTILDE tUPLUS
|
22
|
-
right tPOW
|
23
|
-
right tUMINUS
|
24
|
-
left tSTAR2 tDIVIDE tPERCENT
|
25
|
-
left tPLUS tMINUS
|
26
|
-
left tLSHFT tRSHFT
|
27
|
-
left tAMPER2
|
28
|
-
left tPIPE tCARET
|
29
|
-
left tGT tGEQ tLT tLEQ
|
30
|
-
nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH
|
31
|
-
left tANDOP
|
32
|
-
left tOROP
|
33
|
-
nonassoc tDOT2 tDOT3
|
34
|
-
right tEH tCOLON
|
35
|
-
left kRESCUE_MOD
|
36
|
-
right tEQL tOP_ASGN
|
37
|
-
nonassoc kDEFINED
|
38
|
-
right kNOT
|
39
|
-
left kOR kAND
|
40
|
-
nonassoc kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
|
41
|
-
nonassoc tLBRACE_ARG
|
42
|
-
nonassoc tLOWEST
|
43
|
-
preclow
|
44
|
-
|
45
|
-
rule
|
46
|
-
|
47
|
-
program: top_compstmt
|
48
|
-
|
49
|
-
top_compstmt: top_stmts opt_terms
|
50
|
-
{
|
51
|
-
result = new_compstmt val[0]
|
52
|
-
}
|
53
|
-
|
54
|
-
top_stmts: # none
|
55
|
-
{
|
56
|
-
result = new_block
|
57
|
-
}
|
58
|
-
| top_stmt
|
59
|
-
{
|
60
|
-
result = new_block val[0]
|
61
|
-
}
|
62
|
-
| top_stmts terms top_stmt
|
63
|
-
{
|
64
|
-
val[0] << val[2]
|
65
|
-
result = val[0]
|
66
|
-
}
|
67
|
-
|
68
|
-
top_stmt: stmt
|
69
|
-
| klBEGIN tLCURLY top_compstmt tRCURLY
|
70
|
-
{
|
71
|
-
result = val[2]
|
72
|
-
}
|
73
|
-
|
74
|
-
bodystmt: compstmt opt_rescue opt_else opt_ensure
|
75
|
-
{
|
76
|
-
result = new_body(val[0], val[1], val[2], val[3])
|
77
|
-
}
|
78
|
-
|
79
|
-
compstmt: stmts opt_terms
|
80
|
-
{
|
81
|
-
result = new_compstmt val[0]
|
82
|
-
}
|
83
|
-
|
84
|
-
stmts: # none
|
85
|
-
{
|
86
|
-
result = new_block
|
87
|
-
}
|
88
|
-
| stmt
|
89
|
-
{
|
90
|
-
result = new_block val[0]
|
91
|
-
}
|
92
|
-
| stmts terms stmt
|
93
|
-
{
|
94
|
-
val[0] << val[2]
|
95
|
-
result = val[0]
|
96
|
-
}
|
97
|
-
|
98
|
-
stmt: kALIAS fitem
|
99
|
-
{
|
100
|
-
lexer.lex_state = :expr_fname
|
101
|
-
}
|
102
|
-
fitem
|
103
|
-
{
|
104
|
-
result = new_alias(val[0], val[1], val[3])
|
105
|
-
}
|
106
|
-
| kALIAS tGVAR tGVAR
|
107
|
-
{
|
108
|
-
result = s(:valias, value(val[1]).to_sym, value(val[2]).to_sym)
|
109
|
-
}
|
110
|
-
| kALIAS tGVAR tBACK_REF
|
111
|
-
| kALIAS tGVAR tNTH_REF
|
112
|
-
{
|
113
|
-
result = s(:valias, value(val[1]).to_sym, value(val[2]).to_sym)
|
114
|
-
}
|
115
|
-
| kUNDEF undef_list
|
116
|
-
{
|
117
|
-
result = val[1]
|
118
|
-
}
|
119
|
-
| stmt kIF_MOD expr_value
|
120
|
-
{
|
121
|
-
result = new_if(val[1], val[2], val[0], nil)
|
122
|
-
}
|
123
|
-
| stmt kUNLESS_MOD expr_value
|
124
|
-
{
|
125
|
-
result = new_if(val[1], val[2], nil, val[0])
|
126
|
-
}
|
127
|
-
| stmt kWHILE_MOD expr_value
|
128
|
-
{
|
129
|
-
result = new_while(val[1], val[2], val[0])
|
130
|
-
}
|
131
|
-
| stmt kUNTIL_MOD expr_value
|
132
|
-
{
|
133
|
-
result = new_until(val[1], val[2], val[0])
|
134
|
-
}
|
135
|
-
| stmt kRESCUE_MOD stmt
|
136
|
-
{
|
137
|
-
result = new_rescue_mod(val[1], val[0], val[2])
|
138
|
-
}
|
139
|
-
| klEND tLCURLY compstmt tRCURLY
|
140
|
-
| command_asgn
|
141
|
-
| mlhs tEQL command_call
|
142
|
-
{
|
143
|
-
result = s(:masgn, val[0], s(:to_ary, val[2]))
|
144
|
-
}
|
145
|
-
| var_lhs tOP_ASGN command_call
|
146
|
-
{
|
147
|
-
result = new_op_asgn val[1], val[0], val[2]
|
148
|
-
}
|
149
|
-
| primary_value tLBRACK2 aref_args tRBRACK tOP_ASGN command_call
|
150
|
-
| primary_value tJSLBRACK aref_args tRBRACK tOP_ASGN command_call
|
151
|
-
| primary_value tDOT tIDENTIFIER tOP_ASGN command_call
|
152
|
-
{
|
153
|
-
result = s(:op_asgn2, val[0], op_to_setter(val[2]), value(val[3]).to_sym, val[4])
|
154
|
-
}
|
155
|
-
| primary_value tDOT tCONSTANT tOP_ASGN command_call
|
156
|
-
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_call
|
157
|
-
| backref tOP_ASGN command_call
|
158
|
-
| lhs tEQL mrhs
|
159
|
-
{
|
160
|
-
result = new_assign val[0], val[1], s(:svalue, val[2])
|
161
|
-
}
|
162
|
-
| mlhs tEQL arg_value
|
163
|
-
{
|
164
|
-
result = s(:masgn, val[0], s(:to_ary, val[2]))
|
165
|
-
}
|
166
|
-
| mlhs tEQL mrhs
|
167
|
-
{
|
168
|
-
result = s(:masgn, val[0], val[2])
|
169
|
-
}
|
170
|
-
| expr
|
171
|
-
|
172
|
-
command_asgn: lhs tEQL command_call
|
173
|
-
{
|
174
|
-
result = new_assign(val[0], val[1], val[2])
|
175
|
-
}
|
176
|
-
| lhs tEQL command_asgn
|
177
|
-
{
|
178
|
-
result = new_assign(val[0], val[1], val[2])
|
179
|
-
}
|
180
|
-
|
181
|
-
expr: command_call
|
182
|
-
| expr kAND expr
|
183
|
-
{
|
184
|
-
result = s(:and, val[0], val[2])
|
185
|
-
}
|
186
|
-
| expr kOR expr
|
187
|
-
{
|
188
|
-
result = s(:or, val[0], val[2])
|
189
|
-
}
|
190
|
-
| kNOT expr
|
191
|
-
{
|
192
|
-
result = new_unary_call(['!', []], val[1])
|
193
|
-
}
|
194
|
-
| tBANG command_call
|
195
|
-
{
|
196
|
-
result = new_unary_call(val[0], val[1])
|
197
|
-
}
|
198
|
-
| arg
|
199
|
-
|
200
|
-
expr_value: expr
|
201
|
-
|
202
|
-
command_call: command
|
203
|
-
| block_command
|
204
|
-
|
205
|
-
block_command: block_call
|
206
|
-
| block_call tJSDOT operation2 command_args
|
207
|
-
| block_call tDOT operation2 command_args
|
208
|
-
| block_call tCOLON2 operation2 command_args
|
209
|
-
|
210
|
-
cmd_brace_block: tLBRACE_ARG opt_block_var compstmt tRCURLY
|
211
|
-
{
|
212
|
-
result = new_iter(val[1], val[2])
|
213
|
-
}
|
214
|
-
|
215
|
-
command: operation command_args =tLOWEST
|
216
|
-
{
|
217
|
-
result = new_call(nil, val[0], val[1])
|
218
|
-
}
|
219
|
-
| operation command_args cmd_brace_block
|
220
|
-
{
|
221
|
-
result = new_call(nil, val[0], val[1]) << val[2]
|
222
|
-
}
|
223
|
-
| primary_value tJSDOT operation2 command_args =tLOWEST
|
224
|
-
{
|
225
|
-
result = new_js_call(val[0], val[2], val[3])
|
226
|
-
}
|
227
|
-
| primary_value tJSDOT operation2 command_args cmd_brace_block
|
228
|
-
{
|
229
|
-
result = new_js_call(val[0], val[2], val[3]) << val[4]
|
230
|
-
}
|
231
|
-
| primary_value tDOT operation2 command_args =tLOWEST
|
232
|
-
{
|
233
|
-
result = new_call(val[0], val[2], val[3])
|
234
|
-
}
|
235
|
-
| primary_value tDOT operation2 command_args cmd_brace_block
|
236
|
-
{
|
237
|
-
result = new_call(val[0], val[2], val[3]) << val[4]
|
238
|
-
}
|
239
|
-
| primary_value tCOLON2 operation2 command_args =tLOWEST
|
240
|
-
{
|
241
|
-
result = new_call(val[0], val[2], val[3])
|
242
|
-
}
|
243
|
-
| primary_value tCOLON2 operation2 command_args cmd_brace_block
|
244
|
-
{
|
245
|
-
result = new_call(val[0], val[2], val[3]) << val[4]
|
246
|
-
}
|
247
|
-
| kSUPER command_args
|
248
|
-
{
|
249
|
-
result = new_super(val[0], val[1])
|
250
|
-
}
|
251
|
-
| kYIELD command_args
|
252
|
-
{
|
253
|
-
result = new_yield val[1]
|
254
|
-
}
|
255
|
-
| kRETURN call_args
|
256
|
-
{
|
257
|
-
result = new_return(val[0], val[1])
|
258
|
-
}
|
259
|
-
| kBREAK call_args
|
260
|
-
{
|
261
|
-
result = new_break(val[0], val[1])
|
262
|
-
}
|
263
|
-
| kNEXT call_args
|
264
|
-
{
|
265
|
-
result = new_next(val[0], val[1])
|
266
|
-
}
|
267
|
-
|
268
|
-
mlhs: mlhs_basic
|
269
|
-
{
|
270
|
-
result = val[0]
|
271
|
-
}
|
272
|
-
| tLPAREN mlhs_entry tRPAREN
|
273
|
-
{
|
274
|
-
result = val[1]
|
275
|
-
}
|
276
|
-
|
277
|
-
mlhs_entry: mlhs_basic
|
278
|
-
{
|
279
|
-
result = val[0]
|
280
|
-
}
|
281
|
-
| tLPAREN mlhs_entry tRPAREN
|
282
|
-
{
|
283
|
-
result = val[1]
|
284
|
-
}
|
285
|
-
|
286
|
-
mlhs_basic: mlhs_head
|
287
|
-
{
|
288
|
-
result = val[0]
|
289
|
-
}
|
290
|
-
| mlhs_head mlhs_item
|
291
|
-
{
|
292
|
-
result = val[0] << val[1]
|
293
|
-
}
|
294
|
-
| mlhs_head tSTAR mlhs_node
|
295
|
-
{
|
296
|
-
result = val[0] << s(:splat, val[2])
|
297
|
-
}
|
298
|
-
| mlhs_head tSTAR mlhs_node tCOMMA mlhs_post
|
299
|
-
{
|
300
|
-
result = (val[0] << s(:splat, val[2])).concat(val[4].children)
|
301
|
-
}
|
302
|
-
| mlhs_head tSTAR
|
303
|
-
{
|
304
|
-
result = val[0] << s(:splat)
|
305
|
-
}
|
306
|
-
| mlhs_head tSTAR tCOMMA mlhs_post
|
307
|
-
{
|
308
|
-
result = (val[0] << s(:splat)).concat(val[3].children)
|
309
|
-
}
|
310
|
-
| tSTAR mlhs_node
|
311
|
-
{
|
312
|
-
result = s(:array, s(:splat, val[1]))
|
313
|
-
}
|
314
|
-
| tSTAR mlhs_node tCOMMA mlhs_post
|
315
|
-
{
|
316
|
-
result = s(:array, s(:splat, val[1])).concat(val[3].children)
|
317
|
-
}
|
318
|
-
| tSTAR
|
319
|
-
{
|
320
|
-
result = s(:array, s(:splat))
|
321
|
-
}
|
322
|
-
| tSTAR tCOMMA mlhs_post
|
323
|
-
{
|
324
|
-
result = s(:array, s(:splat)).concat(val[2].children)
|
325
|
-
}
|
326
|
-
|
327
|
-
mlhs_item: mlhs_node
|
328
|
-
{
|
329
|
-
result = val[0]
|
330
|
-
}
|
331
|
-
| tLPAREN mlhs_entry tRPAREN
|
332
|
-
{
|
333
|
-
result = val[1]
|
334
|
-
}
|
335
|
-
|
336
|
-
mlhs_head: mlhs_item tCOMMA
|
337
|
-
{
|
338
|
-
result = s(:array, val[0])
|
339
|
-
}
|
340
|
-
| mlhs_head mlhs_item tCOMMA
|
341
|
-
{
|
342
|
-
result = val[0] << val[1]
|
343
|
-
}
|
344
|
-
|
345
|
-
mlhs_post: mlhs_item
|
346
|
-
{
|
347
|
-
result = s(:array, val[0])
|
348
|
-
}
|
349
|
-
| mlhs_post tCOMMA mlhs_item
|
350
|
-
{
|
351
|
-
result = val[0] << val[2]
|
352
|
-
}
|
353
|
-
|
354
|
-
mlhs_node: variable
|
355
|
-
{
|
356
|
-
result = new_assignable val[0]
|
357
|
-
}
|
358
|
-
| primary_value tLBRACK2 aref_args tRBRACK
|
359
|
-
{
|
360
|
-
args = val[2] ? val[2] : []
|
361
|
-
result = s(:attrasgn, val[0], :[]=, s(:arglist, *args))
|
362
|
-
}
|
363
|
-
| primary_value tDOT tIDENTIFIER
|
364
|
-
{
|
365
|
-
result = new_call val[0], val[2], []
|
366
|
-
}
|
367
|
-
| primary_value tCOLON2 tIDENTIFIER
|
368
|
-
| primary_value tDOT tCONSTANT
|
369
|
-
| primary_value tCOLON2 tCONSTANT
|
370
|
-
| tCOLON3 tCONSTANT
|
371
|
-
| backref
|
372
|
-
|
373
|
-
lhs: variable
|
374
|
-
{
|
375
|
-
result = new_assignable val[0]
|
376
|
-
}
|
377
|
-
| primary_value tJSLBRACK aref_args tRBRACK
|
378
|
-
{
|
379
|
-
result = new_js_attrasgn(val[0], val[2])
|
380
|
-
}
|
381
|
-
| primary_value tLBRACK2 aref_args tRBRACK
|
382
|
-
{
|
383
|
-
result = new_attrasgn(val[0], :[]=, val[2])
|
384
|
-
}
|
385
|
-
| primary_value tDOT tIDENTIFIER
|
386
|
-
{
|
387
|
-
result = new_attrasgn(val[0], op_to_setter(val[2]))
|
388
|
-
}
|
389
|
-
| primary_value tCOLON2 tIDENTIFIER
|
390
|
-
{
|
391
|
-
result = new_attrasgn(val[0], op_to_setter(val[2]))
|
392
|
-
}
|
393
|
-
| primary_value tDOT tCONSTANT
|
394
|
-
{
|
395
|
-
result = new_attrasgn(val[0], op_to_setter(val[2]))
|
396
|
-
}
|
397
|
-
| primary_value tCOLON2 tCONSTANT
|
398
|
-
{
|
399
|
-
result = new_colon2(val[0], val[1], val[2])
|
400
|
-
}
|
401
|
-
| tCOLON3 tCONSTANT
|
402
|
-
{
|
403
|
-
result = new_colon3(val[0], val[1])
|
404
|
-
}
|
405
|
-
| backref
|
406
|
-
|
407
|
-
cname: tCONSTANT
|
408
|
-
|
409
|
-
cpath: tCOLON3 cname
|
410
|
-
{
|
411
|
-
result = new_colon3(val[0], val[1])
|
412
|
-
}
|
413
|
-
| cname
|
414
|
-
{
|
415
|
-
result = new_const(val[0])
|
416
|
-
}
|
417
|
-
| primary_value tCOLON2 cname
|
418
|
-
{
|
419
|
-
result = new_colon2(val[0], val[1], val[2])
|
420
|
-
}
|
421
|
-
|
422
|
-
fname: tIDENTIFIER
|
423
|
-
| tCONSTANT
|
424
|
-
| tFID
|
425
|
-
| op
|
426
|
-
{
|
427
|
-
lexer.lex_state = :expr_end
|
428
|
-
result = val[0]
|
429
|
-
}
|
430
|
-
| reswords
|
431
|
-
{
|
432
|
-
lexer.lex_state = :expr_end
|
433
|
-
result = val[0]
|
434
|
-
}
|
435
|
-
|
436
|
-
fitem: fname
|
437
|
-
{
|
438
|
-
result = new_sym(val[0])
|
439
|
-
}
|
440
|
-
| symbol
|
441
|
-
|
442
|
-
undef_list: fitem
|
443
|
-
{
|
444
|
-
result = s(:undef, val[0])
|
445
|
-
}
|
446
|
-
| undef_list tCOMMA fitem
|
447
|
-
{
|
448
|
-
result = val[0] << val[2]
|
449
|
-
}
|
450
|
-
|
451
|
-
op: tPIPE | tCARET | tAMPER2 | tCMP | tEQ | tEQQ
|
452
|
-
| tMATCH | tNMATCH | tGT | tGEQ | tLT | tLEQ
|
453
|
-
| tNEQ | tLSHFT | tRSHFT | tPLUS | tMINUS | tSTAR2
|
454
|
-
| tSTAR | tDIVIDE | tPERCENT | tPOW | tBANG | tTILDE
|
455
|
-
| tUPLUS | tUMINUS | tAREF | tASET | tBACK_REF2
|
456
|
-
|
457
|
-
reswords: k__LINE__ | k__FILE__ | klBEGIN | klEND | kALIAS | kAND
|
458
|
-
| kBEGIN | kBREAK | kCASE | kCLASS | kDEF | kDEFINED
|
459
|
-
| kDO | kELSE | kELSIF | kEND | kENSURE | kFALSE
|
460
|
-
| kFOR | kIN | kMODULE | kNEXT | kNIL | kNOT
|
461
|
-
| kOR | kREDO | kRESCUE | kRETRY | kRETURN | kSELF
|
462
|
-
| kSUPER | kTHEN | kTRUE | kUNDEF | kWHEN | kYIELD
|
463
|
-
| kIF_MOD | kUNLESS_MOD | kWHILE_MOD | kUNTIL_MOD | kRESCUE_MOD
|
464
|
-
| kIF | kWHILE | kUNTIL | kUNLESS
|
465
|
-
|
466
|
-
arg: lhs tEQL arg
|
467
|
-
{
|
468
|
-
result = new_assign(val[0], val[1], val[2])
|
469
|
-
}
|
470
|
-
| lhs tEQL arg kRESCUE_MOD arg
|
471
|
-
{
|
472
|
-
result = new_assign val[0], val[1], s(:rescue_mod, val[2], val[4])
|
473
|
-
}
|
474
|
-
| var_lhs tOP_ASGN arg
|
475
|
-
{
|
476
|
-
result = new_op_asgn val[1], val[0], val[2]
|
477
|
-
}
|
478
|
-
| primary_value tLBRACK2 aref_args tRBRACK tOP_ASGN arg
|
479
|
-
{
|
480
|
-
result = new_op_asgn1(val[0], val[2], val[4], val[5])
|
481
|
-
}
|
482
|
-
| primary_value tJSLBRACK aref_args tRBRACK tOP_ASGN arg
|
483
|
-
{
|
484
|
-
raise ".JS[...] #{val[4]} is not supported"
|
485
|
-
}
|
486
|
-
| primary_value tDOT tIDENTIFIER tOP_ASGN arg
|
487
|
-
{
|
488
|
-
result = s(:op_asgn2, val[0], op_to_setter(val[2]), value(val[3]).to_sym, val[4])
|
489
|
-
}
|
490
|
-
| primary_value tDOT tCONSTANT tOP_ASGN arg
|
491
|
-
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg
|
492
|
-
| primary_value tCOLON2 tCONSTANT tOP_ASGN arg
|
493
|
-
| tCOLON3 tCONSTANT tOP_ASGN arg
|
494
|
-
| backref tOP_ASGN arg
|
495
|
-
| arg tDOT2 arg
|
496
|
-
{
|
497
|
-
result = new_irange(val[0], val[1], val[2])
|
498
|
-
}
|
499
|
-
| arg tDOT3 arg
|
500
|
-
{
|
501
|
-
result = new_erange(val[0], val[1], val[2])
|
502
|
-
}
|
503
|
-
| arg tPLUS arg
|
504
|
-
{
|
505
|
-
result = new_binary_call(val[0], val[1], val[2])
|
506
|
-
}
|
507
|
-
| arg tMINUS arg
|
508
|
-
{
|
509
|
-
result = new_binary_call(val[0], val[1], val[2])
|
510
|
-
}
|
511
|
-
| arg tSTAR2 arg
|
512
|
-
{
|
513
|
-
result = new_binary_call(val[0], val[1], val[2])
|
514
|
-
}
|
515
|
-
| arg tDIVIDE arg
|
516
|
-
{
|
517
|
-
result = new_binary_call(val[0], val[1], val[2])
|
518
|
-
}
|
519
|
-
| arg tPERCENT arg
|
520
|
-
{
|
521
|
-
result = new_binary_call(val[0], val[1], val[2])
|
522
|
-
}
|
523
|
-
| arg tPOW arg
|
524
|
-
{
|
525
|
-
result = new_binary_call(val[0], val[1], val[2])
|
526
|
-
}
|
527
|
-
| '-@NUM' tINTEGER tPOW arg
|
528
|
-
{
|
529
|
-
result = new_call new_binary_call(new_int(val[1]), val[2], val[3]), [:"-@", []], []
|
530
|
-
}
|
531
|
-
| '-@NUM' tFLOAT tPOW arg
|
532
|
-
{
|
533
|
-
result = new_call new_binary_call(new_float(val[1]), val[2], val[3]), [:"-@", []], []
|
534
|
-
}
|
535
|
-
| tUPLUS arg
|
536
|
-
{
|
537
|
-
result = new_call val[1], [:"+@", []], []
|
538
|
-
if [:int, :float].include? val[1].type
|
539
|
-
result = val[1]
|
540
|
-
end
|
541
|
-
}
|
542
|
-
| tUMINUS arg
|
543
|
-
{
|
544
|
-
result = new_call val[1], [:"-@", []], []
|
545
|
-
if val[1].type == :int
|
546
|
-
val[1][1] = -val[1][1]
|
547
|
-
result = val[1]
|
548
|
-
elsif val[1].type == :float
|
549
|
-
val[1][1] = -val[1][1].to_f
|
550
|
-
result = val[1]
|
551
|
-
end
|
552
|
-
}
|
553
|
-
| arg tPIPE arg
|
554
|
-
{
|
555
|
-
result = new_binary_call(val[0], val[1], val[2])
|
556
|
-
}
|
557
|
-
| arg tCARET arg
|
558
|
-
{
|
559
|
-
result = new_binary_call(val[0], val[1], val[2])
|
560
|
-
}
|
561
|
-
| arg tAMPER2 arg
|
562
|
-
{
|
563
|
-
result = new_binary_call(val[0], val[1], val[2])
|
564
|
-
}
|
565
|
-
| arg tCMP arg
|
566
|
-
{
|
567
|
-
result = new_binary_call(val[0], val[1], val[2])
|
568
|
-
}
|
569
|
-
| arg tGT arg
|
570
|
-
{
|
571
|
-
result = new_binary_call(val[0], val[1], val[2])
|
572
|
-
}
|
573
|
-
| arg tGEQ arg
|
574
|
-
{
|
575
|
-
result = new_binary_call(val[0], val[1], val[2])
|
576
|
-
}
|
577
|
-
| arg tLT arg
|
578
|
-
{
|
579
|
-
result = new_binary_call(val[0], val[1], val[2])
|
580
|
-
}
|
581
|
-
| arg tLEQ arg
|
582
|
-
{
|
583
|
-
result = new_binary_call(val[0], val[1], val[2])
|
584
|
-
}
|
585
|
-
| arg tEQ arg
|
586
|
-
{
|
587
|
-
result = new_binary_call(val[0], val[1], val[2])
|
588
|
-
}
|
589
|
-
| arg tEQQ arg
|
590
|
-
{
|
591
|
-
result = new_binary_call(val[0], val[1], val[2])
|
592
|
-
}
|
593
|
-
| arg tNEQ arg
|
594
|
-
{
|
595
|
-
result = new_binary_call(val[0], val[1], val[2])
|
596
|
-
}
|
597
|
-
| arg tMATCH arg
|
598
|
-
{
|
599
|
-
result = new_binary_call(val[0], val[1], val[2])
|
600
|
-
}
|
601
|
-
| arg tNMATCH arg
|
602
|
-
{
|
603
|
-
result = new_binary_call(val[0], val[1], val[2])
|
604
|
-
}
|
605
|
-
| tBANG arg
|
606
|
-
{
|
607
|
-
result = new_unary_call(val[0], val[1])
|
608
|
-
}
|
609
|
-
| tTILDE arg
|
610
|
-
{
|
611
|
-
result = new_unary_call(val[0], val[1])
|
612
|
-
}
|
613
|
-
| arg tLSHFT arg
|
614
|
-
{
|
615
|
-
result = new_binary_call(val[0], val[1], val[2])
|
616
|
-
}
|
617
|
-
| arg tRSHFT arg
|
618
|
-
{
|
619
|
-
result = new_binary_call(val[0], val[1], val[2])
|
620
|
-
}
|
621
|
-
| arg tANDOP arg
|
622
|
-
{
|
623
|
-
result = new_and(val[0], val[1], val[2])
|
624
|
-
}
|
625
|
-
| arg tOROP arg
|
626
|
-
{
|
627
|
-
result = new_or(val[0], val[1], val[2])
|
628
|
-
}
|
629
|
-
| kDEFINED opt_nl arg
|
630
|
-
{
|
631
|
-
result = s(:defined, val[2])
|
632
|
-
}
|
633
|
-
| arg tEH { lexer.cond_push 1 } arg tCOLON { lexer.cond_pop } arg
|
634
|
-
{
|
635
|
-
result = new_if(val[1], val[0], val[3], val[6])
|
636
|
-
}
|
637
|
-
| primary
|
638
|
-
|
639
|
-
arg_value: arg
|
640
|
-
|
641
|
-
aref_args: none
|
642
|
-
{
|
643
|
-
result = nil
|
644
|
-
}
|
645
|
-
| command opt_nl
|
646
|
-
{
|
647
|
-
result = [val[0]]
|
648
|
-
}
|
649
|
-
| args trailer
|
650
|
-
{
|
651
|
-
result = val[0]
|
652
|
-
}
|
653
|
-
| args tCOMMA assocs trailer
|
654
|
-
{
|
655
|
-
val[0] << s(:hash, *val[2])
|
656
|
-
result = val[0]
|
657
|
-
}
|
658
|
-
| assocs trailer
|
659
|
-
{
|
660
|
-
result = [s(:hash, *val[0])]
|
661
|
-
}
|
662
|
-
| args tCOMMA block_arg
|
663
|
-
{
|
664
|
-
result = val[0] << val[2]
|
665
|
-
}
|
666
|
-
|
667
|
-
|
668
|
-
paren_args: tLPAREN2 opt_call_args rparen
|
669
|
-
{
|
670
|
-
result = val[1]
|
671
|
-
}
|
672
|
-
|
673
|
-
rparen: opt_nl tRPAREN
|
674
|
-
|
675
|
-
opt_paren_args: none
|
676
|
-
{
|
677
|
-
result = []
|
678
|
-
}
|
679
|
-
| paren_args
|
680
|
-
|
681
|
-
opt_call_args: none
|
682
|
-
{
|
683
|
-
result = []
|
684
|
-
}
|
685
|
-
| call_args
|
686
|
-
| args tCOMMA
|
687
|
-
{
|
688
|
-
result = val[0]
|
689
|
-
}
|
690
|
-
| args tCOMMA assocs tCOMMA
|
691
|
-
{
|
692
|
-
result = val[0]
|
693
|
-
result << new_hash(nil, val[2], nil)
|
694
|
-
}
|
695
|
-
| assocs tCOMMA
|
696
|
-
{
|
697
|
-
result = [new_hash(nil, val[0], nil)]
|
698
|
-
}
|
699
|
-
|
700
|
-
call_args: command
|
701
|
-
{
|
702
|
-
result = [val[0]]
|
703
|
-
}
|
704
|
-
| args opt_block_arg
|
705
|
-
{
|
706
|
-
result = val[0]
|
707
|
-
add_block_pass val[0], val[1]
|
708
|
-
}
|
709
|
-
| assocs opt_block_arg
|
710
|
-
{
|
711
|
-
result = [new_hash(nil, val[0], nil)]
|
712
|
-
add_block_pass result, val[1]
|
713
|
-
}
|
714
|
-
| args tCOMMA assocs opt_block_arg
|
715
|
-
{
|
716
|
-
result = val[0]
|
717
|
-
result << new_hash(nil, val[2], nil)
|
718
|
-
result << val[3] if val[3]
|
719
|
-
}
|
720
|
-
| block_arg
|
721
|
-
{
|
722
|
-
result = []
|
723
|
-
add_block_pass result, val[0]
|
724
|
-
}
|
725
|
-
|
726
|
-
command_args: {
|
727
|
-
lexer.cmdarg_push 1
|
728
|
-
}
|
729
|
-
call_args
|
730
|
-
{
|
731
|
-
lexer.cmdarg_pop
|
732
|
-
result = val[1]
|
733
|
-
}
|
734
|
-
|
735
|
-
block_arg: tAMPER arg_value
|
736
|
-
{
|
737
|
-
result = new_block_pass(val[0], val[1])
|
738
|
-
}
|
739
|
-
|
740
|
-
opt_block_arg: tCOMMA block_arg
|
741
|
-
{
|
742
|
-
result = val[1]
|
743
|
-
}
|
744
|
-
| # none
|
745
|
-
{
|
746
|
-
result = nil
|
747
|
-
}
|
748
|
-
|
749
|
-
args: arg_value
|
750
|
-
{
|
751
|
-
result = [val[0]]
|
752
|
-
}
|
753
|
-
| tSTAR arg_value
|
754
|
-
{
|
755
|
-
result = [new_splat(val[0], val[1])]
|
756
|
-
}
|
757
|
-
| args tCOMMA arg_value
|
758
|
-
{
|
759
|
-
result = val[0] << val[2]
|
760
|
-
}
|
761
|
-
| args tCOMMA tSTAR arg_value
|
762
|
-
{
|
763
|
-
result = val[0] << new_splat(val[2], val[3])
|
764
|
-
}
|
765
|
-
|
766
|
-
mrhs: args tCOMMA arg_value
|
767
|
-
{
|
768
|
-
val[0] << val[2]
|
769
|
-
result = s(:array, *val[0])
|
770
|
-
}
|
771
|
-
| args tCOMMA tSTAR arg_value
|
772
|
-
{
|
773
|
-
val[0] << s(:splat, val[3])
|
774
|
-
result = s(:array, *val[0])
|
775
|
-
}
|
776
|
-
| tSTAR arg_value
|
777
|
-
{
|
778
|
-
result = s(:splat, val[1])
|
779
|
-
}
|
780
|
-
|
781
|
-
primary: literal
|
782
|
-
| strings
|
783
|
-
| xstring
|
784
|
-
| regexp
|
785
|
-
| words
|
786
|
-
| awords
|
787
|
-
| var_ref
|
788
|
-
| backref
|
789
|
-
| tFID
|
790
|
-
| kBEGIN
|
791
|
-
{
|
792
|
-
result = lexer.line
|
793
|
-
}
|
794
|
-
bodystmt kEND
|
795
|
-
{
|
796
|
-
result = s(:begin, val[2])
|
797
|
-
}
|
798
|
-
| tLPAREN_ARG expr
|
799
|
-
{
|
800
|
-
lexer.lex_state = :expr_endarg
|
801
|
-
}
|
802
|
-
opt_nl tRPAREN
|
803
|
-
{
|
804
|
-
result = val[1]
|
805
|
-
}
|
806
|
-
| tLPAREN_ARG
|
807
|
-
{
|
808
|
-
lexer.lex_state = :expr_endarg
|
809
|
-
}
|
810
|
-
opt_nl tRPAREN
|
811
|
-
{
|
812
|
-
result = new_nil(val[0])
|
813
|
-
}
|
814
|
-
| tLPAREN compstmt tRPAREN
|
815
|
-
{
|
816
|
-
result = new_paren(val[0], val[1], val[2])
|
817
|
-
}
|
818
|
-
| primary_value tCOLON2 tCONSTANT
|
819
|
-
{
|
820
|
-
result = new_colon2(val[0], val[1], val[2])
|
821
|
-
}
|
822
|
-
| tCOLON3 tCONSTANT
|
823
|
-
{
|
824
|
-
result = new_colon3(val[0], val[1])
|
825
|
-
}
|
826
|
-
| primary_value tLBRACK2 aref_args tRBRACK
|
827
|
-
{
|
828
|
-
result = new_call val[0], [:[], []], val[2]
|
829
|
-
}
|
830
|
-
| primary_value tJSLBRACK aref_args tRBRACK
|
831
|
-
{
|
832
|
-
result = new_js_call val[0], [:[], []], val[2]
|
833
|
-
}
|
834
|
-
| tLBRACK aref_args tRBRACK
|
835
|
-
{
|
836
|
-
result = new_array(val[0], val[1], val[2])
|
837
|
-
}
|
838
|
-
| tLBRACE assoc_list tRCURLY
|
839
|
-
{
|
840
|
-
result = new_hash(val[0], val[1], val[2])
|
841
|
-
}
|
842
|
-
| kRETURN
|
843
|
-
{
|
844
|
-
result = new_return(val[0])
|
845
|
-
}
|
846
|
-
| kYIELD tLPAREN2 call_args tRPAREN
|
847
|
-
{
|
848
|
-
result = new_yield val[2]
|
849
|
-
}
|
850
|
-
| kYIELD tLPAREN2 tRPAREN
|
851
|
-
{
|
852
|
-
result = s(:yield)
|
853
|
-
}
|
854
|
-
| kYIELD
|
855
|
-
{
|
856
|
-
result = s(:yield)
|
857
|
-
}
|
858
|
-
| kDEFINED opt_nl tLPAREN2 expr tRPAREN
|
859
|
-
{
|
860
|
-
result = s(:defined, val[3])
|
861
|
-
}
|
862
|
-
| kNOT tLPAREN2 expr tRPAREN
|
863
|
-
{
|
864
|
-
result = new_unary_call(['!', []], val[2])
|
865
|
-
}
|
866
|
-
| kNOT tLPAREN2 tRPAREN
|
867
|
-
{
|
868
|
-
result = new_unary_call(['!', []], new_nil(val[0]))
|
869
|
-
}
|
870
|
-
| operation brace_block
|
871
|
-
{
|
872
|
-
result = new_call(nil, val[0], [])
|
873
|
-
result << val[1]
|
874
|
-
}
|
875
|
-
| method_call
|
876
|
-
| method_call brace_block
|
877
|
-
{
|
878
|
-
result = new_method_call_with_block(val[0], val[1])
|
879
|
-
}
|
880
|
-
| tLAMBDA lambda
|
881
|
-
{
|
882
|
-
result = val[1]
|
883
|
-
}
|
884
|
-
| kIF expr_value then compstmt if_tail kEND
|
885
|
-
{
|
886
|
-
result = new_if(val[0], val[1], val[3], val[4])
|
887
|
-
}
|
888
|
-
| kUNLESS expr_value then compstmt opt_else kEND
|
889
|
-
{
|
890
|
-
result = new_if(val[0], val[1], val[4], val[3])
|
891
|
-
}
|
892
|
-
| kWHILE
|
893
|
-
{
|
894
|
-
lexer.cond_push 1
|
895
|
-
result = lexer.line
|
896
|
-
}
|
897
|
-
expr_value do
|
898
|
-
{
|
899
|
-
lexer.cond_pop
|
900
|
-
}
|
901
|
-
compstmt kEND
|
902
|
-
{
|
903
|
-
result = s(:while, val[2], val[5])
|
904
|
-
}
|
905
|
-
| kUNTIL
|
906
|
-
{
|
907
|
-
lexer.cond_push 1
|
908
|
-
result = lexer.line
|
909
|
-
}
|
910
|
-
expr_value do
|
911
|
-
{
|
912
|
-
lexer.cond_pop
|
913
|
-
}
|
914
|
-
compstmt kEND
|
915
|
-
{
|
916
|
-
result = s(:until, val[2], val[5])
|
917
|
-
}
|
918
|
-
| kCASE expr_value opt_terms case_body kEND
|
919
|
-
{
|
920
|
-
result = s(:case, val[1], *val[3])
|
921
|
-
}
|
922
|
-
| kCASE opt_terms case_body kEND
|
923
|
-
{
|
924
|
-
result = s(:case, nil, *val[2])
|
925
|
-
}
|
926
|
-
| kCASE opt_terms kELSE compstmt kEND
|
927
|
-
{
|
928
|
-
result = s(:case, nil, val[3])
|
929
|
-
}
|
930
|
-
| kFOR for_var kIN
|
931
|
-
{
|
932
|
-
lexer.cond_push 1
|
933
|
-
result = lexer.line
|
934
|
-
}
|
935
|
-
expr_value do
|
936
|
-
{
|
937
|
-
lexer.cond_pop
|
938
|
-
}
|
939
|
-
compstmt kEND
|
940
|
-
{
|
941
|
-
result = s(:for, val[4], val[1], val[7])
|
942
|
-
}
|
943
|
-
| kCLASS cpath superclass
|
944
|
-
{
|
945
|
-
# ...
|
946
|
-
}
|
947
|
-
bodystmt kEND
|
948
|
-
{
|
949
|
-
result = new_class val[0], val[1], val[2], val[4], val[5]
|
950
|
-
}
|
951
|
-
| kCLASS tLSHFT
|
952
|
-
{
|
953
|
-
result = lexer.line
|
954
|
-
}
|
955
|
-
expr term
|
956
|
-
{
|
957
|
-
# ...
|
958
|
-
}
|
959
|
-
bodystmt kEND
|
960
|
-
{
|
961
|
-
result = new_sclass(val[0], val[3], val[6], val[7])
|
962
|
-
}
|
963
|
-
| kMODULE
|
964
|
-
{
|
965
|
-
result = lexer.line
|
966
|
-
}
|
967
|
-
cpath
|
968
|
-
{
|
969
|
-
# ...
|
970
|
-
}
|
971
|
-
bodystmt kEND
|
972
|
-
{
|
973
|
-
result = new_module(val[0], val[2], val[4], val[5])
|
974
|
-
}
|
975
|
-
| kDEF fname
|
976
|
-
{
|
977
|
-
push_scope
|
978
|
-
}
|
979
|
-
f_arglist bodystmt kEND
|
980
|
-
{
|
981
|
-
result = new_def(val[0], nil, val[1], val[3], val[4], val[5])
|
982
|
-
pop_scope
|
983
|
-
}
|
984
|
-
| kDEF singleton dot_or_colon
|
985
|
-
{
|
986
|
-
lexer.lex_state = :expr_fname
|
987
|
-
}
|
988
|
-
fname
|
989
|
-
{
|
990
|
-
push_scope
|
991
|
-
lexer.lex_state = :expr_endfn
|
992
|
-
}
|
993
|
-
f_arglist bodystmt kEND
|
994
|
-
{
|
995
|
-
result = new_def(val[0], val[1], val[4], val[6], val[7], val[8])
|
996
|
-
pop_scope
|
997
|
-
}
|
998
|
-
| kBREAK
|
999
|
-
{
|
1000
|
-
result = new_break(val[0])
|
1001
|
-
}
|
1002
|
-
| kNEXT
|
1003
|
-
{
|
1004
|
-
result = s(:next)
|
1005
|
-
}
|
1006
|
-
| kREDO
|
1007
|
-
{
|
1008
|
-
result = s(:redo)
|
1009
|
-
}
|
1010
|
-
| kRETRY
|
1011
|
-
|
1012
|
-
primary_value: primary
|
1013
|
-
|
1014
|
-
then: term
|
1015
|
-
| tCOLON
|
1016
|
-
| kTHEN
|
1017
|
-
| term kTHEN
|
1018
|
-
|
1019
|
-
do: term
|
1020
|
-
| tCOLON
|
1021
|
-
| kDO_COND
|
1022
|
-
|
1023
|
-
|
1024
|
-
opt_bv_decl: opt_nl
|
1025
|
-
{
|
1026
|
-
result = []
|
1027
|
-
}
|
1028
|
-
| opt_nl tSEMI bv_decls opt_nl
|
1029
|
-
{
|
1030
|
-
result = val[2]
|
1031
|
-
}
|
1032
|
-
|
1033
|
-
bv_decls: bvar
|
1034
|
-
{
|
1035
|
-
result = [ val[0] ]
|
1036
|
-
}
|
1037
|
-
| bv_decls tCOMMA bvar
|
1038
|
-
{
|
1039
|
-
result = val[0] << val[2]
|
1040
|
-
}
|
1041
|
-
|
1042
|
-
bvar: tIDENTIFIER
|
1043
|
-
{
|
1044
|
-
result = new_shadowarg(val[0])
|
1045
|
-
}
|
1046
|
-
| f_bad_arg
|
1047
|
-
|
1048
|
-
lambda: f_larglist lambda_body
|
1049
|
-
{
|
1050
|
-
result = new_call nil, [:lambda, []], []
|
1051
|
-
result << new_iter(val[0], val[1])
|
1052
|
-
}
|
1053
|
-
|
1054
|
-
f_larglist: tLPAREN2 block_param tRPAREN
|
1055
|
-
{
|
1056
|
-
result = new_block_args(*val[1])
|
1057
|
-
}
|
1058
|
-
| tLPAREN2 tRPAREN
|
1059
|
-
{
|
1060
|
-
result = nil
|
1061
|
-
}
|
1062
|
-
| block_param
|
1063
|
-
{
|
1064
|
-
result = new_block_args(*val[0])
|
1065
|
-
}
|
1066
|
-
| none
|
1067
|
-
|
1068
|
-
lambda_body: tLAMBEG compstmt tRCURLY
|
1069
|
-
{
|
1070
|
-
result = val[1]
|
1071
|
-
}
|
1072
|
-
| kDO_LAMBDA compstmt kEND
|
1073
|
-
{
|
1074
|
-
result = val[1]
|
1075
|
-
}
|
1076
|
-
|
1077
|
-
if_tail: opt_else
|
1078
|
-
{
|
1079
|
-
result = val[0]
|
1080
|
-
}
|
1081
|
-
| kELSIF expr_value then compstmt if_tail
|
1082
|
-
{
|
1083
|
-
result = new_if(val[0], val[1], val[3], val[4])
|
1084
|
-
}
|
1085
|
-
|
1086
|
-
opt_else: none
|
1087
|
-
| kELSE compstmt
|
1088
|
-
{
|
1089
|
-
result = val[1]
|
1090
|
-
}
|
1091
|
-
|
1092
|
-
f_block_optarg: f_block_opt
|
1093
|
-
{
|
1094
|
-
result = s(:block, val[0])
|
1095
|
-
}
|
1096
|
-
| f_block_optarg tCOMMA f_block_opt
|
1097
|
-
{
|
1098
|
-
val[0] << val[2]
|
1099
|
-
result = val[0]
|
1100
|
-
}
|
1101
|
-
|
1102
|
-
f_block_opt: tIDENTIFIER tEQL primary_value
|
1103
|
-
{
|
1104
|
-
result = new_assign(new_assignable(new_ident(
|
1105
|
-
val[0])), val[1], val[2])
|
1106
|
-
}
|
1107
|
-
|
1108
|
-
opt_block_var: none
|
1109
|
-
| tPIPE opt_bv_decl tPIPE
|
1110
|
-
{
|
1111
|
-
result = new_block_args(nil, [val[1]])
|
1112
|
-
}
|
1113
|
-
| tOROP
|
1114
|
-
{
|
1115
|
-
result = nil
|
1116
|
-
}
|
1117
|
-
| tPIPE block_param opt_bv_decl tPIPE
|
1118
|
-
{
|
1119
|
-
val[1] << val[2]
|
1120
|
-
result = new_block_args(*val[1])
|
1121
|
-
}
|
1122
|
-
|
1123
|
-
block_args_tail: f_block_kwarg tCOMMA f_kwrest opt_f_block_arg
|
1124
|
-
{
|
1125
|
-
result = [val[0], val[2], val[3]]
|
1126
|
-
}
|
1127
|
-
| f_block_kwarg opt_f_block_arg
|
1128
|
-
{
|
1129
|
-
result = [val[0], nil, val[1]]
|
1130
|
-
}
|
1131
|
-
| f_kwrest opt_f_block_arg
|
1132
|
-
{
|
1133
|
-
result = [nil, val[0], val[1]]
|
1134
|
-
}
|
1135
|
-
| f_block_arg
|
1136
|
-
{
|
1137
|
-
result = [nil, nil, val[0]]
|
1138
|
-
}
|
1139
|
-
|
1140
|
-
opt_block_args_tail: tCOMMA block_args_tail
|
1141
|
-
{
|
1142
|
-
result = val[1]
|
1143
|
-
}
|
1144
|
-
| none
|
1145
|
-
{
|
1146
|
-
nil
|
1147
|
-
}
|
1148
|
-
|
1149
|
-
block_param: f_arg tCOMMA f_block_optarg tCOMMA f_rest_arg opt_block_args_tail
|
1150
|
-
{
|
1151
|
-
optarg = new_optarg(val[2])
|
1152
|
-
restarg = new_restarg(val[4])
|
1153
|
-
result = [val[0] + optarg + restarg, val[5]]
|
1154
|
-
}
|
1155
|
-
| f_arg tCOMMA f_block_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
|
1156
|
-
{
|
1157
|
-
optarg = new_optarg(val[2])
|
1158
|
-
restarg = new_restarg(val[4])
|
1159
|
-
result = [val[0] + optarg + restarg + val[6], val[7]]
|
1160
|
-
}
|
1161
|
-
| f_arg tCOMMA f_block_optarg opt_block_args_tail
|
1162
|
-
{
|
1163
|
-
optarg = new_optarg(val[2])
|
1164
|
-
result = [val[0] + optarg, val[3]]
|
1165
|
-
}
|
1166
|
-
| f_arg tCOMMA f_block_optarg tCOMMA f_arg opt_block_args_tail
|
1167
|
-
{
|
1168
|
-
optarg = new_optarg(val[2])
|
1169
|
-
result = [val[0] + optarg + val[4], val[5]]
|
1170
|
-
}
|
1171
|
-
| f_arg tCOMMA f_rest_arg opt_block_args_tail
|
1172
|
-
{
|
1173
|
-
restarg = new_restarg(val[2])
|
1174
|
-
result = [val[0] + restarg, val[3]]
|
1175
|
-
}
|
1176
|
-
| f_arg tCOMMA
|
1177
|
-
{
|
1178
|
-
val[0] << nil
|
1179
|
-
result = [val[0], nil]
|
1180
|
-
}
|
1181
|
-
| f_arg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
|
1182
|
-
{
|
1183
|
-
restarg = new_restarg(val[2])
|
1184
|
-
result = [val[0] + restarg + val[4], val[5]]
|
1185
|
-
}
|
1186
|
-
| f_arg opt_block_args_tail
|
1187
|
-
{
|
1188
|
-
result = [val[0], val[1]]
|
1189
|
-
}
|
1190
|
-
| f_block_optarg tCOMMA f_rest_arg opt_block_args_tail
|
1191
|
-
{
|
1192
|
-
optarg = new_optarg(val[0])
|
1193
|
-
restarg = new_restarg(val[2])
|
1194
|
-
result = [optarg + restarg, val[3]]
|
1195
|
-
}
|
1196
|
-
| f_block_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_block_args_tail
|
1197
|
-
{
|
1198
|
-
optarg = new_optarg(val[0])
|
1199
|
-
restarg = new_restarg(val[2])
|
1200
|
-
result = [optarg + restarg + val[4], val[5]]
|
1201
|
-
}
|
1202
|
-
| f_block_optarg opt_block_args_tail
|
1203
|
-
{
|
1204
|
-
optarg= new_optarg(val[0])
|
1205
|
-
result = [optarg, val[1]]
|
1206
|
-
}
|
1207
|
-
| f_block_optarg tCOMMA f_arg opt_block_args_tail
|
1208
|
-
{
|
1209
|
-
optarg = new_optarg(val[0])
|
1210
|
-
result = [optarg + val[2], val[3]]
|
1211
|
-
}
|
1212
|
-
| f_rest_arg opt_block_args_tail
|
1213
|
-
{
|
1214
|
-
restarg = new_restarg(val[0])
|
1215
|
-
result = [restarg, val[1]]
|
1216
|
-
}
|
1217
|
-
| f_rest_arg tCOMMA f_arg opt_block_args_tail
|
1218
|
-
{
|
1219
|
-
restarg = new_restarg(val[0])
|
1220
|
-
result = [restarg + val[2], val[3]]
|
1221
|
-
}
|
1222
|
-
| block_args_tail
|
1223
|
-
{
|
1224
|
-
result = [nil, val[0]]
|
1225
|
-
}
|
1226
|
-
|
1227
|
-
do_block: kDO_BLOCK
|
1228
|
-
{
|
1229
|
-
push_scope :block
|
1230
|
-
result = lexer.line
|
1231
|
-
}
|
1232
|
-
opt_block_var compstmt kEND
|
1233
|
-
{
|
1234
|
-
result = new_iter val[2], val[3]
|
1235
|
-
pop_scope
|
1236
|
-
}
|
1237
|
-
|
1238
|
-
block_call: command do_block
|
1239
|
-
{
|
1240
|
-
val[0] << val[1]
|
1241
|
-
result = val[0]
|
1242
|
-
}
|
1243
|
-
| block_call tJSDOT operation2 opt_paren_args
|
1244
|
-
| block_call tDOT operation2 opt_paren_args
|
1245
|
-
| block_call tCOLON2 operation2 opt_paren_args
|
1246
|
-
|
1247
|
-
method_call: operation paren_args
|
1248
|
-
{
|
1249
|
-
result = new_call(nil, val[0], val[1])
|
1250
|
-
}
|
1251
|
-
| primary_value tDOT operation2 opt_paren_args
|
1252
|
-
{
|
1253
|
-
result = new_call(val[0], val[2], val[3])
|
1254
|
-
}
|
1255
|
-
| primary_value tJSDOT operation2 opt_paren_args
|
1256
|
-
{
|
1257
|
-
result = new_js_call(val[0], val[2], val[3])
|
1258
|
-
}
|
1259
|
-
| primary_value tDOT paren_args
|
1260
|
-
{
|
1261
|
-
result = new_call(val[0], [:call, []], val[2])
|
1262
|
-
}
|
1263
|
-
| primary_value tCOLON2 operation2 paren_args
|
1264
|
-
{
|
1265
|
-
result = new_call(val[0], val[2], val[3])
|
1266
|
-
}
|
1267
|
-
| primary_value tCOLON2 operation3
|
1268
|
-
{
|
1269
|
-
result = new_call(val[0], val[2])
|
1270
|
-
}
|
1271
|
-
| kSUPER paren_args
|
1272
|
-
{
|
1273
|
-
result = new_super(val[0], val[1])
|
1274
|
-
}
|
1275
|
-
| kSUPER
|
1276
|
-
{
|
1277
|
-
result = new_super(val[0], nil)
|
1278
|
-
}
|
1279
|
-
|
1280
|
-
brace_block: tLCURLY
|
1281
|
-
{
|
1282
|
-
push_scope :block
|
1283
|
-
result = lexer.line
|
1284
|
-
}
|
1285
|
-
opt_block_var compstmt tRCURLY
|
1286
|
-
{
|
1287
|
-
result = new_iter val[2], val[3]
|
1288
|
-
pop_scope
|
1289
|
-
}
|
1290
|
-
| kDO
|
1291
|
-
{
|
1292
|
-
push_scope :block
|
1293
|
-
result = lexer.line
|
1294
|
-
}
|
1295
|
-
opt_block_var compstmt kEND
|
1296
|
-
{
|
1297
|
-
result = new_iter val[2], val[3]
|
1298
|
-
pop_scope
|
1299
|
-
}
|
1300
|
-
|
1301
|
-
case_body: kWHEN
|
1302
|
-
{
|
1303
|
-
result = lexer.line
|
1304
|
-
}
|
1305
|
-
args then compstmt cases
|
1306
|
-
{
|
1307
|
-
part = s(:when, s(:array, *val[2]), val[4])
|
1308
|
-
result = [part]
|
1309
|
-
result.push(*val[5]) if val[5]
|
1310
|
-
}
|
1311
|
-
|
1312
|
-
cases: opt_else
|
1313
|
-
{
|
1314
|
-
result = [val[0]]
|
1315
|
-
}
|
1316
|
-
| case_body
|
1317
|
-
|
1318
|
-
opt_rescue: kRESCUE exc_list exc_var then compstmt opt_rescue
|
1319
|
-
{
|
1320
|
-
exc = val[1] || s(:array)
|
1321
|
-
exc << new_assign(val[2], val[2], s(:gvar, '$!'.intern)) if val[2]
|
1322
|
-
result = [s(:resbody, exc, val[4])]
|
1323
|
-
result.concat val[5] if val[5]
|
1324
|
-
}
|
1325
|
-
| # none
|
1326
|
-
{
|
1327
|
-
result = nil
|
1328
|
-
}
|
1329
|
-
|
1330
|
-
exc_list: arg_value
|
1331
|
-
{
|
1332
|
-
result = s(:array, val[0])
|
1333
|
-
}
|
1334
|
-
| mrhs
|
1335
|
-
| none
|
1336
|
-
|
1337
|
-
exc_var: tASSOC lhs
|
1338
|
-
{
|
1339
|
-
result = val[1]
|
1340
|
-
}
|
1341
|
-
| none
|
1342
|
-
{
|
1343
|
-
result = nil
|
1344
|
-
}
|
1345
|
-
|
1346
|
-
opt_ensure: kENSURE compstmt
|
1347
|
-
{
|
1348
|
-
result = val[1].nil? ? s(:nil) : val[1]
|
1349
|
-
}
|
1350
|
-
| none
|
1351
|
-
|
1352
|
-
literal: numeric
|
1353
|
-
| symbol
|
1354
|
-
| dsym
|
1355
|
-
|
1356
|
-
strings: string
|
1357
|
-
{
|
1358
|
-
result = new_str val[0]
|
1359
|
-
}
|
1360
|
-
|
1361
|
-
string: string1
|
1362
|
-
| string string1
|
1363
|
-
{
|
1364
|
-
result = str_append val[0], val[1]
|
1365
|
-
}
|
1366
|
-
|
1367
|
-
string1: tSTRING_BEG string_contents tSTRING_END
|
1368
|
-
{
|
1369
|
-
result = val[1]
|
1370
|
-
}
|
1371
|
-
| tSTRING
|
1372
|
-
{
|
1373
|
-
result = s(:str, value(val[0]))
|
1374
|
-
}
|
1375
|
-
|
1376
|
-
xstring: tXSTRING_BEG xstring_contents tSTRING_END
|
1377
|
-
{
|
1378
|
-
result = new_xstr(val[0], val[1], val[2])
|
1379
|
-
}
|
1380
|
-
|
1381
|
-
regexp: tREGEXP_BEG xstring_contents tREGEXP_END
|
1382
|
-
{
|
1383
|
-
result = new_regexp val[1], val[2]
|
1384
|
-
}
|
1385
|
-
|
1386
|
-
words: tWORDS_BEG tSPACE tSTRING_END
|
1387
|
-
{
|
1388
|
-
result = s(:array)
|
1389
|
-
}
|
1390
|
-
| tWORDS_BEG word_list tSTRING_END
|
1391
|
-
{
|
1392
|
-
result = val[1]
|
1393
|
-
}
|
1394
|
-
|
1395
|
-
word_list: none
|
1396
|
-
{
|
1397
|
-
result = s(:array)
|
1398
|
-
}
|
1399
|
-
| word_list word tSPACE
|
1400
|
-
{
|
1401
|
-
part = val[1]
|
1402
|
-
part = s(:dstr, "", val[1]) if part.type == :evstr
|
1403
|
-
result = val[0] << part
|
1404
|
-
}
|
1405
|
-
|
1406
|
-
word: string_content
|
1407
|
-
{
|
1408
|
-
result = val[0]
|
1409
|
-
}
|
1410
|
-
| word string_content
|
1411
|
-
{
|
1412
|
-
result = val[0].concat([val[1]])
|
1413
|
-
}
|
1414
|
-
|
1415
|
-
awords: tAWORDS_BEG tSPACE tSTRING_END
|
1416
|
-
{
|
1417
|
-
result = s(:array)
|
1418
|
-
}
|
1419
|
-
| tAWORDS_BEG qword_list tSTRING_END
|
1420
|
-
{
|
1421
|
-
result = val[1]
|
1422
|
-
}
|
1423
|
-
|
1424
|
-
qword_list: none
|
1425
|
-
{
|
1426
|
-
result = s(:array)
|
1427
|
-
}
|
1428
|
-
| qword_list tSTRING_CONTENT tSPACE
|
1429
|
-
{
|
1430
|
-
result = val[0] << s(:str, value(val[1]))
|
1431
|
-
}
|
1432
|
-
|
1433
|
-
string_contents: none
|
1434
|
-
{
|
1435
|
-
result = nil
|
1436
|
-
}
|
1437
|
-
| string_contents string_content
|
1438
|
-
{
|
1439
|
-
result = str_append val[0], val[1]
|
1440
|
-
}
|
1441
|
-
|
1442
|
-
xstring_contents: none
|
1443
|
-
{
|
1444
|
-
result = nil
|
1445
|
-
}
|
1446
|
-
| xstring_contents string_content
|
1447
|
-
{
|
1448
|
-
result = str_append val[0], val[1]
|
1449
|
-
}
|
1450
|
-
|
1451
|
-
string_content: tSTRING_CONTENT
|
1452
|
-
{
|
1453
|
-
result = new_str_content(val[0])
|
1454
|
-
}
|
1455
|
-
| tSTRING_DVAR
|
1456
|
-
{
|
1457
|
-
result = lexer.strterm
|
1458
|
-
lexer.strterm = nil
|
1459
|
-
}
|
1460
|
-
string_dvar
|
1461
|
-
{
|
1462
|
-
lexer.strterm = val[1]
|
1463
|
-
result = new_evstr(val[2])
|
1464
|
-
}
|
1465
|
-
| tSTRING_DBEG
|
1466
|
-
{
|
1467
|
-
lexer.cond_push 0
|
1468
|
-
lexer.cmdarg_push 0
|
1469
|
-
result = lexer.strterm
|
1470
|
-
lexer.strterm = nil
|
1471
|
-
lexer.lex_state = :expr_beg
|
1472
|
-
}
|
1473
|
-
compstmt tRCURLY
|
1474
|
-
{
|
1475
|
-
lexer.strterm = val[1]
|
1476
|
-
lexer.cond_lexpop
|
1477
|
-
lexer.cmdarg_lexpop
|
1478
|
-
result = new_evstr(val[2])
|
1479
|
-
}
|
1480
|
-
|
1481
|
-
string_dvar: tGVAR
|
1482
|
-
{
|
1483
|
-
result = new_gvar(val[0])
|
1484
|
-
}
|
1485
|
-
| tIVAR
|
1486
|
-
{
|
1487
|
-
result = new_ivar(val[0])
|
1488
|
-
}
|
1489
|
-
| tCVAR
|
1490
|
-
{
|
1491
|
-
result = new_cvar(val[0])
|
1492
|
-
}
|
1493
|
-
| backref
|
1494
|
-
|
1495
|
-
|
1496
|
-
symbol: tSYMBEG sym
|
1497
|
-
{
|
1498
|
-
result = new_sym(val[1])
|
1499
|
-
lexer.lex_state = :expr_end
|
1500
|
-
}
|
1501
|
-
| tSYMBOL
|
1502
|
-
{
|
1503
|
-
result = new_sym(val[0])
|
1504
|
-
}
|
1505
|
-
|
1506
|
-
sym: fname
|
1507
|
-
| tIVAR
|
1508
|
-
| tGVAR
|
1509
|
-
| tCVAR
|
1510
|
-
|
1511
|
-
dsym: tSYMBEG xstring_contents tSTRING_END
|
1512
|
-
{
|
1513
|
-
result = new_dsym val[1]
|
1514
|
-
}
|
1515
|
-
|
1516
|
-
numeric: tINTEGER
|
1517
|
-
{
|
1518
|
-
result = new_int(val[0])
|
1519
|
-
}
|
1520
|
-
| tFLOAT
|
1521
|
-
{
|
1522
|
-
result = new_float(val[0])
|
1523
|
-
}
|
1524
|
-
| '-@NUM' tINTEGER =tUMINUS
|
1525
|
-
{
|
1526
|
-
result = negate_num(new_int(val[1]))
|
1527
|
-
}
|
1528
|
-
| '-@NUM' tFLOAT =tUMINUS
|
1529
|
-
{
|
1530
|
-
result = negate_num(new_float(val[1]))
|
1531
|
-
}
|
1532
|
-
| '+@NUM' tINTEGER
|
1533
|
-
{
|
1534
|
-
result = new_int(val[1])
|
1535
|
-
}
|
1536
|
-
| '+@NUM' tFLOAT
|
1537
|
-
{
|
1538
|
-
result = new_float(val[1])
|
1539
|
-
}
|
1540
|
-
|
1541
|
-
variable: tIDENTIFIER
|
1542
|
-
{
|
1543
|
-
result = new_ident(val[0])
|
1544
|
-
}
|
1545
|
-
| tIVAR
|
1546
|
-
{
|
1547
|
-
result = new_ivar(val[0])
|
1548
|
-
}
|
1549
|
-
| tGVAR
|
1550
|
-
{
|
1551
|
-
result = new_gvar(val[0])
|
1552
|
-
}
|
1553
|
-
| tCONSTANT
|
1554
|
-
{
|
1555
|
-
result = new_const(val[0])
|
1556
|
-
}
|
1557
|
-
| tCVAR
|
1558
|
-
{
|
1559
|
-
result = new_cvar(val[0])
|
1560
|
-
}
|
1561
|
-
| kNIL
|
1562
|
-
{
|
1563
|
-
result = new_nil(val[0])
|
1564
|
-
}
|
1565
|
-
| kSELF
|
1566
|
-
{
|
1567
|
-
result = new_self(val[0])
|
1568
|
-
}
|
1569
|
-
| kTRUE
|
1570
|
-
{
|
1571
|
-
result = new_true(val[0])
|
1572
|
-
}
|
1573
|
-
| kFALSE
|
1574
|
-
{
|
1575
|
-
result = new_false(val[0])
|
1576
|
-
}
|
1577
|
-
| k__FILE__
|
1578
|
-
{
|
1579
|
-
result = new___FILE__(val[0])
|
1580
|
-
}
|
1581
|
-
| k__LINE__
|
1582
|
-
{
|
1583
|
-
result = new___LINE__(val[0])
|
1584
|
-
}
|
1585
|
-
|
1586
|
-
var_ref: variable
|
1587
|
-
{
|
1588
|
-
result = new_var_ref(val[0])
|
1589
|
-
}
|
1590
|
-
|
1591
|
-
var_lhs: variable
|
1592
|
-
{
|
1593
|
-
result = new_assignable val[0]
|
1594
|
-
}
|
1595
|
-
|
1596
|
-
backref: tNTH_REF
|
1597
|
-
{
|
1598
|
-
result = s(:nth_ref, value(val[0]))
|
1599
|
-
}
|
1600
|
-
| tBACK_REF
|
1601
|
-
|
1602
|
-
superclass: term
|
1603
|
-
{
|
1604
|
-
result = nil
|
1605
|
-
}
|
1606
|
-
| tLT expr_value term
|
1607
|
-
{
|
1608
|
-
result = val[1]
|
1609
|
-
}
|
1610
|
-
| error term
|
1611
|
-
{
|
1612
|
-
result = nil
|
1613
|
-
}
|
1614
|
-
|
1615
|
-
f_arglist: tLPAREN2 f_args opt_bv_decl tRPAREN
|
1616
|
-
{
|
1617
|
-
result = val[1]
|
1618
|
-
lexer.lex_state = :expr_beg
|
1619
|
-
}
|
1620
|
-
| f_args term
|
1621
|
-
{
|
1622
|
-
result = val[0]
|
1623
|
-
lexer.lex_state = :expr_beg
|
1624
|
-
}
|
1625
|
-
|
1626
|
-
kwrest_mark: tPOW
|
1627
|
-
| tDSTAR
|
1628
|
-
|
1629
|
-
f_kwrest: kwrest_mark tIDENTIFIER
|
1630
|
-
{
|
1631
|
-
result = new_kwrestarg(val[1])
|
1632
|
-
}
|
1633
|
-
| kwrest_mark
|
1634
|
-
{
|
1635
|
-
result = new_kwrestarg()
|
1636
|
-
}
|
1637
|
-
|
1638
|
-
f_label: tLABEL
|
1639
|
-
{
|
1640
|
-
result = new_sym(val[0])
|
1641
|
-
}
|
1642
|
-
|
1643
|
-
f_kw: f_label arg_value
|
1644
|
-
{
|
1645
|
-
result = new_kwoptarg(val[0], val[1])
|
1646
|
-
}
|
1647
|
-
| f_label
|
1648
|
-
{
|
1649
|
-
result = new_kwarg(val[0])
|
1650
|
-
}
|
1651
|
-
|
1652
|
-
f_block_kw: f_label primary_value
|
1653
|
-
{
|
1654
|
-
result = new_kwoptarg(val[0], val[1])
|
1655
|
-
}
|
1656
|
-
| f_label
|
1657
|
-
{
|
1658
|
-
result = new_kwarg(val[0])
|
1659
|
-
}
|
1660
|
-
|
1661
|
-
f_block_kwarg: f_block_kw
|
1662
|
-
{
|
1663
|
-
result = [val[0]]
|
1664
|
-
}
|
1665
|
-
| f_block_kwarg tCOMMA f_block_kw
|
1666
|
-
{
|
1667
|
-
result = val[0]
|
1668
|
-
result << val[2]
|
1669
|
-
}
|
1670
|
-
|
1671
|
-
f_kwarg: f_kw
|
1672
|
-
{
|
1673
|
-
result = [val[0]]
|
1674
|
-
}
|
1675
|
-
| f_kwarg tCOMMA f_kw
|
1676
|
-
{
|
1677
|
-
result = val[0]
|
1678
|
-
result << val[2]
|
1679
|
-
}
|
1680
|
-
|
1681
|
-
args_tail: f_kwarg tCOMMA f_kwrest opt_f_block_arg
|
1682
|
-
{
|
1683
|
-
result = new_args_tail(val[0], val[2], val[3])
|
1684
|
-
}
|
1685
|
-
| f_kwarg opt_f_block_arg
|
1686
|
-
{
|
1687
|
-
result = new_args_tail(val[0], nil, val[1])
|
1688
|
-
}
|
1689
|
-
| f_kwrest opt_f_block_arg
|
1690
|
-
{
|
1691
|
-
result = new_args_tail(nil, val[0], val[1])
|
1692
|
-
}
|
1693
|
-
| f_block_arg
|
1694
|
-
{
|
1695
|
-
result = new_args_tail(nil, nil, val[0])
|
1696
|
-
}
|
1697
|
-
|
1698
|
-
opt_args_tail: tCOMMA args_tail
|
1699
|
-
{
|
1700
|
-
result = val[1]
|
1701
|
-
}
|
1702
|
-
| # none
|
1703
|
-
{
|
1704
|
-
result = new_args_tail(nil, nil, nil)
|
1705
|
-
}
|
1706
|
-
|
1707
|
-
f_args: f_arg tCOMMA f_optarg tCOMMA f_rest_arg opt_args_tail
|
1708
|
-
{
|
1709
|
-
optarg = new_optarg(val[2])
|
1710
|
-
restarg = new_restarg(val[4])
|
1711
|
-
result = new_args(val[0] + optarg + restarg, val[5])
|
1712
|
-
}
|
1713
|
-
| f_arg tCOMMA f_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_args_tail
|
1714
|
-
{
|
1715
|
-
optarg = new_optarg(val[2])
|
1716
|
-
restarg = new_restarg(val[4])
|
1717
|
-
result = new_args(val[0] + optarg + restarg + val[6], val[7])
|
1718
|
-
}
|
1719
|
-
| f_arg tCOMMA f_optarg opt_args_tail
|
1720
|
-
{
|
1721
|
-
optarg = new_optarg(val[2])
|
1722
|
-
result = new_args(val[0] + optarg, val[3])
|
1723
|
-
}
|
1724
|
-
| f_arg tCOMMA f_optarg tCOMMA f_arg opt_args_tail
|
1725
|
-
{
|
1726
|
-
optarg = new_optarg(val[2])
|
1727
|
-
result = new_args(val[0] + optarg + val[4], val[5])
|
1728
|
-
}
|
1729
|
-
| f_arg tCOMMA f_rest_arg opt_args_tail
|
1730
|
-
{
|
1731
|
-
restarg = new_restarg(val[2])
|
1732
|
-
result = new_args(val[0] + restarg, val[3])
|
1733
|
-
}
|
1734
|
-
| f_arg tCOMMA f_rest_arg tCOMMA f_arg opt_args_tail
|
1735
|
-
{
|
1736
|
-
restarg = new_restarg(val[2])
|
1737
|
-
result = new_args(val[0] + restarg + val[4], val[5])
|
1738
|
-
}
|
1739
|
-
| f_arg opt_args_tail
|
1740
|
-
{
|
1741
|
-
result = new_args(val[0], val[1])
|
1742
|
-
}
|
1743
|
-
| f_optarg tCOMMA f_rest_arg opt_args_tail
|
1744
|
-
{
|
1745
|
-
optarg = new_optarg(val[0])
|
1746
|
-
restarg = new_restarg(val[2])
|
1747
|
-
result = new_args(optarg + restarg, val[3])
|
1748
|
-
}
|
1749
|
-
| f_optarg tCOMMA f_rest_arg tCOMMA f_arg opt_args_tail
|
1750
|
-
{
|
1751
|
-
optarg = new_optarg(val[0])
|
1752
|
-
restarg = new_restarg(val[2])
|
1753
|
-
result = new_args(optarg + restarg + val[4], val[5])
|
1754
|
-
}
|
1755
|
-
| f_optarg opt_args_tail
|
1756
|
-
{
|
1757
|
-
optarg = new_optarg(val[0])
|
1758
|
-
result = new_args(optarg, val[1])
|
1759
|
-
}
|
1760
|
-
| f_optarg tCOMMA f_arg opt_args_tail
|
1761
|
-
{
|
1762
|
-
optarg = new_optarg(val[0])
|
1763
|
-
result = new_args(optarg + val[2], val[3])
|
1764
|
-
}
|
1765
|
-
| f_rest_arg opt_args_tail
|
1766
|
-
{
|
1767
|
-
optarg = new_restarg(val[0])
|
1768
|
-
result = new_args(optarg, val[1])
|
1769
|
-
}
|
1770
|
-
| f_rest_arg tCOMMA f_arg opt_args_tail
|
1771
|
-
{
|
1772
|
-
restarg = new_restarg(val[0])
|
1773
|
-
result = new_args(restarg + val[2], val[3])
|
1774
|
-
}
|
1775
|
-
| args_tail
|
1776
|
-
{
|
1777
|
-
result = new_args(nil, val[0])
|
1778
|
-
}
|
1779
|
-
| # none
|
1780
|
-
{
|
1781
|
-
result = new_args(nil, nil)
|
1782
|
-
}
|
1783
|
-
|
1784
|
-
f_norm_arg: f_bad_arg
|
1785
|
-
| tIDENTIFIER
|
1786
|
-
{
|
1787
|
-
result = value(val[0]).to_sym
|
1788
|
-
scope.add_local result
|
1789
|
-
}
|
1790
|
-
|
1791
|
-
f_bad_arg: tCONSTANT
|
1792
|
-
{
|
1793
|
-
raise 'formal argument cannot be a constant'
|
1794
|
-
}
|
1795
|
-
| tIVAR
|
1796
|
-
{
|
1797
|
-
raise 'formal argument cannot be an instance variable'
|
1798
|
-
}
|
1799
|
-
| tCVAR
|
1800
|
-
{
|
1801
|
-
raise 'formal argument cannot be a class variable'
|
1802
|
-
}
|
1803
|
-
| tGVAR
|
1804
|
-
{
|
1805
|
-
raise 'formal argument cannot be a global variable'
|
1806
|
-
}
|
1807
|
-
|
1808
|
-
f_arg_item: f_norm_arg
|
1809
|
-
{
|
1810
|
-
result = val[0]
|
1811
|
-
}
|
1812
|
-
| tLPAREN f_margs tRPAREN
|
1813
|
-
{
|
1814
|
-
result = val[1]
|
1815
|
-
}
|
1816
|
-
|
1817
|
-
for_var: lhs
|
1818
|
-
| mlhs
|
1819
|
-
|
1820
|
-
f_marg: f_norm_arg
|
1821
|
-
{
|
1822
|
-
result = s(:arg, val[0])
|
1823
|
-
}
|
1824
|
-
| tLPAREN f_margs tRPAREN
|
1825
|
-
{
|
1826
|
-
result = val[1]
|
1827
|
-
}
|
1828
|
-
|
1829
|
-
f_marg_list: f_marg
|
1830
|
-
{
|
1831
|
-
result = s(:mlhs, val[0])
|
1832
|
-
}
|
1833
|
-
| f_marg_list tCOMMA f_marg
|
1834
|
-
{
|
1835
|
-
val[0] << val[2]
|
1836
|
-
result = val[0]
|
1837
|
-
}
|
1838
|
-
|
1839
|
-
f_margs: f_marg_list
|
1840
|
-
| f_marg_list tCOMMA tSTAR f_norm_arg
|
1841
|
-
{
|
1842
|
-
result = val[0].push(s(:restarg, val[3]))
|
1843
|
-
}
|
1844
|
-
| f_marg_list tCOMMA tSTAR f_norm_arg tCOMMA f_marg_list
|
1845
|
-
{
|
1846
|
-
result = val[0].push(s(:restarg, val[3])).concat(val[5][1..-1])
|
1847
|
-
}
|
1848
|
-
| f_marg_list tCOMMA tSTAR
|
1849
|
-
{
|
1850
|
-
result = val[0].push(s(:restarg))
|
1851
|
-
}
|
1852
|
-
| f_marg_list tCOMMA tSTAR tCOMMA f_marg_list
|
1853
|
-
{
|
1854
|
-
result = val[0].push(s(:restarg)).concat(val[4][1..-1])
|
1855
|
-
}
|
1856
|
-
| tSTAR f_norm_arg
|
1857
|
-
{
|
1858
|
-
result = s(:mlhs, s(:restarg, val[1]))
|
1859
|
-
}
|
1860
|
-
| tSTAR f_norm_arg tCOMMA f_marg_list
|
1861
|
-
{
|
1862
|
-
val[3].insert(1, s(:restarg, val[1]))
|
1863
|
-
result = val[3]
|
1864
|
-
}
|
1865
|
-
| tSTAR
|
1866
|
-
{
|
1867
|
-
result = s(:mlhs, s(:restarg))
|
1868
|
-
}
|
1869
|
-
| tSTAR tCOMMA f_marg_list
|
1870
|
-
{
|
1871
|
-
val[2].insert(1, s(:restarg))
|
1872
|
-
result = val[2]
|
1873
|
-
}
|
1874
|
-
|
1875
|
-
f_arg: f_arg_item
|
1876
|
-
{
|
1877
|
-
result = [val[0]]
|
1878
|
-
}
|
1879
|
-
| f_arg tCOMMA f_arg_item
|
1880
|
-
{
|
1881
|
-
val[0] << val[2]
|
1882
|
-
result = val[0]
|
1883
|
-
}
|
1884
|
-
|
1885
|
-
f_opt: tIDENTIFIER tEQL arg_value
|
1886
|
-
{
|
1887
|
-
result = new_assign(new_assignable(new_ident(val[0])), val[1], val[2])
|
1888
|
-
}
|
1889
|
-
|
1890
|
-
f_optarg: f_opt
|
1891
|
-
{
|
1892
|
-
result = s(:block, val[0])
|
1893
|
-
}
|
1894
|
-
| f_optarg tCOMMA f_opt
|
1895
|
-
{
|
1896
|
-
result = val[0]
|
1897
|
-
val[0] << val[2]
|
1898
|
-
}
|
1899
|
-
|
1900
|
-
restarg_mark: tSTAR2
|
1901
|
-
| tSTAR
|
1902
|
-
|
1903
|
-
f_rest_arg: restarg_mark tIDENTIFIER
|
1904
|
-
{
|
1905
|
-
result = "*#{value(val[1])}".to_sym
|
1906
|
-
}
|
1907
|
-
| restarg_mark
|
1908
|
-
{
|
1909
|
-
result = :"*"
|
1910
|
-
}
|
1911
|
-
|
1912
|
-
blkarg_mark: tAMPER2
|
1913
|
-
| tAMPER
|
1914
|
-
|
1915
|
-
f_block_arg: blkarg_mark tIDENTIFIER
|
1916
|
-
{
|
1917
|
-
result = "&#{value(val[1])}".to_sym
|
1918
|
-
}
|
1919
|
-
|
1920
|
-
opt_f_block_arg: tCOMMA f_block_arg
|
1921
|
-
{
|
1922
|
-
result = val[1]
|
1923
|
-
}
|
1924
|
-
| # none
|
1925
|
-
{
|
1926
|
-
result = nil
|
1927
|
-
}
|
1928
|
-
|
1929
|
-
singleton: var_ref
|
1930
|
-
{
|
1931
|
-
result = val[0]
|
1932
|
-
}
|
1933
|
-
| tLPAREN2 expr opt_nl tRPAREN
|
1934
|
-
{
|
1935
|
-
result = val[1]
|
1936
|
-
}
|
1937
|
-
|
1938
|
-
assoc_list: # none
|
1939
|
-
{
|
1940
|
-
result = []
|
1941
|
-
}
|
1942
|
-
| assocs trailer
|
1943
|
-
{
|
1944
|
-
result = val[0]
|
1945
|
-
}
|
1946
|
-
|
1947
|
-
assocs: assoc
|
1948
|
-
{
|
1949
|
-
result = val[0]
|
1950
|
-
}
|
1951
|
-
| assocs tCOMMA assoc
|
1952
|
-
{
|
1953
|
-
result = val[0].concat(val[2])
|
1954
|
-
}
|
1955
|
-
|
1956
|
-
assoc: arg_value tASSOC arg_value
|
1957
|
-
{
|
1958
|
-
result = [val[0], val[2]]
|
1959
|
-
}
|
1960
|
-
| tLABEL arg_value
|
1961
|
-
{
|
1962
|
-
result = [new_sym(val[0]), val[1]]
|
1963
|
-
}
|
1964
|
-
| tSTRING_BEG string_contents tLABEL_END arg_value
|
1965
|
-
{
|
1966
|
-
result = [s(:sym, source(val[1]).to_sym), val[3]]
|
1967
|
-
}
|
1968
|
-
| tDSTAR arg_value
|
1969
|
-
{
|
1970
|
-
result = [new_kwsplat(val[1])]
|
1971
|
-
}
|
1972
|
-
|
1973
|
-
operation: tIDENTIFIER
|
1974
|
-
| tCONSTANT
|
1975
|
-
| tFID
|
1976
|
-
|
1977
|
-
operation2: tIDENTIFIER
|
1978
|
-
| tCONSTANT
|
1979
|
-
| tFID
|
1980
|
-
| op
|
1981
|
-
|
1982
|
-
operation3: tIDENTIFIER
|
1983
|
-
| tFID
|
1984
|
-
| op
|
1985
|
-
|
1986
|
-
dot_or_colon: tDOT
|
1987
|
-
| tCOLON2
|
1988
|
-
|
1989
|
-
opt_terms: # none
|
1990
|
-
| terms
|
1991
|
-
|
1992
|
-
opt_nl: # none
|
1993
|
-
| tNL
|
1994
|
-
|
1995
|
-
trailer: # none
|
1996
|
-
| tNL
|
1997
|
-
| tCOMMA
|
1998
|
-
|
1999
|
-
term: tSEMI
|
2000
|
-
| tNL
|
2001
|
-
|
2002
|
-
terms: term
|
2003
|
-
| terms tSEMI
|
2004
|
-
|
2005
|
-
none: # none
|
2006
|
-
{
|
2007
|
-
result = nil
|
2008
|
-
}
|
2009
|
-
end
|
2010
|
-
|
2011
|
-
---- inner
|