Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/prism/translation/ruby_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -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].
*
Expand All @@ -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].
*
Expand Down
6 changes: 5 additions & 1 deletion prism/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}
Expand Down