Created
January 29, 2009 18:35
-
-
Save znz/54664 to your computer and use it in GitHub Desktop.
ripperで正規表現のnオプションの使用箇所を探す
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'ripper/filter' | |
class CheckRegexpN < Ripper::Filter | |
def on_regexp_end(token, data) | |
if /n/ =~ token | |
puts "#{data}:#{lineno}:#{token}" | |
end | |
data | |
end | |
end | |
ARGV.each do |path| | |
open(path, "rb") do |f| | |
CheckRegexpN.new(f).parse(path) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment