[前][次][番号順一覧][スレッド一覧]

ruby-changes:48757

From: usa <ko1@a...>
Date: Tue, 21 Nov 2017 17:48:12 +0900 (JST)
Subject: [ruby-changes:48757] usa:r60873 (trunk): Skip comment lines

usa	2017-11-21 17:48:07 +0900 (Tue, 21 Nov 2017)

  New Revision: 60873

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60873

  Log:
    Skip comment lines
    
    * template/prelude.c.tmpl (translate): empty (only LF) lines are not necessary.
      so skip them, but for safety only when they are made from comment line.

  Modified files:
    trunk/template/prelude.c.tmpl
Index: template/prelude.c.tmpl
===================================================================
--- template/prelude.c.tmpl	(revision 60872)
+++ template/prelude.c.tmpl	(revision 60873)
@@ -42,6 +42,7 @@ class Prelude https://github.com/ruby/ruby/blob/trunk/template/prelude.c.tmpl#L42
     result = [@preludes.size, @vpath.strip(filename), lines, sub]
     @vpath.foreach(filename) do |line|
       @preludes[filename] ||= result
+      next if /\A\s*\#.*\n\z/ =~ line
       line.sub!(/(?:^|\s+)\#(?:$|[#\s].*)/, '')
       line.sub!(/require(_relative)?\s*\(?\s*(["'])(.*?)(?:\.rb)?\2\)?/) do
         orig, rel, path = $&, $2, $3

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]