translating code to 'mixed' case

M

Michael Friendly

This is a problem I thought there would have been scripts or modules
I could adapt, but I havent found anything all that useful
on CPAN or other sources (Perl cookbook, 2nd ed)

Given code (perl/C/R, ...) with comments, 'strings', "strings"
and code,
- convert all comments to mixed case as sentences, capitalizing
the first lettter of each '.' delimited sentence, but retain all
'strings' and "strings" within comments in original case.
- convert all non-comment code to lower case, but retain all
'strings' and "strings" within comments in original case.

thanks

--
Michael Friendly Email: (e-mail address removed)
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA
 
A

Anno Siegel

Michael Friendly said:
This is a problem I thought there would have been scripts or modules
I could adapt, but I havent found anything all that useful
on CPAN or other sources (Perl cookbook, 2nd ed)

Given code (perl/C/R, ...) with comments, 'strings', "strings"
and code,
- convert all comments to mixed case as sentences, capitalizing
the first lettter of each '.' delimited sentence, but retain all

Not every period delimits a sentence. That would capitalize more
than required.
'strings' and "strings" within comments in original case.

What about q(), qq(), and here docs? What about auto-quoted
text in "{}" and before "=>"?
- convert all non-comment code to lower case, but retain all
'strings' and "strings" within comments in original case.
^^^^^^^^^^^^^^^
I don't think you want that restriction here.

Doing what you plan without a parser for the programming language,
plus at least a rudimentary natural language parser for the comments
would make a mess out of any source text.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top