mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	{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
This commit is contained in:
		
							parent
							
								
									cd6d919373
								
							
						
					
					
						commit
						e3300dce82
					
				
					 17 changed files with 28 additions and 27 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
#!ruby -s
 | 
			
		||||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'mkmf'
 | 
			
		||||
require 'rbconfig'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
require 'ripper/core'
 | 
			
		||||
require 'ripper/lexer'
 | 
			
		||||
require 'ripper/filter'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
#
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
#
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
#
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
#
 | 
			
		||||
# $Id$
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
off = true
 | 
			
		||||
ARGF.each do |line|
 | 
			
		||||
  case line
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
last_is_void = false
 | 
			
		||||
ARGF.each do |line|
 | 
			
		||||
  case line
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
require 'test/unit'
 | 
			
		||||
 | 
			
		||||
module TestRipper; end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
begin
 | 
			
		||||
  require 'ripper'
 | 
			
		||||
  require 'test/unit'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
# frozen_string_literal: true
 | 
			
		||||
begin
 | 
			
		||||
  require_relative 'dummyparser'
 | 
			
		||||
  require 'test/unit'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# frozen_string_literal: false
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
begin
 | 
			
		||||
  require 'ripper'
 | 
			
		||||
  require 'test/unit'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue