[#75225] [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7) — k@...
Issue #12324 has been reported by Kazuki Yamaguchi.
6 messages
2016/04/27
[#78693] Re: [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7)
— Eric Wong <normalperson@...>
2016/12/17
k@rhe.jp wrote:
[#78701] Re: [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7)
— Kazuki Yamaguchi <k@...>
2016/12/17
On Sat, Dec 17, 2016 at 01:31:12AM +0000, Eric Wong wrote:
[#78702] Re: [Ruby trunk Feature#12324] Support OpenSSL 1.1.0 (and drop support for 0.9.6/0.9.7)
— Eric Wong <normalperson@...>
2016/12/17
Kazuki Yamaguchi <k@rhe.jp> wrote:
[ruby-core:74990] [Ruby trunk Bug#12295] Ripper not emitting on_parse_error for global variable name syntax errors
From:
usa@...
Date:
2016-04-17 21:55:05 UTC
List:
ruby-core #74990
Issue #12295 has been updated by Usaku NAKAMURA.
You can handle the case by using `compile_error` instead of `on_parse_error` as below:
```
$ ruby -rripper -e 'class X < Ripper; def compile_error(m) puts "ERROR #{m}" end end; X.parse ":~$"'
ERROR `$' without identifiers is not allowed as a global variable name
```
IMO, ripper expects that all syntax errors are "compile errors", not "parse errors".
But current implementation of the ruby parser is not so.
Then, we must define both `on_parse_error` and `compile_error` to handle syntax errors at this time.
----------------------------------------
Bug #12295: Ripper not emitting on_parse_error for global variable name syntax errors
https://bugs.ruby-lang.org/issues/12295#change-58116
* Author: Loren Segal
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux-gnu]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Ripper is not emitting the `on_parse_error` event for certain types of syntax errors, specifically for the following snippet of code:
```
:~$
```
Here is the Ruby syntax error:
```
$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux-gnu]
$ ruby -e ':~$'
-e:1: `$' without identifiers is not allowed as a global variable name
```
Here is the expected Ripper result for a syntax error emitting `on_parse_error`:
```
$ ruby -rripper -e 'class X < Ripper; def on_parse_error(m) puts "ERROR #{m}" end end; X.parse "class;end"'
ERROR syntax error, unexpected ';'
```
Here is reproduction for the omitted `on_parse_error` event:
```
$ ruby -rripper -e 'class X < Ripper; def on_parse_error(m) puts "ERROR #{m}" end end; X.parse ":~$"'
$
```
Note the lack of ERROR message. The expectation is that this parse error will emit the `on_parse_error` event in Ripper.
I reproduced this in Ruby 2.3.0, I have not tested 2.2 or dev, so I don't know if it needs porting, though I imagine it does.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>