!!!Perl JavaコードをHTMLに open IN, "c:\\test.html"; print OUT ""; print OUT "
"; $c = 1; $isCmt = 0; while ( $line = ) { $line =~ s/\s*$//; $line =~ s/(&)/&/g; $line =~ s/(<)/</g; $line =~ s/(>)/>/g; $line =~ s/([ ])/ /g; $line =~ s/(\t)/    /g; if ($line =~ /(\/\*)/) { $line =~ s/(\/\*)/\1/; $isCmt = 1; } if ($isCmt) { if ($line =~ /(\*\/)/) { $line =~ s/(\*\/)/\1<\/span>/; $isCmt = 0; } } else { $line =~ s/(\bString\b|\babstract\b|\bcontinue\b|\bfor\b|\bnew\b|\bswitch\b|\bassert\b|\bdefault\b|\bif\b|\bpackage\b|\bsynchronized\b|\bboolean\b|\bdo\b|\bgoto\b|\bprivate\b|\bthis\b|\bbreak\b|\bdouble\b|\bimplements\b|\bprotected\b|\bthrow\b|\bbyte\b|\belse\b|\bimport\b|\bpublic\b|\bthrows\b|\bcase\b|\benum\b|\binstanceof\b|\breturn\b|\btransient\b|\bcatch\b|\bextends\b|\bint\b|\bshort\b|\btry\b|\bchar\b|\bfinal\b|\binterface\b|\bstatic\b|\bvoid\b|\bclass\b|\bfinally\b|\blong\b|\bstrictfp\b|\bvolatile\b|\bconst\b|\bfloat\b|\bnative\b|\bsuper\b|\bwhile\b)/\1<\/span>/g; $line =~ s/(\/\/.*)/\1<\/span>/g; } printf(OUT "%04d: $line
\n", $c); $c++; } print OUT "
"; close IN; close OUT; {{ref j2html.pl}}