Project

General

Profile

Bug #14046

Ripper loses DATA

Added by mjago (Martyn Jago) about 2 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-10-19 trunk 60213) [x86_64-darwin13]
[ruby-core:83537]

Description

Since the following is a valid self-contained script:

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

Also available in: Atom PDF