Open majewsky opened 12 years ago
DetectIndent doesn't generally need to know about comments. The special handling for /* */ is there because a lot of people do this:
/*
* notice the aligned star character with atypical indenting
*/
Does typical use of POD also screw up indent detection?
Yes, because you can embed code examples. Everything is a code example if its line starts with any number of spaces. I've opened this issue exactly because unusual indentation in code examples (e.g. one space only) screws up the DetectIndent logic.
majewsky, see also https://github.com/ciaranm/detectindent/issues/12
Perl comments are from "#" until line end, like in most contemporary scripting languages.
Furthermore, the Perl interpreter skips over documentation written in the POD (Plain Old Documentation) format, so this should be treated like a comment, too. POD looks like this:
It is started by any POD command. Such commands always start with "=" and must always appear at the beginning of the line (without any whitespace before them, i.e. column 1). The regexp /^=/ detects POD commands reasonably reliably in Perl code.
A documentation text always ends with the command "=cut", so the end can be found by /^=cut/.
A complete reference of the POD format is available at http://perldoc.perl.org/perlpod.html