Created
May 31, 2013 04:40
-
-
Save kyonmm/5682974 to your computer and use it in GitHub Desktop.
F# のコメントと空白行を除いた行数を出力します。ざっくり実装です。起動引数にディレクトリを指定すると、配下のフォルダ全てのfsファイルを対象に行数を出力します。
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
| import groovy.io.FileType | |
| def multiLineComment = false | |
| new File(args[0]) | |
| .eachFileRecurse(FileType.FILES){ | |
| if(it.name.endsWith("fs") == false) { return } | |
| println it.name + "\t" + it.grep{it.trim().startsWith("//") == false} | |
| .grep{ | |
| if(it.trim().contains("(*")){ | |
| multiLineComment = true | |
| } | |
| if(it.trim().contains("*)")){ | |
| multiLineComment = false | |
| } | |
| !multiLineComment} | |
| .grep{it.trim().size() != 0} | |
| .size() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment