Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package rubygem-ruby_parser for
openSUSE:Factory checked in at 2022-12-13 18:56:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-ruby_parser (Old)
and /work/SRC/openSUSE:Factory/.rubygem-ruby_parser.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-ruby_parser"
Tue Dec 13 18:56:59 2022 rev:45 rq:1042660 version:3.19.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-ruby_parser/rubygem-ruby_parser.changes
2022-04-30 22:53:02.752265493 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-ruby_parser.new.1835/rubygem-ruby_parser.changes
2022-12-13 18:57:29.207849930 +0100
@@ -1,0 +2,17 @@
+Wed Dec 7 11:34:30 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 3.19.2
+ see installed History.rdoc
+
+ === 3.19.2 / 2022-12-03
+
+ * 5 bug fixes:
+
+ * Fixed bug parsing array patterns using %w, %i, etc.
+ * Fixed dedenting when heredoc has only empty line and interpolation. (mvz)
+ * Fixed dsym unescaping. (mvz)
+ * Fixed vars in pattern matching that should be lasgn, not lvar.
+ * find_pat mid-patterns are now splatted inline, not wrapped in an
array_pat.
+
+
+-------------------------------------------------------------------
Old:
----
ruby_parser-3.19.1.gem
New:
----
ruby_parser-3.19.2.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-ruby_parser.spec ++++++
--- /var/tmp/diff_new_pack.Dp4IOH/_old 2022-12-13 18:57:30.195855203 +0100
+++ /var/tmp/diff_new_pack.Dp4IOH/_new 2022-12-13 18:57:30.199855225 +0100
@@ -24,7 +24,7 @@
#
Name: rubygem-ruby_parser
-Version: 3.19.1
+Version: 3.19.2
Release: 0
%define mod_name ruby_parser
%define mod_full_name %{mod_name}-%{version}
++++++ ruby_parser-3.19.1.gem -> ruby_parser-3.19.2.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/History.rdoc new/History.rdoc
--- old/History.rdoc 2022-04-06 08:32:48.000000000 +0200
+++ new/History.rdoc 2022-12-04 00:40:58.000000000 +0100
@@ -1,3 +1,13 @@
+=== 3.19.2 / 2022-12-03
+
+* 5 bug fixes:
+
+ * Fixed bug parsing array patterns using %w, %i, etc.
+ * Fixed dedenting when heredoc has only empty line and interpolation. (mvz)
+ * Fixed dsym unescaping. (mvz)
+ * Fixed vars in pattern matching that should be lasgn, not lvar.
+ * find_pat mid-patterns are now splatted inline, not wrapped in an array_pat.
+
=== 3.19.1 / 2022-04-05
* 2 bug fixes:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile 2022-04-06 08:32:48.000000000 +0200
+++ new/Rakefile 2022-12-04 00:40:58.000000000 +0100
@@ -12,6 +12,7 @@
Hoe.add_include_dirs "../../sexp_processor/dev/lib"
Hoe.add_include_dirs "../../minitest/dev/lib"
Hoe.add_include_dirs "../../oedipus_lex/dev/lib"
+Hoe.add_include_dirs "../../ruby2ruby/dev/lib"
V2 = %w[20 21 22 23 24 25 26 27]
V3 = %w[30 31]
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
Binary files old/checksums.yaml.gz.sig and new/checksums.yaml.gz.sig differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/data.tar.gz.sig new/data.tar.gz.sig
--- old/data.tar.gz.sig 2022-04-06 08:32:48.000000000 +0200
+++ new/data.tar.gz.sig 2022-12-04 00:40:58.000000000 +0100
@@ -1 +1 @@
-¼C-]Ìê˺óý)5Jí»Ë¡ÃüØàI[öµY5þÖSt?øþeè¿ûz1ëQ£²áe»¨i
ÒÅþ^ÆÞèBU4'b°þÍo!_ÑÙ:QÛ"lÞlÀ$cÝ5n©V6L5{о
0¨}ª»ByÐp3î^H{²íá5ÛýËÖjöyúõáIÓN^ù6ãÚò§ÝIZþDQÝM³
2w|(|x¡uaPFæÙL¸iùíô6ì³M¬>5s@_ç%
|ïP¸ Ê[ûì¥GPê¤ËiÍéâ
6Ùsñ×Ñ,L
\ No newline at end of file
+â4i¸L[ë.MØèÄ4D=ÜEuÆK® ×OegEÄWKʱçDwc}
¯À÷lÙ·þ3PâWVògýLÈ_Â7vÍ]{ØH>n|ôÚ2YÜZxM@oGz'Yq!¸ã+ÕâÜoÛ¢·ÍUïmYÖñÿWAQ²^ª²1½gJØtíZ[wp¾>o®v2¸qÞh[øÕ"ûþy/}l½²ÙjÜß
]oQi/[RÔ·ËãbÙ¢Túm^x{´«í9pHJjK.eKzÁBôɹ£C6U8[$ÈL½æ9YV^À
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/ruby27_parser.rb new/lib/ruby27_parser.rb
--- old/lib/ruby27_parser.rb 2022-04-06 08:32:48.000000000 +0200
+++ new/lib/ruby27_parser.rb 2022-12-04 00:40:58.000000000 +0100
@@ -7722,10 +7722,10 @@
1, 364, :_reduce_none,
1, 364, :_reduce_none,
1, 364, :_reduce_none,
- 1, 364, :_reduce_none,
- 1, 364, :_reduce_none,
- 1, 364, :_reduce_none,
- 1, 364, :_reduce_none,
+ 1, 364, :_reduce_548,
+ 1, 364, :_reduce_549,
+ 1, 364, :_reduce_550,
+ 1, 364, :_reduce_551,
1, 364, :_reduce_552,
1, 364, :_reduce_none,
1, 344, :_reduce_554,
@@ -11813,13 +11813,29 @@
# reduce 547 omitted
-# reduce 548 omitted
+def _reduce_548(val, _values, result)
+ result = ary_to_pat val[0]
+
+ result
+end
+
+def _reduce_549(val, _values, result)
+ result = ary_to_pat val[0]
-# reduce 549 omitted
+ result
+end
+
+def _reduce_550(val, _values, result)
+ result = ary_to_pat val[0]
+
+ result
+end
-# reduce 550 omitted
+def _reduce_551(val, _values, result)
+ result = ary_to_pat val[0]
-# reduce 551 omitted
+ result
+end
def _reduce_552(val, _values, result)
# TODO? if (!($$ = gettable(p, $1, &@$))) $$ =
NEW_BEGIN(0, &@$);
@@ -11835,7 +11851,7 @@
def _reduce_554(val, _values, result)
# TODO: error_duplicate_pattern_variable(p, $1, &@1);
# TODO: assignable(p, $1, 0, &@$);
- result = wrap :lvar, val[0]
+ result = wrap :lasgn, val[0]
result
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/ruby27_parser.y new/lib/ruby27_parser.y
--- old/lib/ruby27_parser.y 2022-04-06 08:32:48.000000000 +0200
+++ new/lib/ruby27_parser.y 2022-12-04 00:40:58.000000000 +0100
@@ -2453,9 +2453,21 @@
| xstring
| regexp
| words
+ {
+ result = ary_to_pat val[0]
+ }
| qwords
+ {
+ result = ary_to_pat val[0]
+ }
| symbols
+ {
+ result = ary_to_pat val[0]
+ }
| qsymbols
+ {
+ result = ary_to_pat val[0]
+ }
| keyword_variable
{
# TODO? if (!($$ = gettable(p, $1, &@$))) $$ =
NEW_BEGIN(0, &@$);
@@ -2469,7 +2481,7 @@
{
# TODO: error_duplicate_pattern_variable(p, $1, &@1);
# TODO: assignable(p, $1, 0, &@$);
- result = wrap :lvar, val[0]
+ result = wrap :lasgn, val[0]
}
p_var_ref: tCARET tIDENTIFIER
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/ruby30_parser.rb new/lib/ruby30_parser.rb
--- old/lib/ruby30_parser.rb 2022-04-06 08:32:48.000000000 +0200
+++ new/lib/ruby30_parser.rb 2022-12-04 00:40:58.000000000 +0100
@@ -7841,10 +7841,10 @@
1, 371, :_reduce_none,
1, 371, :_reduce_none,
1, 371, :_reduce_none,
- 1, 371, :_reduce_none,
- 1, 371, :_reduce_none,
- 1, 371, :_reduce_none,
- 1, 371, :_reduce_none,
+ 1, 371, :_reduce_561,
+ 1, 371, :_reduce_562,
+ 1, 371, :_reduce_563,
+ 1, 371, :_reduce_564,
1, 371, :_reduce_565,
1, 371, :_reduce_none,
1, 350, :_reduce_567,
@@ -12038,13 +12038,29 @@
# reduce 560 omitted
-# reduce 561 omitted
+def _reduce_561(val, _values, result)
+ result = ary_to_pat val[0]
+
+ result
+end
+
+def _reduce_562(val, _values, result)
+ result = ary_to_pat val[0]
-# reduce 562 omitted
+ result
+end
+
+def _reduce_563(val, _values, result)
+ result = ary_to_pat val[0]
+
+ result
+end
-# reduce 563 omitted
+def _reduce_564(val, _values, result)
+ result = ary_to_pat val[0]
-# reduce 564 omitted
+ result
+end
def _reduce_565(val, _values, result)
# TODO? if (!($$ = gettable(p, $1, &@$))) $$ =
NEW_BEGIN(0, &@$);
@@ -12060,7 +12076,7 @@
def _reduce_567(val, _values, result)
# TODO: error_duplicate_pattern_variable(p, $1, &@1);
# TODO: assignable(p, $1, 0, &@$);
- result = wrap :lvar, val[0]
+ result = wrap :lasgn, val[0]
result
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/ruby30_parser.y new/lib/ruby30_parser.y
--- old/lib/ruby30_parser.y 2022-04-06 08:32:48.000000000 +0200
+++ new/lib/ruby30_parser.y 2022-12-04 00:40:58.000000000 +0100
@@ -2534,9 +2534,21 @@
| xstring
| regexp
| words
+ {
+ result = ary_to_pat val[0]
+ }
| qwords
+ {
+ result = ary_to_pat val[0]
+ }
| symbols
+ {
+ result = ary_to_pat val[0]
+ }
| qsymbols
+ {
+ result = ary_to_pat val[0]
+ }
| keyword_variable
{
# TODO? if (!($$ = gettable(p, $1, &@$))) $$ =
NEW_BEGIN(0, &@$);
@@ -2550,7 +2562,7 @@
{
# TODO: error_duplicate_pattern_variable(p, $1, &@1);
# TODO: assignable(p, $1, 0, &@$);
- result = wrap :lvar, val[0]
+ result = wrap :lasgn, val[0]
}
p_var_ref: tCARET tIDENTIFIER
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/ruby31_parser.rb new/lib/ruby31_parser.rb
--- old/lib/ruby31_parser.rb 2022-04-06 08:32:48.000000000 +0200
+++ new/lib/ruby31_parser.rb 2022-12-04 00:40:58.000000000 +0100
@@ -8153,10 +8153,10 @@
1, 373, :_reduce_none,
1, 373, :_reduce_none,
1, 373, :_reduce_none,
- 1, 373, :_reduce_none,
- 1, 373, :_reduce_none,
- 1, 373, :_reduce_none,
- 1, 373, :_reduce_none,
+ 1, 373, :_reduce_569,
+ 1, 373, :_reduce_570,
+ 1, 373, :_reduce_571,
+ 1, 373, :_reduce_572,
1, 373, :_reduce_573,
1, 373, :_reduce_none,
1, 351, :_reduce_575,
@@ -12399,13 +12399,29 @@
# reduce 568 omitted
-# reduce 569 omitted
+def _reduce_569(val, _values, result)
+ result = ary_to_pat val[0]
+
+ result
+end
+
+def _reduce_570(val, _values, result)
+ result = ary_to_pat val[0]
-# reduce 570 omitted
+ result
+end
+
+def _reduce_571(val, _values, result)
+ result = ary_to_pat val[0]
+
+ result
+end
-# reduce 571 omitted
+def _reduce_572(val, _values, result)
+ result = ary_to_pat val[0]
-# reduce 572 omitted
+ result
+end
def _reduce_573(val, _values, result)
# TODO? if (!($$ = gettable(p, $1, &@$))) $$ =
NEW_BEGIN(0, &@$);
@@ -12421,7 +12437,7 @@
def _reduce_575(val, _values, result)
# TODO: error_duplicate_pattern_variable(p, $1, &@1);
# TODO: assignable(p, $1, 0, &@$);
- result = wrap :lvar, val[0]
+ result = wrap :lasgn, val[0]
result
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/ruby31_parser.y new/lib/ruby31_parser.y
--- old/lib/ruby31_parser.y 2022-04-06 08:32:48.000000000 +0200
+++ new/lib/ruby31_parser.y 2022-12-04 00:40:58.000000000 +0100
@@ -2562,9 +2562,21 @@
| xstring
| regexp
| words
+ {
+ result = ary_to_pat val[0]
+ }
| qwords
+ {
+ result = ary_to_pat val[0]
+ }
| symbols
+ {
+ result = ary_to_pat val[0]
+ }
| qsymbols
+ {
+ result = ary_to_pat val[0]
+ }
| keyword_variable
{
# TODO? if (!($$ = gettable(p, $1, &@$))) $$ =
NEW_BEGIN(0, &@$);
@@ -2578,7 +2590,7 @@
{
# TODO: error_duplicate_pattern_variable(p, $1, &@1);
# TODO: assignable(p, $1, 0, &@$);
- result = wrap :lvar, val[0]
+ result = wrap :lasgn, val[0]
}
p_var_ref: tCARET tIDENTIFIER
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/ruby3_parser.yy new/lib/ruby3_parser.yy
--- old/lib/ruby3_parser.yy 2022-04-06 08:32:48.000000000 +0200
+++ new/lib/ruby3_parser.yy 2022-12-04 00:40:58.000000000 +0100
@@ -2591,9 +2591,21 @@
| xstring
| regexp
| words
+ {
+ result = ary_to_pat val[0]
+ }
| qwords
+ {
+ result = ary_to_pat val[0]
+ }
| symbols
+ {
+ result = ary_to_pat val[0]
+ }
| qsymbols
+ {
+ result = ary_to_pat val[0]
+ }
| keyword_variable
{
# TODO? if (!($$ = gettable(p, $1, &@$))) $$ =
NEW_BEGIN(0, &@$);
@@ -2607,7 +2619,7 @@
{
# TODO: error_duplicate_pattern_variable(p, $1, &@1);
# TODO: assignable(p, $1, 0, &@$);
- result = wrap :lvar, val[0]
+ result = wrap :lasgn, val[0]
}
p_var_ref: tCARET tIDENTIFIER
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/ruby_lexer.rb new/lib/ruby_lexer.rb
--- old/lib/ruby_lexer.rb 2022-04-06 08:32:48.000000000 +0200
+++ new/lib/ruby_lexer.rb 2022-12-04 00:40:58.000000000 +0100
@@ -232,7 +232,7 @@
content = match[1]
if text =~ check then
- content.gsub(ESC) { unescape $1 }
+ unescape_string content
else
content.gsub(/\\\\/, "\\").gsub(/\\\'/, "'")
end
@@ -590,9 +590,7 @@
orig_line = lineno
self.lineno += text.count("\n")
- str = text[1..-2]
- .gsub(ESC) { unescape($1).b.force_encoding Encoding::UTF_8 }
- str = str.b unless str.valid_encoding?
+ str = unescape_string text[1..-2]
result EXPR_END, :tSTRING, str, orig_line
end
@@ -817,6 +815,15 @@
end
end
+ def unescape_string str
+ str = str.gsub(ESC) { unescape($1).b.force_encoding Encoding::UTF_8 }
+ if str.valid_encoding?
+ str
+ else
+ str.b
+ end
+ end
+
def unescape s
r = ESCAPES[s]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/ruby_parser.yy new/lib/ruby_parser.yy
--- old/lib/ruby_parser.yy 2022-04-06 08:32:48.000000000 +0200
+++ new/lib/ruby_parser.yy 2022-12-04 00:40:58.000000000 +0100
@@ -2530,9 +2530,21 @@
| xstring
| regexp
| words
+ {
+ result = ary_to_pat val[0]
+ }
| qwords
+ {
+ result = ary_to_pat val[0]
+ }
| symbols
+ {
+ result = ary_to_pat val[0]
+ }
| qsymbols
+ {
+ result = ary_to_pat val[0]
+ }
| keyword_variable
{
# TODO? if (!($$ = gettable(p, $1, &@$))) $$ =
NEW_BEGIN(0, &@$);
@@ -2546,7 +2558,7 @@
{
# TODO: error_duplicate_pattern_variable(p, $1, &@1);
# TODO: assignable(p, $1, 0, &@$);
- result = wrap :lvar, val[0]
+ result = wrap :lasgn, val[0]
}
p_var_ref: tCARET tIDENTIFIER
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/ruby_parser_extras.rb
new/lib/ruby_parser_extras.rb
--- old/lib/ruby_parser_extras.rb 2022-04-06 08:32:48.000000000 +0200
+++ new/lib/ruby_parser_extras.rb 2022-12-04 00:40:58.000000000 +0100
@@ -30,7 +30,7 @@
end
module RubyParserStuff
- VERSION = "3.19.1"
+ VERSION = "3.19.2"
attr_accessor :lexer, :in_def, :in_single, :file
attr_accessor :in_kwarg
@@ -471,7 +471,7 @@
end
else
warn "unprocessed: %p" % [s]
- end.map { |l| whitespace_width l.chomp }
+ end.map { |l| whitespace_width l }
}.compact.min
end
@@ -731,6 +731,13 @@
result
end
+ def ary_to_pat ary
+ pat = ary.dup
+ pat.sexp_type = :array_TAIL
+
+ new_array_pattern nil, nil, pat, ary.line
+ end
+
def new_array_pattern const, pre_arg, arypat, loc
result = s(:array_pat, const).line loc
result << pre_arg if pre_arg
@@ -1066,9 +1073,9 @@
lhs_id = "*#{lhs_id}".to_sym
rhs_id = "*#{rhs_id}".to_sym
- mid.sexp_type = :array_pat # HACK?
+ raise "BAD?" unless mid.sexp_type == :array_TAIL
- s(:find_pat_TAIL, lhs_id, mid, rhs_id).line line
+ s(:find_pat_TAIL, lhs_id, *mid.sexp_body, rhs_id).line line
end
def new_for expr, var, body
@@ -1651,7 +1658,7 @@
if remove_width then
line[idx..-1]
- elsif line[idx].nil?
+ elsif line[idx] == "\n"
nil
else
col
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2022-04-06 08:32:48.000000000 +0200
+++ new/metadata 2022-12-04 00:40:58.000000000 +0100
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: ruby_parser
version: !ruby/object:Gem::Version
- version: 3.19.1
+ version: 3.19.2
platform: ruby
authors:
- Ryan Davis
@@ -29,7 +29,7 @@
JFmxn4h9YO/pVdB962BdBNNDia0kgIjI3ENnkLq0dKpYU3+F3KhEuTksLO0L6X/V
YsuyUzsMz6GQA4khyaMgKNSD
-----END CERTIFICATE-----
-date: 2022-04-06 00:00:00.000000000 Z
+date: 2022-12-03 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: sexp_processor
@@ -119,14 +119,14 @@
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '3.23'
+ version: '3.25'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - "~>"
- !ruby/object:Gem::Version
- version: '3.23'
+ version: '3.25'
description: |-
ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
racc--which does by default use a C extension). It outputs
@@ -243,7 +243,7 @@
- !ruby/object:Gem::Version
version: '0'
requirements: []
-rubygems_version: 3.3.3
+rubygems_version: 3.3.12
signing_key:
specification_version: 4
summary: ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
racc--which
Binary files old/metadata.gz.sig and new/metadata.gz.sig differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/test_ruby_lexer.rb new/test/test_ruby_lexer.rb
--- old/test/test_ruby_lexer.rb 2022-04-06 08:32:48.000000000 +0200
+++ new/test/test_ruby_lexer.rb 2022-12-04 00:40:58.000000000 +0100
@@ -3009,6 +3009,19 @@
:tSTRING_END, "\"", EXPR_LIT)
end
+ def test_yylex_symbol_double_escape_octal
+ setup_lexer ":\"Variet\\303\\240\""
+
+ adv = @lex.next_token
+ act_token, act_value = adv
+ act_value = act_value.first
+
+ assert_equal :tSYMBOL, act_token
+ assert_match EXPR_LIT, @lex.lex_state
+ # Force comparison of encodings
+ assert_equal "Varietà ", act_value
+ end
+
def test_yylex_symbol_single
assert_lex3(":'symbol'",
nil,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/test/test_ruby_parser.rb new/test/test_ruby_parser.rb
--- old/test/test_ruby_parser.rb 2022-04-06 08:32:48.000000000 +0200
+++ new/test/test_ruby_parser.rb 2022-12-04 00:40:58.000000000 +0100
@@ -826,6 +826,13 @@
assert_parse rb, pt
end
+ def test_dsym_esc_to_sym
+ rb = ':"Variet\303\240"'
+ pt = s(:lit, :Varietà )
+
+ assert_parse rb, pt
+ end
+
def test_empty
refute_parse ""
end
@@ -3541,10 +3548,8 @@
end
def test_regexp_esc_C_slash
- skip "https://bugs.ruby-lang.org/issues/18449" if RUBY_VERSION == "3.1.0"
-
rb = "/\\cC\\d/"
- pt = s(:lit, /\cC\d/)
+ pt = s(:lit, Regexp.new('\cC\d')) # https://bugs.ruby-lang.org/issues/18449
assert_parse rb, pt
end
@@ -4270,6 +4275,21 @@
assert_parse rb, pt
end
+ def test_heredoc_squiggly_blank_line_plus_interpolation
+ rb = "a = foo(<<~EOF.chop)\n\n #\{bar}baz\n EOF"
+ pt = s(:lasgn, :a,
+ s(:call,
+ nil,
+ :foo,
+ s(:call,
+ s(:dstr, "\n",
+ s(:evstr, s(:call, nil, :bar).line(3)).line(3),
+ s(:str, "baz\n").line(3)).line(1),
+ :chop).line(1)).line(1)).line(1)
+
+ assert_parse rb, pt
+ end
+
def test_integer_with_if_modifier
rb = "1_234if true"
pt = s(:if, s(:true), s(:lit, 1234), nil)
@@ -4553,8 +4573,8 @@
pt = s(:array_pat,
nil,
s(:lit, :a).line(2),
- s(:lvar, :b).line(2),
- s(:lvar, :c).line(2),
+ s(:lasgn, :b).line(2),
+ s(:lasgn, :c).line(2),
s(:array_pat,
nil,
s(:lit, :d).line(2),
@@ -4647,19 +4667,19 @@
end
def test_case_in_78
- assert_case_in "%W[a b]", s(:array, s(:str, "a").line(2), s(:str,
"b").line(2)).line(2)
+ assert_case_in "%W[a b]", s(:array_pat, nil, s(:str, "a").line(2), s(:str,
"b").line(2)).line(2)
end
def test_case_in_79
- assert_case_in "%w[a b]", s(:array, s(:str, "a").line(2), s(:str,
"b").line(2)).line(2)
+ assert_case_in "%w[a b]", s(:array_pat, nil, s(:str, "a").line(2), s(:str,
"b").line(2)).line(2)
end
def test_case_in_80
- assert_case_in "%I[a b]", s(:array, s(:lit, :a).line(2), s(:lit,
:b).line(2)).line(2)
+ assert_case_in "%I[a b]", s(:array_pat, nil, s(:lit, :a).line(2), s(:lit,
:b).line(2)).line(2)
end
def test_case_in_81
- assert_case_in "%i[a b]", s(:array, s(:lit, :a).line(2), s(:lit,
:b).line(2)).line(2)
+ assert_case_in "%i[a b]", s(:array_pat, nil, s(:lit, :a).line(2), s(:lit,
:b).line(2)).line(2)
end
def test_case_in_83
@@ -4667,7 +4687,7 @@
pt = s(:array_pat, nil,
s(:iter, s(:lambda).line(2), s(:args, :b).line(2),
s(:true).line(2)).line(2),
- s(:lvar, :c).line(2)).line(2)
+ s(:lasgn, :c).line(2)).line(2)
assert_case_in rb, pt
end
@@ -4677,7 +4697,7 @@
pt = s(:array_pat, nil,
s(:array_pat, nil,
s(:lit, :b).line(2),
- s(:lvar, :c).line(2)).line(2),
+ s(:lasgn, :c).line(2)).line(2),
s(:array_pat,
nil,
s(:lit, :d).line(2),
@@ -4723,7 +4743,7 @@
s(:in,
s(:array_pat,
s(:const, :B).line(2),
- s(:lvar, :c).line(2)).line(2),
+ s(:lasgn, :c).line(2)).line(2),
s(:lit, :d).line(3)).line(2),
nil)
@@ -4736,7 +4756,7 @@
s(:in,
s(:array_pat,
s(:const, s(:colon2, s(:const, :B).line(2),
:C).line(2)).line(2),
- s(:lvar, :d).line(2)).line(2),
+ s(:lasgn, :d).line(2)).line(2),
s(:lit, :e).line(3)).line(2),
nil)
@@ -4841,7 +4861,7 @@
s(:hash_pat,
nil,
s(:lit, :b).line(2),
- s(:lvar, :c).line(2),
+ s(:lasgn, :c).line(2),
s(:kwrest, :"**rest").line(2)).line(2),
s(:lit, :d).line(2)).line(2),
nil)
@@ -4934,12 +4954,12 @@
end
def test_parse_pattern_044
- rb = <<~RUBY
- case obj
- in Object[]
- true
- end
- RUBY
+ rb = <<~RUBY
+ case obj
+ in Object[]
+ true
+ end
+ RUBY
pt = s(:case,
s(:call, nil, :obj),
s(:in, s(:array_pat, s(:const, :Object).line(2)).line(2),
@@ -5072,7 +5092,7 @@
s(:find_pat,
s(:const, :Symbol).line(2),
:"*lhs",
- s(:array_pat, s(:lvar, :x).line(2)).line(2),
+ s(:lasgn, :x).line(2),
:"*rhs").line(2))
end
@@ -5080,7 +5100,7 @@
assert_case_in("Symbol[*lhs, x, *rhs]",
s(:find_pat, s(:const, :Symbol).line(2),
:"*lhs",
- s(:array_pat, s(:lvar, :x).line(2)).line(2),
+ s(:lasgn, :x).line(2),
:"*rhs").line(2))
end
end
@@ -5196,7 +5216,7 @@
rb = "42 => n"
pt = s(:case,
s(:lit, 42),
- s(:in, s(:lvar, :n), nil), nil)
+ s(:in, s(:lasgn, :n), nil), nil)
assert_parse rb, pt
end
@@ -5208,7 +5228,7 @@
s(:in,
s(:find_pat, nil,
:"*a",
- s(:array_pat, s(:lit, :+).line(2)).line(2),
+ s(:lit, :+).line(2),
:"*b").line(2),
nil).line(2),
nil)
@@ -5223,7 +5243,7 @@
s(:in,
s(:find_pat, nil,
:*,
- s(:array_pat, s(:lit, :b).line(2), s(:lvar,
:c).line(2)).line(2),
+ s(:lit, :b).line(2), s(:lasgn, :c).line(2),
:*).line(2),
nil).line(2),
nil)
@@ -5524,6 +5544,8 @@
attr_accessor :assert_parse_ran
+ require "ruby2ruby" if ENV["R2R"]
+
def assert_parse rb, pt
self.processor.reset if assert_parse_ran # allows multiple calls
self.assert_parse_ran = true
@@ -5534,6 +5556,10 @@
pt.line ||= 1
self.result = processor.parse rb, "(string)", timeout
+
+ # just try it for now:
+ Ruby2Ruby.new.process(result.deep_clone) if ENV["R2R"]
+
assert_equal pt, result
end