[#102393] [Ruby master Feature#17608] Compact and sum in one step — sawadatsuyoshi@...

Issue #17608 has been reported by sawa (Tsuyoshi Sawada).

13 messages 2021/02/04

[#102438] [Ruby master Bug#17619] if false foo=42; end creates a foo local variable set to nil — pkmuldoon@...

Issue #17619 has been reported by pkmuldoon (Phil Muldoon).

10 messages 2021/02/10

[#102631] [Ruby master Feature#17660] Expose information about which basic methods have been redefined — tenderlove@...

Issue #17660 has been reported by tenderlovemaking (Aaron Patterson).

9 messages 2021/02/27

[#102639] [Ruby master Misc#17662] The herdoc pattern used in tests does not syntax highlight correctly in many editors — eregontp@...

Issue #17662 has been reported by Eregon (Benoit Daloze).

13 messages 2021/02/27

[#102652] [Ruby master Bug#17664] Behavior of sockets changed in Ruby 3.0 to non-blocking — ciconia@...

Issue #17664 has been reported by ciconia (Sharon Rosner).

23 messages 2021/02/28

[ruby-core:102449] [Ruby master Bug#17621] Ripper can call on_parse_error multiple times for syntax error. Is this correct?

From: mauro.otonelli@...
Date: 2021-02-10 20:48:49 UTC
List: ruby-core #102449
Issue #17621 has been reported by mauro_oto (Mauro Otonelli).

----------------------------------------
Bug #17621: Ripper can call on_parse_error multiple times for syntax error. Is this correct?
https://bugs.ruby-lang.org/issues/17621

* Author: mauro_oto (Mauro Otonelli)
* Status: Open
* Priority: Normal
* ruby -v: 2.7.2
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Here's an example subclass of Ripper:

``` ruby
class MyRipperSubclass < Ripper
  def on_parse_error(msg)
    @count ||= 0
    @count += 1
    puts [count: @count, msg: msg]
  end
end
source = <<~EOM
  module Hey
    class Foo
      def initialize
        [1,2,3
      end
      def call
      end
    end
  end
EOM
MyRipperSubclass.new(source).parse
```

The source it's parsing has a syntax error, so I would only expect one parse error. However, when you execute this code, you see two:

``` ruby
MyRipperSubclass.new(source).parse
# => {:count=>1, :msg=>"syntax error, unexpected `end', expecting ']'"}
# => {:count=>2, :msg=>"syntax error, unexpected end-of-input, expecting `end'"}
```

Is this a bug, or is this expected? If this is expected, can you give me more context? Is there an upper bound to the number of parse errors a document can generate? Is the order guaranteed? 



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next