summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-05 07:54:32 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-05 07:54:32 +0000
commite3300dce829955390b5099c013ab4452a74ffd20 (patch)
tree15ee88b1ac001411f23f966c5c5ebbc9d02fa848
parentcd6d919373f2d0a1631b10a666d892365407821c (diff)
{ext,test}/ripper: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/ripper/extconf.rb2
-rw-r--r--ext/ripper/lib/ripper.rb2
-rw-r--r--ext/ripper/lib/ripper/core.rb2
-rw-r--r--ext/ripper/lib/ripper/filter.rb2
-rw-r--r--ext/ripper/lib/ripper/lexer.rb2
-rw-r--r--ext/ripper/lib/ripper/sexp.rb2
-rwxr-xr-xext/ripper/tools/generate-param-macros.rb2
-rwxr-xr-xext/ripper/tools/generate.rb6
-rwxr-xr-xext/ripper/tools/preproc.rb4
-rwxr-xr-xext/ripper/tools/strip.rb2
-rw-r--r--test/ripper/dummyparser.rb4
-rw-r--r--test/ripper/test_files.rb2
-rw-r--r--test/ripper/test_filter.rb2
-rw-r--r--test/ripper/test_parser_events.rb1
-rw-r--r--test/ripper/test_ripper.rb14
-rw-r--r--test/ripper/test_scanner_events.rb4
-rw-r--r--test/ripper/test_sexp.rb2
17 files changed, 28 insertions, 27 deletions
diff --git a/ext/ripper/extconf.rb b/ext/ripper/extconf.rb
index 91d4b32..89b46ab 100644
--- a/ext/ripper/extconf.rb
+++ b/ext/ripper/extconf.rb
@@ -1,5 +1,5 @@
#!ruby -s
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'mkmf'
require 'rbconfig'
diff --git a/ext/ripper/lib/ripper.rb b/ext/ripper/lib/ripper.rb
index c5c3a80..9eff2ce 100644
--- a/ext/ripper/lib/ripper.rb
+++ b/ext/ripper/lib/ripper.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'ripper/core'
require 'ripper/lexer'
require 'ripper/filter'
diff --git a/ext/ripper/lib/ripper/core.rb b/ext/ripper/lib/ripper/core.rb
index 53ed14d..cdbaf7d 100644
--- a/ext/ripper/lib/ripper/core.rb
+++ b/ext/ripper/lib/ripper/core.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# $Id$
#
diff --git a/ext/ripper/lib/ripper/filter.rb b/ext/ripper/lib/ripper/filter.rb
index a50a2c6..455197f 100644
--- a/ext/ripper/lib/ripper/filter.rb
+++ b/ext/ripper/lib/ripper/filter.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# $Id$
#
diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb
index 6952634..669314a 100644
--- a/ext/ripper/lib/ripper/lexer.rb
+++ b/ext/ripper/lib/ripper/lexer.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# $Id$
#
diff --git a/ext/ripper/lib/ripper/sexp.rb b/ext/ripper/lib/ripper/sexp.rb
index aa1f86e..d7bf530 100644
--- a/ext/ripper/lib/ripper/sexp.rb
+++ b/ext/ripper/lib/ripper/sexp.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# $Id$
#
diff --git a/ext/ripper/tools/generate-param-macros.rb b/ext/ripper/tools/generate-param-macros.rb
index c1f0c5b..f0de55a 100755
--- a/ext/ripper/tools/generate-param-macros.rb
+++ b/ext/ripper/tools/generate-param-macros.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
off = true
ARGF.each do |line|
case line
diff --git a/ext/ripper/tools/generate.rb b/ext/ripper/tools/generate.rb
index cb02de9..cf24f13 100755
--- a/ext/ripper/tools/generate.rb
+++ b/ext/ripper/tools/generate.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
# $Id$
require 'optparse'
@@ -68,7 +68,7 @@ def usage(msg)
end
def generate_eventids1(ids)
- buf = ""
+ buf = "".dup
buf << %Q[static struct {\n]
ids.each do |id, arity|
buf << %Q[ ID id_#{id};\n]
@@ -101,7 +101,7 @@ def generate_eventids1(ids)
end
def generate_eventids2_table(ids)
- buf = ""
+ buf = "".dup
buf << %Q[static void\n]
buf << %Q[ripper_init_eventids2_table(VALUE self)\n]
buf << %Q[{\n]
diff --git a/ext/ripper/tools/preproc.rb b/ext/ripper/tools/preproc.rb
index 2377506..16449ec 100755
--- a/ext/ripper/tools/preproc.rb
+++ b/ext/ripper/tools/preproc.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
# $Id$
require 'optparse'
@@ -24,7 +24,7 @@ def main
unless ARGV.size == 1
abort "wrong number of arguments (#{ARGV.size} for 1)"
end
- out = ""
+ out = "".dup
File.open(ARGV[0]) {|f|
prelude f, out
grammar f, out
diff --git a/ext/ripper/tools/strip.rb b/ext/ripper/tools/strip.rb
index 0e409eb..23102f7 100755
--- a/ext/ripper/tools/strip.rb
+++ b/ext/ripper/tools/strip.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
last_is_void = false
ARGF.each do |line|
case line
diff --git a/test/ripper/dummyparser.rb b/test/ripper/dummyparser.rb
index 3c196d9..05220dc 100644
--- a/test/ripper/dummyparser.rb
+++ b/test/ripper/dummyparser.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# dummyparser.rb
#
@@ -186,7 +186,7 @@ class DummyParser < Ripper
end
def on_word_new
- ""
+ "".dup
end
def on_word_add(word, w)
diff --git a/test/ripper/test_files.rb b/test/ripper/test_files.rb
index ac24727..d90cd64 100644
--- a/test/ripper/test_files.rb
+++ b/test/ripper/test_files.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'test/unit'
module TestRipper; end
diff --git a/test/ripper/test_filter.rb b/test/ripper/test_filter.rb
index 0f9d38f..d025cf5 100644
--- a/test/ripper/test_filter.rb
+++ b/test/ripper/test_filter.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
begin
require 'ripper'
require 'test/unit'
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index 540d36e..7af2019 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
begin
require_relative 'dummyparser'
require 'test/unit'
diff --git a/test/ripper/test_ripper.rb b/test/ripper/test_ripper.rb
index b99feb7..79cbf88 100644
--- a/test/ripper/test_ripper.rb
+++ b/test/ripper/test_ripper.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
begin
require 'ripper'
require 'test/unit'
@@ -37,7 +37,7 @@ class TestRipper::Ripper < Test::Unit::TestCase
def test_filename
assert_equal '(ripper)', @ripper.filename
- filename = "ripper"
+ filename = "ripper".dup
ripper = Ripper.new("", filename)
filename.clear
assert_equal "ripper", ripper.filename
@@ -63,11 +63,11 @@ class TestRipper::Ripper < Test::Unit::TestCase
def test_regexp_with_option
bug11932 = '[ruby-core:72638] [Bug #11932]'
- src = '/[\xC0-\xF0]/u'.force_encoding(Encoding::UTF_8)
+ src = '/[\xC0-\xF0]/u'.dup.force_encoding(Encoding::UTF_8)
ripper = Ripper.new(src)
ripper.parse
assert_predicate(ripper, :error?)
- src = '/[\xC0-\xF0]/n'.force_encoding(Encoding::UTF_8)
+ src = '/[\xC0-\xF0]/n'.dup.force_encoding(Encoding::UTF_8)
ripper = Ripper.new(src)
ripper.parse
assert_not_predicate(ripper, :error?, bug11932)
@@ -101,11 +101,11 @@ class TestRipper::Ripper < Test::Unit::TestCase
# https://bugs.jruby.org/4176
def test_dedent_string
- col = Ripper.dedent_string ' hello', 0
+ col = Ripper.dedent_string ' hello'.dup, 0
assert_equal 0, col
- col = Ripper.dedent_string ' hello', 2
+ col = Ripper.dedent_string ' hello'.dup, 2
assert_equal 2, col
- col = Ripper.dedent_string ' hello', 4
+ col = Ripper.dedent_string ' hello'.dup, 4
assert_equal 2, col
# lexing a squiggly heredoc triggers Ripper#dedent_string use
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index 1b7b56e..7ae58bb 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# test_scanner_events.rb
#
@@ -134,7 +134,7 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
end
def assert_location(src)
- buf = ''
+ buf = ''.dup
Ripper.lex(src).each do |pos, type, tok|
line, col = *pos
assert_equal buf.count("\n") + 1, line,
diff --git a/test/ripper/test_sexp.rb b/test/ripper/test_sexp.rb
index 46fb7f2..26d19b1 100644
--- a/test/ripper/test_sexp.rb
+++ b/test/ripper/test_sexp.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
begin
require 'ripper'
require 'test/unit'