summaryrefslogtreecommitdiff
path: root/ext/ripper
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-01-20 16:53:31 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-20 16:58:58 +0900
commit9f99760dafac6eaa53287470b8ff59b1be0bf6d6 (patch)
treecdf96ad34f8e0c4add4af206fc710ea2201be3fe /ext/ripper
parentf31b90f2b99b04dc9e003436a39fd08732eef004 (diff)
Get rid of use of special variables
Use `"\n"` and `IO#fileno` instead of `$/` and `$.` respectively. [Feature #14240]
Diffstat (limited to 'ext/ripper')
-rw-r--r--ext/ripper/tools/preproc.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/ripper/tools/preproc.rb b/ext/ripper/tools/preproc.rb
index 7639a901dfd..b838a78db71 100644
--- a/ext/ripper/tools/preproc.rb
+++ b/ext/ripper/tools/preproc.rb
@@ -45,7 +45,7 @@ def prelude(f, out)
while line = f.gets
case line
when /\A%%/
- out << '%%' << $/
+ out << "%%\n"
return
when /\A%token/
out << line.sub(/<\w+>/, '<val>')
@@ -79,15 +79,15 @@ def grammar(f, out)
while line = f.gets
case line
when %r</\*% *ripper(?:\[(.*?)\])?: *(.*?) *%\*/>
- out << DSL.new($2, ($1 || "").split(",")).generate << $/
+ out << DSL.new($2, ($1 || "").split(",")).generate << "\n"
when %r</\*%%%\*/>
- out << '#if 0' << $/
+ out << "#if 0\n"
when %r</\*%>
- out << '#endif' << $/
+ out << "#endif\n"
when %r<%\*/>
- out << $/
+ out << "\n"
when /\A%%/
- out << '%%' << $/
+ out << "%%\n"
return
else
out << line