diff --git a/lib/prism/translation/ruby_parser.rb b/lib/prism/translation/ruby_parser.rb index 5149756addefe4..a33ea2306c1967 100644 --- a/lib/prism/translation/ruby_parser.rb +++ b/lib/prism/translation/ruby_parser.rb @@ -2,12 +2,17 @@ # :markup: markdown begin - require "ruby_parser" + require "sexp" rescue LoadError - warn(%q{Error: Unable to load ruby_parser. Add `gem "ruby_parser"` to your Gemfile.}) + warn(%q{Error: Unable to load sexp. Add `gem "sexp"` to your Gemfile.}) exit(1) end +class RubyParser # :nodoc: + class SyntaxError < RuntimeError # :nodoc: + end +end + module Prism module Translation # This module is the entry-point for converting a prism syntax tree into the diff --git a/numeric.c b/numeric.c index 1942a6164f616a..f96535cd2461d2 100644 --- a/numeric.c +++ b/numeric.c @@ -2601,7 +2601,7 @@ flo_truncate(int argc, VALUE *argv, VALUE num) * floor(ndigits = 0) -> float or integer * * Returns the largest float or integer that is less than or equal to +self+, - * as specified by the given `ndigits`, + * as specified by the given +ndigits+, * which must be an * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects]. * @@ -2621,7 +2621,7 @@ num_floor(int argc, VALUE *argv, VALUE num) * ceil(ndigits = 0) -> float or integer * * Returns the smallest float or integer that is greater than or equal to +self+, - * as specified by the given `ndigits`, + * as specified by the given +ndigits+, * which must be an * {integer-convertible object}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects]. * diff --git a/prism/prism.c b/prism/prism.c index 7059db8f1d6c49..677e65056f8f74 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -2075,7 +2075,10 @@ pm_arguments_node_arguments_append(pm_arguments_node_t *node, pm_node_t *argumen node->base.location.start = argument->location.start; } - node->base.location.end = argument->location.end; + if (node->base.location.end < argument->location.end) { + node->base.location.end = argument->location.end; + } + pm_node_list_append(&node->arguments, argument); if (PM_NODE_TYPE_P(argument, PM_SPLAT_NODE)) { @@ -18492,6 +18495,7 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b // yield node. if (arguments.block != NULL) { pm_parser_err_node(parser, arguments.block, PM_ERR_UNEXPECTED_BLOCK_ARGUMENT); + pm_node_unreference(parser, arguments.block); pm_node_destroy(parser, arguments.block); arguments.block = NULL; }