From: Koji Arai Date: 1998-11-12T21:35:11+09:00 Subject: [ruby-dev:3581] [BUG] wrong line count in %r// 新井です。 ruby-1.1c7 バグ報告です。 %r// で、正規表現の中に改行があると __LINE__ や raise が出力するスクリプトの行番号が狂うようです。 以下のスクリプトで、 $ cat -n hoge.rb 1 #!/usr/local/bin/ruby 2 3 p __LINE__ 4 5 %r{ 6 7 } 8 9 p __LINE__ $ ruby hoge.rb 3 7 となります。以下、修正です。 --- parse.y.orig Mon Nov 9 18:11:50 1998 +++ parse.y Thu Nov 12 20:11:53 1998 @@ -1898,6 +1898,10 @@ } switch (c) { + case '\n': + sourceline++; + break; + case '[': in_brack = 1; break; あと、ruby-mode.el で hilit19 を使うと # # sample class # class Sample # # sample method # def sample : end end のようなスクリプトの "def sample" 行がコメント色になります。 これも修正しておきました。 --- ruby-mode.el.orig Mon Nov 9 18:11:52 1998 +++ ruby-mode.el Thu Nov 12 20:12:07 1998 @@ -592,7 +592,7 @@ ("[^$\\?]\\('[^\\']*\\(\\\\\\(.\\|\n\\)[^\\']*\\)*'\\)" 1 string) ("[^$\\?]\\(`[^\\`]*\\(\\\\\\(.\\|\n\\)[^\\`]*\\)*`\\)" 1 string) ("^\\s *#.*$" nil comment) - ("[^$@?\\]\\(#[^$@{].*$\\)" 1 comment) + ("[^$@?\\]\\(#[^$@{\n].*$\\)" 1 comment) ("[^a-zA-Z_]\\(\\?\\(\\\\[CM]-\\)*.\\)" 1 string) ("^\\s *\\(require\\|load\\).*$" nil include) ("^\\s *\\(include\\|alias\\|undef\\).*$" nil decl)