Skip to content

Commit

Permalink
[STD_syntax_highlight] changed the redspans* to simple*
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@22840 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
azawawi committed Oct 31, 2008
1 parent 547fe69 commit 3b34869
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
14 changes: 7 additions & 7 deletions ETOOMUCHTIME
Expand Up @@ -41,7 +41,7 @@ my @failed;
for my $file (@files) {
my $myfile = $file;
$myfile =~ s/^\.\.\/\.\.\/t\/spec/html/;
my ($redspans_html,$full_html) = ("$myfile.simple.html", "$myfile.html");
my ($simple_html,$full_html) = ("$myfile.simple.html", "$myfile.html");
my ($html_filename,$html_path,$html_suffix) = fileparse($full_html);
mkpath $html_path;

Expand All @@ -50,11 +50,11 @@ for my $file (@files) {
$file
-> $full_html
-> $redspans_html
-> $simple_html
OUT
my $t0 = new Benchmark;
my $cmd = "./$HILITE --clean-html " .
"--redspans-html=$redspans_html " .
"--redspans-html=$simple_html " .
"--full-html=$full_html $file";
my $log = `$cmd 2>&1`;
print "It took " .
Expand Down Expand Up @@ -83,10 +83,10 @@ Reason:
$log
</pre></body></html>
ERROR
open REDSPANS_HTML, ">$redspans_html"
or die "Could not open $redspans_html for writing: $OS_ERROR\n";
print REDSPANS_HTML $error_html;
close REDSPANS_HTML;
open SIMPLE_HTML, ">$simple_html"
or die "Could not open $simple_html for writing: $OS_ERROR\n";
print SIMPLE_HTML $error_html;
close SIMPLE_HTML;
open FULL_HTML, ">$full_html"
or die "Could not open $full_html for writing: $OS_ERROR\n";
print FULL_HTML $error_html;
Expand Down
24 changes: 12 additions & 12 deletions STD_syntax_highlight
Expand Up @@ -29,8 +29,8 @@ STD_syntax_highlight - Highlights Perl 6 source code using STD.pm
# print html for with 'statementlist' as the top-level rule
STD_syntax_highlight foo.pl statementlist
# write redspans output to foo.redspans.html
STD_syntax_highlight --redspans-html=foo.redspans.html foo.pl
# write simple output to foo.pl.html
STD_syntax_highlight --simple-html=foo.pl.html foo.pl
=head1 SUBROUTINES
Expand All @@ -39,7 +39,7 @@ STD_syntax_highlight - Highlights Perl 6 source code using STD.pm
=cut

my ($clean_html,$help) = (0,0);
my ($full_html,$redspans_html) = (0,'-');
my ($full_html,$simple_html) = (0,'-');
my ($file, $parser, $src_text);

# These are needed for redspans
Expand All @@ -55,7 +55,7 @@ sub main {
GetOptions(
"clean-html"=>\$clean_html,
"full-html=s"=>\$full_html,
"redspans-html=s"=>\$redspans_html,
"simple-html=s"=>\$simple_html,
"help"=>\$help
);

Expand All @@ -72,8 +72,8 @@ USAGE:
--full-html=filename
write full-mode html to filename (disabled by default, - for STDOUT)
--redspans-html=filename
write redspans-mode html to filename (enabled by default, - for STDOUT)
--simple-html=filename
write simple-mode html to filename (enabled by default, - for STDOUT)
HELP
}
Expand Down Expand Up @@ -123,9 +123,9 @@ sub highlight_match {
my $html = highlight_perl6_full();
write_html_file $full_html, $html;
}
if($redspans_html) {
my $html = highlight_perl6_redspans();
write_html_file $redspans_html, $html;
if($simple_html) {
my $html = highlight_perl6_simple();
write_html_file $simple_html, $html;
}
}

Expand Down Expand Up @@ -242,13 +242,13 @@ HTML
$str;
}

=item highlight_perl6_redspans
=item highlight_perl6_simple
This is same as C<highlight_perl6_full> when --redspans is used.
This is same as C<highlight_perl6_full> when --simple-html is used.
No more javascript tree viewer or anything fancy.
Only nodes that have a color are printed. Not optimal but works ;-)
=cut
sub highlight_perl6_redspans {
sub highlight_perl6_simple {
my $str = "";
my %colors = ();

Expand Down

0 comments on commit 3b34869

Please sign in to comment.