Skip to content

Instantly share code, notes, and snippets.

@syou6162
Created September 8, 2012 04:44
Show Gist options
  • Save syou6162/3671858 to your computer and use it in GitHub Desktop.
Save syou6162/3671858 to your computer and use it in GitHub Desktop.
R用のflymake
#! /opt/local/bin/ruby
# -*- coding: utf-8 -*-
require 'open3'
error = ""
Open3.popen3("R --vanilla -q -e \"parse(file=\\\"#{ARGV[0]}\\\")\""){|stdin, stdout, stderr|
error = stderr.read.to_s
}
error = error.split("\n")
message = ""
error.each{|e|
if e =~ /(^\s{4})(.*?)(場所\s$)/
message = $2
end
if e =~ /(\d+)\:(.*)/
STDERR.puts "#{ARGV[0]}:#{$1}: #{message}"
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment