Skip to content

Instantly share code, notes, and snippets.

@cohalz
Last active August 29, 2015 13:57
Show Gist options
  • Save cohalz/9349850 to your computer and use it in GitHub Desktop.
Save cohalz/9349850 to your computer and use it in GitHub Desktop.
//grepでdefのある行を抽出したファイルからvim用のdict向けに結果を出力
//例:grep -r -h def */scalaz-scalaz-seven > scalaz.txt
// scalaToDict.scala scalaz.txt > scalaz.dict
import scala.io.Source
val reg = """def\s(.+?)[\s\[\(]""".r
if(args.length > 0) {
val lines = Source.fromFile(args(0)).getLines().toList
val defdict = for(line <- lines;m <- reg.findFirstMatchIn(line)) yield m.group(1)
val defdictsorted = defdict.sorted.distinct
defdictsorted.foreach(println)
}
else Console.err.println("Please enter inputfile")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment