How do I code the filters for multi-line comments that start with #+ and end with #-? If you compare this to C, you can say that "/" = "#+", and "\" = "#-".
interesting... your question ended up revealing a bug in cloc. My initial answer was going to be "yes, just use the remove_between_general directive". However when I ran with
cloc --write-lang-def=lang.txt
to make a custom file I could modify, I noticed only start-of-comment markers appear; the end-of-comment marker is missing. Your definition should look something like:
Another alternative is to modify the cloc source code to handle your language. If you're working with the source version instead of the .exe, I can explain how to do that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2013-10-18
I am working with the exe file. If you talk me through using the source version, I would be happy to give it a try.
Here's the complete definition that I'm using. The language (Siemens NX Knowledge Fusion DFA) is pretty obscure, but I happen to be evaluating several applications that are written in it. The language also uses "#" as a comment character. It works like C++'s "//".
OK, for starters you'll need a Perl interpreter installed on your Windows box, something like Strawberry Perl or ActiveState Perl (ActivePerl). Once you have that, pull the latest cloc source code from subversion (https://sourceforge.net/p/cloc/code/HEAD/tree/trunk/cloc) and save it to a file called 'cloc.pl'.
Use a text editor to modify cloc.pl in the following way:
First add an entry for your language extension. Look for a line that starts with
"%{$rh_Language_by_Extension} = (" and put your dfa extension to language name after it:
%{$rh_Language_by_Extension} = ('dfa'='dfa',
Next add your language filters below the line that starts with "%{$rhaa_Filters_by_Language} = ("
interesting... your question ended up revealing a bug in cloc. My initial answer was going to be "yes, just use the remove_between_general directive". However when I ran with
to make a custom file I could modify, I noticed only start-of-comment markers appear; the end-of-comment marker is missing. Your definition should look something like:
but doubtful that will work until I fix the bug.
Another alternative is to modify the cloc source code to handle your language. If you're working with the source version instead of the .exe, I can explain how to do that.
I am working with the exe file. If you talk me through using the source version, I would be happy to give it a try.
Here's the complete definition that I'm using. The language (Siemens NX Knowledge Fusion DFA) is pretty obscure, but I happen to be evaluating several applications that are written in it. The language also uses "#" as a comment character. It works like C++'s "//".
dfa
filter remove_between_general #+ #-
filter call_regexp_common C
filter remove_matches ^\s#
filter remove_inline #.$
extension dfa
3rd_gen_scale 1.00
When I use the remove_between_general, I receive a lot of "Use of uninitialized value in quotemeta at cloc-1.60.exe line 3791." messages.
OK, for starters you'll need a Perl interpreter installed on your Windows box, something like Strawberry Perl or ActiveState Perl (ActivePerl). Once you have that, pull the latest cloc source code from subversion (https://sourceforge.net/p/cloc/code/HEAD/tree/trunk/cloc) and save it to a file called 'cloc.pl'.
Use a text editor to modify cloc.pl in the following way:
First add an entry for your language extension. Look for a line that starts with
"%{$rh_Language_by_Extension} = (" and put your dfa extension to language name after it:
Next add your language filters below the line that starts with "%{$rhaa_Filters_by_Language} = ("
Finally, below "%{$rh_Scale_Factor} = (" add your language scale factor:
Let me know how that works out.
Thank you very much. It works perfectly!
cool
v1.64 released