Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into Ractor-Local-GC-v…
Browse files Browse the repository at this point in the history
…ersion-3
  • Loading branch information
rm155 committed Sep 11, 2024
2 parents 2d0de9f + d4d6f1d commit dcaa144
Show file tree
Hide file tree
Showing 64 changed files with 1,031 additions and 841 deletions.
124 changes: 75 additions & 49 deletions array.c

Large diffs are not rendered by default.

25 changes: 7 additions & 18 deletions array.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
class Array
# call-seq:
# array.each {|element| ... } -> self
# array.each -> Enumerator
# each {|element| ... } -> self
# each -> new_enumerator
#
# Iterates over array elements.
#
# When a block given, passes each successive array element to the block;
# With a block given, iterates over the elements of +self+,
# passing each element to the block;
# returns +self+:
#
# a = [:foo, 'bar', 2]
Expand All @@ -27,20 +26,10 @@ class Array
# foo
# bar
#
# When no block given, returns a new Enumerator:
# a = [:foo, 'bar', 2]
#
# e = a.each
# e # => #<Enumerator: [:foo, "bar", 2]:each>
# a1 = e.each {|element| puts "#{element.class} #{element}" }
#
# Output:
#
# Symbol foo
# String bar
# Integer 2
# With no block given, returns a new Enumerator.
#
# Related: #each_index, #reverse_each.
# Related: see {Methods for Iterating}[rdoc-ref:Array@Methods+for+Iterating].

def each
Primitive.attr! :inline_block

Expand Down
22 changes: 22 additions & 0 deletions ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,10 +783,22 @@ node_locations(VALUE ast_value, const NODE *node)
return rb_ary_new_from_args(2,
location_new(nd_code_loc(node)),
location_new(&RNODE_AND(node)->operator_loc));
case NODE_BREAK:
return rb_ary_new_from_args(2,
location_new(nd_code_loc(node)),
location_new(&RNODE_BREAK(node)->keyword_loc));
case NODE_NEXT:
return rb_ary_new_from_args(2,
location_new(nd_code_loc(node)),
location_new(&RNODE_NEXT(node)->keyword_loc));
case NODE_OR:
return rb_ary_new_from_args(2,
location_new(nd_code_loc(node)),
location_new(&RNODE_OR(node)->operator_loc));
case NODE_REDO:
return rb_ary_new_from_args(2,
location_new(nd_code_loc(node)),
location_new(&RNODE_REDO(node)->keyword_loc));
case NODE_UNDEF:
return rb_ary_new_from_args(2,
location_new(nd_code_loc(node)),
Expand All @@ -806,6 +818,16 @@ node_locations(VALUE ast_value, const NODE *node)
location_new(nd_code_loc(node)),
location_new(&RNODE_WHEN(node)->keyword_loc),
location_new(&RNODE_WHEN(node)->then_keyword_loc));
case NODE_WHILE:
return rb_ary_new_from_args(3,
location_new(nd_code_loc(node)),
location_new(&RNODE_WHILE(node)->keyword_loc),
location_new(&RNODE_WHILE(node)->closing_loc));
case NODE_UNTIL:
return rb_ary_new_from_args(3,
location_new(nd_code_loc(node)),
location_new(&RNODE_UNTIL(node)->keyword_loc),
location_new(&RNODE_UNTIL(node)->closing_loc));
case NODE_ARGS_AUX:
case NODE_LAST:
break;
Expand Down
4 changes: 2 additions & 2 deletions doc/_regexp.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Method Regexp.escape returns an escaped string:
=== Source Literals

The source literal largely behaves like a double-quoted string;
see {String Literals}[rdoc-ref:syntax/literals.rdoc@String+Literals].
see {Double-Quoted String Literals}[rdoc-ref:syntax/literals.rdoc@Double-Quoted+String+Literals].

In particular, a source literal may contain interpolated expressions:

Expand Down Expand Up @@ -1050,7 +1050,7 @@ Example:
re.match('TEst') # => #<MatchData "TEst">
re.match('TEST') # => nil
re.match('teST') # => nil

re = /t(?i:e)st/
re.match('test') # => #<MatchData "test">
re.match('tEst') # => #<MatchData "tEst">
Expand Down
4 changes: 2 additions & 2 deletions doc/syntax/literals.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ sequences are as follows:
The last one, <tt>\<newline></tt>, represents an empty string instead of a character.
It is used to fold a line in a string.

=== Double-quoted \String Literals
=== Double-Quoted \String Literals

The most common way of writing strings is using <tt>"</tt>:

Expand Down Expand Up @@ -213,7 +213,7 @@ See also:

* {% and %Q: Interpolable String Literals}[#label-25+and+-25Q-3A+Interpolable+String+Literals]

=== Single-quoted \String Literals
=== Single-Quoted \String Literals

Interpolation may be disabled by escaping the "#" character or using
single-quoted strings:
Expand Down
2 changes: 1 addition & 1 deletion ext/pathname/lib/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def find(ignore_error: true) # :yield: pathname
return to_enum(__method__, ignore_error: ignore_error) unless block_given?
require 'find'
if @path == '.'
Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f.sub(%r{\A\./}, '')) }
Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f.delete_prefix('./')) }
else
Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f) }
end
Expand Down
16 changes: 8 additions & 8 deletions ext/psych/lib/psych/scalar_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ class ScalarScanner
# Base 60, [-+]inf and NaN are handled separately
FLOAT = /^(?:[-+]?([0-9][0-9_,]*)?\.[0-9]*([eE][-+][0-9]+)?(?# base 10))$/x

# Taken from http://yaml.org/type/int.html
INTEGER_STRICT = /^(?:[-+]?0b[0-1_]+ (?# base 2)
|[-+]?0[0-7_]+ (?# base 8)
|[-+]?(0|[1-9][0-9_]*) (?# base 10)
|[-+]?0x[0-9a-fA-F_]+ (?# base 16))$/x
# Taken from http://yaml.org/type/int.html and modified to ensure at least one numerical symbol exists
INTEGER_STRICT = /^(?:[-+]?0b[_]*[0-1][0-1_]* (?# base 2)
|[-+]?0[_]*[0-7][0-7_]* (?# base 8)
|[-+]?(0|[1-9][0-9_]*) (?# base 10)
|[-+]?0x[_]*[0-9a-fA-F][0-9a-fA-F_]* (?# base 16))$/x

# Same as above, but allows commas.
# Not to YML spec, but kept for backwards compatibility
INTEGER_LEGACY = /^(?:[-+]?0b[0-1_,]+ (?# base 2)
|[-+]?0[0-7_,]+ (?# base 8)
INTEGER_LEGACY = /^(?:[-+]?0b[_,]*[0-1][0-1_,]* (?# base 2)
|[-+]?0[_,]*[0-7][0-7_,]* (?# base 8)
|[-+]?(?:0|[1-9](?:[0-9]|,[0-9]|_[0-9])*) (?# base 10)
|[-+]?0x[0-9a-fA-F_,]+ (?# base 16))$/x
|[-+]?0x[_,]*[0-9a-fA-F][0-9a-fA-F_,]* (?# base 16))$/x

attr_reader :class_loader

Expand Down
3 changes: 3 additions & 0 deletions ext/win32/resolv/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require 'mkmf'
if have_library('iphlpapi', 'GetNetworkParams')
create_makefile('win32/resolv')
else
File.write('Makefile', "all clean install:\n\t@echo Done: $(@)\n")
end
Loading

0 comments on commit dcaa144

Please sign in to comment.