darkname
06-26-03, 06:45
| Hello everyone!! Does anyone knows a module that parses and extracts comments of a given source code file?? (such as C, C++, Java, PL/SQL, PERL, etc)!!? Thereīs a module in CPAN that was designed to do this (Regexp::Common::comment) but this module donīt preview all cases for example in PERL!! Because.. there are special cases that should be contemplated such as: @array=/1 # 2 3 4/; print"#This is not a comment"; $size=?#array; @array=("#", 1,2,3); How can i do this? There is another module Text::Balanced that should work to.. with the function extract_delimited, where the delimitators would be starting with # and ending with \n! But i canīt make this work! :(( Another issue.. is this regex that should get the comments in Perl but it doesnīt work also!! ~ m{ ( \# .*? \n ) # extract a comment wich starts with # to \n | " (?: [^"\#]* | \#. )* " # skip over "..." | ' (?: [^'\#]* | \#. )* ' # skip over '...' | . [^\#"']* # skip over non-comments-or-quotes }xgs; Can someone tell me why?? Thank you all very much! darkname...:p |