1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Unnamed groups are not captured when named groups are used

This commit is contained in:
Nobuyoshi Nakada 2020-01-30 11:31:48 +09:00
parent 5d124a3b68
commit f7f8dc5fd4
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -105,7 +105,7 @@ module MJITHeader
su2_regex = /{([^{}]|#{su1_regex})*}/
su3_regex = /{([^{}]|#{su2_regex})*}/ # 3 nested structs/unions is probably enough
reduced_decl.gsub!(su3_regex, '') # remove structs/unions in the header
id_seq_regex = /\s*(#{ident_regex}(\s+|\s*[*]+\s*))*/
id_seq_regex = /\s*(?:#{ident_regex}(?:\s+|\s*[*]+\s*))*/
# Process function header:
match = /\A#{id_seq_regex}(?<name>#{ident_regex})\s*\(/.match(reduced_decl)
return match[:name] if match