Issue #14046 has been reported by mjago (Martyn Jago).

----------------------------------------
Bug #14046: Ripper loses DATA
https://bugs.ruby-lang.org/issues/14046

* Author: mjago (Martyn Jago)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0dev (2017-10-19 trunk 60213) [x86_64-darwin13]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Since the following is a valid self-contained script:

~~~ ruby
p DATA.read # comment
__END__
 abc
~~~

should the `__END__` suffix data be preserved with `:on___end__` ?
Alternatively should there be an `:on_ignored___end` token to preserve DATA?
Notably the comment content is preserved:

~~~
[[[1, 0], :on_ident, "p", EXPR_CMDARG],
 [[1, 1], :on_sp, " ", EXPR_CMDARG],
 [[1, 2], :on_const, "DATA", EXPR_ARG],
 [[1, 6], :on_period, ".", EXPR_DOT],
 [[1, 7], :on_ident, "read", EXPR_ARG],
 [[1, 11], :on_sp, " ", EXPR_ARG],
 [[1, 12], :on_comment, "# comment\n", EXPR_ARG],
 [[2, 0], :on___end__, "__END__\n", EXPR_BEG]]
~~~



-- 
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>